danielutils 0.9.94__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {danielutils-0.9.94/danielutils.egg-info → danielutils-1.0.0}/PKG-INFO +2 -2
- {danielutils-0.9.94 → danielutils-1.0.0}/README.md +1 -1
- danielutils-1.0.0/danielutils/Decorators/singleton.py +41 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/isoftype.py +33 -19
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/__init__.py +4 -1
- danielutils-1.0.0/danielutils/Reflection/argument_info.py +114 -0
- danielutils-1.0.0/danielutils/Reflection/class_info.py +104 -0
- danielutils-1.0.0/danielutils/Reflection/decoration_info.py +44 -0
- danielutils-1.0.0/danielutils/Reflection/function_info.py +97 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/computability_and_complexity/languages/sat.py +3 -3
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/frange.py +1 -1
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/custom_types.py +2 -6
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/graph/multinode.py +2 -2
- danielutils-1.0.0/danielutils/java/__init__.py +8 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/java/interfaces/comparable.py +2 -2
- danielutils-1.0.0/danielutils/java/java_interface.py +33 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/print_.py +2 -2
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/progress_bar/progress_bar.py +1 -1
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/progress_bar/progress_bar_pool.py +1 -1
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/random_.py +12 -0
- danielutils-1.0.0/danielutils/retry_executor/backoff_strategies/__init__.py +6 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/retry_executor/backoff_strategies/constant_backoff.py +2 -1
- danielutils-1.0.0/danielutils/retry_executor/backoff_strategies/exponential_backoff.py +20 -0
- danielutils-1.0.0/danielutils/retry_executor/backoff_strategies/functional_backoff.py +20 -0
- danielutils-1.0.0/danielutils/retry_executor/backoff_strategies/linear_backoff.py +18 -0
- danielutils-1.0.0/danielutils/retry_executor/backoff_strategies/multiplicative_backoff.py +18 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/retry_executor/backoff_strategies/no_backoff.py +1 -1
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/retry_executor/backoff_strategy.py +2 -2
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/testing/unittest_/auto_cwd_testcase.py +4 -4
- danielutils-1.0.0/danielutils/versioned_imports.py +23 -0
- {danielutils-0.9.94 → danielutils-1.0.0/danielutils.egg-info}/PKG-INFO +2 -2
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils.egg-info/SOURCES.txt +49 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/pyproject.toml +1 -1
- danielutils-0.9.94/danielutils/decorators/singleton.py +0 -24
- danielutils-0.9.94/danielutils/java/__init__.py +0 -2
- danielutils-0.9.94/danielutils/java/java_interface.py +0 -25
- danielutils-0.9.94/danielutils/retry_executor/backoff_strategies/__init__.py +0 -3
- danielutils-0.9.94/danielutils/retry_executor/backoff_strategies/exponential_backoff.py +0 -21
- danielutils-0.9.94/danielutils/versioned_imports.py +0 -12
- {danielutils-0.9.94 → danielutils-1.0.0}/LICENSE +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/MANIFEST.in +0 -0
- /danielutils-0.9.94/danielutils/aliases.py → /danielutils-1.0.0/danielutils/Aliases.py +0 -0
- /danielutils-0.9.94/danielutils/colors.py → /danielutils-1.0.0/danielutils/Colors.py +0 -0
- {danielutils-0.9.94/danielutils/conversions → danielutils-1.0.0/danielutils/Conversions}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/conversions → danielutils-1.0.0/danielutils/Conversions}/main_conversions.py +0 -0
- {danielutils-0.9.94/danielutils/conversions → danielutils-1.0.0/danielutils/Conversions}/specialized_conversions/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/conversions → danielutils-1.0.0/danielutils/Conversions}/specialized_conversions/to_hex.py +0 -0
- {danielutils-0.9.94/danielutils/conversions → danielutils-1.0.0/danielutils/Conversions}/specialized_conversions/to_int.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/atomic.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/attach.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/chain_decorators.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/decorate_conditionally.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/delay_call.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/deprecate.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/final.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/limit_recursion.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/memo.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/overload.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/partially_implemented.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/processify.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/property.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/threadify.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/timeout.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/total_ordering.py +0 -0
- {danielutils-0.9.94/danielutils/decorators → danielutils-1.0.0/danielutils/Decorators}/validate.py +0 -0
- /danielutils-0.9.94/danielutils/exceptions.py → /danielutils-1.0.0/danielutils/Exceptions.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/areoneof.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/check_foreach.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/factorial.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/flatten.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/foreach.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/isoneof.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/multiloop.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/parallel_for.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/partition.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/powerset.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/subseteq.py +0 -0
- {danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/types_subseteq.py +0 -0
- {danielutils-0.9.94/danielutils/generators → danielutils-1.0.0/danielutils/Generators}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/generators → danielutils-1.0.0/danielutils/Generators}/conditional_generator.py +0 -0
- {danielutils-0.9.94/danielutils/generators → danielutils-1.0.0/danielutils/Generators}/generator_from_stream.py +0 -0
- {danielutils-0.9.94/danielutils/generators → danielutils-1.0.0/danielutils/Generators}/join_generators.py +0 -0
- /danielutils-0.9.94/danielutils/internet.py → /danielutils-1.0.0/danielutils/Internet.py +0 -0
- /danielutils-0.9.94/danielutils/metaclasses/interface.py → /danielutils-1.0.0/danielutils/MetaClasses/Interface.py +0 -0
- {danielutils-0.9.94/danielutils/metaclasses → danielutils-1.0.0/danielutils/MetaClasses}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/metaclasses → danielutils-1.0.0/danielutils/MetaClasses}/atomic_class_meta.py +0 -0
- {danielutils-0.9.94/danielutils/metaclasses → danielutils-1.0.0/danielutils/MetaClasses}/implicit_data_deleter_meta.py +0 -0
- {danielutils-0.9.94/danielutils/metaclasses → danielutils-1.0.0/danielutils/MetaClasses}/instance_cache_meta.py +0 -0
- {danielutils-0.9.94/danielutils/metaclasses → danielutils-1.0.0/danielutils/MetaClasses}/overload_meta.py +0 -0
- /danielutils-0.9.94/danielutils/path.py → /danielutils-1.0.0/danielutils/Path.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/class_/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/class_/class_reflection.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/file/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/file/file_reflection.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/function/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/function/function_reflections.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/callstack.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/get_traceback.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/interpreter.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/is_debugging.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/os_.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/packages.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/python_version.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/signals.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/interpreter/tracer.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/module/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/module/module_reflections.py +0 -0
- {danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/module/package_reflection.py +0 -0
- {danielutils-0.9.94/danielutils/snippets → danielutils-1.0.0/danielutils/Snippets}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/snippets → danielutils-1.0.0/danielutils/Snippets}/try_get.py +0 -0
- /danielutils-0.9.94/danielutils/text.py → /danielutils-1.0.0/danielutils/Text.py +0 -0
- /danielutils-0.9.94/danielutils/time.py → /danielutils-1.0.0/danielutils/Time.py +0 -0
- {danielutils-0.9.94/danielutils/university/databases → danielutils-1.0.0/danielutils/University/Databases}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university/databases → danielutils-1.0.0/danielutils/University/Databases}/all.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/computability_and_complexity/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/computability_and_complexity/discreate_finite_automaton.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/computability_and_complexity/languages/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/computability_and_complexity/languages/language.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/computability_and_complexity/turing_machine.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/encoding.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossless/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossless/huffman.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossless/lossless_encoding.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossless/lzw.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossless/run_length.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossy/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/encoding/lossy/lossy_encoding.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/tansformations/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/tansformations/gaussian.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/tansformations/gradient.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/tansformations/hough.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/tansformations/laplacian.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/image_proccesing/tansformations/transformation.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/linear_algebra/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/linear_algebra/matrix.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/machine_learning/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/machine_learning/activation_functions/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/machine_learning/activation_functions/activation_function.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/machine_learning/activation_functions/relu.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/machine_learning/neuron.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/oop/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/oop/observer.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/oop/strategy.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/conditional_variable.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/continuous/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/bernoulli.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/binomial.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/conditional_from_discrete_probability_func.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/discrete.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/geometric.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/poisson.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/conditional_variable/discrete/uniform.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/distributions.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/expressions/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/expressions/accumulation_expression.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/expressions/probability_expression.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/funcs/__init__.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/funcs/covariance.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/funcs/expected_value.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/funcs/probability_function.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/funcs/variance.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/operator.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/protocols.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/supp.py +0 -0
- {danielutils-0.9.94/danielutils/university → danielutils-1.0.0/danielutils/University}/probability/transformation.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/database/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/database/cached_database.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/database/database.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/database/redis_database.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/multiprogramming/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/multiprogramming/multi_id.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/multiprogramming/worker.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/multiprogramming/worker_pool.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/abstractions/repl.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/counter.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/typed_builtins/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/typed_builtins/factory.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/typed_builtins/tdict.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/typed_builtins/tlist.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/typed_builtins/tset.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/better_builtins/typed_builtins/ttuple.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/context_managers/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/context_managers/attr_context.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/context_managers/multi_context.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/context_managers/optional_context.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/context_managers/state_context.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/context_managers/temporary_file.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/convenience.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/algorithms.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/comparer.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/default_dict.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/functions.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/graph/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/graph/binary_node.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/graph/graph.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/graph/node.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/heap/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/heap/heap.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/heap/max_heap.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/heap/min_heap.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/queue/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/queue/atomic_queue.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/queue/priority_queue.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/queue/queue.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/stack.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/trees/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/trees/binary_syntax_tree.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/data_structures/trees/binary_tree.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/date.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/date_time.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/file_specifications/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/io_.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/java/interfaces/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/math_/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/math_/constants.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/math_/functions.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/math_/math_print.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/math_/math_symbols.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/mock_/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/mock_/mock_database.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/mock_/mock_module.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/progress_bar/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/progress_bar/ascii_progress_bar.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/protocols/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/protocols/dictable.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/protocols/evaluable.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/protocols/serializable.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/py.typed +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/retry_executor/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/retry_executor/retry_executor.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/independent.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/layered_command.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/windows/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/windows/utils/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/windows/utils/filetime.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/windows/win32_ctime.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/system/windows/windows.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/testing/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/testing/unittest_/__init__.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils/testing/unittest_/always_teardown_testcase.py +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils.egg-info/dependency_links.txt +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/danielutils.egg-info/top_level.txt +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/setup.cfg +0 -0
- {danielutils-0.9.94 → danielutils-1.0.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: danielutils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: A python utils library for things I find useful
|
|
5
5
|
Author-email: danielnachumdev <danielnachumdev@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -40,7 +40,7 @@ License-File: LICENSE
|
|
|
40
40
|
[](https://www.python.org/downloads/release/python-31011/)
|
|
41
41
|
[](https://github.com/danielnachumdev/danielutils/actions/workflows/gitleaks.yml)
|
|
42
42
|
[](https://github.com/danielnachumdev/danielutils/actions/workflows/github-code-scanning/codeql)
|
|
43
|
-
# danielutils v=0.
|
|
43
|
+
# danielutils v=1.0.0
|
|
44
44
|
A utils library for things that I find useful for my coding workflow.\
|
|
45
45
|
Feel free to use and / or contribute / improve my code :)
|
|
46
46
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.python.org/downloads/release/python-31011/)
|
|
5
5
|
[](https://github.com/danielnachumdev/danielutils/actions/workflows/gitleaks.yml)
|
|
6
6
|
[](https://github.com/danielnachumdev/danielutils/actions/workflows/github-code-scanning/codeql)
|
|
7
|
-
# danielutils v=0.
|
|
7
|
+
# danielutils v=1.0.0
|
|
8
8
|
A utils library for things that I find useful for my coding workflow.\
|
|
9
9
|
Feel free to use and / or contribute / improve my code :)
|
|
10
10
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
def singleton(og_class):
|
|
2
|
+
instance = None
|
|
3
|
+
original_new = getattr(og_class, '__new__')
|
|
4
|
+
original_init = getattr(og_class, '__init__')
|
|
5
|
+
|
|
6
|
+
def __new__(cls, *args, **kwargs):
|
|
7
|
+
nonlocal instance
|
|
8
|
+
if instance is None:
|
|
9
|
+
# index 0 is the current class.
|
|
10
|
+
# in the minimal case index 1 has 'object' class
|
|
11
|
+
# otherwise the immediate parent of current class
|
|
12
|
+
cls_index, og_index = 0, list(cls.__mro__).index(og_class)
|
|
13
|
+
blacklist = {*cls.__mro__[:og_index + 1]}
|
|
14
|
+
for candidate in cls.__mro__[og_index + 1:]:
|
|
15
|
+
if candidate not in blacklist:
|
|
16
|
+
try:
|
|
17
|
+
instance = candidate.__new__(cls, *args, **kwargs)
|
|
18
|
+
break
|
|
19
|
+
except:
|
|
20
|
+
pass
|
|
21
|
+
else:
|
|
22
|
+
instance = object.__new__(cls)
|
|
23
|
+
return instance
|
|
24
|
+
|
|
25
|
+
is_init: bool = False
|
|
26
|
+
|
|
27
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
28
|
+
nonlocal is_init
|
|
29
|
+
if not is_init:
|
|
30
|
+
original_init(self, *args, **kwargs)
|
|
31
|
+
is_init = True
|
|
32
|
+
|
|
33
|
+
setattr(og_class, "__new__", __new__)
|
|
34
|
+
setattr(og_class, "__init__", __init__)
|
|
35
|
+
setattr(og_class, "instance", lambda: instance)
|
|
36
|
+
return og_class
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"singleton"
|
|
41
|
+
]
|
{danielutils-0.9.94/danielutils/functions → danielutils-1.0.0/danielutils/Functions}/isoftype.py
RENAMED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import inspect
|
|
2
1
|
from typing import get_args, get_origin, get_type_hints, Any, Union, TypeVar, \
|
|
3
|
-
ForwardRef, Literal, Optional, Protocol, Generic, Type, List, Tuple, Set, Dict
|
|
2
|
+
ForwardRef, Literal, Optional, Protocol, Generic, Type, List, Tuple, Set, Dict
|
|
4
3
|
from collections.abc import Callable, Generator, Iterable
|
|
5
4
|
from ..reflection import get_python_version
|
|
6
|
-
from ..versioned_imports import ParamSpec, Concatenate
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
class _tmp(Protocol): ...
|
|
@@ -25,9 +23,15 @@ try:
|
|
|
25
23
|
implicit_union_type = type(int | str)
|
|
26
24
|
except:
|
|
27
25
|
implicit_union_type = Union
|
|
28
|
-
|
|
26
|
+
|
|
29
27
|
ellipsis_ = ...
|
|
30
28
|
|
|
29
|
+
PARAMSPEC_STRICT: bool = True
|
|
30
|
+
try:
|
|
31
|
+
from typing import ParamSpec
|
|
32
|
+
except ImportError:
|
|
33
|
+
PARAMSPEC_STRICT = False
|
|
34
|
+
|
|
31
35
|
|
|
32
36
|
def __isoftype_inquire(obj: Any) -> Tuple[Optional[type], Optional[tuple], Optional[dict]]:
|
|
33
37
|
"""
|
|
@@ -187,18 +191,28 @@ def __handle_callable(params: tuple) -> bool:
|
|
|
187
191
|
return True
|
|
188
192
|
if len(t_args) == 0:
|
|
189
193
|
return True
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
try:
|
|
195
|
+
from typing import Concatenate, ParamSpec
|
|
196
|
+
concatenate_t = type(Concatenate[str, ParamSpec("P_")])
|
|
197
|
+
if get_python_version() < (3, 10):
|
|
198
|
+
if isoftype(t_args[0][0], [ParamSpec, concatenate_t]):
|
|
199
|
+
return True
|
|
200
|
+
else:
|
|
201
|
+
if isoftype(t_args[0], [ParamSpec, concatenate_t]):
|
|
202
|
+
return True
|
|
203
|
+
except ImportError:
|
|
204
|
+
pass
|
|
197
205
|
|
|
198
206
|
obj_return_type = obj_hints.get('return')
|
|
199
207
|
obj_param_types = list(obj_hints.values())[:-1] if obj_hints else None
|
|
200
208
|
t_return_type = t_args[1]
|
|
201
209
|
|
|
210
|
+
if not PARAMSPEC_STRICT:
|
|
211
|
+
if t_args[0] == Ellipsis:
|
|
212
|
+
return True
|
|
213
|
+
if t_args[0] == [Any]:
|
|
214
|
+
return True
|
|
215
|
+
|
|
202
216
|
if isinstance(t_args[0], Iterable):
|
|
203
217
|
t_param_types = list(t_args[0])
|
|
204
218
|
A = obj_param_types + [obj_return_type] if obj_param_types else None
|
|
@@ -276,8 +290,8 @@ def __handle_protocol(params: tuple, /, allow_classes: bool = False) -> bool:
|
|
|
276
290
|
t_origin = T
|
|
277
291
|
|
|
278
292
|
cls = ClassDeclaration.from_cls(t_origin)
|
|
279
|
-
declared_funcs:
|
|
280
|
-
required_funcs:
|
|
293
|
+
declared_funcs: List[FunctionDeclaration] = list(FunctionDeclaration.get_declared_functions(V))
|
|
294
|
+
required_funcs: List[FunctionDeclaration] = list(FunctionDeclaration.get_declared_functions(t_origin))
|
|
281
295
|
|
|
282
296
|
for i, req_func in enumerate(required_funcs):
|
|
283
297
|
if req_func.has_generics:
|
|
@@ -383,26 +397,26 @@ def isoftype(V: Any, T: Any, /, strict: bool = True) -> bool:
|
|
|
383
397
|
t_origin, t_args, t_hints
|
|
384
398
|
)
|
|
385
399
|
|
|
386
|
-
if t_args is not None and Ellipsis in t_args:
|
|
400
|
+
if t_args is not None and Ellipsis in t_args and PARAMSPEC_STRICT:
|
|
387
401
|
from ..colors import warning # pylint: disable=cyclic-import
|
|
388
402
|
warning(
|
|
389
403
|
"using an ellipsis (as in '...') with isoftype is ambiguous returning False")
|
|
390
404
|
return False
|
|
391
405
|
|
|
392
406
|
if T is Union:
|
|
393
|
-
t_origin = Union
|
|
407
|
+
t_origin = Union # type:ignore
|
|
394
408
|
elif T is Protocol or Protocol in getattr(T, "__mro__", []):
|
|
395
|
-
t_origin = Protocol
|
|
409
|
+
t_origin = Protocol # type:ignore
|
|
396
410
|
elif Protocol in getattr(V, "__mro__", []):
|
|
397
|
-
t_origin = Protocol
|
|
411
|
+
t_origin = Protocol # type:ignore
|
|
398
412
|
|
|
399
413
|
if t_origin is not None:
|
|
400
414
|
if getattr(t_origin, "_is_protocol", False) or isinstance(t_origin, _ProtocolMeta):
|
|
401
|
-
t_origin = Protocol
|
|
415
|
+
t_origin = Protocol # type:ignore
|
|
402
416
|
|
|
403
417
|
if t_origin in HANDLERS:
|
|
404
418
|
if t_origin in (list, tuple, dict, set, dict, Iterable):
|
|
405
|
-
if not isinstance(V, t_origin):
|
|
419
|
+
if not isinstance(V, t_origin): # type:ignore
|
|
406
420
|
return False
|
|
407
421
|
return HANDLERS[t_origin](params) # type:ignore
|
|
408
422
|
# These imports must explicitly be specifically here and not at the top
|
{danielutils-0.9.94/danielutils/reflection → danielutils-1.0.0/danielutils/Reflection}/__init__.py
RENAMED
|
@@ -3,7 +3,10 @@ from .file import *
|
|
|
3
3
|
from .function import *
|
|
4
4
|
from .class_ import *
|
|
5
5
|
from .module import *
|
|
6
|
-
|
|
6
|
+
from .argument_info import *
|
|
7
|
+
from .decoration_info import *
|
|
8
|
+
from .function_info import *
|
|
9
|
+
from .class_info import *
|
|
7
10
|
# def get_class(module_name: str, class_name: str) -> type:
|
|
8
11
|
# """dynammically loads the module and returns the class from this file
|
|
9
12
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Optional, List
|
|
4
|
+
|
|
5
|
+
ARGUMENT_INFO_REGEX: re.Pattern = re.compile(
|
|
6
|
+
r"(?P<kwargs>\*\*\w[\w\d]*)|(?P<args>\*(?:\w[\w\d]*)?)|(?P<kwarg_only>\/)|(?P<pname>\w[\w\d]*)\[(?P<parameters>.+)\]|(?P<name>\w[\w\d]*)(?:(?:\s*:(?P<type>[^\=\n]+))?(?:\s*=(?P<default_value>[\s\S]+))?)?")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ArgumentInfo:
|
|
10
|
+
def __init__(self,
|
|
11
|
+
name: Optional[str],
|
|
12
|
+
type: Optional[str],
|
|
13
|
+
default: Optional[str],
|
|
14
|
+
is_kwargs: bool,
|
|
15
|
+
is_args: bool,
|
|
16
|
+
is_kwargs_only: bool,
|
|
17
|
+
parameters: Optional[List]):
|
|
18
|
+
self._name = name
|
|
19
|
+
self._type = type
|
|
20
|
+
self._default = default
|
|
21
|
+
self._is_kwargs = is_kwargs
|
|
22
|
+
self._is_args = is_args
|
|
23
|
+
self._is_kwargs_only = is_kwargs_only
|
|
24
|
+
self._parameters = parameters
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def name(self) -> Optional[str]:
|
|
28
|
+
return self._name
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def type(self) -> Optional[str]:
|
|
32
|
+
return self._type
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def default(self) -> Optional[str]:
|
|
36
|
+
return self._default
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def is_kwargs(self) -> bool:
|
|
40
|
+
return self._is_kwargs
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def is_args(self) -> bool:
|
|
44
|
+
return self._is_args
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def is_kwargs_only(self) -> bool:
|
|
48
|
+
return self._is_kwargs_only
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def parameters(self) -> Optional[List]:
|
|
52
|
+
return self._parameters
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def is_parameterized(self) -> bool:
|
|
56
|
+
return self._parameters is not None and len(self.parameters) > 0 # type: ignore
|
|
57
|
+
|
|
58
|
+
def __repr__(self) -> str:
|
|
59
|
+
res = f"{self.__class__.__name__}(name=\"{self.name}\""
|
|
60
|
+
if self.type is not None:
|
|
61
|
+
res += f", type={self.type}"
|
|
62
|
+
if self.default is not None:
|
|
63
|
+
res += f", default={self.default}"
|
|
64
|
+
if self.is_parameterized:
|
|
65
|
+
res+=f", parameters={self.parameters}"
|
|
66
|
+
return res + ")"
|
|
67
|
+
|
|
68
|
+
def __str__(self) -> str:
|
|
69
|
+
return repr(self)
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def _parse_one(string: str) -> 'ArgumentInfo':
|
|
73
|
+
m = ARGUMENT_INFO_REGEX.match(string)
|
|
74
|
+
if m is None:
|
|
75
|
+
raise ValueError(f"Invalid argument info string: {string}")
|
|
76
|
+
|
|
77
|
+
kwargs, args, kwarg_only, pname, parameters, name, type, default_value = m.groups()
|
|
78
|
+
return ArgumentInfo(
|
|
79
|
+
name=name or pname,
|
|
80
|
+
type=type,
|
|
81
|
+
default=default_value,
|
|
82
|
+
is_kwargs=kwargs is not None,
|
|
83
|
+
is_args=args is not None,
|
|
84
|
+
is_kwargs_only=kwarg_only is not None,
|
|
85
|
+
parameters=[parameters]
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
@staticmethod
|
|
89
|
+
def from_str(string: str) -> List['ArgumentInfo']:
|
|
90
|
+
if string is None:
|
|
91
|
+
return []
|
|
92
|
+
string = string.strip()
|
|
93
|
+
indices = [-1]
|
|
94
|
+
stack: List[str] = []
|
|
95
|
+
for i, c in enumerate(string):
|
|
96
|
+
if c in {'[', ']'}:
|
|
97
|
+
if c == '[':
|
|
98
|
+
stack.append(c)
|
|
99
|
+
else:
|
|
100
|
+
stack.pop()
|
|
101
|
+
elif len(stack) == 0:
|
|
102
|
+
if c == ",":
|
|
103
|
+
indices.append(i)
|
|
104
|
+
indices.append(len(string))
|
|
105
|
+
res = []
|
|
106
|
+
for start, end in zip(indices[:-1], indices[1:]):
|
|
107
|
+
substr = string[start + 1:end].strip()
|
|
108
|
+
res.append(ArgumentInfo._parse_one(substr))
|
|
109
|
+
return res
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
__all__ = [
|
|
113
|
+
"ArgumentInfo",
|
|
114
|
+
]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
import re
|
|
3
|
+
from typing import Optional, List, Iterable, Type
|
|
4
|
+
from .function_info import FunctionInfo
|
|
5
|
+
from .decoration_info import DecorationInfo
|
|
6
|
+
from .argument_info import ArgumentInfo
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ClassInfo:
|
|
10
|
+
CLASS_DEFINITION_REGEX: re.Pattern = re.compile(
|
|
11
|
+
r"(?P<decorations>[\s\S]*)?^class (?P<name>\w[\w\d]*)(?:\((?P<bases>.*)\))?:(?P<body>[\s\S]+)", re.MULTILINE)
|
|
12
|
+
|
|
13
|
+
# r"(?P<decorations>[\s\S]*)?^class (?P<name>\w[\w\d]*)(?:\((?P<bases>.*)\))?:(?P<body>[\s\S]+)"
|
|
14
|
+
|
|
15
|
+
def __init__(self, cls: Type) -> None:
|
|
16
|
+
if not inspect.isclass(cls):
|
|
17
|
+
raise TypeError(f"'{cls.__name__}' is not a class")
|
|
18
|
+
self._cls = cls
|
|
19
|
+
self._src_code: str = ""
|
|
20
|
+
self._name: str = ""
|
|
21
|
+
self._bases: List[ArgumentInfo] = []
|
|
22
|
+
self._functions: List[FunctionInfo] = []
|
|
23
|
+
self._decorations: List[DecorationInfo] = []
|
|
24
|
+
self._parse_src_code()
|
|
25
|
+
|
|
26
|
+
def _parse_src_code(self) -> None:
|
|
27
|
+
self._src_code = inspect.getsource(self._cls)
|
|
28
|
+
m = ClassInfo.CLASS_DEFINITION_REGEX.match(self._src_code)
|
|
29
|
+
if m is None:
|
|
30
|
+
raise SyntaxError()
|
|
31
|
+
decorators, name, bases, _ = m.groups()
|
|
32
|
+
self._name = name
|
|
33
|
+
self._bases = ArgumentInfo.from_str(bases)
|
|
34
|
+
self._parse_body()
|
|
35
|
+
|
|
36
|
+
if decorators is not None:
|
|
37
|
+
for substr in decorators.strip().splitlines():
|
|
38
|
+
self._decorations.append(DecorationInfo.from_str(substr.strip()))
|
|
39
|
+
|
|
40
|
+
def _parse_body(self) -> None:
|
|
41
|
+
for attr in dir(self._cls):
|
|
42
|
+
obj = getattr(self._cls, attr, None)
|
|
43
|
+
if inspect.isbuiltin(obj): continue
|
|
44
|
+
try:
|
|
45
|
+
if inspect.isroutine(obj):
|
|
46
|
+
inspect.getsource(obj)
|
|
47
|
+
elif inspect.isdatadescriptor(obj):
|
|
48
|
+
inspect.getsource(obj.fget) # type:ignore
|
|
49
|
+
else:
|
|
50
|
+
raise 1
|
|
51
|
+
except:
|
|
52
|
+
continue
|
|
53
|
+
self._functions.append(FunctionInfo(obj, self._cls))
|
|
54
|
+
|
|
55
|
+
def __str__(self) -> str:
|
|
56
|
+
return f"{self.__class__.__name__}(name=\"{self.name}\", bases={self.bases}, decorations={self.decorations}, static_methods={self.static_methods}, class_methods={self.class_methods}, isntance_methods={self.instance_methods})"
|
|
57
|
+
|
|
58
|
+
def __repr__(self):
|
|
59
|
+
return f"{self.__class__.__name__}(name=\"{self.name}\")"
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def name(self) -> str:
|
|
63
|
+
return self._name
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def decorations(self) -> List[DecorationInfo]:
|
|
67
|
+
return self._decorations
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def bases(self) -> List[ArgumentInfo]:
|
|
71
|
+
return self._bases
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def static_methods(self) -> Iterable[FunctionInfo]:
|
|
75
|
+
return sorted(filter(lambda f: f.is_static_method, self._functions), key=lambda f: f.name)
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def class_methods(self) -> Iterable[FunctionInfo]:
|
|
79
|
+
return sorted(filter(lambda f: f.is_class_method, self._functions), key=lambda f: f.name)
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def instance_methods(self) -> Iterable[FunctionInfo]:
|
|
83
|
+
return sorted(filter(lambda f: f.is_instance_method, self._functions), key=lambda f: f.name)
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def functions(self) -> List[FunctionInfo]:
|
|
87
|
+
return self._functions
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def properties(self):
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def instance_properties(self):
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def class_properties(self):
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
__all__ = [
|
|
103
|
+
"ClassInfo"
|
|
104
|
+
]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from dataclasses import dataclass, Field
|
|
3
|
+
from typing import Optional, List
|
|
4
|
+
|
|
5
|
+
from .argument_info import ArgumentInfo
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DecorationInfo:
|
|
9
|
+
DECORATOR_INFO_REGEX: re.Pattern = re.compile(r"^@?(?P<name>\w[\w\d]*)(?P<arguments>\(.*\))?")
|
|
10
|
+
|
|
11
|
+
def __init__(self, name: str, arguments: List[ArgumentInfo]):
|
|
12
|
+
self._name = name
|
|
13
|
+
self._arguments = arguments
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def name(self) -> str:
|
|
17
|
+
return self._name
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def arguments(self) -> List[ArgumentInfo]:
|
|
21
|
+
return self._arguments
|
|
22
|
+
|
|
23
|
+
@staticmethod
|
|
24
|
+
def from_str(string: str) -> 'DecorationInfo':
|
|
25
|
+
m = DecorationInfo.DECORATOR_INFO_REGEX.match(string)
|
|
26
|
+
if m is None:
|
|
27
|
+
raise ValueError()
|
|
28
|
+
|
|
29
|
+
name, arguments = m.groups()
|
|
30
|
+
args = ArgumentInfo.from_str(arguments)
|
|
31
|
+
return DecorationInfo(name, args)
|
|
32
|
+
|
|
33
|
+
def __str__(self) -> str:
|
|
34
|
+
return repr(self)
|
|
35
|
+
|
|
36
|
+
def __repr__(self) -> str:
|
|
37
|
+
if self.arguments:
|
|
38
|
+
return f"{self.__class__.__name__}(name=\"{self.name}\", arguments={self.arguments})"
|
|
39
|
+
return f"{self.__class__.__name__}(name=\"{self.name}\")"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
'DecorationInfo',
|
|
44
|
+
]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
import re
|
|
3
|
+
from typing import Type, Optional, List, Callable
|
|
4
|
+
from .decoration_info import DecorationInfo
|
|
5
|
+
from .argument_info import ArgumentInfo
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FunctionInfo:
|
|
9
|
+
FUNCTION_DEFINITION_REGEX: re.Pattern = re.compile(
|
|
10
|
+
r"(?P<decorators>[\s\S]+)?\s*def (?P<name>\w[\w\d]*)\s*\((?P<arguments>.+)?\)\s*(?:\s*\-\>\s*(?P<return_type>[\s\S]+?)\s*)?:(?P<body>[\s\S]+)",
|
|
11
|
+
re.MULTILINE)
|
|
12
|
+
|
|
13
|
+
def __init__(self, func: Callable, owner: Type) -> None:
|
|
14
|
+
try:
|
|
15
|
+
if inspect.isdatadescriptor(func):
|
|
16
|
+
inspect.getsource(func.fget)
|
|
17
|
+
self._is_property = True
|
|
18
|
+
else:
|
|
19
|
+
inspect.getsource(func)
|
|
20
|
+
self._is_property = False
|
|
21
|
+
except:
|
|
22
|
+
raise TypeError(f"'{func.__name__}' is not a user defined function")
|
|
23
|
+
self._func = func
|
|
24
|
+
self._decorators: List[DecorationInfo] = []
|
|
25
|
+
self._arguments: List[ArgumentInfo] = []
|
|
26
|
+
self._return_type: str = ""
|
|
27
|
+
self._owner = owner
|
|
28
|
+
self._parse_src_code()
|
|
29
|
+
|
|
30
|
+
def _parse_src_code(self) -> None:
|
|
31
|
+
f = self._func if not self.is_property else self._func.fget # type:ignore
|
|
32
|
+
code = inspect.getsource(f).strip()
|
|
33
|
+
m = FunctionInfo.FUNCTION_DEFINITION_REGEX.match(code)
|
|
34
|
+
if m is None:
|
|
35
|
+
raise ValueError("Invalid function source code")
|
|
36
|
+
decorators, name, arguments, return_type, body = m.groups()
|
|
37
|
+
if decorators is not None:
|
|
38
|
+
for substr in decorators.strip().splitlines():
|
|
39
|
+
self._decorators.append(DecorationInfo.from_str(substr.strip()))
|
|
40
|
+
self._name = name
|
|
41
|
+
if arguments is not None:
|
|
42
|
+
self._arguments = ArgumentInfo.from_str(arguments)
|
|
43
|
+
|
|
44
|
+
self._return_type = "None"
|
|
45
|
+
if return_type is not None:
|
|
46
|
+
self._return_type = return_type
|
|
47
|
+
|
|
48
|
+
def __str__(self) -> str:
|
|
49
|
+
return f"{self.__class__.__name__}(name=\"{self.name}\", decorators={self.decorators}, arguments={self.arguments})"
|
|
50
|
+
|
|
51
|
+
def __repr__(self) -> str:
|
|
52
|
+
return f"{self.__class__.__name__}(name=\"{self.name}\")"
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def is_inherited(self) -> bool:
|
|
56
|
+
return self._func in self._owner.__dict__
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def is_class_method(self) -> bool:
|
|
60
|
+
return "classmethod" in set(d.name for d in self.decorators)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def is_static_method(self) -> bool:
|
|
64
|
+
return "staticmethod" in set(d.name for d in self.decorators)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def is_instance_method(self) -> bool:
|
|
68
|
+
return not self.is_class_method and not self.is_static_method
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def is_abstract(self) -> bool:
|
|
72
|
+
return getattr(self._func, '__isabstractmethod__', False)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def is_property(self) -> bool:
|
|
76
|
+
return self._is_property
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def name(self) -> str:
|
|
80
|
+
return self._name
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def return_type(self) -> str:
|
|
84
|
+
return self._return_type
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def arguments(self) -> List[ArgumentInfo]:
|
|
88
|
+
return self._arguments
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def decorators(self) -> List[DecorationInfo]:
|
|
92
|
+
return self._decorators
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
__all__ = [
|
|
96
|
+
"FunctionInfo",
|
|
97
|
+
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List, TypeVar
|
|
1
|
+
from typing import List, TypeVar, Optional
|
|
2
2
|
|
|
3
3
|
from .language import Language
|
|
4
4
|
|
|
@@ -34,14 +34,14 @@ class CNFLiteral:
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class CNFClause:
|
|
37
|
-
def __bool__(self, literals: List[CNFLiteral] = None) -> None:
|
|
37
|
+
def __bool__(self, literals: Optional[List[CNFLiteral]] = None) -> None:
|
|
38
38
|
self.literals = literals or []
|
|
39
39
|
|
|
40
40
|
def add_literal(self, literal: CNFLiteral):
|
|
41
41
|
self.literals.append(literal)
|
|
42
42
|
|
|
43
43
|
def evaluate(self, variables: List[CNFVariable]) -> bool:
|
|
44
|
-
dct = {v.get_id(): v for v in variables}
|
|
44
|
+
dct: dict = {v.get_id(): v for v in variables}
|
|
45
45
|
|
|
46
46
|
for literal in self.literals:
|
|
47
47
|
if not literal.get_corresponding_variable_id() in dct.keys():
|
|
@@ -210,7 +210,7 @@ class brange(frange):
|
|
|
210
210
|
def __iter__(self):
|
|
211
211
|
itr = super().__iter__()
|
|
212
212
|
try:
|
|
213
|
-
from
|
|
213
|
+
from tqdm import tqdm # type:ignore # pylint: disable=import-error
|
|
214
214
|
return iter(tqdm(itr, desc=f"{self}", total=len(self)))
|
|
215
215
|
except:
|
|
216
216
|
return itr
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
from typing import Callable, TypeVar
|
|
2
|
-
|
|
3
|
-
try:
|
|
4
|
-
from typing import TypeAlias
|
|
5
|
-
except ImportError:
|
|
6
|
-
from typing_extensions import TypeAlias
|
|
1
|
+
from typing import Callable, TypeVar
|
|
2
|
+
from .versioned_imports import TypeAlias
|
|
7
3
|
|
|
8
4
|
T = TypeVar('T')
|
|
9
5
|
U = TypeVar('U')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Optional, Generator, TypeVar, Generic, List as List
|
|
1
|
+
from typing import Optional, Generator, TypeVar, Generic, List as List, Set
|
|
2
2
|
|
|
3
3
|
from ...reflection import get_python_version
|
|
4
4
|
|
|
@@ -82,7 +82,7 @@ class MultiNode(Generic[T]):
|
|
|
82
82
|
int
|
|
83
83
|
"""
|
|
84
84
|
|
|
85
|
-
def helper(cur: MultiNode, seen: Optional[
|
|
85
|
+
def helper(cur: MultiNode, seen: Optional[Set[MultiNode]] = None) -> int:
|
|
86
86
|
if not isinstance(cur, MultiNode):
|
|
87
87
|
return 0
|
|
88
88
|
if seen is None:
|
|
@@ -6,7 +6,7 @@ from ..java_interface import JavaInterface
|
|
|
6
6
|
T = TypeVar('T')
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class Comparable(JavaInterface
|
|
9
|
+
class Comparable(JavaInterface[T]):
|
|
10
10
|
@abstractmethod
|
|
11
11
|
def __lt__(self, other: T) -> bool: ...
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ class Comparable(JavaInterface, Generic[T]):
|
|
|
14
14
|
def __gt__(self, other: T) -> bool: ...
|
|
15
15
|
|
|
16
16
|
@abstractmethod
|
|
17
|
-
def __eq__(self, other: T) -> bool: ...
|
|
17
|
+
def __eq__(self, other: T) -> bool: ... # type:ignore
|
|
18
18
|
|
|
19
19
|
@abstractmethod
|
|
20
20
|
def __le__(self, other: T) -> bool: ...
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
from abc import abstractmethod, ABC
|
|
3
|
+
from typing import Protocol, runtime_checkable, Any, Callable, ParamSpec, Generic
|
|
4
|
+
from ..reflection import ClassInfo
|
|
5
|
+
|
|
6
|
+
P = ParamSpec("P")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@runtime_checkable
|
|
10
|
+
class JavaInterface(Generic[P], Protocol[P]):
|
|
11
|
+
@staticmethod
|
|
12
|
+
def definition(func: Callable) -> Callable:
|
|
13
|
+
return abstractmethod(func)
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def __init_subclass__(cls, **kwargs) -> None:
|
|
17
|
+
info = ClassInfo(cls)
|
|
18
|
+
super().__init_subclass__(**kwargs)
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def is_implemented_by(interface, cls) -> bool:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def implements(cls, interface) -> bool:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
definition = JavaInterface.definition
|
|
30
|
+
__all__ = [
|
|
31
|
+
"JavaInterface",
|
|
32
|
+
"definition"
|
|
33
|
+
]
|