-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major syntax updates, PEP8 Compliance, enhancement suggestions, and proposed changes! #37
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- data_structures - Updated __init__.py - graph.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Removed redundant import statments in methods - Updated syntaxing for PEP8 compliance - Updated conditional sytaxing - Removed camel casing from variable and parameter names - Updated _union() and _set_of() in WeightedGraph() class to make them private - Added self.forest to __init__() or WeightedGraph() class - Updated _topological_sort_rec() in TopologicalSort() class to make it private - Updated _check_cycle_rec() in CheckCycleDirectedGraph() class to make it private - Updated _check_cycle_rec() in CheckCycleUndirectedGraph() class to make it private - string - anagram.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Fixed indentations in is_anagram() - Updated syntaxing for PEP8 compliance - palindrome.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Optimized code of is_palindrome - isogram.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Optimized code of is_isogram - pangram.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Optimized code in is_pangram - fibonacci - generator.py - Updated syntaxing for PEP8 compliance - Updated parameter name on nested function sequence(), it was shadowing outer functions parameter name - goldenratio.py - Updated syntaxing for PEP8 compliance - Functions no longer nested - math - lcm.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Updated code to prevent variables from shadowing method names - lcm_using_gcd.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Updated code to remove camel casing on parameter names - sieve_of_eratosthenesd.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Removed redundant parenthesis in conditionals - Optimized conditionals - searching - binary_search.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Updated code in binary_search - breadth_first_search.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - depth_fist_seach.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Updated code in depth_first_search - linear_search.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - Removed camel casing from variable and parameter names - quick_select.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Updated syntaxing for PEP8 compliance - moved nested functions out of search() Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
- queue.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Removed redundant import statments in methods - linked_list.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Removed redundant import statments in methods - Updated conditionals and syntaxing - Removed redundant parenthesis around conditionals - Removed camel casing on variables - heap.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Removed redundant import statments in methods - Updated parent_idx, left_child_idx, right_child_idx, time_complexities to be static - removed unused variable 'ROOT' from heapify_down() - stack.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Removed redundant import statments in methods - Removed camel casing on methods and variables - Updated get_code() in Stack(object) to be static - Updated _isOperand(), _precedence() in InfixToPostfix() to be static and private - Updated get_code() to be static - Updated method _isOperand() - Removed redundant parenthesis around conditionals - tree.py - Updated docstrings at top of file - Updated docstrings for functions - Optimized import statements - Removed redundant import statments in methods - Removed redundant parenthesis around conditionals - Updated min_val_bst_node(), get_code() - Removed camel casing on variables and parameter names Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
- stack.py, binary_search.py, depth_first_search.py Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
…earch.py Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
…al in method __precedence() Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
# Conflicts: # pygorithm/data_structures/stack.py
…al in method __precedence() Signed-off-by: IanDoarn <ian.doarn@zimmerbiomet.com>
After #38 issue resolution All unit tests pass. Thanks MrDupin!!! test_data_structures
test_fibonacci
test_math
test_searching
test_sorting
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suggestions
Example:
The time_complexities() function can also be removed, instead this can be included in each module/.py docstrings or in the functions docstrings. When the user calls help() on the function, it will explain how they work, and give them the time complexities.
A sort of function to time some algorithms? We could incorperate a decorator package, users could decorate their functions with them, and see how effeciant each are!
Use function annotations to annotate inputs, and use a custom decorator so when a user calls methods, we can make sure their input is correct, as in checking that the input is a str, int, float, to make python act more like other languages since by default python does not check input parameters. Though this could make the source code for the functions more confusing for newcommers to python! More information: https://code.tutsplus.com/tutorials/python-3-function-annotations--cms-25689
package string should be changed to strings. string is a default python module, having a package shadow builtin/default modules can cause problems.
Decide whether or not to support Python 2.7. heap.py uses
super()
which is a Python 3+ builtin. Something can be added to the main init.py to check for the version thats being run. I've includedfrom __future__ import division
in some of the modules since I see that//
has been used and Python 3+ you only need/
. If you want to support Python 2.7 you or someone will need to rewrite heao.py!Updates