id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
249,800
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf.choose_schema
def choose_schema(self, out_file): """ Finds all schema templates and prompts to choose one. Copies the file to self.lazy_folder. """ path = os.path.dirname(lazyconf.__file__) + '/schema/' self.prompt.header('Choose a template for your config file: ') i = 0 choices = [] ...
python
def choose_schema(self, out_file): """ Finds all schema templates and prompts to choose one. Copies the file to self.lazy_folder. """ path = os.path.dirname(lazyconf.__file__) + '/schema/' self.prompt.header('Choose a template for your config file: ') i = 0 choices = [] ...
[ "def", "choose_schema", "(", "self", ",", "out_file", ")", ":", "path", "=", "os", ".", "path", ".", "dirname", "(", "lazyconf", ".", "__file__", ")", "+", "'/schema/'", "self", ".", "prompt", ".", "header", "(", "'Choose a template for your config file: '", ...
Finds all schema templates and prompts to choose one. Copies the file to self.lazy_folder.
[ "Finds", "all", "schema", "templates", "and", "prompts", "to", "choose", "one", ".", "Copies", "the", "file", "to", "self", ".", "lazy_folder", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L56-L97
249,801
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf.configure_data
def configure_data(self, data, key_string = ''): """ Goes through all the options in `data`, and prompts new values. This function calls itself recursively if it finds an inner dictionary. Arguments: data -- The dictionary to loop through. key_string -- The dot-...
python
def configure_data(self, data, key_string = ''): """ Goes through all the options in `data`, and prompts new values. This function calls itself recursively if it finds an inner dictionary. Arguments: data -- The dictionary to loop through. key_string -- The dot-...
[ "def", "configure_data", "(", "self", ",", "data", ",", "key_string", "=", "''", ")", ":", "# If there's no keys in this dictionary, we have nothing to do.", "if", "len", "(", "data", ".", "keys", "(", ")", ")", "==", "0", ":", "return", "# Split the key string by...
Goes through all the options in `data`, and prompts new values. This function calls itself recursively if it finds an inner dictionary. Arguments: data -- The dictionary to loop through. key_string -- The dot-notated key of the dictionary being checked through.
[ "Goes", "through", "all", "the", "options", "in", "data", "and", "prompts", "new", "values", ".", "This", "function", "calls", "itself", "recursively", "if", "it", "finds", "an", "inner", "dictionary", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L99-L158
249,802
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf.configure
def configure(self): """ The main configure function. Uses a schema file and an optional data file, and combines them with user prompts to write a new data file. """ # Make the lazy folder if it doesn't already exist. path = os.getcwd() + '/' + self.lazy_folder if not os.pat...
python
def configure(self): """ The main configure function. Uses a schema file and an optional data file, and combines them with user prompts to write a new data file. """ # Make the lazy folder if it doesn't already exist. path = os.getcwd() + '/' + self.lazy_folder if not os.pat...
[ "def", "configure", "(", "self", ")", ":", "# Make the lazy folder if it doesn't already exist.", "path", "=", "os", ".", "getcwd", "(", ")", "+", "'/'", "+", "self", ".", "lazy_folder", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":",...
The main configure function. Uses a schema file and an optional data file, and combines them with user prompts to write a new data file.
[ "The", "main", "configure", "function", ".", "Uses", "a", "schema", "file", "and", "an", "optional", "data", "file", "and", "combines", "them", "with", "user", "prompts", "to", "write", "a", "new", "data", "file", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L160-L234
249,803
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf.parse_value
def parse_value(self, inner_dict, label, key, value, default): """ Parses a single value and sets it in an inner dictionary. Arguments: inner_dict -- The dictionary containing the value to set label -- The label to show for the prompt. key -- The key ...
python
def parse_value(self, inner_dict, label, key, value, default): """ Parses a single value and sets it in an inner dictionary. Arguments: inner_dict -- The dictionary containing the value to set label -- The label to show for the prompt. key -- The key ...
[ "def", "parse_value", "(", "self", ",", "inner_dict", ",", "label", ",", "key", ",", "value", ",", "default", ")", ":", "t", "=", "type", "(", "default", ")", "if", "t", "is", "dict", ":", "return", "select", "=", "self", ".", "data", ".", "get_sel...
Parses a single value and sets it in an inner dictionary. Arguments: inner_dict -- The dictionary containing the value to set label -- The label to show for the prompt. key -- The key in the dictionary to set the value for. value -- The value...
[ "Parses", "a", "single", "value", "and", "sets", "it", "in", "an", "inner", "dictionary", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L236-L271
249,804
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf.set
def set(self, key, value): """ Sets a single value in a preconfigured data file. Arguments: key -- The full dot-notated key to set the value for. value -- The value to set. """ d = self.data.data keys = key.split('.') latest = keys.pop() ...
python
def set(self, key, value): """ Sets a single value in a preconfigured data file. Arguments: key -- The full dot-notated key to set the value for. value -- The value to set. """ d = self.data.data keys = key.split('.') latest = keys.pop() ...
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "d", "=", "self", ".", "data", ".", "data", "keys", "=", "key", ".", "split", "(", "'.'", ")", "latest", "=", "keys", ".", "pop", "(", ")", "for", "k", "in", "keys", ":", "d", "...
Sets a single value in a preconfigured data file. Arguments: key -- The full dot-notated key to set the value for. value -- The value to set.
[ "Sets", "a", "single", "value", "in", "a", "preconfigured", "data", "file", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L273-L290
249,805
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf._load
def _load(self, data_file): """ Internal load function. Creates the object and returns it. Arguments: data_file -- The filename to load. """ # Load the data from a file. try: data = Schema().load(data_file) except (Exception, IOError, ValueErr...
python
def _load(self, data_file): """ Internal load function. Creates the object and returns it. Arguments: data_file -- The filename to load. """ # Load the data from a file. try: data = Schema().load(data_file) except (Exception, IOError, ValueErr...
[ "def", "_load", "(", "self", ",", "data_file", ")", ":", "# Load the data from a file.", "try", ":", "data", "=", "Schema", "(", ")", ".", "load", "(", "data_file", ")", "except", "(", "Exception", ",", "IOError", ",", "ValueError", ")", "as", "e", ":", ...
Internal load function. Creates the object and returns it. Arguments: data_file -- The filename to load.
[ "Internal", "load", "function", ".", "Creates", "the", "object", "and", "returns", "it", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L301-L314
249,806
fmd/lazyconf
lazyconf/lazyconf.py
Lazyconf.load
def load(self, data_file = None): """ Loads a data file and sets it to self.data. Arguments: data_file -- The filename to load. """ if not data_file: data_file = '' elif data_file[-1] != '/': data_file += '/' if data_file[-6:] !=...
python
def load(self, data_file = None): """ Loads a data file and sets it to self.data. Arguments: data_file -- The filename to load. """ if not data_file: data_file = '' elif data_file[-1] != '/': data_file += '/' if data_file[-6:] !=...
[ "def", "load", "(", "self", ",", "data_file", "=", "None", ")", ":", "if", "not", "data_file", ":", "data_file", "=", "''", "elif", "data_file", "[", "-", "1", "]", "!=", "'/'", ":", "data_file", "+=", "'/'", "if", "data_file", "[", "-", "6", ":", ...
Loads a data file and sets it to self.data. Arguments: data_file -- The filename to load.
[ "Loads", "a", "data", "file", "and", "sets", "it", "to", "self", ".", "data", "." ]
78e94320c7ff2c08988df04b4e43968f0a7ae06e
https://github.com/fmd/lazyconf/blob/78e94320c7ff2c08988df04b4e43968f0a7ae06e/lazyconf/lazyconf.py#L317-L335
249,807
minhhoit/yacms
yacms/twitter/managers.py
TweetManager.get_for
def get_for(self, query_type, value): """ Create a query and run it for the given arg if it doesn't exist, and return the tweets for the query. """ from yacms.twitter.models import Query lookup = {"type": query_type, "value": value} query, created = Query.objects....
python
def get_for(self, query_type, value): """ Create a query and run it for the given arg if it doesn't exist, and return the tweets for the query. """ from yacms.twitter.models import Query lookup = {"type": query_type, "value": value} query, created = Query.objects....
[ "def", "get_for", "(", "self", ",", "query_type", ",", "value", ")", ":", "from", "yacms", ".", "twitter", ".", "models", "import", "Query", "lookup", "=", "{", "\"type\"", ":", "query_type", ",", "\"value\"", ":", "value", "}", "query", ",", "created", ...
Create a query and run it for the given arg if it doesn't exist, and return the tweets for the query.
[ "Create", "a", "query", "and", "run", "it", "for", "the", "given", "arg", "if", "it", "doesn", "t", "exist", "and", "return", "the", "tweets", "for", "the", "query", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/twitter/managers.py#L12-L25
249,808
inspirehep/plotextractor
plotextractor/converter.py
untar
def untar(original_tarball, output_directory): """Untar given tarball file into directory. Here we decide if our file is actually a tarball, then we untar it and return a list of extracted files. :param: tarball (string): the name of the tar file from arXiv :param: output_directory (string): the d...
python
def untar(original_tarball, output_directory): """Untar given tarball file into directory. Here we decide if our file is actually a tarball, then we untar it and return a list of extracted files. :param: tarball (string): the name of the tar file from arXiv :param: output_directory (string): the d...
[ "def", "untar", "(", "original_tarball", ",", "output_directory", ")", ":", "if", "not", "tarfile", ".", "is_tarfile", "(", "original_tarball", ")", ":", "raise", "InvalidTarball", "tarball", "=", "tarfile", ".", "open", "(", "original_tarball", ")", "# set mtim...
Untar given tarball file into directory. Here we decide if our file is actually a tarball, then we untar it and return a list of extracted files. :param: tarball (string): the name of the tar file from arXiv :param: output_directory (string): the directory to untar in :return: list of absolute fi...
[ "Untar", "given", "tarball", "file", "into", "directory", "." ]
12a65350fb9f32d496f9ea57908d9a2771b20474
https://github.com/inspirehep/plotextractor/blob/12a65350fb9f32d496f9ea57908d9a2771b20474/plotextractor/converter.py#L45-L79
249,809
inspirehep/plotextractor
plotextractor/converter.py
detect_images_and_tex
def detect_images_and_tex( file_list, allowed_image_types=('eps', 'png', 'ps', 'jpg', 'pdf'), timeout=20): """Detect from a list of files which are TeX or images. :param: file_list (list): list of absolute file paths :param: allowed_image_types (list): list of allows image formats ...
python
def detect_images_and_tex( file_list, allowed_image_types=('eps', 'png', 'ps', 'jpg', 'pdf'), timeout=20): """Detect from a list of files which are TeX or images. :param: file_list (list): list of absolute file paths :param: allowed_image_types (list): list of allows image formats ...
[ "def", "detect_images_and_tex", "(", "file_list", ",", "allowed_image_types", "=", "(", "'eps'", ",", "'png'", ",", "'ps'", ",", "'jpg'", ",", "'pdf'", ")", ",", "timeout", "=", "20", ")", ":", "tex_file_extension", "=", "'tex'", "image_list", "=", "[", "]...
Detect from a list of files which are TeX or images. :param: file_list (list): list of absolute file paths :param: allowed_image_types (list): list of allows image formats :param: timeout (int): the timeout value on shell commands. :return: (image_list, tex_file) (([string, string, ...], string)): ...
[ "Detect", "from", "a", "list", "of", "files", "which", "are", "TeX", "or", "images", "." ]
12a65350fb9f32d496f9ea57908d9a2771b20474
https://github.com/inspirehep/plotextractor/blob/12a65350fb9f32d496f9ea57908d9a2771b20474/plotextractor/converter.py#L82-L126
249,810
inspirehep/plotextractor
plotextractor/converter.py
convert_images
def convert_images(image_list, image_format="png", timeout=20): """Convert images from list of images to given format, if needed. Figure out the types of the images that were extracted from the tarball and determine how to convert them into PNG. :param: image_list ([string, string, ...]): the list of ...
python
def convert_images(image_list, image_format="png", timeout=20): """Convert images from list of images to given format, if needed. Figure out the types of the images that were extracted from the tarball and determine how to convert them into PNG. :param: image_list ([string, string, ...]): the list of ...
[ "def", "convert_images", "(", "image_list", ",", "image_format", "=", "\"png\"", ",", "timeout", "=", "20", ")", ":", "png_output_contains", "=", "'PNG image'", "image_mapping", "=", "{", "}", "for", "image_file", "in", "image_list", ":", "if", "os", ".", "p...
Convert images from list of images to given format, if needed. Figure out the types of the images that were extracted from the tarball and determine how to convert them into PNG. :param: image_list ([string, string, ...]): the list of image files extracted from the tarball in step 1 :param: im...
[ "Convert", "images", "from", "list", "of", "images", "to", "given", "format", "if", "needed", "." ]
12a65350fb9f32d496f9ea57908d9a2771b20474
https://github.com/inspirehep/plotextractor/blob/12a65350fb9f32d496f9ea57908d9a2771b20474/plotextractor/converter.py#L129-L171
249,811
inspirehep/plotextractor
plotextractor/converter.py
convert_image
def convert_image(from_file, to_file, image_format): """Convert an image to given format.""" with Image(filename=from_file) as original: with original.convert(image_format) as converted: converted.save(filename=to_file) return to_file
python
def convert_image(from_file, to_file, image_format): """Convert an image to given format.""" with Image(filename=from_file) as original: with original.convert(image_format) as converted: converted.save(filename=to_file) return to_file
[ "def", "convert_image", "(", "from_file", ",", "to_file", ",", "image_format", ")", ":", "with", "Image", "(", "filename", "=", "from_file", ")", "as", "original", ":", "with", "original", ".", "convert", "(", "image_format", ")", "as", "converted", ":", "...
Convert an image to given format.
[ "Convert", "an", "image", "to", "given", "format", "." ]
12a65350fb9f32d496f9ea57908d9a2771b20474
https://github.com/inspirehep/plotextractor/blob/12a65350fb9f32d496f9ea57908d9a2771b20474/plotextractor/converter.py#L174-L179
249,812
inspirehep/plotextractor
plotextractor/converter.py
rotate_image
def rotate_image(filename, line, sdir, image_list): """Rotate a image. Given a filename and a line, figure out what it is that the author wanted to do wrt changing the rotation of the image and convert the file so that this rotation is reflected in its presentation. :param: filename (string): the ...
python
def rotate_image(filename, line, sdir, image_list): """Rotate a image. Given a filename and a line, figure out what it is that the author wanted to do wrt changing the rotation of the image and convert the file so that this rotation is reflected in its presentation. :param: filename (string): the ...
[ "def", "rotate_image", "(", "filename", ",", "line", ",", "sdir", ",", "image_list", ")", ":", "file_loc", "=", "get_image_location", "(", "filename", ",", "sdir", ",", "image_list", ")", "degrees", "=", "re", ".", "findall", "(", "'(angle=[-\\\\d]+|rotate=[-\...
Rotate a image. Given a filename and a line, figure out what it is that the author wanted to do wrt changing the rotation of the image and convert the file so that this rotation is reflected in its presentation. :param: filename (string): the name of the file as specified in the TeX :param: line (...
[ "Rotate", "a", "image", "." ]
12a65350fb9f32d496f9ea57908d9a2771b20474
https://github.com/inspirehep/plotextractor/blob/12a65350fb9f32d496f9ea57908d9a2771b20474/plotextractor/converter.py#L182-L221
249,813
Othernet-Project/ndb-utils
ndb_utils/models.py
OwnershipMixin.get_by_owner
def get_by_owner(cls, owner): """ get all entities owned by specified owner """ return cls.query(cls.owner==cls._get_key(owner))
python
def get_by_owner(cls, owner): """ get all entities owned by specified owner """ return cls.query(cls.owner==cls._get_key(owner))
[ "def", "get_by_owner", "(", "cls", ",", "owner", ")", ":", "return", "cls", ".", "query", "(", "cls", ".", "owner", "==", "cls", ".", "_get_key", "(", "owner", ")", ")" ]
get all entities owned by specified owner
[ "get", "all", "entities", "owned", "by", "specified", "owner" ]
7804a5e305a4ed280742e22dad1dd10756cbe695
https://github.com/Othernet-Project/ndb-utils/blob/7804a5e305a4ed280742e22dad1dd10756cbe695/ndb_utils/models.py#L113-L115
249,814
Othernet-Project/ndb-utils
ndb_utils/models.py
ValidatingMixin.clean
def clean(self): """ Cleans the data and throws ValidationError on failure """ errors = {} cleaned = {} for name, validator in self.validate_schema.items(): val = getattr(self, name, None) try: cleaned[name] = validator.to_python(val) ...
python
def clean(self): """ Cleans the data and throws ValidationError on failure """ errors = {} cleaned = {} for name, validator in self.validate_schema.items(): val = getattr(self, name, None) try: cleaned[name] = validator.to_python(val) ...
[ "def", "clean", "(", "self", ")", ":", "errors", "=", "{", "}", "cleaned", "=", "{", "}", "for", "name", ",", "validator", "in", "self", ".", "validate_schema", ".", "items", "(", ")", ":", "val", "=", "getattr", "(", "self", ",", "name", ",", "N...
Cleans the data and throws ValidationError on failure
[ "Cleans", "the", "data", "and", "throws", "ValidationError", "on", "failure" ]
7804a5e305a4ed280742e22dad1dd10756cbe695
https://github.com/Othernet-Project/ndb-utils/blob/7804a5e305a4ed280742e22dad1dd10756cbe695/ndb_utils/models.py#L130-L144
249,815
calvinku96/labreporthelper
labreporthelper/bestfit/bestfit.py
BestFit.set_defaults
def set_defaults(self, **defaults): """ Add all keyword arguments to self.args args: **defaults: key and value represents dictionary key and value """ try: defaults_items = defaults.iteritems() except AttributeError: de...
python
def set_defaults(self, **defaults): """ Add all keyword arguments to self.args args: **defaults: key and value represents dictionary key and value """ try: defaults_items = defaults.iteritems() except AttributeError: de...
[ "def", "set_defaults", "(", "self", ",", "*", "*", "defaults", ")", ":", "try", ":", "defaults_items", "=", "defaults", ".", "iteritems", "(", ")", "except", "AttributeError", ":", "defaults_items", "=", "defaults", ".", "items", "(", ")", "for", "key", ...
Add all keyword arguments to self.args args: **defaults: key and value represents dictionary key and value
[ "Add", "all", "keyword", "arguments", "to", "self", ".", "args" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/bestfit/bestfit.py#L25-L39
249,816
calvinku96/labreporthelper
labreporthelper/bestfit/bestfit.py
BestFit.set_args
def set_args(self, **kwargs): """ Set more arguments to self.args args: **kwargs: key and value represents dictionary key and value """ try: kwargs_items = kwargs.iteritems() except AttributeError: kwargs_items = kwargs...
python
def set_args(self, **kwargs): """ Set more arguments to self.args args: **kwargs: key and value represents dictionary key and value """ try: kwargs_items = kwargs.iteritems() except AttributeError: kwargs_items = kwargs...
[ "def", "set_args", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "kwargs_items", "=", "kwargs", ".", "iteritems", "(", ")", "except", "AttributeError", ":", "kwargs_items", "=", "kwargs", ".", "items", "(", ")", "for", "key", ",", "val", ...
Set more arguments to self.args args: **kwargs: key and value represents dictionary key and value
[ "Set", "more", "arguments", "to", "self", ".", "args" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/bestfit/bestfit.py#L42-L55
249,817
calvinku96/labreporthelper
labreporthelper/bestfit/bestfit.py
BestFit.check_important_variables
def check_important_variables(self): """ Check all the variables needed are defined """ if len(self.important_variables - set(self.args.keys())): raise TypeError("Some important variables are not set")
python
def check_important_variables(self): """ Check all the variables needed are defined """ if len(self.important_variables - set(self.args.keys())): raise TypeError("Some important variables are not set")
[ "def", "check_important_variables", "(", "self", ")", ":", "if", "len", "(", "self", ".", "important_variables", "-", "set", "(", "self", ".", "args", ".", "keys", "(", ")", ")", ")", ":", "raise", "TypeError", "(", "\"Some important variables are not set\"", ...
Check all the variables needed are defined
[ "Check", "all", "the", "variables", "needed", "are", "defined" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/bestfit/bestfit.py#L57-L62
249,818
calvinku96/labreporthelper
labreporthelper/bestfit/bestfit.py
BestFit.get_bestfit_line
def get_bestfit_line(self, x_min=None, x_max=None, resolution=None): """ Method to get bestfit line using the defined self.bestfit_func method args: x_min: scalar, default=min(x) minimum x value of the line x_max: scalar, default=max(x) ...
python
def get_bestfit_line(self, x_min=None, x_max=None, resolution=None): """ Method to get bestfit line using the defined self.bestfit_func method args: x_min: scalar, default=min(x) minimum x value of the line x_max: scalar, default=max(x) ...
[ "def", "get_bestfit_line", "(", "self", ",", "x_min", "=", "None", ",", "x_max", "=", "None", ",", "resolution", "=", "None", ")", ":", "x", "=", "self", ".", "args", "[", "\"x\"", "]", "if", "x_min", "is", "None", ":", "x_min", "=", "min", "(", ...
Method to get bestfit line using the defined self.bestfit_func method args: x_min: scalar, default=min(x) minimum x value of the line x_max: scalar, default=max(x) maximum x value of the line resolution: int, default=1000 ...
[ "Method", "to", "get", "bestfit", "line", "using", "the", "defined", "self", ".", "bestfit_func", "method" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/bestfit/bestfit.py#L83-L106
249,819
calvinku96/labreporthelper
labreporthelper/bestfit/bestfit.py
BestFit.get_rmse
def get_rmse(self, data_x=None, data_y=None): """ Get Root Mean Square Error using self.bestfit_func args: x_min: scalar, default=min(x) minimum x value of the line x_max: scalar, default=max(x) maximum x value of the line ...
python
def get_rmse(self, data_x=None, data_y=None): """ Get Root Mean Square Error using self.bestfit_func args: x_min: scalar, default=min(x) minimum x value of the line x_max: scalar, default=max(x) maximum x value of the line ...
[ "def", "get_rmse", "(", "self", ",", "data_x", "=", "None", ",", "data_y", "=", "None", ")", ":", "if", "data_x", "is", "None", ":", "data_x", "=", "np", ".", "array", "(", "self", ".", "args", "[", "\"x\"", "]", ")", "if", "data_y", "is", "None"...
Get Root Mean Square Error using self.bestfit_func args: x_min: scalar, default=min(x) minimum x value of the line x_max: scalar, default=max(x) maximum x value of the line resolution: int, default=1000 how many steps b...
[ "Get", "Root", "Mean", "Square", "Error", "using", "self", ".", "bestfit_func" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/bestfit/bestfit.py#L108-L128
249,820
calvinku96/labreporthelper
labreporthelper/bestfit/bestfit.py
BestFit.get_mae
def get_mae(self, data_x=None, data_y=None): """ Get Mean Absolute Error using self.bestfit_func args: data_x: array_like, default=x x value used to determine rmse, used if only a section of x is to be calculated data_y: array_like...
python
def get_mae(self, data_x=None, data_y=None): """ Get Mean Absolute Error using self.bestfit_func args: data_x: array_like, default=x x value used to determine rmse, used if only a section of x is to be calculated data_y: array_like...
[ "def", "get_mae", "(", "self", ",", "data_x", "=", "None", ",", "data_y", "=", "None", ")", ":", "if", "data_x", "is", "None", ":", "data_x", "=", "np", ".", "array", "(", "self", ".", "args", "[", "\"x\"", "]", ")", "if", "data_y", "is", "None",...
Get Mean Absolute Error using self.bestfit_func args: data_x: array_like, default=x x value used to determine rmse, used if only a section of x is to be calculated data_y: array_like, default=y y value used to determine rmse, used ...
[ "Get", "Mean", "Absolute", "Error", "using", "self", ".", "bestfit_func" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/bestfit/bestfit.py#L130-L150
249,821
leonjza/filesmudge
filesmudge/smudge.py
_backup_bytes
def _backup_bytes(target, offset, length): """ Read bytes from one file and write it to a backup file with the .bytes_backup suffix """ click.echo('Backup {l} byes at position {offset} on file {file} to .bytes_backup'.format( l=length, offset=offset, file=target)) with open(targ...
python
def _backup_bytes(target, offset, length): """ Read bytes from one file and write it to a backup file with the .bytes_backup suffix """ click.echo('Backup {l} byes at position {offset} on file {file} to .bytes_backup'.format( l=length, offset=offset, file=target)) with open(targ...
[ "def", "_backup_bytes", "(", "target", ",", "offset", ",", "length", ")", ":", "click", ".", "echo", "(", "'Backup {l} byes at position {offset} on file {file} to .bytes_backup'", ".", "format", "(", "l", "=", "length", ",", "offset", "=", "offset", ",", "file", ...
Read bytes from one file and write it to a backup file with the .bytes_backup suffix
[ "Read", "bytes", "from", "one", "file", "and", "write", "it", "to", "a", "backup", "file", "with", "the", ".", "bytes_backup", "suffix" ]
ba519aa4df85751458faf68220964d3e2480b9fc
https://github.com/leonjza/filesmudge/blob/ba519aa4df85751458faf68220964d3e2480b9fc/filesmudge/smudge.py#L68-L85
249,822
leonjza/filesmudge
filesmudge/smudge.py
_smudge_bytes
def _smudge_bytes(target, offset, magic_bytes): """ Write magic bytes to a file relative from offset """ click.echo('Writing {c} magic byes at position {offset} on file {file}'.format( c=len(magic_bytes), offset=offset, file=target)) with open(target, 'r+b') as f: f.seek...
python
def _smudge_bytes(target, offset, magic_bytes): """ Write magic bytes to a file relative from offset """ click.echo('Writing {c} magic byes at position {offset} on file {file}'.format( c=len(magic_bytes), offset=offset, file=target)) with open(target, 'r+b') as f: f.seek...
[ "def", "_smudge_bytes", "(", "target", ",", "offset", ",", "magic_bytes", ")", ":", "click", ".", "echo", "(", "'Writing {c} magic byes at position {offset} on file {file}'", ".", "format", "(", "c", "=", "len", "(", "magic_bytes", ")", ",", "offset", "=", "offs...
Write magic bytes to a file relative from offset
[ "Write", "magic", "bytes", "to", "a", "file", "relative", "from", "offset" ]
ba519aa4df85751458faf68220964d3e2480b9fc
https://github.com/leonjza/filesmudge/blob/ba519aa4df85751458faf68220964d3e2480b9fc/filesmudge/smudge.py#L88-L101
249,823
leonjza/filesmudge
filesmudge/smudge.py
smudge
def smudge(newtype, target): """ Smudge magic bytes with a known type """ db = smudge_db.get() magic_bytes = db[newtype]['magic'] magic_offset = db[newtype]['offset'] _backup_bytes(target, magic_offset, len(magic_bytes)) _smudge_bytes(target, magic_offset, magic_bytes)
python
def smudge(newtype, target): """ Smudge magic bytes with a known type """ db = smudge_db.get() magic_bytes = db[newtype]['magic'] magic_offset = db[newtype]['offset'] _backup_bytes(target, magic_offset, len(magic_bytes)) _smudge_bytes(target, magic_offset, magic_bytes)
[ "def", "smudge", "(", "newtype", ",", "target", ")", ":", "db", "=", "smudge_db", ".", "get", "(", ")", "magic_bytes", "=", "db", "[", "newtype", "]", "[", "'magic'", "]", "magic_offset", "=", "db", "[", "newtype", "]", "[", "'offset'", "]", "_backup...
Smudge magic bytes with a known type
[ "Smudge", "magic", "bytes", "with", "a", "known", "type" ]
ba519aa4df85751458faf68220964d3e2480b9fc
https://github.com/leonjza/filesmudge/blob/ba519aa4df85751458faf68220964d3e2480b9fc/filesmudge/smudge.py#L107-L118
249,824
leonjza/filesmudge
filesmudge/smudge.py
smudgeraw
def smudgeraw(target, offset, magicbytes): """ Smudge magic bytes with raw bytes """ magicbytes = magicbytes.replace('\\x', '').decode('hex') _backup_bytes(target, offset, len(magicbytes)) _smudge_bytes(target, offset, magicbytes)
python
def smudgeraw(target, offset, magicbytes): """ Smudge magic bytes with raw bytes """ magicbytes = magicbytes.replace('\\x', '').decode('hex') _backup_bytes(target, offset, len(magicbytes)) _smudge_bytes(target, offset, magicbytes)
[ "def", "smudgeraw", "(", "target", ",", "offset", ",", "magicbytes", ")", ":", "magicbytes", "=", "magicbytes", ".", "replace", "(", "'\\\\x'", ",", "''", ")", ".", "decode", "(", "'hex'", ")", "_backup_bytes", "(", "target", ",", "offset", ",", "len", ...
Smudge magic bytes with raw bytes
[ "Smudge", "magic", "bytes", "with", "raw", "bytes" ]
ba519aa4df85751458faf68220964d3e2480b9fc
https://github.com/leonjza/filesmudge/blob/ba519aa4df85751458faf68220964d3e2480b9fc/filesmudge/smudge.py#L125-L132
249,825
leonjza/filesmudge
filesmudge/smudge.py
restore
def restore(source, offset): """ Restore a smudged file from .bytes_backup """ backup_location = os.path.join( os.path.dirname(os.path.abspath(source)), source + '.bytes_backup') click.echo('Reading backup from: {location}'.format(location=backup_location)) if not os.path.isfile(bac...
python
def restore(source, offset): """ Restore a smudged file from .bytes_backup """ backup_location = os.path.join( os.path.dirname(os.path.abspath(source)), source + '.bytes_backup') click.echo('Reading backup from: {location}'.format(location=backup_location)) if not os.path.isfile(bac...
[ "def", "restore", "(", "source", ",", "offset", ")", ":", "backup_location", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "source", ")", ")", ",", "source", "+", "'.bytes_...
Restore a smudged file from .bytes_backup
[ "Restore", "a", "smudged", "file", "from", ".", "bytes_backup" ]
ba519aa4df85751458faf68220964d3e2480b9fc
https://github.com/leonjza/filesmudge/blob/ba519aa4df85751458faf68220964d3e2480b9fc/filesmudge/smudge.py#L138-L159
249,826
leonjza/filesmudge
filesmudge/smudge.py
available
def available(): """ List available types for 'smudge' """ db = smudge_db.get() click.echo('{:<6} {:<6} {:<50}'.format('Type', 'Offset', 'Magic')) for k, v in db.items(): click.echo('{type:<6} {offset:<6} {magic}'.format( type=k, magic=v['magic'].encode('hex'), offset=v...
python
def available(): """ List available types for 'smudge' """ db = smudge_db.get() click.echo('{:<6} {:<6} {:<50}'.format('Type', 'Offset', 'Magic')) for k, v in db.items(): click.echo('{type:<6} {offset:<6} {magic}'.format( type=k, magic=v['magic'].encode('hex'), offset=v...
[ "def", "available", "(", ")", ":", "db", "=", "smudge_db", ".", "get", "(", ")", "click", ".", "echo", "(", "'{:<6} {:<6} {:<50}'", ".", "format", "(", "'Type'", ",", "'Offset'", ",", "'Magic'", ")", ")", "for", "k", ",", "v", "in", "db", ".", "ite...
List available types for 'smudge'
[ "List", "available", "types", "for", "smudge" ]
ba519aa4df85751458faf68220964d3e2480b9fc
https://github.com/leonjza/filesmudge/blob/ba519aa4df85751458faf68220964d3e2480b9fc/filesmudge/smudge.py#L163-L173
249,827
ktdreyer/txproductpages
txproductpages/connection.py
Connection.upcoming_releases
def upcoming_releases(self, product): """ Get upcoming releases for this product. Specifically we search for releases with a GA date greater-than or equal to today's date. :param product: str, eg. "ceph" :returns: deferred that when fired returns a list of Munch (dict-l...
python
def upcoming_releases(self, product): """ Get upcoming releases for this product. Specifically we search for releases with a GA date greater-than or equal to today's date. :param product: str, eg. "ceph" :returns: deferred that when fired returns a list of Munch (dict-l...
[ "def", "upcoming_releases", "(", "self", ",", "product", ")", ":", "url", "=", "'api/v6/releases/'", "url", "=", "url", "+", "'?product__shortname='", "+", "product", "url", "=", "url", "+", "'&ga_date__gte='", "+", "date", ".", "today", "(", ")", ".", "st...
Get upcoming releases for this product. Specifically we search for releases with a GA date greater-than or equal to today's date. :param product: str, eg. "ceph" :returns: deferred that when fired returns a list of Munch (dict-like) objects representing all releases, ...
[ "Get", "upcoming", "releases", "for", "this", "product", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/connection.py#L26-L43
249,828
ktdreyer/txproductpages
txproductpages/connection.py
Connection.newest_release
def newest_release(self, product): """ Get the shortname of the newest upcoming release for a product. :param product: str, eg. "ceph" :returns: deferred that when fired returns the shortname of the newest release. """ releases = yield self.upcoming_rel...
python
def newest_release(self, product): """ Get the shortname of the newest upcoming release for a product. :param product: str, eg. "ceph" :returns: deferred that when fired returns the shortname of the newest release. """ releases = yield self.upcoming_rel...
[ "def", "newest_release", "(", "self", ",", "product", ")", ":", "releases", "=", "yield", "self", ".", "upcoming_releases", "(", "product", ")", "if", "not", "releases", ":", "raise", "ProductPagesException", "(", "'no upcoming releases'", ")", "defer", ".", "...
Get the shortname of the newest upcoming release for a product. :param product: str, eg. "ceph" :returns: deferred that when fired returns the shortname of the newest release.
[ "Get", "the", "shortname", "of", "the", "newest", "upcoming", "release", "for", "a", "product", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/connection.py#L46-L57
249,829
ktdreyer/txproductpages
txproductpages/connection.py
Connection.product_url
def product_url(self, product): """ Return a human-friendly URL for this product. :param product: str, eg. "ceph" :returns: str, URL """ url = 'product/%s' % product return posixpath.join(self.url, url)
python
def product_url(self, product): """ Return a human-friendly URL for this product. :param product: str, eg. "ceph" :returns: str, URL """ url = 'product/%s' % product return posixpath.join(self.url, url)
[ "def", "product_url", "(", "self", ",", "product", ")", ":", "url", "=", "'product/%s'", "%", "product", "return", "posixpath", ".", "join", "(", "self", ".", "url", ",", "url", ")" ]
Return a human-friendly URL for this product. :param product: str, eg. "ceph" :returns: str, URL
[ "Return", "a", "human", "-", "friendly", "URL", "for", "this", "product", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/connection.py#L59-L67
249,830
ktdreyer/txproductpages
txproductpages/connection.py
Connection.release
def release(self, shortname): """ Get a specific release by its shortname. :param shortname: str, eg. "ceph-3-0" :returns: deferred that when fired returns a Release (Munch, dict-like) object representing this release. :raises: ReleaseNotFoundException if this ...
python
def release(self, shortname): """ Get a specific release by its shortname. :param shortname: str, eg. "ceph-3-0" :returns: deferred that when fired returns a Release (Munch, dict-like) object representing this release. :raises: ReleaseNotFoundException if this ...
[ "def", "release", "(", "self", ",", "shortname", ")", ":", "url", "=", "'api/v6/releases/?shortname=%s'", "%", "shortname", "releases", "=", "yield", "self", ".", "_get", "(", "url", ")", "# Note, even if this shortname does not exist, _get() will not errback", "# for t...
Get a specific release by its shortname. :param shortname: str, eg. "ceph-3-0" :returns: deferred that when fired returns a Release (Munch, dict-like) object representing this release. :raises: ReleaseNotFoundException if this release does not exist.
[ "Get", "a", "specific", "release", "by", "its", "shortname", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/connection.py#L70-L87
249,831
ktdreyer/txproductpages
txproductpages/connection.py
Connection.schedule_url
def schedule_url(self, release): """ Return a human-friendly URL for this release. :param release: str, release shortname eg. "ceph-3-0" :returns: str, URL """ product, _ = release.split('-', 1) url = 'product/%s/release/%s/schedule/tasks' % (product, release) ...
python
def schedule_url(self, release): """ Return a human-friendly URL for this release. :param release: str, release shortname eg. "ceph-3-0" :returns: str, URL """ product, _ = release.split('-', 1) url = 'product/%s/release/%s/schedule/tasks' % (product, release) ...
[ "def", "schedule_url", "(", "self", ",", "release", ")", ":", "product", ",", "_", "=", "release", ".", "split", "(", "'-'", ",", "1", ")", "url", "=", "'product/%s/release/%s/schedule/tasks'", "%", "(", "product", ",", "release", ")", "return", "posixpath...
Return a human-friendly URL for this release. :param release: str, release shortname eg. "ceph-3-0" :returns: str, URL
[ "Return", "a", "human", "-", "friendly", "URL", "for", "this", "release", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/connection.py#L89-L98
249,832
ktdreyer/txproductpages
txproductpages/connection.py
Connection._get
def _get(self, url, headers={}): """ Get a JSON API endpoint and return the parsed data. :param url: str, *relative* URL (relative to pp-admin/ api endpoint) :param headers: dict (optional) :returns: deferred that when fired returns the parsed data from JSON or errback...
python
def _get(self, url, headers={}): """ Get a JSON API endpoint and return the parsed data. :param url: str, *relative* URL (relative to pp-admin/ api endpoint) :param headers: dict (optional) :returns: deferred that when fired returns the parsed data from JSON or errback...
[ "def", "_get", "(", "self", ",", "url", ",", "headers", "=", "{", "}", ")", ":", "# print('getting %s' % url)", "headers", "=", "headers", ".", "copy", "(", ")", "headers", "[", "'Accept'", "]", "=", "'application/json'", "url", "=", "posixpath", ".", "j...
Get a JSON API endpoint and return the parsed data. :param url: str, *relative* URL (relative to pp-admin/ api endpoint) :param headers: dict (optional) :returns: deferred that when fired returns the parsed data from JSON or errbacks with ProductPagesException
[ "Get", "a", "JSON", "API", "endpoint", "and", "return", "the", "parsed", "data", "." ]
96c85c498c0eef1d37cddb031db32e8b885fcbd9
https://github.com/ktdreyer/txproductpages/blob/96c85c498c0eef1d37cddb031db32e8b885fcbd9/txproductpages/connection.py#L101-L126
249,833
jmgilman/Neolib
neolib/pyamf/util/__init__.py
get_datetime
def get_datetime(secs): """ Return a UTC date from a timestamp. @type secs: C{long} @param secs: Seconds since 1970. @return: UTC timestamp. @rtype: C{datetime.datetime} """ if negative_timestamp_broken and secs < 0: return datetime.datetime(1970, 1, 1) + datetime.timedelta(seco...
python
def get_datetime(secs): """ Return a UTC date from a timestamp. @type secs: C{long} @param secs: Seconds since 1970. @return: UTC timestamp. @rtype: C{datetime.datetime} """ if negative_timestamp_broken and secs < 0: return datetime.datetime(1970, 1, 1) + datetime.timedelta(seco...
[ "def", "get_datetime", "(", "secs", ")", ":", "if", "negative_timestamp_broken", "and", "secs", "<", "0", ":", "return", "datetime", ".", "datetime", "(", "1970", ",", "1", ",", "1", ")", "+", "datetime", ".", "timedelta", "(", "seconds", "=", "secs", ...
Return a UTC date from a timestamp. @type secs: C{long} @param secs: Seconds since 1970. @return: UTC timestamp. @rtype: C{datetime.datetime}
[ "Return", "a", "UTC", "date", "from", "a", "timestamp", "." ]
228fafeaed0f3195676137732384a14820ae285c
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/__init__.py#L46-L58
249,834
jmgilman/Neolib
neolib/pyamf/util/__init__.py
is_class_sealed
def is_class_sealed(klass): """ Whether or not the supplied class can accept dynamic properties. @rtype: C{bool} @since: 0.5 """ mro = inspect.getmro(klass) new = False if mro[-1] is object: mro = mro[:-1] new = True for kls in mro: if new and '__dict__' in...
python
def is_class_sealed(klass): """ Whether or not the supplied class can accept dynamic properties. @rtype: C{bool} @since: 0.5 """ mro = inspect.getmro(klass) new = False if mro[-1] is object: mro = mro[:-1] new = True for kls in mro: if new and '__dict__' in...
[ "def", "is_class_sealed", "(", "klass", ")", ":", "mro", "=", "inspect", ".", "getmro", "(", "klass", ")", "new", "=", "False", "if", "mro", "[", "-", "1", "]", "is", "object", ":", "mro", "=", "mro", "[", ":", "-", "1", "]", "new", "=", "True"...
Whether or not the supplied class can accept dynamic properties. @rtype: C{bool} @since: 0.5
[ "Whether", "or", "not", "the", "supplied", "class", "can", "accept", "dynamic", "properties", "." ]
228fafeaed0f3195676137732384a14820ae285c
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/__init__.py#L108-L129
249,835
nathforge/pydentifier
src/pydentifier/__init__.py
lower_underscore
def lower_underscore(string, prefix='', suffix=''): """ Generate an underscore-separated lower-case identifier, given English text, a prefix, and an optional suffix. Useful for function names and variable names. `prefix` can be set to `''`, though be careful - without a prefix, the function wi...
python
def lower_underscore(string, prefix='', suffix=''): """ Generate an underscore-separated lower-case identifier, given English text, a prefix, and an optional suffix. Useful for function names and variable names. `prefix` can be set to `''`, though be careful - without a prefix, the function wi...
[ "def", "lower_underscore", "(", "string", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ")", ":", "return", "require_valid", "(", "append_underscore_if_keyword", "(", "'_'", ".", "join", "(", "word", ".", "lower", "(", ")", "for", "word", "in", "en...
Generate an underscore-separated lower-case identifier, given English text, a prefix, and an optional suffix. Useful for function names and variable names. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when your string starts with a ...
[ "Generate", "an", "underscore", "-", "separated", "lower", "-", "case", "identifier", "given", "English", "text", "a", "prefix", "and", "an", "optional", "suffix", "." ]
b8d27076254c65cfd7893c1401e2a198abd6afb4
https://github.com/nathforge/pydentifier/blob/b8d27076254c65cfd7893c1401e2a198abd6afb4/src/pydentifier/__init__.py#L11-L30
249,836
nathforge/pydentifier
src/pydentifier/__init__.py
upper_underscore
def upper_underscore(string, prefix='', suffix=''): """ Generate an underscore-separated upper-case identifier. Useful for constants. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when...
python
def upper_underscore(string, prefix='', suffix=''): """ Generate an underscore-separated upper-case identifier. Useful for constants. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when...
[ "def", "upper_underscore", "(", "string", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ")", ":", "return", "require_valid", "(", "append_underscore_if_keyword", "(", "'_'", ".", "join", "(", "word", ".", "upper", "(", ")", "for", "word", "in", "en...
Generate an underscore-separated upper-case identifier. Useful for constants. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when your string starts with a number. Example: >>>...
[ "Generate", "an", "underscore", "-", "separated", "upper", "-", "case", "identifier", ".", "Useful", "for", "constants", "." ]
b8d27076254c65cfd7893c1401e2a198abd6afb4
https://github.com/nathforge/pydentifier/blob/b8d27076254c65cfd7893c1401e2a198abd6afb4/src/pydentifier/__init__.py#L32-L51
249,837
nathforge/pydentifier
src/pydentifier/__init__.py
upper_camel
def upper_camel(string, prefix='', suffix=''): """ Generate a camel-case identifier with the first word capitalised. Useful for class names. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifie...
python
def upper_camel(string, prefix='', suffix=''): """ Generate a camel-case identifier with the first word capitalised. Useful for class names. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifie...
[ "def", "upper_camel", "(", "string", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ")", ":", "return", "require_valid", "(", "append_underscore_if_keyword", "(", "''", ".", "join", "(", "upper_case_first_char", "(", "word", ")", "for", "word", "in", ...
Generate a camel-case identifier with the first word capitalised. Useful for class names. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when your string starts with a number. Example:...
[ "Generate", "a", "camel", "-", "case", "identifier", "with", "the", "first", "word", "capitalised", ".", "Useful", "for", "class", "names", "." ]
b8d27076254c65cfd7893c1401e2a198abd6afb4
https://github.com/nathforge/pydentifier/blob/b8d27076254c65cfd7893c1401e2a198abd6afb4/src/pydentifier/__init__.py#L53-L72
249,838
nathforge/pydentifier
src/pydentifier/__init__.py
lower_camel
def lower_camel(string, prefix='', suffix=''): """ Generate a camel-case identifier. Useful for unit test methods. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when your string starts...
python
def lower_camel(string, prefix='', suffix=''): """ Generate a camel-case identifier. Useful for unit test methods. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when your string starts...
[ "def", "lower_camel", "(", "string", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ")", ":", "return", "require_valid", "(", "append_underscore_if_keyword", "(", "''", ".", "join", "(", "word", ".", "lower", "(", ")", "if", "index", "==", "0", "e...
Generate a camel-case identifier. Useful for unit test methods. Takes a string, prefix, and optional suffix. `prefix` can be set to `''`, though be careful - without a prefix, the function will throw `InvalidIdentifier` when your string starts with a number. Example: >>> lower_camel("...
[ "Generate", "a", "camel", "-", "case", "identifier", ".", "Useful", "for", "unit", "test", "methods", "." ]
b8d27076254c65cfd7893c1401e2a198abd6afb4
https://github.com/nathforge/pydentifier/blob/b8d27076254c65cfd7893c1401e2a198abd6afb4/src/pydentifier/__init__.py#L74-L93
249,839
nathforge/pydentifier
src/pydentifier/__init__.py
is_valid
def is_valid(identifier): """ If the identifier is valid for Python, return True, otherwise False. """ return ( isinstance(identifier, six.string_types) and bool(NAME_RE.search(identifier)) and not keyword.iskeyword(identifier) )
python
def is_valid(identifier): """ If the identifier is valid for Python, return True, otherwise False. """ return ( isinstance(identifier, six.string_types) and bool(NAME_RE.search(identifier)) and not keyword.iskeyword(identifier) )
[ "def", "is_valid", "(", "identifier", ")", ":", "return", "(", "isinstance", "(", "identifier", ",", "six", ".", "string_types", ")", "and", "bool", "(", "NAME_RE", ".", "search", "(", "identifier", ")", ")", "and", "not", "keyword", ".", "iskeyword", "(...
If the identifier is valid for Python, return True, otherwise False.
[ "If", "the", "identifier", "is", "valid", "for", "Python", "return", "True", "otherwise", "False", "." ]
b8d27076254c65cfd7893c1401e2a198abd6afb4
https://github.com/nathforge/pydentifier/blob/b8d27076254c65cfd7893c1401e2a198abd6afb4/src/pydentifier/__init__.py#L106-L115
249,840
20c/xbahn
xbahn/connection/__init__.py
receiver
def receiver(url, **kwargs): """ Return receiver instance from connection url string url <str> connection url eg. 'tcp://0.0.0.0:8080' """ res = url_to_resources(url) fnc = res["receiver"] return fnc(res.get("url"), **kwargs)
python
def receiver(url, **kwargs): """ Return receiver instance from connection url string url <str> connection url eg. 'tcp://0.0.0.0:8080' """ res = url_to_resources(url) fnc = res["receiver"] return fnc(res.get("url"), **kwargs)
[ "def", "receiver", "(", "url", ",", "*", "*", "kwargs", ")", ":", "res", "=", "url_to_resources", "(", "url", ")", "fnc", "=", "res", "[", "\"receiver\"", "]", "return", "fnc", "(", "res", ".", "get", "(", "\"url\"", ")", ",", "*", "*", "kwargs", ...
Return receiver instance from connection url string url <str> connection url eg. 'tcp://0.0.0.0:8080'
[ "Return", "receiver", "instance", "from", "connection", "url", "string" ]
afb27b0576841338a366d7cac0200a782bd84be6
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L289-L297
249,841
20c/xbahn
xbahn/connection/__init__.py
sender
def sender(url, **kwargs): """ Return sender instance from connection url string url <str> connection url eg. 'tcp://0.0.0.0:8080' """ res = url_to_resources(url) fnc = res["sender"] return fnc(res.get("url"), **kwargs)
python
def sender(url, **kwargs): """ Return sender instance from connection url string url <str> connection url eg. 'tcp://0.0.0.0:8080' """ res = url_to_resources(url) fnc = res["sender"] return fnc(res.get("url"), **kwargs)
[ "def", "sender", "(", "url", ",", "*", "*", "kwargs", ")", ":", "res", "=", "url_to_resources", "(", "url", ")", "fnc", "=", "res", "[", "\"sender\"", "]", "return", "fnc", "(", "res", ".", "get", "(", "\"url\"", ")", ",", "*", "*", "kwargs", ")"...
Return sender instance from connection url string url <str> connection url eg. 'tcp://0.0.0.0:8080'
[ "Return", "sender", "instance", "from", "connection", "url", "string" ]
afb27b0576841338a366d7cac0200a782bd84be6
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L299-L308
249,842
20c/xbahn
xbahn/connection/__init__.py
listen
def listen(url, prefix=None, **kwargs): """ bind and return a connection instance from url arguments: - url (str): xbahn connection url """ return listener(url, prefix=get_prefix(prefix), **kwargs)
python
def listen(url, prefix=None, **kwargs): """ bind and return a connection instance from url arguments: - url (str): xbahn connection url """ return listener(url, prefix=get_prefix(prefix), **kwargs)
[ "def", "listen", "(", "url", ",", "prefix", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "listener", "(", "url", ",", "prefix", "=", "get_prefix", "(", "prefix", ")", ",", "*", "*", "kwargs", ")" ]
bind and return a connection instance from url arguments: - url (str): xbahn connection url
[ "bind", "and", "return", "a", "connection", "instance", "from", "url" ]
afb27b0576841338a366d7cac0200a782bd84be6
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L320-L327
249,843
20c/xbahn
xbahn/connection/__init__.py
connect
def connect(url, prefix=None, **kwargs): """ connect and return a connection instance from url arguments: - url (str): xbahn connection url """ return connection(url, prefix=get_prefix(prefix), **kwargs)
python
def connect(url, prefix=None, **kwargs): """ connect and return a connection instance from url arguments: - url (str): xbahn connection url """ return connection(url, prefix=get_prefix(prefix), **kwargs)
[ "def", "connect", "(", "url", ",", "prefix", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "connection", "(", "url", ",", "prefix", "=", "get_prefix", "(", "prefix", ")", ",", "*", "*", "kwargs", ")" ]
connect and return a connection instance from url arguments: - url (str): xbahn connection url
[ "connect", "and", "return", "a", "connection", "instance", "from", "url" ]
afb27b0576841338a366d7cac0200a782bd84be6
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L329-L336
249,844
20c/xbahn
xbahn/connection/__init__.py
Connection.make_data
def make_data(self, message): """ make data string from message according to transport_content_type Returns: str: message data """ if not isinstance(message, Message): return message return message.export(self.transport_content_type)
python
def make_data(self, message): """ make data string from message according to transport_content_type Returns: str: message data """ if not isinstance(message, Message): return message return message.export(self.transport_content_type)
[ "def", "make_data", "(", "self", ",", "message", ")", ":", "if", "not", "isinstance", "(", "message", ",", "Message", ")", ":", "return", "message", "return", "message", ".", "export", "(", "self", ".", "transport_content_type", ")" ]
make data string from message according to transport_content_type Returns: str: message data
[ "make", "data", "string", "from", "message", "according", "to", "transport_content_type" ]
afb27b0576841338a366d7cac0200a782bd84be6
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L122-L134
249,845
20c/xbahn
xbahn/connection/__init__.py
Connection.make_message
def make_message(self, data): """ Create a Message instance from data, data will be loaded via munge according to the codec specified in the transport_content_type attribute Returns: Message: message object """ data = self.codec.loads(data) ...
python
def make_message(self, data): """ Create a Message instance from data, data will be loaded via munge according to the codec specified in the transport_content_type attribute Returns: Message: message object """ data = self.codec.loads(data) ...
[ "def", "make_message", "(", "self", ",", "data", ")", ":", "data", "=", "self", ".", "codec", ".", "loads", "(", "data", ")", "msg", "=", "Message", "(", "data", ".", "get", "(", "\"data\"", ")", ",", "*", "data", ".", "get", "(", "\"args\"", ","...
Create a Message instance from data, data will be loaded via munge according to the codec specified in the transport_content_type attribute Returns: Message: message object
[ "Create", "a", "Message", "instance", "from", "data", "data", "will", "be", "loaded", "via", "munge", "according", "to", "the", "codec", "specified", "in", "the", "transport_content_type", "attribute" ]
afb27b0576841338a366d7cac0200a782bd84be6
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L136-L156
249,846
kshlm/gant
gant/utils/gant_docker.py
check_permissions
def check_permissions(): """ Checks if current user can access docker """ if ( not grp.getgrnam('docker').gr_gid in os.getgroups() and not os.geteuid() == 0 ): exitStr = """ User doesn't have permission to use docker. You can do either of the following, ...
python
def check_permissions(): """ Checks if current user can access docker """ if ( not grp.getgrnam('docker').gr_gid in os.getgroups() and not os.geteuid() == 0 ): exitStr = """ User doesn't have permission to use docker. You can do either of the following, ...
[ "def", "check_permissions", "(", ")", ":", "if", "(", "not", "grp", ".", "getgrnam", "(", "'docker'", ")", ".", "gr_gid", "in", "os", ".", "getgroups", "(", ")", "and", "not", "os", ".", "geteuid", "(", ")", "==", "0", ")", ":", "exitStr", "=", "...
Checks if current user can access docker
[ "Checks", "if", "current", "user", "can", "access", "docker" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L14-L28
249,847
kshlm/gant
gant/utils/gant_docker.py
GantDocker.build_base_image_cmd
def build_base_image_cmd(self, force): """ Build the glusterbase image """ check_permissions() basetag = self.conf.basetag basedir = self.conf.basedir verbose = self.conf.verbose if self.image_exists(tag=basetag): if not force: ...
python
def build_base_image_cmd(self, force): """ Build the glusterbase image """ check_permissions() basetag = self.conf.basetag basedir = self.conf.basedir verbose = self.conf.verbose if self.image_exists(tag=basetag): if not force: ...
[ "def", "build_base_image_cmd", "(", "self", ",", "force", ")", ":", "check_permissions", "(", ")", "basetag", "=", "self", ".", "conf", ".", "basetag", "basedir", "=", "self", ".", "conf", ".", "basedir", "verbose", "=", "self", ".", "conf", ".", "verbos...
Build the glusterbase image
[ "Build", "the", "glusterbase", "image" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L50-L76
249,848
kshlm/gant
gant/utils/gant_docker.py
GantDocker.build_main_image_cmd
def build_main_image_cmd(self, srcdir, force): """ Build the main image to be used for launching containers """ check_permissions() basetag = self.conf.basetag basedir = self.conf.basedir maintag = self.conf.maintag if not self.image_exists(tag=basetag):...
python
def build_main_image_cmd(self, srcdir, force): """ Build the main image to be used for launching containers """ check_permissions() basetag = self.conf.basetag basedir = self.conf.basedir maintag = self.conf.maintag if not self.image_exists(tag=basetag):...
[ "def", "build_main_image_cmd", "(", "self", ",", "srcdir", ",", "force", ")", ":", "check_permissions", "(", ")", "basetag", "=", "self", ".", "conf", ".", "basetag", "basedir", "=", "self", ".", "conf", ".", "basedir", "maintag", "=", "self", ".", "conf...
Build the main image to be used for launching containers
[ "Build", "the", "main", "image", "to", "be", "used", "for", "launching", "containers" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L78-L118
249,849
kshlm/gant
gant/utils/gant_docker.py
GantDocker.launch_cmd
def launch_cmd(self, n, force): """ Launch the specified docker containers using the main image """ check_permissions() prefix = self.conf.prefix maintag = self.conf.maintag commandStr = "supervisord -c /etc/supervisor/conf.d/supervisord.conf" for i in ...
python
def launch_cmd(self, n, force): """ Launch the specified docker containers using the main image """ check_permissions() prefix = self.conf.prefix maintag = self.conf.maintag commandStr = "supervisord -c /etc/supervisor/conf.d/supervisord.conf" for i in ...
[ "def", "launch_cmd", "(", "self", ",", "n", ",", "force", ")", ":", "check_permissions", "(", ")", "prefix", "=", "self", ".", "conf", ".", "prefix", "maintag", "=", "self", ".", "conf", ".", "maintag", "commandStr", "=", "\"supervisord -c /etc/supervisor/co...
Launch the specified docker containers using the main image
[ "Launch", "the", "specified", "docker", "containers", "using", "the", "main", "image" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L120-L150
249,850
kshlm/gant
gant/utils/gant_docker.py
GantDocker.stop_cmd
def stop_cmd(self, name, force): """ Stop the specified or all docker containers launched by us """ check_permissions() if name: echo("Would stop container {0}".format(name)) else: echo("Would stop all containers") echo("For now use 'docke...
python
def stop_cmd(self, name, force): """ Stop the specified or all docker containers launched by us """ check_permissions() if name: echo("Would stop container {0}".format(name)) else: echo("Would stop all containers") echo("For now use 'docke...
[ "def", "stop_cmd", "(", "self", ",", "name", ",", "force", ")", ":", "check_permissions", "(", ")", "if", "name", ":", "echo", "(", "\"Would stop container {0}\"", ".", "format", "(", "name", ")", ")", "else", ":", "echo", "(", "\"Would stop all containers\"...
Stop the specified or all docker containers launched by us
[ "Stop", "the", "specified", "or", "all", "docker", "containers", "launched", "by", "us" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L152-L162
249,851
kshlm/gant
gant/utils/gant_docker.py
GantDocker.ssh_cmd
def ssh_cmd(self, name, ssh_command): """ SSH into given container and executre command if given """ if not self.container_exists(name=name): exit("Unknown container {0}".format(name)) if not self.container_running(name=name): exit("Container {0} is not r...
python
def ssh_cmd(self, name, ssh_command): """ SSH into given container and executre command if given """ if not self.container_exists(name=name): exit("Unknown container {0}".format(name)) if not self.container_running(name=name): exit("Container {0} is not r...
[ "def", "ssh_cmd", "(", "self", ",", "name", ",", "ssh_command", ")", ":", "if", "not", "self", ".", "container_exists", "(", "name", "=", "name", ")", ":", "exit", "(", "\"Unknown container {0}\"", ".", "format", "(", "name", ")", ")", "if", "not", "se...
SSH into given container and executre command if given
[ "SSH", "into", "given", "container", "and", "executre", "command", "if", "given" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L170-L187
249,852
kshlm/gant
gant/utils/gant_docker.py
GantDocker.ip_cmd
def ip_cmd(self, name): """ Print ip of given container """ if not self.container_exists(name=name): exit('Unknown container {0}'.format(name)) ip = self.get_container_ip(name) if not ip: exit("Failed to get network address for" "...
python
def ip_cmd(self, name): """ Print ip of given container """ if not self.container_exists(name=name): exit('Unknown container {0}'.format(name)) ip = self.get_container_ip(name) if not ip: exit("Failed to get network address for" "...
[ "def", "ip_cmd", "(", "self", ",", "name", ")", ":", "if", "not", "self", ".", "container_exists", "(", "name", "=", "name", ")", ":", "exit", "(", "'Unknown container {0}'", ".", "format", "(", "name", ")", ")", "ip", "=", "self", ".", "get_container_...
Print ip of given container
[ "Print", "ip", "of", "given", "container" ]
eabaa17ebfd31b1654ee1f27e7026f6d7b370609
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L189-L201
249,853
florianpaquet/mease
mease/backends/base.py
BasePublisher.pack
def pack(self, message_type, client_id, client_storage, args, kwargs): """ Packs a message """ return pickle.dumps( (message_type, client_id, client_storage, args, kwargs), protocol=2)
python
def pack(self, message_type, client_id, client_storage, args, kwargs): """ Packs a message """ return pickle.dumps( (message_type, client_id, client_storage, args, kwargs), protocol=2)
[ "def", "pack", "(", "self", ",", "message_type", ",", "client_id", ",", "client_storage", ",", "args", ",", "kwargs", ")", ":", "return", "pickle", ".", "dumps", "(", "(", "message_type", ",", "client_id", ",", "client_storage", ",", "args", ",", "kwargs",...
Packs a message
[ "Packs", "a", "message" ]
b9fbd08bbe162c8890c2a2124674371170c319ef
https://github.com/florianpaquet/mease/blob/b9fbd08bbe162c8890c2a2124674371170c319ef/mease/backends/base.py#L37-L42
249,854
florianpaquet/mease
mease/backends/base.py
BaseSubscriber.dispatch_message
def dispatch_message(self, message_type, client_id, client_storage, args, kwargs): """ Calls callback functions """ logger.debug("Backend message ({message_type}) : {args} {kwargs}".format( message_type=dict(MESSAGES_TYPES)[message_type], args=args, kwargs=kwargs)) i...
python
def dispatch_message(self, message_type, client_id, client_storage, args, kwargs): """ Calls callback functions """ logger.debug("Backend message ({message_type}) : {args} {kwargs}".format( message_type=dict(MESSAGES_TYPES)[message_type], args=args, kwargs=kwargs)) i...
[ "def", "dispatch_message", "(", "self", ",", "message_type", ",", "client_id", ",", "client_storage", ",", "args", ",", "kwargs", ")", ":", "logger", ".", "debug", "(", "\"Backend message ({message_type}) : {args} {kwargs}\"", ".", "format", "(", "message_type", "="...
Calls callback functions
[ "Calls", "callback", "functions" ]
b9fbd08bbe162c8890c2a2124674371170c319ef
https://github.com/florianpaquet/mease/blob/b9fbd08bbe162c8890c2a2124674371170c319ef/mease/backends/base.py#L71-L110
249,855
Zaeb0s/loop-function
loopfunction/loopfunction.py
Loop._loop
def _loop(self, *args, **kwargs): """Loops the target function :param args: The args specified on initiation :param kwargs: The kwargs specified on initiation """ self.on_start(*self.on_start_args, **self.on_start_kwargs) try: while not self._stop_signal: ...
python
def _loop(self, *args, **kwargs): """Loops the target function :param args: The args specified on initiation :param kwargs: The kwargs specified on initiation """ self.on_start(*self.on_start_args, **self.on_start_kwargs) try: while not self._stop_signal: ...
[ "def", "_loop", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "on_start", "(", "*", "self", ".", "on_start_args", ",", "*", "*", "self", ".", "on_start_kwargs", ")", "try", ":", "while", "not", "self", ".", "_stop_s...
Loops the target function :param args: The args specified on initiation :param kwargs: The kwargs specified on initiation
[ "Loops", "the", "target", "function" ]
5999132aca5cf79b34e4ad5c05f9185712f1b583
https://github.com/Zaeb0s/loop-function/blob/5999132aca5cf79b34e4ad5c05f9185712f1b583/loopfunction/loopfunction.py#L48-L61
249,856
Zaeb0s/loop-function
loopfunction/loopfunction.py
Loop.start
def start(self, subthread=True): """Starts the loop Tries to start the loop. Raises RuntimeError if the loop is currently running. :param subthread: True/False value that specifies whether or not to start the loop within a subthread. If True the threading.Thread object is found in Loop...
python
def start(self, subthread=True): """Starts the loop Tries to start the loop. Raises RuntimeError if the loop is currently running. :param subthread: True/False value that specifies whether or not to start the loop within a subthread. If True the threading.Thread object is found in Loop...
[ "def", "start", "(", "self", ",", "subthread", "=", "True", ")", ":", "if", "self", ".", "is_running", "(", ")", ":", "raise", "RuntimeError", "(", "'Loop is currently running'", ")", "else", ":", "self", ".", "_lock", ".", "clear", "(", ")", "self", "...
Starts the loop Tries to start the loop. Raises RuntimeError if the loop is currently running. :param subthread: True/False value that specifies whether or not to start the loop within a subthread. If True the threading.Thread object is found in Loop._loop_thread.
[ "Starts", "the", "loop" ]
5999132aca5cf79b34e4ad5c05f9185712f1b583
https://github.com/Zaeb0s/loop-function/blob/5999132aca5cf79b34e4ad5c05f9185712f1b583/loopfunction/loopfunction.py#L63-L83
249,857
Zaeb0s/loop-function
loopfunction/loopfunction.py
Loop.stop
def stop(self, silent=False): """Sends a stop signal to the loop thread and waits until it stops A stop signal is sent using Loop.send_stop_signal(silent) (see docs for Loop.send_stop_signal) :param silent: True/False same parameter as in Loop.send_stop_signal(silent) """ self....
python
def stop(self, silent=False): """Sends a stop signal to the loop thread and waits until it stops A stop signal is sent using Loop.send_stop_signal(silent) (see docs for Loop.send_stop_signal) :param silent: True/False same parameter as in Loop.send_stop_signal(silent) """ self....
[ "def", "stop", "(", "self", ",", "silent", "=", "False", ")", ":", "self", ".", "send_stop_signal", "(", "silent", ")", "self", ".", "_lock", ".", "wait", "(", ")" ]
Sends a stop signal to the loop thread and waits until it stops A stop signal is sent using Loop.send_stop_signal(silent) (see docs for Loop.send_stop_signal) :param silent: True/False same parameter as in Loop.send_stop_signal(silent)
[ "Sends", "a", "stop", "signal", "to", "the", "loop", "thread", "and", "waits", "until", "it", "stops" ]
5999132aca5cf79b34e4ad5c05f9185712f1b583
https://github.com/Zaeb0s/loop-function/blob/5999132aca5cf79b34e4ad5c05f9185712f1b583/loopfunction/loopfunction.py#L85-L93
249,858
Zaeb0s/loop-function
loopfunction/loopfunction.py
Loop.send_stop_signal
def send_stop_signal(self, silent=False): """Sends a stop signal to the loop thread :param silent: True/False value that specifies whether or not to raise RuntimeError if the loop is currently not running :return: """ if self.is_running(): self._stop_signal =...
python
def send_stop_signal(self, silent=False): """Sends a stop signal to the loop thread :param silent: True/False value that specifies whether or not to raise RuntimeError if the loop is currently not running :return: """ if self.is_running(): self._stop_signal =...
[ "def", "send_stop_signal", "(", "self", ",", "silent", "=", "False", ")", ":", "if", "self", ".", "is_running", "(", ")", ":", "self", ".", "_stop_signal", "=", "True", "elif", "not", "silent", ":", "raise", "RuntimeError", "(", "'Loop is currently not runni...
Sends a stop signal to the loop thread :param silent: True/False value that specifies whether or not to raise RuntimeError if the loop is currently not running :return:
[ "Sends", "a", "stop", "signal", "to", "the", "loop", "thread" ]
5999132aca5cf79b34e4ad5c05f9185712f1b583
https://github.com/Zaeb0s/loop-function/blob/5999132aca5cf79b34e4ad5c05f9185712f1b583/loopfunction/loopfunction.py#L95-L105
249,859
Zaeb0s/loop-function
loopfunction/loopfunction.py
Loop.restart
def restart(self, subthread=None): """Restarts the loop function Tries to restart the loop thread using the current thread. Raises RuntimeError if a previous call to Loop.start was not made. :param subthread: True/False value used when calling Loop.start(subthread=subthread). If set to...
python
def restart(self, subthread=None): """Restarts the loop function Tries to restart the loop thread using the current thread. Raises RuntimeError if a previous call to Loop.start was not made. :param subthread: True/False value used when calling Loop.start(subthread=subthread). If set to...
[ "def", "restart", "(", "self", ",", "subthread", "=", "None", ")", ":", "if", "self", ".", "_in_subthread", "is", "None", ":", "raise", "RuntimeError", "(", "'A call to start must first be placed before restart'", ")", "self", ".", "stop", "(", "silent", "=", ...
Restarts the loop function Tries to restart the loop thread using the current thread. Raises RuntimeError if a previous call to Loop.start was not made. :param subthread: True/False value used when calling Loop.start(subthread=subthread). If set to None it uses the same value as the la...
[ "Restarts", "the", "loop", "function" ]
5999132aca5cf79b34e4ad5c05f9185712f1b583
https://github.com/Zaeb0s/loop-function/blob/5999132aca5cf79b34e4ad5c05f9185712f1b583/loopfunction/loopfunction.py#L107-L122
249,860
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
make_property
def make_property(prop_defs, prop_name, cls_names=[], hierarchy=[]): """ Generates a property class from the defintion dictionary args: prop_defs: the dictionary defining the property prop_name: the base name of the property cls_name: the name of the rdf_class with which the property is...
python
def make_property(prop_defs, prop_name, cls_names=[], hierarchy=[]): """ Generates a property class from the defintion dictionary args: prop_defs: the dictionary defining the property prop_name: the base name of the property cls_name: the name of the rdf_class with which the property is...
[ "def", "make_property", "(", "prop_defs", ",", "prop_name", ",", "cls_names", "=", "[", "]", ",", "hierarchy", "=", "[", "]", ")", ":", "register", "=", "False", "try", ":", "cls_names", ".", "remove", "(", "'RdfClassBase'", ")", "except", "ValueError", ...
Generates a property class from the defintion dictionary args: prop_defs: the dictionary defining the property prop_name: the base name of the property cls_name: the name of the rdf_class with which the property is associated
[ "Generates", "a", "property", "class", "from", "the", "defintion", "dictionary" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L313-L358
249,861
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
link_property
def link_property(prop, cls_object): """ Generates a property class linked to the rdfclass args: prop: unlinked property class cls_name: the name of the rdf_class with which the property is associated cls_object: the rdf_class """ register = False cls_name ...
python
def link_property(prop, cls_object): """ Generates a property class linked to the rdfclass args: prop: unlinked property class cls_name: the name of the rdf_class with which the property is associated cls_object: the rdf_class """ register = False cls_name ...
[ "def", "link_property", "(", "prop", ",", "cls_object", ")", ":", "register", "=", "False", "cls_name", "=", "cls_object", ".", "__name__", "if", "cls_name", "and", "cls_name", "!=", "'RdfBaseClass'", ":", "new_name", "=", "\"%s_%s\"", "%", "(", "prop", ".",...
Generates a property class linked to the rdfclass args: prop: unlinked property class cls_name: the name of the rdf_class with which the property is associated cls_object: the rdf_class
[ "Generates", "a", "property", "class", "linked", "to", "the", "rdfclass" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L361-L383
249,862
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
get_properties
def get_properties(cls_def): """ cycles through the class definiton and returns all properties """ # pdb.set_trace() prop_list = {prop: value for prop, value in cls_def.items() \ if 'rdf_Property' in value.get('rdf_type', "") or \ value.get('rdfs_domain')} return prop_...
python
def get_properties(cls_def): """ cycles through the class definiton and returns all properties """ # pdb.set_trace() prop_list = {prop: value for prop, value in cls_def.items() \ if 'rdf_Property' in value.get('rdf_type', "") or \ value.get('rdfs_domain')} return prop_...
[ "def", "get_properties", "(", "cls_def", ")", ":", "# pdb.set_trace()", "prop_list", "=", "{", "prop", ":", "value", "for", "prop", ",", "value", "in", "cls_def", ".", "items", "(", ")", "if", "'rdf_Property'", "in", "value", ".", "get", "(", "'rdf_type'",...
cycles through the class definiton and returns all properties
[ "cycles", "through", "the", "class", "definiton", "and", "returns", "all", "properties" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L385-L392
249,863
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
filter_prop_defs
def filter_prop_defs(prop_defs, hierarchy, cls_names): """ Reads through the prop_defs and returns a dictionary filtered by the current class args: prop_defs: the defintions from the rdf vocabulary defintion cls_object: the class object to tie the property cls_names: the name of...
python
def filter_prop_defs(prop_defs, hierarchy, cls_names): """ Reads through the prop_defs and returns a dictionary filtered by the current class args: prop_defs: the defintions from the rdf vocabulary defintion cls_object: the class object to tie the property cls_names: the name of...
[ "def", "filter_prop_defs", "(", "prop_defs", ",", "hierarchy", ",", "cls_names", ")", ":", "def", "_is_valid", "(", "test_list", ",", "valid_list", ")", ":", "\"\"\" reads the list of classes in appliesToClass and returns whether\n the test_list matches\n\n args...
Reads through the prop_defs and returns a dictionary filtered by the current class args: prop_defs: the defintions from the rdf vocabulary defintion cls_object: the class object to tie the property cls_names: the name of the classes
[ "Reads", "through", "the", "prop_defs", "and", "returns", "a", "dictionary", "filtered", "by", "the", "current", "class" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L423-L463
249,864
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
get_processors
def get_processors(processor_cat, prop_defs, data_attr=None): """ reads the prop defs and adds applicable processors for the property Args: processor_cat(str): The category of processors to retreive prop_defs: property defintions as defined by the rdf defintions data_attr: the attr to m...
python
def get_processors(processor_cat, prop_defs, data_attr=None): """ reads the prop defs and adds applicable processors for the property Args: processor_cat(str): The category of processors to retreive prop_defs: property defintions as defined by the rdf defintions data_attr: the attr to m...
[ "def", "get_processors", "(", "processor_cat", ",", "prop_defs", ",", "data_attr", "=", "None", ")", ":", "processor_defs", "=", "prop_defs", ".", "get", "(", "processor_cat", ",", "[", "]", ")", "processor_list", "=", "[", "]", "for", "processor", "in", "...
reads the prop defs and adds applicable processors for the property Args: processor_cat(str): The category of processors to retreive prop_defs: property defintions as defined by the rdf defintions data_attr: the attr to manipulate during processing. Returns: list: a list of pro...
[ "reads", "the", "prop", "defs", "and", "adds", "applicable", "processors", "for", "the", "property" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L601-L618
249,865
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
merge_rdf_list
def merge_rdf_list(rdf_list): """ takes an rdf list and merges it into a python list args: rdf_list: the RdfDataset object with the list values returns: list of values """ # pdb.set_trace() if isinstance(rdf_list, list): rdf_list = rdf_list[0] rtn_list = [] # fo...
python
def merge_rdf_list(rdf_list): """ takes an rdf list and merges it into a python list args: rdf_list: the RdfDataset object with the list values returns: list of values """ # pdb.set_trace() if isinstance(rdf_list, list): rdf_list = rdf_list[0] rtn_list = [] # fo...
[ "def", "merge_rdf_list", "(", "rdf_list", ")", ":", "# pdb.set_trace()", "if", "isinstance", "(", "rdf_list", ",", "list", ")", ":", "rdf_list", "=", "rdf_list", "[", "0", "]", "rtn_list", "=", "[", "]", "# for item in rdf_list:", "item", "=", "rdf_list", "i...
takes an rdf list and merges it into a python list args: rdf_list: the RdfDataset object with the list values returns: list of values
[ "takes", "an", "rdf", "list", "and", "merges", "it", "into", "a", "python", "list" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L621-L641
249,866
KnowledgeLinks/rdfframework
rdfframework/rdfclass/rdfproperty.py
RdfPropertyBase.es_json
def es_json(self, **kwargs): """ Returns a JSON object of the property for insertion into es """ rtn_list = [] rng_defs = get_prop_range_defs(self.class_names, self.kds_rangeDef) # if self.__class__._prop_name == 'bf_partOf': # pdb.set_trace() rng_def = get_pr...
python
def es_json(self, **kwargs): """ Returns a JSON object of the property for insertion into es """ rtn_list = [] rng_defs = get_prop_range_defs(self.class_names, self.kds_rangeDef) # if self.__class__._prop_name == 'bf_partOf': # pdb.set_trace() rng_def = get_pr...
[ "def", "es_json", "(", "self", ",", "*", "*", "kwargs", ")", ":", "rtn_list", "=", "[", "]", "rng_defs", "=", "get_prop_range_defs", "(", "self", ".", "class_names", ",", "self", ".", "kds_rangeDef", ")", "# if self.__class__._prop_name == 'bf_partOf':", "# ...
Returns a JSON object of the property for insertion into es
[ "Returns", "a", "JSON", "object", "of", "the", "property", "for", "insertion", "into", "es" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rdfclass/rdfproperty.py#L242-L310
249,867
laysakura/relshell
relshell/batch_command.py
BatchCommand._parse_in_batches
def _parse_in_batches(cmd_array): """Find patterns that match to `in_batches_pat` and replace them into `STDIN` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], ( batch_to_file, batch_to_file, ... ) ) :returns: Modified `cmd_array` and tuple to show how e...
python
def _parse_in_batches(cmd_array): """Find patterns that match to `in_batches_pat` and replace them into `STDIN` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], ( batch_to_file, batch_to_file, ... ) ) :returns: Modified `cmd_array` and tuple to show how e...
[ "def", "_parse_in_batches", "(", "cmd_array", ")", ":", "res_cmd_array", "=", "cmd_array", "[", ":", "]", "res_batch_to_file_s", "=", "[", "]", "in_batches_cmdidx", "=", "BatchCommand", ".", "_in_batches_cmdidx", "(", "cmd_array", ")", "for", "batch_id", ",", "c...
Find patterns that match to `in_batches_pat` and replace them into `STDIN` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], ( batch_to_file, batch_to_file, ... ) ) :returns: Modified `cmd_array` and tuple to show how each IN_BATCH is instantiated (TMPFILE or STDI...
[ "Find", "patterns", "that", "match", "to", "in_batches_pat", "and", "replace", "them", "into", "STDIN", "or", "TMPFILE", "." ]
9ca5c03a34c11cb763a4a75595f18bf4383aa8cc
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch_command.py#L60-L83
249,868
laysakura/relshell
relshell/batch_command.py
BatchCommand._parse_out_batch
def _parse_out_batch(cmd_array): """Find patterns that match to `out_batch_pat` and replace them into `STDOUT` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], batch_from_file) :returns: Modified `cmd_array` and tuple to show how OUT_BATCH is instantiated...
python
def _parse_out_batch(cmd_array): """Find patterns that match to `out_batch_pat` and replace them into `STDOUT` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], batch_from_file) :returns: Modified `cmd_array` and tuple to show how OUT_BATCH is instantiated...
[ "def", "_parse_out_batch", "(", "cmd_array", ")", ":", "res_cmd_array", "=", "cmd_array", "[", ":", "]", "res_batch_from_file", "=", "None", "out_batch_cmdidx", "=", "BatchCommand", ".", "_out_batch_cmdidx", "(", "cmd_array", ")", "if", "out_batch_cmdidx", "is", "...
Find patterns that match to `out_batch_pat` and replace them into `STDOUT` or `TMPFILE`. :param cmd_array: `shlex.split`-ed command :rtype: ([cmd_array], batch_from_file) :returns: Modified `cmd_array` and tuple to show how OUT_BATCH is instantiated (TMPFILE or STDOUT). Returned `...
[ "Find", "patterns", "that", "match", "to", "out_batch_pat", "and", "replace", "them", "into", "STDOUT", "or", "TMPFILE", "." ]
9ca5c03a34c11cb763a4a75595f18bf4383aa8cc
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch_command.py#L86-L110
249,869
laysakura/relshell
relshell/batch_command.py
BatchCommand._in_batches_cmdidx
def _in_batches_cmdidx(cmd_array): """Raise `IndexError` if IN_BATCH0 - IN_BATCHx is not used sequentially in `cmd_array` :returns: (IN_BATCH0's cmdidx, IN_BATCH1's cmdidx, ...) $ cat a.txt IN_BATCH1 IN_BATCH0 b.txt c.txt IN_BATCH2 => (3, 2, 5) """ in_batches_cmdidx_dict = {...
python
def _in_batches_cmdidx(cmd_array): """Raise `IndexError` if IN_BATCH0 - IN_BATCHx is not used sequentially in `cmd_array` :returns: (IN_BATCH0's cmdidx, IN_BATCH1's cmdidx, ...) $ cat a.txt IN_BATCH1 IN_BATCH0 b.txt c.txt IN_BATCH2 => (3, 2, 5) """ in_batches_cmdidx_dict = {...
[ "def", "_in_batches_cmdidx", "(", "cmd_array", ")", ":", "in_batches_cmdidx_dict", "=", "{", "}", "for", "cmdidx", ",", "tok", "in", "enumerate", "(", "cmd_array", ")", ":", "mat", "=", "BatchCommand", ".", "in_batches_pat", ".", "match", "(", "tok", ")", ...
Raise `IndexError` if IN_BATCH0 - IN_BATCHx is not used sequentially in `cmd_array` :returns: (IN_BATCH0's cmdidx, IN_BATCH1's cmdidx, ...) $ cat a.txt IN_BATCH1 IN_BATCH0 b.txt c.txt IN_BATCH2 => (3, 2, 5)
[ "Raise", "IndexError", "if", "IN_BATCH0", "-", "IN_BATCHx", "is", "not", "used", "sequentially", "in", "cmd_array" ]
9ca5c03a34c11cb763a4a75595f18bf4383aa8cc
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch_command.py#L113-L139
249,870
laysakura/relshell
relshell/batch_command.py
BatchCommand._out_batch_cmdidx
def _out_batch_cmdidx(cmd_array): """Raise `IndexError` if OUT_BATCH is used multiple time :returns: OUT_BATCH cmdidx (None if OUT_BATCH is not in `cmd_array`) $ cat a.txt > OUT_BATCH => 3 """ out_batch_cmdidx = None for cmdidx, tok in enumerate(cmd_array): ...
python
def _out_batch_cmdidx(cmd_array): """Raise `IndexError` if OUT_BATCH is used multiple time :returns: OUT_BATCH cmdidx (None if OUT_BATCH is not in `cmd_array`) $ cat a.txt > OUT_BATCH => 3 """ out_batch_cmdidx = None for cmdidx, tok in enumerate(cmd_array): ...
[ "def", "_out_batch_cmdidx", "(", "cmd_array", ")", ":", "out_batch_cmdidx", "=", "None", "for", "cmdidx", ",", "tok", "in", "enumerate", "(", "cmd_array", ")", ":", "mat", "=", "BatchCommand", ".", "out_batch_pat", ".", "match", "(", "tok", ")", "if", "mat...
Raise `IndexError` if OUT_BATCH is used multiple time :returns: OUT_BATCH cmdidx (None if OUT_BATCH is not in `cmd_array`) $ cat a.txt > OUT_BATCH => 3
[ "Raise", "IndexError", "if", "OUT_BATCH", "is", "used", "multiple", "time" ]
9ca5c03a34c11cb763a4a75595f18bf4383aa8cc
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch_command.py#L142-L157
249,871
mouse-reeve/nomina-flora
nominaflora/NominaFlora.py
NominaFlora.get_builder
def get_builder(self, corpus): ''' creates a builder object for a wordlist ''' builder = WordBuilder(chunk_size=self.chunk_size) builder.ingest(corpus) return builder
python
def get_builder(self, corpus): ''' creates a builder object for a wordlist ''' builder = WordBuilder(chunk_size=self.chunk_size) builder.ingest(corpus) return builder
[ "def", "get_builder", "(", "self", ",", "corpus", ")", ":", "builder", "=", "WordBuilder", "(", "chunk_size", "=", "self", ".", "chunk_size", ")", "builder", ".", "ingest", "(", "corpus", ")", "return", "builder" ]
creates a builder object for a wordlist
[ "creates", "a", "builder", "object", "for", "a", "wordlist" ]
d99723b95d169dc38021a38c1f9d1f9f2b04c46b
https://github.com/mouse-reeve/nomina-flora/blob/d99723b95d169dc38021a38c1f9d1f9f2b04c46b/nominaflora/NominaFlora.py#L19-L23
249,872
mouse-reeve/nomina-flora
nominaflora/NominaFlora.py
NominaFlora.get_common
def get_common(self, filename): ''' Process lists of common name words ''' word_list = [] words = open(filename) for word in words.readlines(): word_list.append(word.strip()) return word_list
python
def get_common(self, filename): ''' Process lists of common name words ''' word_list = [] words = open(filename) for word in words.readlines(): word_list.append(word.strip()) return word_list
[ "def", "get_common", "(", "self", ",", "filename", ")", ":", "word_list", "=", "[", "]", "words", "=", "open", "(", "filename", ")", "for", "word", "in", "words", ".", "readlines", "(", ")", ":", "word_list", ".", "append", "(", "word", ".", "strip",...
Process lists of common name words
[ "Process", "lists", "of", "common", "name", "words" ]
d99723b95d169dc38021a38c1f9d1f9f2b04c46b
https://github.com/mouse-reeve/nomina-flora/blob/d99723b95d169dc38021a38c1f9d1f9f2b04c46b/nominaflora/NominaFlora.py#L26-L32
249,873
mouse-reeve/nomina-flora
nominaflora/NominaFlora.py
NominaFlora.get_scientific_name
def get_scientific_name(self): ''' Get a new flower name ''' genus = self.genus_builder.get_word() species = self.species_builder.get_word() return '%s %s' % (genus, species)
python
def get_scientific_name(self): ''' Get a new flower name ''' genus = self.genus_builder.get_word() species = self.species_builder.get_word() return '%s %s' % (genus, species)
[ "def", "get_scientific_name", "(", "self", ")", ":", "genus", "=", "self", ".", "genus_builder", ".", "get_word", "(", ")", "species", "=", "self", ".", "species_builder", ".", "get_word", "(", ")", "return", "'%s %s'", "%", "(", "genus", ",", "species", ...
Get a new flower name
[ "Get", "a", "new", "flower", "name" ]
d99723b95d169dc38021a38c1f9d1f9f2b04c46b
https://github.com/mouse-reeve/nomina-flora/blob/d99723b95d169dc38021a38c1f9d1f9f2b04c46b/nominaflora/NominaFlora.py#L35-L39
249,874
mouse-reeve/nomina-flora
nominaflora/NominaFlora.py
NominaFlora.get_common_name
def get_common_name(self): ''' Get a flower's common name ''' name = random.choice(self.common_first) if random.randint(0, 1) == 1: name += ' ' + random.choice(self.common_first).lower() name += ' ' + random.choice(self.common_second).lower() return name
python
def get_common_name(self): ''' Get a flower's common name ''' name = random.choice(self.common_first) if random.randint(0, 1) == 1: name += ' ' + random.choice(self.common_first).lower() name += ' ' + random.choice(self.common_second).lower() return name
[ "def", "get_common_name", "(", "self", ")", ":", "name", "=", "random", ".", "choice", "(", "self", ".", "common_first", ")", "if", "random", ".", "randint", "(", "0", ",", "1", ")", "==", "1", ":", "name", "+=", "' '", "+", "random", ".", "choice"...
Get a flower's common name
[ "Get", "a", "flower", "s", "common", "name" ]
d99723b95d169dc38021a38c1f9d1f9f2b04c46b
https://github.com/mouse-reeve/nomina-flora/blob/d99723b95d169dc38021a38c1f9d1f9f2b04c46b/nominaflora/NominaFlora.py#L42-L48
249,875
sys-git/certifiable
certifiable/complex.py
certify_dict_schema
def certify_dict_schema( value, schema=None, key_certifier=None, value_certifier=None, required=None, allow_extra=None, ): """ Certify the dictionary schema. :param dict|Mapping|MutableMapping value: The mapping value to certify against the schema. :param object schema: The schema t...
python
def certify_dict_schema( value, schema=None, key_certifier=None, value_certifier=None, required=None, allow_extra=None, ): """ Certify the dictionary schema. :param dict|Mapping|MutableMapping value: The mapping value to certify against the schema. :param object schema: The schema t...
[ "def", "certify_dict_schema", "(", "value", ",", "schema", "=", "None", ",", "key_certifier", "=", "None", ",", "value_certifier", "=", "None", ",", "required", "=", "None", ",", "allow_extra", "=", "None", ",", ")", ":", "if", "key_certifier", "is", "not"...
Certify the dictionary schema. :param dict|Mapping|MutableMapping value: The mapping value to certify against the schema. :param object schema: The schema to validate with. :param callable key_certifier: A certifier to use on the dictionary's keys. :param callable value_certifie...
[ "Certify", "the", "dictionary", "schema", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L26-L80
249,876
sys-git/certifiable
certifiable/complex.py
certify_dict
def certify_dict( value, schema=None, allow_extra=False, required=True, key_certifier=None, value_certifier=None, include_collections=False, ): """ Certifies a dictionary, checking it against an optional schema. The schema should be a dictionary, with keys corresponding to the expected keys in `val...
python
def certify_dict( value, schema=None, allow_extra=False, required=True, key_certifier=None, value_certifier=None, include_collections=False, ): """ Certifies a dictionary, checking it against an optional schema. The schema should be a dictionary, with keys corresponding to the expected keys in `val...
[ "def", "certify_dict", "(", "value", ",", "schema", "=", "None", ",", "allow_extra", "=", "False", ",", "required", "=", "True", ",", "key_certifier", "=", "None", ",", "value_certifier", "=", "None", ",", "include_collections", "=", "False", ",", ")", ":"...
Certifies a dictionary, checking it against an optional schema. The schema should be a dictionary, with keys corresponding to the expected keys in `value`, but with the values replaced by functions which will be called to with the corresponding value in the input. A simple example: >>> certif...
[ "Certifies", "a", "dictionary", "checking", "it", "against", "an", "optional", "schema", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L84-L160
249,877
sys-git/certifiable
certifiable/complex.py
certify_iterable_schema
def certify_iterable_schema(value, schema=None, required=True): """ Certify an iterable against a schema. :param iterable value: The iterable to certify against the schema. :param iterable schema: The schema to use :param bool required: Whether the value can't be `None`. Def...
python
def certify_iterable_schema(value, schema=None, required=True): """ Certify an iterable against a schema. :param iterable value: The iterable to certify against the schema. :param iterable schema: The schema to use :param bool required: Whether the value can't be `None`. Def...
[ "def", "certify_iterable_schema", "(", "value", ",", "schema", "=", "None", ",", "required", "=", "True", ")", ":", "if", "schema", "is", "not", "None", ":", "if", "len", "(", "schema", ")", "!=", "len", "(", "value", ")", ":", "raise", "CertifierValue...
Certify an iterable against a schema. :param iterable value: The iterable to certify against the schema. :param iterable schema: The schema to use :param bool required: Whether the value can't be `None`. Defaults to True. :return: The validated iterable. :rtype: ...
[ "Certify", "an", "iterable", "against", "a", "schema", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L164-L200
249,878
sys-git/certifiable
certifiable/complex.py
certify_iterable
def certify_iterable( value, types, certifier=None, min_len=None, max_len=None, schema=None, required=True ): """ Validates an iterable sequence, checking it against an optional schema. The schema should be a list of expected values replaced by functions which will be called to with the corresp...
python
def certify_iterable( value, types, certifier=None, min_len=None, max_len=None, schema=None, required=True ): """ Validates an iterable sequence, checking it against an optional schema. The schema should be a list of expected values replaced by functions which will be called to with the corresp...
[ "def", "certify_iterable", "(", "value", ",", "types", ",", "certifier", "=", "None", ",", "min_len", "=", "None", ",", "max_len", "=", "None", ",", "schema", "=", "None", ",", "required", "=", "True", ")", ":", "certify_required", "(", "value", "=", "...
Validates an iterable sequence, checking it against an optional schema. The schema should be a list of expected values replaced by functions which will be called to with the corresponding value in the input. :param iterable value: The value to be certified. :param tuple(object) types: ...
[ "Validates", "an", "iterable", "sequence", "checking", "it", "against", "an", "optional", "schema", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L203-L281
249,879
sys-git/certifiable
certifiable/complex.py
certify_set
def certify_set( value, certifier=None, min_len=None, max_len=None, include_collections=False, required=True, ): """ Certifier for a set. :param set value: The set to be certified. :param func certifier: A function to be called on each value in the list to check that it is valid...
python
def certify_set( value, certifier=None, min_len=None, max_len=None, include_collections=False, required=True, ): """ Certifier for a set. :param set value: The set to be certified. :param func certifier: A function to be called on each value in the list to check that it is valid...
[ "def", "certify_set", "(", "value", ",", "certifier", "=", "None", ",", "min_len", "=", "None", ",", "max_len", "=", "None", ",", "include_collections", "=", "False", ",", "required", "=", "True", ",", ")", ":", "certify_bool", "(", "include_collections", ...
Certifier for a set. :param set value: The set to be certified. :param func certifier: A function to be called on each value in the list to check that it is valid. :param int min_len: The minimum acceptable length for the list. If None, the minimum length is not checked. :param ...
[ "Certifier", "for", "a", "set", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L285-L322
249,880
sys-git/certifiable
certifiable/complex.py
certify_tuple
def certify_tuple(value, certifier=None, min_len=None, max_len=None, required=True, schema=None): """ Validates a tuple, checking it against an optional schema. The schema should be a list of expected values replaced by functions which will be called to with the corresponding value in the input. A...
python
def certify_tuple(value, certifier=None, min_len=None, max_len=None, required=True, schema=None): """ Validates a tuple, checking it against an optional schema. The schema should be a list of expected values replaced by functions which will be called to with the corresponding value in the input. A...
[ "def", "certify_tuple", "(", "value", ",", "certifier", "=", "None", ",", "min_len", "=", "None", ",", "max_len", "=", "None", ",", "required", "=", "True", ",", "schema", "=", "None", ")", ":", "certify_iterable", "(", "value", "=", "value", ",", "typ...
Validates a tuple, checking it against an optional schema. The schema should be a list of expected values replaced by functions which will be called to with the corresponding value in the input. A simple example: >>> certifier = certify_tuple(schema=( ... certify_key(kind='Model'), ...
[ "Validates", "a", "tuple", "checking", "it", "against", "an", "optional", "schema", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L326-L372
249,881
sys-git/certifiable
certifiable/complex.py
certify_list
def certify_list( value, certifier=None, min_len=None, max_len=None, required=True, schema=None, include_collections=False, ): """ Certifier for a list. :param list value: The array to be certified. :param func certifier: A function to be called on each value in the iterable to ...
python
def certify_list( value, certifier=None, min_len=None, max_len=None, required=True, schema=None, include_collections=False, ): """ Certifier for a list. :param list value: The array to be certified. :param func certifier: A function to be called on each value in the iterable to ...
[ "def", "certify_list", "(", "value", ",", "certifier", "=", "None", ",", "min_len", "=", "None", ",", "max_len", "=", "None", ",", "required", "=", "True", ",", "schema", "=", "None", ",", "include_collections", "=", "False", ",", ")", ":", "certify_bool...
Certifier for a list. :param list value: The array to be certified. :param func certifier: A function to be called on each value in the iterable to check that it is valid. :param int min_len: The minimum acceptable length for the iterable. If None, the minimum length is not checked...
[ "Certifier", "for", "a", "list", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L376-L417
249,882
sys-git/certifiable
certifiable/complex.py
certify_email
def certify_email(value, required=True): """ Certifier which verifies that email addresses are well-formed. Does not check that the address exists. :param six.string_types value: The email address to certify. **Should be normalized!** :param bool required: Whether the value can be ...
python
def certify_email(value, required=True): """ Certifier which verifies that email addresses are well-formed. Does not check that the address exists. :param six.string_types value: The email address to certify. **Should be normalized!** :param bool required: Whether the value can be ...
[ "def", "certify_email", "(", "value", ",", "required", "=", "True", ")", ":", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", "certify_string", "(", "value", ",", "min_length", "=", "3", ",", "max_length", "=", ...
Certifier which verifies that email addresses are well-formed. Does not check that the address exists. :param six.string_types value: The email address to certify. **Should be normalized!** :param bool required: Whether the value can be `None`. Defaults to True. :return: The ce...
[ "Certifier", "which", "verifies", "that", "email", "addresses", "are", "well", "-", "formed", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L421-L471
249,883
treycucco/bidon
bidon/db/model/validation.py
Validation.is_valid
def is_valid(self, model, validator=None): """Returns true if the model passes the validation, and false if not. Validator must be present_optional if validation is not 'simple'. """ if self.property_name and self.is_property_specific: arg0 = getattr(model, self.property_name) else: arg0...
python
def is_valid(self, model, validator=None): """Returns true if the model passes the validation, and false if not. Validator must be present_optional if validation is not 'simple'. """ if self.property_name and self.is_property_specific: arg0 = getattr(model, self.property_name) else: arg0...
[ "def", "is_valid", "(", "self", ",", "model", ",", "validator", "=", "None", ")", ":", "if", "self", ".", "property_name", "and", "self", ".", "is_property_specific", ":", "arg0", "=", "getattr", "(", "model", ",", "self", ".", "property_name", ")", "els...
Returns true if the model passes the validation, and false if not. Validator must be present_optional if validation is not 'simple'.
[ "Returns", "true", "if", "the", "model", "passes", "the", "validation", "and", "false", "if", "not", ".", "Validator", "must", "be", "present_optional", "if", "validation", "is", "not", "simple", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L41-L55
249,884
treycucco/bidon
bidon/db/model/validation.py
Validation.validate
def validate(self, model, validator=None): """Checks the model against all filters, and if it shoud be validated, runs the validation. if the model is invalid, an error is added to the model. Then the validity value is returned. """ for filter_ in self.filters: if not filter_(model): retur...
python
def validate(self, model, validator=None): """Checks the model against all filters, and if it shoud be validated, runs the validation. if the model is invalid, an error is added to the model. Then the validity value is returned. """ for filter_ in self.filters: if not filter_(model): retur...
[ "def", "validate", "(", "self", ",", "model", ",", "validator", "=", "None", ")", ":", "for", "filter_", "in", "self", ".", "filters", ":", "if", "not", "filter_", "(", "model", ")", ":", "return", "True", "is_valid", ",", "message", "=", "self", "."...
Checks the model against all filters, and if it shoud be validated, runs the validation. if the model is invalid, an error is added to the model. Then the validity value is returned.
[ "Checks", "the", "model", "against", "all", "filters", "and", "if", "it", "shoud", "be", "validated", "runs", "the", "validation", ".", "if", "the", "model", "is", "invalid", "an", "error", "is", "added", "to", "the", "model", ".", "Then", "the", "validi...
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L57-L68
249,885
treycucco/bidon
bidon/db/model/validation.py
Validation._is_present
def _is_present(val): """Returns True if the value is not None, and if it is either not a string, or a string with length > 0. """ if val is None: return False if isinstance(val, str): return len(val) > 0 return True
python
def _is_present(val): """Returns True if the value is not None, and if it is either not a string, or a string with length > 0. """ if val is None: return False if isinstance(val, str): return len(val) > 0 return True
[ "def", "_is_present", "(", "val", ")", ":", "if", "val", "is", "None", ":", "return", "False", "if", "isinstance", "(", "val", ",", "str", ")", ":", "return", "len", "(", "val", ")", ">", "0", "return", "True" ]
Returns True if the value is not None, and if it is either not a string, or a string with length > 0.
[ "Returns", "True", "if", "the", "value", "is", "not", "None", "and", "if", "it", "is", "either", "not", "a", "string", "or", "a", "string", "with", "length", ">", "0", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L71-L79
249,886
treycucco/bidon
bidon/db/model/validation.py
Validation.is_length
def is_length(property_name, *, min_length=1, max_length=None, present_optional=False): """Returns a Validation that checks the length of a string.""" def check(val): """Checks that a value matches a scope-enclosed set of length parameters.""" if not val: return present_optional else: ...
python
def is_length(property_name, *, min_length=1, max_length=None, present_optional=False): """Returns a Validation that checks the length of a string.""" def check(val): """Checks that a value matches a scope-enclosed set of length parameters.""" if not val: return present_optional else: ...
[ "def", "is_length", "(", "property_name", ",", "*", ",", "min_length", "=", "1", ",", "max_length", "=", "None", ",", "present_optional", "=", "False", ")", ":", "def", "check", "(", "val", ")", ":", "\"\"\"Checks that a value matches a scope-enclosed set of lengt...
Returns a Validation that checks the length of a string.
[ "Returns", "a", "Validation", "that", "checks", "the", "length", "of", "a", "string", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L87-L107
249,887
treycucco/bidon
bidon/db/model/validation.py
Validation.matches
def matches(property_name, regex, *, present_optional=False, message=None): """Returns a Validation that checks a property against a regex.""" def check(val): """Checks that a value matches a scope-enclosed regex.""" if not val: return present_optional else: return True if rege...
python
def matches(property_name, regex, *, present_optional=False, message=None): """Returns a Validation that checks a property against a regex.""" def check(val): """Checks that a value matches a scope-enclosed regex.""" if not val: return present_optional else: return True if rege...
[ "def", "matches", "(", "property_name", ",", "regex", ",", "*", ",", "present_optional", "=", "False", ",", "message", "=", "None", ")", ":", "def", "check", "(", "val", ")", ":", "\"\"\"Checks that a value matches a scope-enclosed regex.\"\"\"", "if", "not", "v...
Returns a Validation that checks a property against a regex.
[ "Returns", "a", "Validation", "that", "checks", "a", "property", "against", "a", "regex", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L110-L119
249,888
treycucco/bidon
bidon/db/model/validation.py
Validation.is_numeric
def is_numeric(property_name, *, numtype="float", min=None, max=None, present_optional=False, message=None): """Returns a Validation that checks a property as a number, with optional range constraints.""" if numtype == "int": cast = util.try_parse_int elif numtype == "decimal": ...
python
def is_numeric(property_name, *, numtype="float", min=None, max=None, present_optional=False, message=None): """Returns a Validation that checks a property as a number, with optional range constraints.""" if numtype == "int": cast = util.try_parse_int elif numtype == "decimal": ...
[ "def", "is_numeric", "(", "property_name", ",", "*", ",", "numtype", "=", "\"float\"", ",", "min", "=", "None", ",", "max", "=", "None", ",", "present_optional", "=", "False", ",", "message", "=", "None", ")", ":", "if", "numtype", "==", "\"int\"", ":"...
Returns a Validation that checks a property as a number, with optional range constraints.
[ "Returns", "a", "Validation", "that", "checks", "a", "property", "as", "a", "number", "with", "optional", "range", "constraints", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L122-L163
249,889
treycucco/bidon
bidon/db/model/validation.py
Validation.is_date
def is_date(property_name, *, format=None, present_optional=False, message=None): """Returns a Validation that checks a value as a date.""" # NOTE: Not currently using format param def check(val): """Checks that a value can be parsed as a date.""" if val is None: return present_optional ...
python
def is_date(property_name, *, format=None, present_optional=False, message=None): """Returns a Validation that checks a value as a date.""" # NOTE: Not currently using format param def check(val): """Checks that a value can be parsed as a date.""" if val is None: return present_optional ...
[ "def", "is_date", "(", "property_name", ",", "*", ",", "format", "=", "None", ",", "present_optional", "=", "False", ",", "message", "=", "None", ")", ":", "# NOTE: Not currently using format param", "def", "check", "(", "val", ")", ":", "\"\"\"Checks that a val...
Returns a Validation that checks a value as a date.
[ "Returns", "a", "Validation", "that", "checks", "a", "value", "as", "a", "date", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L166-L177
249,890
treycucco/bidon
bidon/db/model/validation.py
Validation.is_datetime
def is_datetime(property_name, *, format=None, present_optional=False, message=None): """Returns a Validation that checks a value as a datetime.""" # NOTE: Not currently using format param def check(val): """Checks that a value can be parsed as a datetime.""" if val is None: return prese...
python
def is_datetime(property_name, *, format=None, present_optional=False, message=None): """Returns a Validation that checks a value as a datetime.""" # NOTE: Not currently using format param def check(val): """Checks that a value can be parsed as a datetime.""" if val is None: return prese...
[ "def", "is_datetime", "(", "property_name", ",", "*", ",", "format", "=", "None", ",", "present_optional", "=", "False", ",", "message", "=", "None", ")", ":", "# NOTE: Not currently using format param", "def", "check", "(", "val", ")", ":", "\"\"\"Checks that a...
Returns a Validation that checks a value as a datetime.
[ "Returns", "a", "Validation", "that", "checks", "a", "value", "as", "a", "datetime", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L180-L191
249,891
treycucco/bidon
bidon/db/model/validation.py
Validation.is_in
def is_in(property_name, set_values, *, present_optional=False, message=None): """Returns a Validation that checks that a value is contained within a given set.""" def check(val): """Checks that a value is contained within a scope-enclosed set.""" if val is None: return present_optional ...
python
def is_in(property_name, set_values, *, present_optional=False, message=None): """Returns a Validation that checks that a value is contained within a given set.""" def check(val): """Checks that a value is contained within a scope-enclosed set.""" if val is None: return present_optional ...
[ "def", "is_in", "(", "property_name", ",", "set_values", ",", "*", ",", "present_optional", "=", "False", ",", "message", "=", "None", ")", ":", "def", "check", "(", "val", ")", ":", "\"\"\"Checks that a value is contained within a scope-enclosed set.\"\"\"", "if", ...
Returns a Validation that checks that a value is contained within a given set.
[ "Returns", "a", "Validation", "that", "checks", "that", "a", "value", "is", "contained", "within", "a", "given", "set", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L194-L203
249,892
treycucco/bidon
bidon/db/model/validation.py
Validation.is_unique
def is_unique(keys, *, scope=None, comparison_operators=None, present_optional=False, message=None): """Returns a Validation that makes sure the given value is unique for a table and optionally a scope. """ def check(pname, validator): """Checks that a value is unique in its column...
python
def is_unique(keys, *, scope=None, comparison_operators=None, present_optional=False, message=None): """Returns a Validation that makes sure the given value is unique for a table and optionally a scope. """ def check(pname, validator): """Checks that a value is unique in its column...
[ "def", "is_unique", "(", "keys", ",", "*", ",", "scope", "=", "None", ",", "comparison_operators", "=", "None", ",", "present_optional", "=", "False", ",", "message", "=", "None", ")", ":", "def", "check", "(", "pname", ",", "validator", ")", ":", "\"\...
Returns a Validation that makes sure the given value is unique for a table and optionally a scope.
[ "Returns", "a", "Validation", "that", "makes", "sure", "the", "given", "value", "is", "unique", "for", "a", "table", "and", "optionally", "a", "scope", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L206-L259
249,893
treycucco/bidon
bidon/db/model/validation.py
Validator.validate
def validate(self, model, data_access=None, *, fail_fast=None): """Validates a model against the collection of Validations. Returns True if all Validations pass, or False if one or more do not. """ if fail_fast is None: fail_fast = self.fail_fast self.model = model self.data_access = dat...
python
def validate(self, model, data_access=None, *, fail_fast=None): """Validates a model against the collection of Validations. Returns True if all Validations pass, or False if one or more do not. """ if fail_fast is None: fail_fast = self.fail_fast self.model = model self.data_access = dat...
[ "def", "validate", "(", "self", ",", "model", ",", "data_access", "=", "None", ",", "*", ",", "fail_fast", "=", "None", ")", ":", "if", "fail_fast", "is", "None", ":", "fail_fast", "=", "self", ".", "fail_fast", "self", ".", "model", "=", "model", "s...
Validates a model against the collection of Validations. Returns True if all Validations pass, or False if one or more do not.
[ "Validates", "a", "model", "against", "the", "collection", "of", "Validations", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/model/validation.py#L275-L291
249,894
techdragon/python-git-repo-info
src/git_repo_info/git_repo_info.py
GitRepo.configured_options
def configured_options(self): """What are the configured options in the git repo.""" stdout_lines = self._check_output(['config', '--list']).splitlines() return {key: value for key, value in [line.split('=') for line in stdout_lines]}
python
def configured_options(self): """What are the configured options in the git repo.""" stdout_lines = self._check_output(['config', '--list']).splitlines() return {key: value for key, value in [line.split('=') for line in stdout_lines]}
[ "def", "configured_options", "(", "self", ")", ":", "stdout_lines", "=", "self", ".", "_check_output", "(", "[", "'config'", ",", "'--list'", "]", ")", ".", "splitlines", "(", ")", "return", "{", "key", ":", "value", "for", "key", ",", "value", "in", "...
What are the configured options in the git repo.
[ "What", "are", "the", "configured", "options", "in", "the", "git", "repo", "." ]
f840ad83fe349abac96002e55c153f55d77b1cc9
https://github.com/techdragon/python-git-repo-info/blob/f840ad83fe349abac96002e55c153f55d77b1cc9/src/git_repo_info/git_repo_info.py#L67-L70
249,895
KnowledgeLinks/rdfframework
rdfframework/search/esutilities.py
get_es_action_item
def get_es_action_item(data_item, action_settings, es_type, id_field=None): ''' This method will return an item formated and ready to append to the action list ''' action_item = dict.copy(action_settings) if id_field is not None: id_val = first(list(get_dict_key(data_item, id_field))) ...
python
def get_es_action_item(data_item, action_settings, es_type, id_field=None): ''' This method will return an item formated and ready to append to the action list ''' action_item = dict.copy(action_settings) if id_field is not None: id_val = first(list(get_dict_key(data_item, id_field))) ...
[ "def", "get_es_action_item", "(", "data_item", ",", "action_settings", ",", "es_type", ",", "id_field", "=", "None", ")", ":", "action_item", "=", "dict", ".", "copy", "(", "action_settings", ")", "if", "id_field", "is", "not", "None", ":", "id_val", "=", ...
This method will return an item formated and ready to append to the action list
[ "This", "method", "will", "return", "an", "item", "formated", "and", "ready", "to", "append", "to", "the", "action", "list" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/search/esutilities.py#L1-L20
249,896
KnowledgeLinks/rdfframework
rdfframework/search/esutilities.py
es_field_sort
def es_field_sort(fld_name): """ Used with lambda to sort fields """ parts = fld_name.split(".") if "_" not in parts[-1]: parts[-1] = "_" + parts[-1] return ".".join(parts)
python
def es_field_sort(fld_name): """ Used with lambda to sort fields """ parts = fld_name.split(".") if "_" not in parts[-1]: parts[-1] = "_" + parts[-1] return ".".join(parts)
[ "def", "es_field_sort", "(", "fld_name", ")", ":", "parts", "=", "fld_name", ".", "split", "(", "\".\"", ")", "if", "\"_\"", "not", "in", "parts", "[", "-", "1", "]", ":", "parts", "[", "-", "1", "]", "=", "\"_\"", "+", "parts", "[", "-", "1", ...
Used with lambda to sort fields
[ "Used", "with", "lambda", "to", "sort", "fields" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/search/esutilities.py#L111-L116
249,897
kodexlab/reliure
reliure/web.py
app_routes
def app_routes(app): """ list of route of an app """ _routes = [] for rule in app.url_map.iter_rules(): _routes.append({ 'path': rule.rule, 'name': rule.endpoint, 'methods': list(rule.methods) }) return jsonify({'routes': _routes})
python
def app_routes(app): """ list of route of an app """ _routes = [] for rule in app.url_map.iter_rules(): _routes.append({ 'path': rule.rule, 'name': rule.endpoint, 'methods': list(rule.methods) }) return jsonify({'routes': _routes})
[ "def", "app_routes", "(", "app", ")", ":", "_routes", "=", "[", "]", "for", "rule", "in", "app", ".", "url_map", ".", "iter_rules", "(", ")", ":", "_routes", ".", "append", "(", "{", "'path'", ":", "rule", ".", "rule", ",", "'name'", ":", "rule", ...
list of route of an app
[ "list", "of", "route", "of", "an", "app" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/web.py#L28-L38
249,898
kodexlab/reliure
reliure/web.py
EngineView.set_input_type
def set_input_type(self, type_or_parse): """ Set an unique input type. If you use this then you have only one input for the play. """ self._inputs = OrderedDict() default_inputs = self.engine.in_name if len(default_inputs) > 1: raise ValueError("Need more tha...
python
def set_input_type(self, type_or_parse): """ Set an unique input type. If you use this then you have only one input for the play. """ self._inputs = OrderedDict() default_inputs = self.engine.in_name if len(default_inputs) > 1: raise ValueError("Need more tha...
[ "def", "set_input_type", "(", "self", ",", "type_or_parse", ")", ":", "self", ".", "_inputs", "=", "OrderedDict", "(", ")", "default_inputs", "=", "self", ".", "engine", ".", "in_name", "if", "len", "(", "default_inputs", ")", ">", "1", ":", "raise", "Va...
Set an unique input type. If you use this then you have only one input for the play.
[ "Set", "an", "unique", "input", "type", "." ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/web.py#L74-L83
249,899
kodexlab/reliure
reliure/web.py
EngineView.add_input
def add_input(self, in_name, type_or_parse=None): """ Declare a possible input """ if type_or_parse is None: type_or_parse = GenericType() elif not isinstance(type_or_parse, GenericType) and callable(type_or_parse): type_or_parse = GenericType(parse=type_or_parse)...
python
def add_input(self, in_name, type_or_parse=None): """ Declare a possible input """ if type_or_parse is None: type_or_parse = GenericType() elif not isinstance(type_or_parse, GenericType) and callable(type_or_parse): type_or_parse = GenericType(parse=type_or_parse)...
[ "def", "add_input", "(", "self", ",", "in_name", ",", "type_or_parse", "=", "None", ")", ":", "if", "type_or_parse", "is", "None", ":", "type_or_parse", "=", "GenericType", "(", ")", "elif", "not", "isinstance", "(", "type_or_parse", ",", "GenericType", ")",...
Declare a possible input
[ "Declare", "a", "possible", "input" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/web.py#L85-L94