File tree Expand file tree Collapse file tree 4 files changed +17
-10
lines changed Expand file tree Collapse file tree 4 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 1313
1414__version__ = "0.2.1"
1515
16+ import typing
1617import warnings
1718
1819import rdflib .util # type: ignore
1920
2021from . import local_uuid
2122
22- def guess_format (fpath , fmap = None ):
23+ def guess_format (
24+ fpath : str ,
25+ fmap : typing .Optional [typing .Dict [str , str ]] = None
26+ ) -> typing .Optional [str ]:
2327 warnings .warn ("The functionality in case_utils.guess_format is now upstream. Please revise your code to use rdflib.util.guess_format. The function arguments remain the same. case_utils.guess_format will be removed in case_utils 0.4.0." , DeprecationWarning )
2428
2529 return rdflib .util .guess_format (fpath , fmap )
Original file line number Diff line number Diff line change 2020import datetime
2121import hashlib
2222import os
23+ import typing
2324
2425import rdflib # type: ignore
2526
@@ -234,7 +235,7 @@ def main() -> None:
234235 else :
235236 output_format = args .output_format
236237
237- serialize_kwargs = {
238+ serialize_kwargs : typing . Dict [ str , typing . Any ] = {
238239 "format" : output_format
239240 }
240241 if output_format == "json-ld" :
Original file line number Diff line number Diff line change 2020import argparse
2121import os
2222import logging
23+ import typing
2324
2425import rdflib .plugins .sparql # type: ignore
2526
@@ -74,7 +75,7 @@ def main() -> None:
7475 else :
7576 output_format = args .output_format
7677
77- serialize_kwargs = {
78+ serialize_kwargs : typing . Dict [ str , typing . Any ] = {
7879 "format" : output_format
7980 }
8081 if output_format == "json-ld" :
Original file line number Diff line number Diff line change 2121import sys
2222import uuid
2323
24- USE_DEMO_UUID = False
24+ USE_DEMO_UUID : bool = False
2525
26- DEMO_UUID_COUNTER = 0
26+ DEMO_UUID_COUNTER : int = 0
2727
28- def configure ():
28+ def configure () -> None :
2929 global USE_DEMO_UUID
3030
3131 if os .getenv ("DEMO_UUID_REQUESTING_NONRANDOM" ) == "NONRANDOM_REQUESTED" :
3232 USE_DEMO_UUID = True
3333
34- def demo_uuid ():
34+ def demo_uuid () -> str :
3535 """
3636 This function generates a repeatable UUID, drawing on non-varying elements of the environment and process call for entropy.
3737
@@ -52,16 +52,17 @@ def demo_uuid():
5252 parts .append (str (DEMO_UUID_COUNTER ))
5353
5454 # Component: Present working directory, replacing $HOME with '~'.
55- parts .append (os .getcwd ().replace (os .getenv ("HOME" ), "~" ))
55+ env_HOME : str = os .getenv ("HOME" , "/nonexistent" )
56+ parts .append (os .getcwd ().replace (env_HOME , "~" ))
5657
5758 # Component: Argument vector.
5859 parts .extend (sys .argv )
5960
6061 return str (uuid .uuid5 (uuid .NAMESPACE_URL , "/" .join (parts )))
6162
62- def local_uuid ():
63+ def local_uuid () -> str :
6364 """
64- Generate either a UUID4, or if requested via environment configuration, a non-random demo UUID. Returns a string.
65+ Generate either a UUID4, or if requested via environment configuration, a non-random demo UUID.
6566 """
6667 global USE_DEMO_UUID
6768 if USE_DEMO_UUID :
You can’t perform that action at this time.
0 commit comments