Commit Graph

59 Commits

Author SHA1 Message Date
Christian Clauss
c909da9b08
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* 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>
2023-02-01 18:44:54 +05:30
Dhruv Manilawala
8bfd1c844b
fix: mypy 0.991 issues (#7988)
* fix: mypy 0.991 issues

* fix: invalid condition for base case
2022-11-15 18:29:14 +01:00
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Caeden Perelli-Harris
393b960525
refactor: Replace doctest traceback with ... (#7558) 2022-10-23 16:36:10 +02:00
Caeden
c6582b35bf
refactor: Move constants outside of variable scope (#7262)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-16 15:03:29 +05:30
Claudio Lucisano
dcca5351c9
Added astronomical_length_scale_conversion.py (#7183) 2022-10-15 00:45:12 +02:00
Abinash Satapathy
0c06b25582
Create speed_conversions.py (#7128)
* Update README.md

Added Google Cirq references

* Create barcode_validator.py

Barcode/EAN validator

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Included docstring and updated variables to snake_case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Included docset and updated bugs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Implemented the changes asked in review.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Updated with f-string format

* Update barcode_validator.py

* Update volume_conversions.py

Simpler doctest output

* Create speed_conversions.py

Conversion of speed units

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update speed_conversions.py

Doctests updated, dictionary implemented.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update speed_conversions.py

Reduced LOC

* Update volume_conversions.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-14 23:42:41 +02:00
Abinash Satapathy
fd5ab45492
Doctest output simpler version (#7116)
* Update README.md

Added Google Cirq references

* Create barcode_validator.py

Barcode/EAN validator

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Included docstring and updated variables to snake_case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Included docset and updated bugs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Implemented the changes asked in review.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update barcode_validator.py

Updated with f-string format

* Update barcode_validator.py

* Update volume_conversions.py

Simpler doctest output

* Update volume_conversions.py

Fixed indentation

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-14 17:47:39 +02:00
Caeden
07e991d553
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038)

* refactor: Fix naming conventions (#7038)

* Update arithmetic_analysis/lu_decomposition.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

* refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038)

* chore: Fix naming conventions in doctests (#7038)

* fix: Temporarily disable project euler problem 104 (#7069)

* chore: Fix naming conventions in doctests (#7038)

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-13 00:54:20 +02:00
Luke Banicevic
a28ad3f759
Add Microsoft Excel Column Title to Column Number Conversion (#4849)
* Added excel column title to number algorithm as part of conversions

* Renamed file to better reflect algorithm function

* Removed duplicate file

* Update excel_title_to_column.py

* Update excel_title_to_column.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-24 09:18:50 +08:00
dangbb
5bac76d7a5
Fix iter_merge_sort bug (#6153)
* Fixed bug where array length 2 can't be sorted

* Add MCC and DU path test

Add test to conversions/octal_to_decimal.py and sorts\iterative_merge_sort.py

* ""

* Update octal_to_decimal.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-21 22:02:53 +08:00
John Law
7a394411b7
fix black at prefix string (#6122)
* fix black at prefix string

* Type -> type

* Type unused
2022-05-01 15:52:40 +02:00
Manuel Di Lullo
a7e4b2326a
Add prefix conversions for strings (#5453)
* First commit for add_prefix_conversion

* Class names in CamelCase, str.format() to f-string

* Fixed following pre-commit guidelines

* solved issues with mypy and enum.Enum

* Rename add_prefix_conversion.py to prefix_conversions_string.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-01 17:45:08 +08:00
Leoriem-code
6314195bb1
Add README files 2/8 (#5766)
* add 5 README files

* empty commit to (hopefully) get rid of the `test-are-failling` label

* Update ciphers/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update conversions/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update cellular_automata/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update computer_vision/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update conversions/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update compression/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-11 21:39:54 +08:00
Brian Evans
dc6e77338c
Add stone unit of measuring weight (#5730)
* Add stone unit of measuring weight

And some tests in the docs using an external calculator. Not yet tested if they pass.

* Fix rounding descrepencies in doctests to pass tests
2021-11-02 00:09:40 +01:00
Sabari Ganesh
582f57f41f
Added physical pressure units (#5613)
* Added physical pressure units

This uses tuple pair which stores units required to be converted to respective other units as mentioned.
Available Units:- Pascal,Bar,Kilopascal,Megapascal,psi(pound per square inch),inHg(in mercury column),torr,atm

* Formatted file

File was formatted as per repo rules

* Reformatted file :)

* Added more reference

* More reference added
2021-10-26 19:55:41 +02:00
Sabari Ganesh
23f43afee5
Added volume conversions (#5607)
* Added volume conversions

This is a file which has relevant function which helps in conversion between volume units.
Available Units:- Cubic metre,Litre,KiloLitre,Gallon,Cubic yard,Cubic foot,cup

The file is also written in a way that , adding a new unit can easily be done by modifying tuple available in the source code

* Formatted file

The file was formatted to follow the syntax formatting rules of the repo

* Formatted file further
2021-10-26 17:57:59 +02:00
Francisco Perez
568c107e68
add bin_to_hexadecimal (#5156) 2021-10-25 15:58:24 +08:00
Christian Clauss
f7804334f1
length_conversion.py: Deal with uppercase and abbreviations (#5433)
* length_conversion.py: Deal with uppercase and abbreviations

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-19 11:11:49 +02:00
Christian Clauss
aa0ace4df7
Remove exception detail from doctest (#5430)
* Remove exception detail from doctest

These details are configuration dependant so should be removed according to https://docs.python.org/3/library/doctest.html

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-19 08:05:20 +02:00
Sabari Ganesh
66c96aa037
Added length unit conversions (#5373)
* Added length unit conversions

Conversion of length units were added with respective tests being implemented and passed.
Available Units:- Metre,Kilometre,Feet,Inch,Centimeter,Yard,Foot,Mile,Millimeter

* Formatted File

File was formatted to go as per repo rules

* Reformatted file

* Reformatted code once again

* Added more test 

Added test to evaluate whether the code handles wrong arguements passed

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Fixed  Minor errors in test

One of the test was failing and it was fixed

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-19 07:26:03 +02:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
TANMAY SRIVASTAVA
368ce7aecc
Added a hex-bin.py file in conversion.py (#4433)
* Added a file that converts hexa to binary

* Added file to convert hexadecimal to binary

* Update hex-bin.py

* added type hint in the code

* Added doctest

* Added code to handle exception

* Resolved doctest issue

* Update hex-bin.py

* Modified convert function

* Added WhiteSpace around operators.

* Made more pythonic

* removed whitespace

* Updated doctest command

* Removed whitespace

* imported union

* Replaced flag with is_negative

* updated return type

* removed pip command

* Resolved doctest issue

* Resolved doctest error

* Reformated the code

* Changes function name

* Changed exception handling statements

* Update and rename hex-bin.py to hex_to_bin.py

* Update newton_method.py

* Update matrix_operation.py

* Update can_string_be_rearranged_as_palindrome.py

* Update hex_to_bin.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-20 10:28:00 +02:00
algobytewise
1a39970538
Add rgb_hsv_conversion.py (#4334)
* Add rgb_hsv_conversion.py

* updating DIRECTORY.md

* snake-case

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-04-23 08:24:01 +02:00
Dhruv Manilawala
20c7518028
fix(mypy): type annotations for conversions algorithms (#4314)
* fix(mypy): type annotations for conversions algorithms

* refactor(CI): include conversions algorithms for mypy tests
2021-04-04 15:25:49 +02:00
Kavindu Santhusa
03889613bc
add integer to roman function (#4050)
* add integer to roman function

simply added fastest method i found.

* Rename roman_to_integer.py to roman_numerals.py

* Update roman_numerals.py

* Update roman_numerals.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-12-21 22:55:59 +01:00
Anubhav Solanki
9333d2f017
Create weight_conversion.py (#3964)
* Create weight_conversion.py
* Update weight_conversion.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-27 21:33:17 +05:30
Mikail Farid
49d0c41905
Renamed octal_to_decimal to octal_to_decimal.py (#3420)
* Renamed octal_to_decimal to octal_to_decimal.py
* Updated octal_to_decimal.py
* modified doctests
* updated octal_to_decimal.py
2020-11-23 11:41:28 +05:30
Prakhar Gurunani
a6ad25c351
Add molecular_chemistry.py (#2944)
* Create molecular_chemistry.py

* round up outputs

* Remove floating point

* Add Wikipedia references

* fixup! Format Python code with psf/black push

* Add Conversions/Molecular Chemistry

* updating DIRECTORY.md

* Update molecular_chemistry.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-10 08:20:27 +01:00
Mikail Farid
5fcd250c99
Added decimal_to_binary_recursion.py (#3266)
* Added decimal_to_binary_recursion.py

* Added decimal_to_binary_recursion.py

* Made changes to docstring

* Use divmod()

* binary_recursive(div) + str(mod)

* Be kind with user input if possible

* Update decimal_to_binary_recursion.py

* ValueError: invalid literal for int() with base 10: 'number'

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-14 12:27:08 +02:00
Sabari Ganesh
e9865ae611
Update temperature_conversions.py (#2522)
* Update temperature_conversions.py

Added Reaumur scale unit conversions.

* Update temperature_conversions.py

* Update temperature_conversions.py
2020-10-03 22:02:58 +05:30
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Christian Clauss
b05081a717
Update and rename bin_to_octal.py to binary_to_octal.py (#2449)
* Update and rename bin_to_octal.py to binary_to_octal.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 14:58:08 +08:00
mohammadreza490
b22596cd96
bin_to_octal (#2431)
* bin_to_octal

Converts binary values to the octal equivalent.

* Update bin_to_octal

* Update conversions/bin_to_octal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Rename bin_to_octal to bin_to_octal.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-09-19 13:36:56 +08:00
Du Yuanchao
d6bff5c133
Renamed files and fixed Doctest (#2421)
* * Renamed files
* Fiexed doctest

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-13 13:27:20 +02:00
mohammadreza490
1b3fec3f1f
binary_to_decimal converter (#2400)
* Create binary_to_decimal

binary to decimal converter

* Update conversions/binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update binary_to_decimal

* Update conversions/binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 06:16:43 +02:00
mohammadreza490
696cd47e15
octal_to_decimal converter (#2399)
* Create octal_to_decimal

octal to decimal converter

* Update octal_to_decimal

* Update conversions/octal_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-10 10:37:29 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
mohammadreza490
1385e47c36
Create hexadecimal_to_decimal (#2393)
* Create hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update hexadecimal_to_decimal

Added negative hexadecimal conversion to decimal number

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-04 15:48:44 +02:00
lance-pyles
f760ecc73c
initial commit of prefix-conversions (#2243)
* initial commit of prefix-conversions

* minor tweaks;

* Lose the blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 00:11:16 +02:00
lance-pyles
44f9fd12c2
added tests (#2234) 2020-07-25 20:58:53 +02:00
lance-pyles
99b40e2a26
add Rankine scale (#2232)
* add Rankine scale
black formatting

* add Wikipedia links

* add optional rounding, default to 2 digits

* fix variable name

* fixed variable name; helps to stage before commiting
2020-07-24 22:55:18 +02:00
karimzakir02
88e82db89a
Celsius to Fahrenheit Conversions (#2188)
* added conversions between celsius and fahrenheit

* Renamed celsius_to_fahrenheit.py

* Fixed spelling issues

* modified file to fit the 88-character limit

* added changes to pass the travis-ci test

* further changed the files to pass the travis-ci test

* further changed the files to pass the travis-ci test

* Shortened conversions/fahrenheit_to_celsius.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Type hints added to conversions/fahrenheit_to_celsius.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* changed the code to let the caller do the printing

* addressed the changes made on github

* Added Kelvin conversions and put temperature functions in a single file

* Removed whitespace from a blank line

* Update temperature_conversions.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-15 21:30:54 +02:00
Hardik Aggarwal
b6ca263983
Update decimal_to_binary.py (#2185)
"an Integer" instead of "a Integer"
2020-07-07 13:26:10 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Christian Clauss
ae9d0f9196
Fix indentation (#2097) 2020-06-14 14:28:00 +08:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
bnMikheili
ec2d900b03
implement sdbm hash algorithm (#2094)
* implement sdbm hash algorithm

* fix bug: styling

* fix styling for decimal_to_any
2020-06-11 22:22:16 +02:00
Kevin C. Escobedo
19c3871b21
Added function to convert from decimal to another base (#2087)
* Added function to convert from decimal to another base

* Update conversions/decimal_to_any.py

Changed type() to isinstance()

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Changed to base in (0, 1)

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Updated to div not in (0, 1)

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Updated to make condition clearer

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Using divmod() instead of % operator

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Improved readability on a docstring test

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Changed use of type() to isinstance()

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update conversions/decimal_to_any.py

Changed from use of type() to isinstance()

Co-authored-by: Christian Clauss <cclauss@me.com>

* Made changes and improved function

* Update conversions/decimal_to_any.py

Added space to docstring test

Co-authored-by: Christian Clauss <cclauss@me.com>

* Changed action for bad input

* Added support for conversions up to base 36 (#2087)

* Added support for conversions up to base 36 and renamed HEXADECIMAL dict (#2087)

* Fixed whitespace issue (#2087)

* Fixed issue with line length (#2087)

* Fixed issue with conversions past base-10 failing (#2087)

* Added more robust testing (#2087)

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-11 17:59:42 +02:00
Shivam Verma
d7cc778092
conversions/decimal_to_binary.py: Add type hints (#2001)
* A .py file to covert a base to any new base(2-18)

* Update base_changer.py

* Added type-hints.

* Delete base_changer.py
2020-06-02 16:47:10 +02:00