Skip to content

Instantly share code, notes, and snippets.

View HorridModz's full-sized avatar

HorridModz HorridModz

View GitHub Profile
@pylover
pylover / inspections.txt
Last active May 11, 2025 18:25 — forked from ar45/inspections.txt
PyCharm inspections
# 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
@indraniel
indraniel / python-call-method-from-string.py
Created August 31, 2015 20:31
Python: How to dynamically call a method/function given a string of its name
# 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