* Update receive_file.py
Here are the changes I made:
Added the main() function and called it from if __name__ == "__main__" block. This makes it easier to test the code and import it into other programs.
Added socket.AF_INET as the first argument to socket.socket(). This specifies the address family to be used, which is necessary when using connect().
Changed print(f"{data = }") to print("Received:", len(data), "bytes"). This makes it clearer what's happening and how much data is being received.
Changed the final print statement to "Successfully received the file". This makes it more accurate and descriptive.
Moved the import statement to the top of the file. This is a common convention in Python.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* added kadane's algorithm directory with one problem's solution.
* added type hints
* Rename kaadne_algorithm/max_product_subarray.py to dynamic_programming/max_product_subarray.py
* Update dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update max_product_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update max_product_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update max_product_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update max_product_subarray.py
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Reduce the complexity of graphs/bi_directional_dijkstra.py
* Try to lower the --max-complexity threshold in the file .flake8
* Lower the --max-complexity threshold in the file .flake8
* updating DIRECTORY.md
* updating DIRECTORY.md
* Try to lower max-complexity
* Try to lower max-complexity
* Try to lower max-complexity
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* add circular convolution
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add type hint for __init__
* rounding off final values to 2 and minor changes
* add test case for unequal signals
* changes in list comprehension and enumeraton
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* pre-commit: Upgrade psf/black for stable style 2023
Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310
> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…
Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.
I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* updating DIRECTORY.md
* Fix mypy errors in lorentz_transformation_four_vector.py
* Remove unused symbol vars
* Add function documentation and rewrite algorithm explanation
Previous explanation was misleading, as the code only calculates Lorentz
transformations for movement in the x direction (0 velocity in the y and
z directions) and not movement in any direction
* updating DIRECTORY.md
* Update error message for speed
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add maths/Gcd of N Numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add maths/Gcd of N Numbers
* add maths/Gcd of N Numbers
* more pythonic
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* more pythonic
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* merged
* merged
* more readable
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: Add `fib_recursive_cached` func
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* doc: Show difference in time when caching algorithm
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* updating DIRECTORY.md
* Update sierpinski_triangle.py header doc
* Remove unused PROGNAME var in sierpinski_triangle.py
The PROGNAME var was used to print an image description in the reference
code that this implementation was taken from, but it's entirely unused
here
* Refactor triangle() function to not use list of vertices
Since the number of vertices is always fixed at 3, there's no need to
pass in the vertices as a list, and it's clearer to give the vertices
distinct names rather than index them from the list
* Refactor sierpinski_triangle.py to use tuples
Tuples make more sense than lists for storing coordinate pairs
* Flip if-statement condition in sierpinski_triangle.py to avoid nesting
* Add type hints to sierpinski_triangle.py
* Add doctests to sierpinski_triangle.py
* Fix return types in doctests
* Update fractals/sierpinski_triangle.py
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* updating DIRECTORY.md
* Format local_weighted_learning.py doctests for clarity
* Refactor local_weighted_learning.py to use np.array instead of np.mat
The np.matrix class is planned to be eventually depreciated in favor of
np.array, and current use of the class raises warnings in pytest
* Update local_weighted_learning.py documentation
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Refactor bottom-up function to be class method
* Add type hints
* Update convolve function namespace
* Remove depreciated np.float
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* Renamed function for consistency
* updating DIRECTORY.md
* Remove extra imports in gamma.py doctests
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* - add "lz77_compressor" class with compress and decompress methods using LZ77 compression algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* - use "list" instead "List", formatting
* - fix spelling
* - add Python type hints
* - add 'Token' class to represent triplet (offset, length, indicator)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* - add test, hange type rom List to list
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* - remove extra import
* - remove extra types in comments
* - better test
* - edit comments
* - add return types
* - add tests for __str__ and __repr__
* Update lz77.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add autoclave cipher
* Update autoclave with the given suggestions
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixing errors
* Another fixes
* Update and rename autoclave.py to autokey.py
* Rename gaussian_naive_bayes.py to gaussian_naive_bayes.py.broken.txt
* Rename gradient_boosting_regressor.py to gradient_boosting_regressor.py.broken.txt
* Rename random_forest_classifier.py to random_forest_classifier.py.broken.txt
* Rename random_forest_regressor.py to random_forest_regressor.py.broken.txt
* Rename equal_loudness_filter.py to equal_loudness_filter.py.broken.txt
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* feat: Add hexagonal number
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>