* MAINT: Used f-string method
Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.
* Updated files with f-string method
* Update rsa_key_generator.py
* Update rsa_key_generator.py
* Update elgamal_key_generator.py
* Update lru_cache.py
I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.
* Update lru_cache.py
* Update lru_cache.py
Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* makes LRUCache constructor concrete
* fixes bug in dq_removal in other/least_recently_used
+ deque.remove() operates by value not index
* [mypy] Annotates other/least_recently_used over generic type
+ clean-up: rename key_reference to match type.
* [mypy] updates example to demonstrate LRUCache with complex type
* Adds doctest to other/least_recently_used
* mypy.ini: Remove exclude = (other/least_recently_used.py)
* Various mypy configs
* Delete mypy.ini
* Add mypy to .pre-commit-config.yaml
* mypy --ignore-missing-imports --install-types --non-interactive .
* mypy v0.910
* Pillow=8.3.7
* Pillow==8.3.7
* Pillow==8.3.2
* Update .pre-commit-config.yaml
* Update requirements.txt
* Update pre-commit.yml
* --install-types # See mirrors-mypy README.md
Co-authored-by: Christian Clauss <cclauss@me.com>
* Adds repr and doctest of current behavior linkedlist in other/lru_cache
* Blocks removal of head or tail of double linked list
* clarifies add() logic for double linked list in other/lru_cache
* expands doctests to compare cache and lru cache
* [mypy] annotates vars for other/lru_cache
* [mypy] Annotates lru_cache decorator for other/lru_cache
* Higher order functions require a verbose Callable annotation
* [mypy] Makes LRU_Cache generic over key and value types for other/lru_cache
+ no reason to force int -> int
* [mypy] makes decorator a classmethod for access to class generic types
* breaks two long lines in doctest for other/lru_cache
* simplifies boundary test remove() for other/lru_cache
* [mypy] Annotates, adds doctests, and makes Generic other/lfu_cache
See also commits to other/lru_cache which guided these
* [mypy] annotates cls var in other/lfu_cache
* cleans up items from code review for lfu_cache and lru_cache
* [mypy] runs mypy on lfu_cache and lru_cache
+ As per usage examples, clause literals are a list of strings.
+ Note: symbols extracted from literals are expected to be exactly two characters.
+ self.literal boolean values are initialized to None, so must be optional
+ model values should be Booleans, but aren't guaranteed to be non-None
in the code.
+ uses newer '... | None' annotation for Optional values
+ clauses are passed to the Formula initializer as both lists and sets, they
are stored as lists. Returned clauses will always be lists.
+ use explicit tuple annotation from __future__ rather than using (..., ...)
in return signatures
+ mapping returned by dpll_algorithm is optional per the documentation.
* [mypy] Fixes typing errors in other/date_to_weekday
* [mypy] uses future annotation style for other/date_to_weekly
* date_to_weekday: new implementation replaces buggy original
* date_to_weekday: add examples from multiple of 100 years
* clean-up: runs `black` to fix formatting
* Delete date_to_weekday.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* scoring_algorithm: Moves doctest into function docstring so it will be run
* [mypy] annotates other/scoring_algorithm
* [mypy] renames temp var to unique value to work around mypy issue in other/scoring_algorithm
reusing loop variables with the same name and different types gives
this very confusing mypy error response.
pyright correctly infers the types without issue.
```
scoring_algorithm.py:58: error: Incompatible types in assignment
(expression has type "float", variable has type "List[float]")
scoring_algorithm.py:60: error: Unsupported operand types for -
("List[float]" and "float")
scoring_algorithm.py:65: error: Incompatible types in assignment
(expression has type "float", variable has type "List[float]")
scoring_algorithm.py:67: error: Unsupported operand types for -
("List[float]" and "float")
Found 4 errors in 1 file (checked 1 source file)
```
* scoring_algorithm: uses enumeration instead of manual indexing on loop var
* scoring_algorithm: sometimes we look before we leap.
* clean-up: runs `black` to fix formatting
* Approve functions used as default argumenets
* The default value for **seed** is the result of a function call
The default value for **seed** is the result of a function call which is not normally recommended and causes flake8-bugbear to raise a B008 error. However, in this case, it is accptable because `LinearCongruentialGenerator.__init__()` will only be called once per instance and it ensures that each instance will generate a unique sequence of numbers.
* The default value for **backend** is the result of a function call
The default value for **backend** is the result of a function call which is not normally recommended and causes flake8-bugbear to raise a B008 error. However, in this case, it is accptable because `Aer.get_backend()` is called when the function is definition and that same backend is then reused for function calls.
* Update linear_congruential_generator.py
* Update ripple_adder_classic.py
* Update ripple_adder_classic.py
* Update ripple_adder_classic.py
* Update ripple_adder_classic.py
* Update ripple_adder_classic.py
* add date_to_weekday finder method
* reformat date_to_weekday method
* remove time
* remove hardcode weekdays list
* fix return type error
* fixing fail issue
* Finding the test failing issue
* after testing the pre-commit in local environment
* Move files to cellular_automata
* Rename other/davis–putnam–logemann–loveland.py to backtracking/davis–putnam–logemann–loveland.py
* Rename other/markov_chain.py to graphs/markov_chain.py
* undid rename: need to fix mypy first
* Add graham scan algorithm
* Fix argument name p with point
* Add tests in inner function
* updating DIRECTORY.md
* Fix graham scan for isort --profile=black
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Create medianOf TwoArrays.py
This code finds the median of two arrays (which may or may not be sorted initially).
Example:
Enter elements of an array: 1 5 4 2
Enter elements of another array: 1 7 4 2 7
The median of two arrays is : 4
* Rename medianOf TwoArrays.py to median_of _two_arrays.py
* Rename median_of _two_arrays.py to median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Update median_of_two_arrays.py
* Added doomsday algorithm
* Adding unit-tests to doomsday algorithm
* running black on doomsday
* adding doctest and fixing a black issue [doomsday]
* Update doomsday.py
* fixing black issue [doomsday]
* Update other/doomsday.py
* Update doomsday.py
* adding more doctests (following review comment) [doomsday]
Co-authored-by: John Law <johnlaw.po@gmail.com>
* fix assignment of a variable to itself
* Fix unnecessary 'else' clause in loop
* formatting and redundant reasignment fix
* mark unreachable code with a TODO comment
* fix variable defined multiple times
* fix static method without static decorator
* revert unintended autoformatting
Co-authored-by: Christian Clauss <cclauss@me.com>
* revert autoformatting issue
* applied black autoformatting
Co-authored-by: Christian Clauss <cclauss@me.com>
* Tighten up psf/black and flake8
* Fix some tests
* Fix some E741
* Fix some E741
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>