This file contains hidden or 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
""" | |
Truncate a string (first argument) if it is longer than the given maximum string length (second argument). | |
Return the truncated string with a ... ending. | |
Note that inserting the three dots to the end will add to the string length. | |
However, if the given maximum string length num is less than or equal to 3, | |
then the addition of the three dots does not add to the string length in determining the truncated string. | |
""" | |
def truncate(string, num): |
This file contains hidden or 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
# Extracted using: $ unzip -p lib/pycharm.jar com/jetbrains/python/PyBundle.properties | grep -B1 INSP.NAME | grep '^#' | sed 's|Inspection||g' | sed -e 's|#\s\{,1\}|# noinspection |' | |
# noinspection PyPep8 | |
# noinspection PyPep8Naming | |
# noinspection PyTypeChecker | |
# noinspection PyAbstractClass | |
# noinspection PyArgumentEqualDefault | |
# noinspection PyArgumentList | |
# noinspection PyAssignmentToLoopOrWithParameter | |
# noinspection PyAttributeOutsideInit |
This file contains hidden or 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
# Based on reading : http://stackoverflow.com/questions/7936572/python-call-a-function-from-string-name | |
# http://stackoverflow.com/questions/3061/calling-a-function-of-a-module-from-a-string-with-the-functions-name-in-python | |
class Foo(object): | |
def dynamic_call(self, attribute_name): | |
method_name = 'calculate_' + attribute_name # e.g. given attribute name "baz" call method "calculate_baz" | |
func = getattr(self, method_name) # find method that located within the class | |
func() # execute the method |
This file contains hidden or 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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
NewerOlder