Skip to content

Commit e35518e

Browse files
committed
Address review comments
1 parent a44aa76 commit e35518e

File tree

6 files changed

+9
-90
lines changed

6 files changed

+9
-90
lines changed

Makefile

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -54,68 +54,10 @@ tox:
5454

5555

5656
lint-rust:
57-
cargo fmt --version
5857
cargo fmt --all -- --check
59-
cargo clippy --version
60-
cargo clippy --tests -- \
61-
-D warnings \
62-
-W clippy::pedantic \
63-
-W clippy::dbg_macro \
64-
-W clippy::print_stdout \
65-
-A clippy::cast-possible-truncation \
66-
-A clippy::cast-possible-wrap \
67-
-A clippy::cast-precision-loss \
68-
-A clippy::cast-sign-loss \
69-
-A clippy::doc-markdown \
70-
-A clippy::float-cmp \
71-
-A clippy::fn-params-excessive-bools \
72-
-A clippy::if-not-else \
73-
-A clippy::manual-let-else \
74-
-A clippy::match-bool \
75-
-A clippy::match-same-arms \
76-
-A clippy::missing-errors-doc \
77-
-A clippy::missing-panics-doc \
78-
-A clippy::module-name-repetitions \
79-
-A clippy::must-use-candidate \
80-
-A clippy::needless-pass-by-value \
81-
-A clippy::similar-names \
82-
-A clippy::single-match-else \
83-
-A clippy::struct-excessive-bools \
84-
-A clippy::too-many-lines \
85-
-A clippy::unnecessary-wraps \
86-
-A clippy::unused-self \
87-
-A clippy::used-underscore-binding
58+
cargo clippy --tests -- -D warnings
8859

8960

9061
format-rust:
91-
cargo fmt --version
9262
cargo fmt --all
93-
cargo clippy --version
94-
cargo clippy --tests --fix --allow-dirty -- \
95-
-D warnings \
96-
-W clippy::pedantic \
97-
-W clippy::dbg_macro \
98-
-W clippy::print_stdout \
99-
-A clippy::cast-possible-truncation \
100-
-A clippy::cast-possible-wrap \
101-
-A clippy::cast-precision-loss \
102-
-A clippy::cast-sign-loss \
103-
-A clippy::doc-markdown \
104-
-A clippy::float-cmp \
105-
-A clippy::fn-params-excessive-bools \
106-
-A clippy::if-not-else \
107-
-A clippy::manual-let-else \
108-
-A clippy::match-bool \
109-
-A clippy::match-same-arms \
110-
-A clippy::missing-errors-doc \
111-
-A clippy::missing-panics-doc \
112-
-A clippy::module-name-repetitions \
113-
-A clippy::must-use-candidate \
114-
-A clippy::needless-pass-by-value \
115-
-A clippy::similar-names \
116-
-A clippy::single-match-else \
117-
-A clippy::struct-excessive-bools \
118-
-A clippy::too-many-lines \
119-
-A clippy::unnecessary-wraps \
120-
-A clippy::unused-self \
121-
-A clippy::used-underscore-binding
63+
cargo clippy --tests --fix --allow-dirty -- -D warnings

_pendulum.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ def local_time(
3737
unix_time: int, utc_offset: int, microseconds: int
3838
) -> tuple[int, int, int, int, int, int, int]: ...
3939
def precise_diff(d1: datetime | date, d2: datetime | date) -> PreciseDiff: ...
40-
def timestamp(dt: datetime) -> int: ...
4140
def week_day(year: int, month: int, day: int) -> int: ...

build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def _build():
2525

2626
maturin("build", "-r", *cargo_args)
2727

28+
# We won't use the wheel built by maturin directly since
29+
# we want Poetry to build it but we need to retrieve the
30+
# compiled extensions from the maturin wheel.
2831
wheel = list(wheels_dir.glob("*.whl"))[0]
2932
with zipfile.ZipFile(wheel.as_posix()) as whl:
3033
whl.extractall(wheels_dir.as_posix())

pendulum/_helpers.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,6 @@ def days_in_year(year: int) -> int:
8484
return DAYS_PER_N_YEAR
8585

8686

87-
def timestamp(dt: datetime.datetime) -> int:
88-
year = dt.year
89-
90-
result = (year - 1970) * 365 + MONTHS_OFFSETS[0][dt.month]
91-
result += (year - 1968) // 4
92-
result -= (year - 1900) // 100
93-
result += (year - 1600) // 400
94-
95-
if is_leap(year) and dt.month < 3:
96-
result -= 1
97-
98-
result += dt.day - 1
99-
result *= 24
100-
result += dt.hour
101-
result *= 60
102-
result += dt.minute
103-
result *= 60
104-
result += dt.second
105-
106-
return result
107-
108-
10987
def local_time(
11088
unix_time: int, utc_offset: int, microseconds: int
11189
) -> tuple[int, int, int, int, int, int, int]:

pendulum/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from pendulum.time import Time
1919

2020
try:
21-
from _pendulum import Duration as CDuration
21+
from _pendulum import Duration as RustDuration
2222
except ImportError:
23-
CDuration = None # type: ignore[assignment,misc]
23+
RustDuration = None # type: ignore[assignment,misc]
2424

2525

2626
def parse(text: str, **options: t.Any) -> Date | Time | DateTime | Duration:
@@ -113,7 +113,7 @@ def _parse(text: str, **options: t.Any) -> Date | DateTime | Time | Duration | I
113113
if isinstance(parsed, Duration):
114114
return parsed
115115

116-
if CDuration and isinstance(parsed, CDuration): # type: ignore[truthy-function]
116+
if RustDuration is not None and isinstance(parsed, RustDuration):
117117
return pendulum.duration(
118118
years=parsed.years,
119119
months=parsed.months,

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ packages = [
1717
include = [
1818
{ path = "meson.build", format = "sdist" },
1919
{ path = "pendulum/py.typed" },
20-
# C extensions must be included in the wheel distributions
21-
{ path = "pendulum/_extensions/*.so", format = "wheel" },
22-
{ path = "pendulum/_extensions/*.pyd", format = "wheel" },
2320
# Typing stubs
2421
{ path = "*.pyi"},
2522
# Rust source
@@ -224,5 +221,5 @@ omit = [
224221
]
225222

226223
[build-system]
227-
requires = ["poetry-core>=1.1.0a6", "maturin>=1,<2"]
224+
requires = ["poetry-core>=1.6.1", "maturin>=1,<2"]
228225
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)