Skip to content

Commit

Permalink
fix: update coverage, formatting/linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Mar 27, 2024
1 parent 16fa75c commit 7d9fa11
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ omit =
*/__init__.py

# Show missing lines in report output
show_missing = True
show_missing = False

exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
Expand Down
12 changes: 6 additions & 6 deletions RTN/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ class BaseRankingModel(BaseModel):
`dubbed` (int): The ranking value for dubbed attribute.
`subbed` (int): The ranking value for subbed attribute.
`av1` (int): The ranking value for AV1 attribute.
Note:
- The higher the ranking value, the better the quality of the media item.
- The default ranking values are set to 0, which means that the attribute does not affect the overall rank.
- Users can customize the ranking values based on their preferences and requirements by using inheritance.
"""

# resolution
uhd: int = 0 # 4K
fhd: int = 0 # 1080p
uhd: int = 0 # 4K
fhd: int = 0 # 1080p
hd: int = 0 # 720p
sd: int = 0 # 480p
# quality
Expand Down Expand Up @@ -214,11 +214,11 @@ def compile_and_validate_patterns(cls, values: dict[str, Any]) -> dict[str, Any]
compiled_patterns = []
for pattern in raw_patterns:
if isinstance(pattern, str):
if pattern.startswith("/") and pattern.endswith("/i"): # case-insensitive
if pattern.startswith("/") and pattern.endswith("/i"): # case-insensitive
compiled_patterns.append(regex.compile(pattern[1:-2], regex.IGNORECASE))
elif pattern.startswith("/") and pattern.endswith("/"): # case-sensitive
elif pattern.startswith("/") and pattern.endswith("/"): # case-sensitive
compiled_patterns.append(regex.compile(pattern[1:-1]))
else: # case-insensitive by default
else: # case-insensitive by default
compiled_patterns.append(regex.compile(pattern, regex.IGNORECASE))
elif isinstance(pattern, regex.Pattern):
# Keep already compiled patterns as is
Expand Down
2 changes: 1 addition & 1 deletion RTN/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def batch_parse(titles: List[str], chunk_size: int = 50) -> List[ParsedData]:
Returns:
List[ParsedData]: A list of ParsedData objects for each title.
"""
chunks = [titles[i:i + chunk_size] for i in range(0, len(titles), chunk_size)]
chunks = [titles[i : i + chunk_size] for i in range(0, len(titles), chunk_size)]
parsed_data = []
with ThreadPoolExecutor() as executor:
future_to_chunk = {executor.submit(parse_chunk, chunk): chunk for chunk in chunks}
Expand Down
Loading

0 comments on commit 7d9fa11

Please sign in to comment.