Skip to content

Commit a4b21e9

Browse files
authored
Merge pull request #83 from rcolfin/dependencies
Upgrading dependencies.
2 parents 3a6a438 + 5ec7f64 commit a4b21e9

File tree

7 files changed

+954
-632
lines changed

7 files changed

+954
-632
lines changed

.github/workflows/dependabotautomerge.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
github.rest.pulls.merge({
3535
owner: context.payload.repository.owner.login,
3636
repo: context.payload.repository.name,
37-
pull_number: context.payload.pull_request.number
37+
pull_number: context.payload.pull_request.number,
38+
merge_method: 'squash',
3839
})
3940
github-token: ${{github.token}}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ repos:
2121
- id: detect-private-key
2222

2323
- repo: https://github.com/astral-sh/uv-pre-commit
24-
rev: '0.8.23'
24+
rev: '0.9.3'
2525
hooks:
2626
- id: uv-lock
2727
- id: uv-sync
2828

2929
# Run the Ruff linter.
3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.13.3
31+
rev: v0.14.1
3232
hooks:
3333
# Linter
3434
- id: ruff

pymkv/Timestamp.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def __init__( # noqa: PLR0913
6060
self._ss = 0 if ss is None else ss
6161
self._nn = 0 if nn is None else nn
6262

63+
def __hash__(self) -> int:
64+
"""Returns a hash value for the Timestamp object."""
65+
return self.time
66+
6367
def __eq__(self, other: object) -> bool:
6468
"""
6569
Compares the Timestamp object with another Timestamp object for equality.
@@ -225,7 +229,7 @@ def ts(self) -> str:
225229
return timestamp_string
226230

227231
@ts.setter
228-
def ts(self, timestamp: Timestamp) -> None:
232+
def ts(self, timestamp: Timestamp | int | str) -> None:
229233
"""
230234
Set a new timestamp.
231235
@@ -322,6 +326,16 @@ def nn(self, value: int) -> None:
322326
"""
323327
self._nn = value if value < 1000000000 else 0 # noqa: PLR2004
324328

329+
@property
330+
def time(self) -> int:
331+
"""
332+
Get the total time in seconds represented by the timestamp.
333+
334+
Returns:
335+
int: The total time in seconds.
336+
"""
337+
return self.hh * 3600 + self.mm * 60 + self.ss + self.nn // 1000000000
338+
325339
@property
326340
def form(self) -> str:
327341
"""

pyproject.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dev = [
4141
"pytest-ruff<1.0.0,>=0.4.1",
4242
"pytest-mypy>=0.10.3,<2.0.0",
4343
"mypy<2.0.0,>=1.14.1",
44-
"ruff<1.0.0,>=0.9.0",
44+
"ruff<1.0.0,>=0.14.0",
4545
"sphinx-immaterial<0.14.0,>=0.12.4; python_version == \"3.13\"",
4646
"pyinstrument>=5.1.1",
4747
]
@@ -149,10 +149,6 @@ ignore = [
149149
"S101", # Use of assert detected https://docs.astral.sh/ruff/rules/assert/
150150
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
151151
"SIM102", # sometimes it's better to nest
152-
"UP038", # Checks for uses of isinstance/issubclass that take a tuple
153-
# of types for comparison.
154-
# Deactivated because it can make the code slow:
155-
# https://github.com/astral-sh/ruff/issues/7871
156152
"TC003", # Ignore moving imports into a type-checking block.
157153
"C901" # too complex
158154
]
@@ -161,9 +157,7 @@ fixable = ["ALL"]
161157
unfixable = []
162158
# The fixes in extend-unsafe-fixes will require
163159
# provide the `--unsafe-fixes` flag when fixing.
164-
extend-unsafe-fixes = [
165-
"UP038"
166-
]
160+
extend-unsafe-fixes = []
167161
# Allow unused variables when underscore-prefixed.
168162
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
169163

tests/test_decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def track_id(self) -> int | None:
1919
return self._track_id
2020

2121
@track_id.setter
22-
@ensure_info(
22+
@ensure_info( # type: ignore[arg-type]
2323
"_info_json",
2424
lambda *args, **kwargs: {"tracks": [{"id": 0}, {"id": 1}]},
2525
["file_path", "mkvmerge_path"],

tests/test_timestamp.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,19 @@ def test_ts_property() -> None:
8989
ts.ts = "02:30:00"
9090
assert ts.ts == "02:30:00"
9191

92+
ts.ts = ts.time
93+
assert ts.ts == "02:30:00"
94+
9295
with pytest.raises(TypeError):
9396
ts.ts = cast("str", [])
97+
98+
99+
def test_ts_equals() -> None:
100+
ts1 = Timestamp("01:23:45.678")
101+
ts2 = Timestamp("01:23:45.678")
102+
ts3 = Timestamp("02:30:00")
103+
104+
assert ts1 == ts2
105+
assert ts1 != ts3
106+
assert hash(ts1) == hash(ts2)
107+
assert hash(ts1) != hash(ts3)

0 commit comments

Comments
 (0)