fnmatch() will do case-normalization if the OS expects it:
we do not want this as
* the path is more a URL than a file path
* results need to not change based on OS
Fix the result on Windows by using fnmatchcase()
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
We could just stop testing with 3.9... but I think this will lead to
unintentionally breaking 3.9 anyway sooner or later.
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Fixes for ruff 0.12
* Tweak some annotations
* Add __hash__() implementations to api classes: These really should be
hashable
* My use of "super().__hash__()" is not very optimized but avoids some
repetition
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
securesystemslib.hash is a small wrapper around hashlib, which serves
two main purposes:
* provide helper function to hash a file
* translate custom hash algorithm name "blake2b-256" to "blake2b" with
(digest_size=32).
In preparation for the removal of securesystemslib.hash, this patch ports
above behavior to tuf and uses the builtin hashlib directly where
possible.
related secure-systems-lab/securesystemslib#943
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
The noqa comment was added manually to avoid
A005 Module `json` shadows a Python standard-library module
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This reverts commit eb6d82f324.
The change itself was fine but since the code is otherwise compatible
with python 3.8, let's revert this to be compatible for one more
release.
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This allows using some more nice annotations from 3.10
while still being compatible with even Python 3.8.
These are all annotation changes, should not modify any functionality.
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This makes flake8-datetimez happier but has no effect on the result:
DTZ007 The use of `datetime.datetime.strptime()` without %z must be
followed by `.replace(tzinfo=)` or `.astimezone()
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Practically were changing API if we start requiring that
expires is non-naive because this no longer works:
metadata.signed.expires = datetime(3000,1,1)
We can make this work without API breaks though:
* it the input is naive, just use UTC
* if the input is not naive or UTC, raise
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
* Most importantly use strftime() to serialize the datetime
* Force the timezone as UTC when deserializing
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Allows to simultanously use those classes in different container /
signature wrapper APIs, e.g. Metadata API and Envelope API (DSSE).
All moved classes are imported into tuf.api.metadata scope for
backwards-compatibility.
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>