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
41,100
asascience-open/paegan-transport
paegan/transport/shoreline.py
ShorelineWFS.get_feature_type_info
def get_feature_type_info(self): """ Gets FeatureType as a python dict. Transforms feature_name info into python dict. """ caps = self.get_capabilities() if caps is None: return None el = caps.find('{http://www.opengis.net/wfs}FeatureTypeList') ...
python
def get_feature_type_info(self): """ Gets FeatureType as a python dict. Transforms feature_name info into python dict. """ caps = self.get_capabilities() if caps is None: return None el = caps.find('{http://www.opengis.net/wfs}FeatureTypeList') ...
[ "def", "get_feature_type_info", "(", "self", ")", ":", "caps", "=", "self", ".", "get_capabilities", "(", ")", "if", "caps", "is", "None", ":", "return", "None", "el", "=", "caps", ".", "find", "(", "'{http://www.opengis.net/wfs}FeatureTypeList'", ")", "for", ...
Gets FeatureType as a python dict. Transforms feature_name info into python dict.
[ "Gets", "FeatureType", "as", "a", "python", "dict", "." ]
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/shoreline.py#L416-L447
41,101
brap/brap
brap/node_registrations.py
extract_edges_from_callable
def extract_edges_from_callable(fn): """ This takes args and kwargs provided, and returns the names of the strings assigned. If a string is not provided for a value, an exception is raised. This is how we extract the edges provided in the brap call lambdas. """ def extractor(*args, **kwargs): ...
python
def extract_edges_from_callable(fn): """ This takes args and kwargs provided, and returns the names of the strings assigned. If a string is not provided for a value, an exception is raised. This is how we extract the edges provided in the brap call lambdas. """ def extractor(*args, **kwargs): ...
[ "def", "extract_edges_from_callable", "(", "fn", ")", ":", "def", "extractor", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Because I don't think this technique is common in python...\n\n Service constructors were defined as:\n lambda c: c...
This takes args and kwargs provided, and returns the names of the strings assigned. If a string is not provided for a value, an exception is raised. This is how we extract the edges provided in the brap call lambdas.
[ "This", "takes", "args", "and", "kwargs", "provided", "and", "returns", "the", "names", "of", "the", "strings", "assigned", ".", "If", "a", "string", "is", "not", "provided", "for", "a", "value", "an", "exception", "is", "raised", "." ]
227d1b6ce2799b7caf1d98d8805e821d19d0969b
https://github.com/brap/brap/blob/227d1b6ce2799b7caf1d98d8805e821d19d0969b/brap/node_registrations.py#L4-L36
41,102
SeattleTestbed/seash
pyreadline/rlmain.py
BaseReadline.parse_and_bind
def parse_and_bind(self, string): u'''Parse and execute single line of a readline init file.''' try: log(u'parse_and_bind("%s")' % string) if string.startswith(u'#'): return if string.startswith(u'set'): m = re.compile(ur'set\s+([-a-zA-...
python
def parse_and_bind(self, string): u'''Parse and execute single line of a readline init file.''' try: log(u'parse_and_bind("%s")' % string) if string.startswith(u'#'): return if string.startswith(u'set'): m = re.compile(ur'set\s+([-a-zA-...
[ "def", "parse_and_bind", "(", "self", ",", "string", ")", ":", "try", ":", "log", "(", "u'parse_and_bind(\"%s\")'", "%", "string", ")", "if", "string", ".", "startswith", "(", "u'#'", ")", ":", "return", "if", "string", ".", "startswith", "(", "u'set'", ...
u'''Parse and execute single line of a readline init file.
[ "u", "Parse", "and", "execute", "single", "line", "of", "a", "readline", "init", "file", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/rlmain.py#L69-L102
41,103
SeattleTestbed/seash
pyreadline/rlmain.py
Readline._bell
def _bell(self): u'''ring the bell if requested.''' if self.bell_style == u'none': pass elif self.bell_style == u'visible': raise NotImplementedError(u"Bellstyle visible is not implemented yet.") elif self.bell_style == u'audible': self.console.bell() ...
python
def _bell(self): u'''ring the bell if requested.''' if self.bell_style == u'none': pass elif self.bell_style == u'visible': raise NotImplementedError(u"Bellstyle visible is not implemented yet.") elif self.bell_style == u'audible': self.console.bell() ...
[ "def", "_bell", "(", "self", ")", ":", "if", "self", ".", "bell_style", "==", "u'none'", ":", "pass", "elif", "self", ".", "bell_style", "==", "u'visible'", ":", "raise", "NotImplementedError", "(", "u\"Bellstyle visible is not implemented yet.\"", ")", "elif", ...
u'''ring the bell if requested.
[ "u", "ring", "the", "bell", "if", "requested", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/rlmain.py#L432-L441
41,104
hatemile/hatemile-for-python
hatemile/util/commonfunctions.py
CommonFunctions.set_list_attributes
def set_list_attributes(element1, element2, attributes): """ Copy a list of attributes of a element for other element. :param element1: The element that have attributes copied. :type element1: hatemile.util.html.htmldomelement.HTMLDOMElement :param element2: The element that cop...
python
def set_list_attributes(element1, element2, attributes): """ Copy a list of attributes of a element for other element. :param element1: The element that have attributes copied. :type element1: hatemile.util.html.htmldomelement.HTMLDOMElement :param element2: The element that cop...
[ "def", "set_list_attributes", "(", "element1", ",", "element2", ",", "attributes", ")", ":", "for", "attribute", "in", "attributes", ":", "if", "element1", ".", "has_attribute", "(", "attribute", ")", ":", "element2", ".", "set_attribute", "(", "attribute", ",...
Copy a list of attributes of a element for other element. :param element1: The element that have attributes copied. :type element1: hatemile.util.html.htmldomelement.HTMLDOMElement :param element2: The element that copy the attributes. :type element2: hatemile.util.html.htmldomelement.H...
[ "Copy", "a", "list", "of", "attributes", "of", "a", "element", "for", "other", "element", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/util/commonfunctions.py#L29-L46
41,105
hatemile/hatemile-for-python
hatemile/util/commonfunctions.py
CommonFunctions.increase_in_list
def increase_in_list(list_to_increase, string_to_increase): """ Increase a item in a HTML list. :param list_to_increase: The list. :type list_to_increase: str :param string_to_increase: The value of item. :type string_to_increase: str :return: The HTML list with ...
python
def increase_in_list(list_to_increase, string_to_increase): """ Increase a item in a HTML list. :param list_to_increase: The list. :type list_to_increase: str :param string_to_increase: The value of item. :type string_to_increase: str :return: The HTML list with ...
[ "def", "increase_in_list", "(", "list_to_increase", ",", "string_to_increase", ")", ":", "if", "(", "bool", "(", "list_to_increase", ")", ")", "and", "(", "bool", "(", "string_to_increase", ")", ")", ":", "if", "CommonFunctions", ".", "in_list", "(", "list_to_...
Increase a item in a HTML list. :param list_to_increase: The list. :type list_to_increase: str :param string_to_increase: The value of item. :type string_to_increase: str :return: The HTML list with the item added, if the item not was contained in list. ...
[ "Increase", "a", "item", "in", "a", "HTML", "list", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/util/commonfunctions.py#L49-L68
41,106
hatemile/hatemile-for-python
hatemile/util/commonfunctions.py
CommonFunctions.in_list
def in_list(list_to_search, string_to_search): """ Verify if the list contains the item. :param list_to_search: The list. :type list_to_search: str :param string_to_search: The value of item. :type string_to_search: str :return: True if the list contains the item...
python
def in_list(list_to_search, string_to_search): """ Verify if the list contains the item. :param list_to_search: The list. :type list_to_search: str :param string_to_search: The value of item. :type string_to_search: str :return: True if the list contains the item...
[ "def", "in_list", "(", "list_to_search", ",", "string_to_search", ")", ":", "if", "(", "bool", "(", "list_to_search", ")", ")", "and", "(", "bool", "(", "string_to_search", ")", ")", ":", "elements", "=", "re", ".", "split", "(", "'[ \\n\\t\\r]+'", ",", ...
Verify if the list contains the item. :param list_to_search: The list. :type list_to_search: str :param string_to_search: The value of item. :type string_to_search: str :return: True if the list contains the item or False is not contains. :rtype: bool
[ "Verify", "if", "the", "list", "contains", "the", "item", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/util/commonfunctions.py#L71-L88
41,107
hatemile/hatemile-for-python
hatemile/util/commonfunctions.py
CommonFunctions.is_valid_element
def is_valid_element(element): """ Check that the element can be manipulated by HaTeMiLe. :param element: The element :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: True if element can be manipulated or False if element cannot be manipu...
python
def is_valid_element(element): """ Check that the element can be manipulated by HaTeMiLe. :param element: The element :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: True if element can be manipulated or False if element cannot be manipu...
[ "def", "is_valid_element", "(", "element", ")", ":", "if", "element", ".", "has_attribute", "(", "CommonFunctions", ".", "DATA_IGNORE", ")", ":", "return", "False", "else", ":", "parent_element", "=", "element", ".", "get_parent_element", "(", ")", "if", "pare...
Check that the element can be manipulated by HaTeMiLe. :param element: The element :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: True if element can be manipulated or False if element cannot be manipulated. :rtype: bool
[ "Check", "that", "the", "element", "can", "be", "manipulated", "by", "HaTeMiLe", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/util/commonfunctions.py#L91-L111
41,108
seancallaway/laughs
laughs/services/chucknorris.py
get_joke
def get_joke(): """Returns a joke from the WebKnox one liner API. Returns None if unable to retrieve a joke. """ page = requests.get("https://api.chucknorris.io/jokes/random") if page.status_code == 200: joke = json.loads(page.content.decode("UTF-8")) return joke["value"] ...
python
def get_joke(): """Returns a joke from the WebKnox one liner API. Returns None if unable to retrieve a joke. """ page = requests.get("https://api.chucknorris.io/jokes/random") if page.status_code == 200: joke = json.loads(page.content.decode("UTF-8")) return joke["value"] ...
[ "def", "get_joke", "(", ")", ":", "page", "=", "requests", ".", "get", "(", "\"https://api.chucknorris.io/jokes/random\"", ")", "if", "page", ".", "status_code", "==", "200", ":", "joke", "=", "json", ".", "loads", "(", "page", ".", "content", ".", "decode...
Returns a joke from the WebKnox one liner API. Returns None if unable to retrieve a joke.
[ "Returns", "a", "joke", "from", "the", "WebKnox", "one", "liner", "API", ".", "Returns", "None", "if", "unable", "to", "retrieve", "a", "joke", "." ]
e13ca6f16b12401b0384bbf1fea86c081e52143d
https://github.com/seancallaway/laughs/blob/e13ca6f16b12401b0384bbf1fea86c081e52143d/laughs/services/chucknorris.py#L13-L26
41,109
brews/snakebacon
snakebacon/mcmc.py
McmcResults.burnin
def burnin(self, n): """Remove the earliest n ensemble members from the MCMC output""" self.sediment_rate = self.sediment_rate[:, n:] self.headage = self.headage[n:] self.sediment_memory = self.sediment_memory[n:] self.objective = self.objective[n:]
python
def burnin(self, n): """Remove the earliest n ensemble members from the MCMC output""" self.sediment_rate = self.sediment_rate[:, n:] self.headage = self.headage[n:] self.sediment_memory = self.sediment_memory[n:] self.objective = self.objective[n:]
[ "def", "burnin", "(", "self", ",", "n", ")", ":", "self", ".", "sediment_rate", "=", "self", ".", "sediment_rate", "[", ":", ",", "n", ":", "]", "self", ".", "headage", "=", "self", ".", "headage", "[", "n", ":", "]", "self", ".", "sediment_memory"...
Remove the earliest n ensemble members from the MCMC output
[ "Remove", "the", "earliest", "n", "ensemble", "members", "from", "the", "MCMC", "output" ]
f5363d0d1225912adc30031bf2c13b54000de8f2
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/mcmc.py#L54-L59
41,110
silver-castle/mach9
mach9/timer.py
update_current_time
def update_current_time(loop): """Cache the current time, since it is needed at the end of every keep-alive request to update the request timeout time :param loop: :return: """ global current_time current_time = time() loop.call_later(1, partial(update_current_time, loop))
python
def update_current_time(loop): """Cache the current time, since it is needed at the end of every keep-alive request to update the request timeout time :param loop: :return: """ global current_time current_time = time() loop.call_later(1, partial(update_current_time, loop))
[ "def", "update_current_time", "(", "loop", ")", ":", "global", "current_time", "current_time", "=", "time", "(", ")", "loop", ".", "call_later", "(", "1", ",", "partial", "(", "update_current_time", ",", "loop", ")", ")" ]
Cache the current time, since it is needed at the end of every keep-alive request to update the request timeout time :param loop: :return:
[ "Cache", "the", "current", "time", "since", "it", "is", "needed", "at", "the", "end", "of", "every", "keep", "-", "alive", "request", "to", "update", "the", "request", "timeout", "time" ]
7a623aab3c70d89d36ade6901b6307e115400c5e
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/timer.py#L8-L17
41,111
helixyte/everest
everest/ini.py
EverestNosePlugin.options
def options(self, parser, env=None): """ Adds command-line options for this plugin. """ if env is None: env = os.environ env_opt_name = 'NOSE_%s' % self.__dest_opt_name.upper() parser.add_option("--%s" % self.__opt_name, dest=self.__d...
python
def options(self, parser, env=None): """ Adds command-line options for this plugin. """ if env is None: env = os.environ env_opt_name = 'NOSE_%s' % self.__dest_opt_name.upper() parser.add_option("--%s" % self.__opt_name, dest=self.__d...
[ "def", "options", "(", "self", ",", "parser", ",", "env", "=", "None", ")", ":", "if", "env", "is", "None", ":", "env", "=", "os", ".", "environ", "env_opt_name", "=", "'NOSE_%s'", "%", "self", ".", "__dest_opt_name", ".", "upper", "(", ")", "parser"...
Adds command-line options for this plugin.
[ "Adds", "command", "-", "line", "options", "for", "this", "plugin", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/ini.py#L32-L44
41,112
helixyte/everest
everest/ini.py
EverestNosePlugin.configure
def configure(self, options, conf): """ Configures the plugin. """ super(EverestNosePlugin, self).configure(options, conf) opt_val = getattr(options, self.__dest_opt_name, None) if opt_val: self.enabled = True EverestIni.ini_file_path = opt_val
python
def configure(self, options, conf): """ Configures the plugin. """ super(EverestNosePlugin, self).configure(options, conf) opt_val = getattr(options, self.__dest_opt_name, None) if opt_val: self.enabled = True EverestIni.ini_file_path = opt_val
[ "def", "configure", "(", "self", ",", "options", ",", "conf", ")", ":", "super", "(", "EverestNosePlugin", ",", "self", ")", ".", "configure", "(", "options", ",", "conf", ")", "opt_val", "=", "getattr", "(", "options", ",", "self", ".", "__dest_opt_name...
Configures the plugin.
[ "Configures", "the", "plugin", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/ini.py#L46-L54
41,113
RetailMeNotSandbox/acky
acky/ec2.py
InstanceCollection.create
def create(self, ami, count, config=None): """Create an instance using the launcher.""" return self.Launcher(config=config).launch(ami, count)
python
def create(self, ami, count, config=None): """Create an instance using the launcher.""" return self.Launcher(config=config).launch(ami, count)
[ "def", "create", "(", "self", ",", "ami", ",", "count", ",", "config", "=", "None", ")", ":", "return", "self", ".", "Launcher", "(", "config", "=", "config", ")", ".", "launch", "(", "ami", ",", "count", ")" ]
Create an instance using the launcher.
[ "Create", "an", "instance", "using", "the", "launcher", "." ]
fcd4d092c42892ede7c924cafc41e9cf4be3fb9f
https://github.com/RetailMeNotSandbox/acky/blob/fcd4d092c42892ede7c924cafc41e9cf4be3fb9f/acky/ec2.py#L218-L220
41,114
RetailMeNotSandbox/acky
acky/ec2.py
InstanceCollection.Launcher
def Launcher(self, config=None): """Provides a configurable launcher for EC2 instances.""" class _launcher(EC2ApiClient): """Configurable launcher for EC2 instances. Create the Launcher (passing an optional dict of its attributes), set its attributes (as described in ...
python
def Launcher(self, config=None): """Provides a configurable launcher for EC2 instances.""" class _launcher(EC2ApiClient): """Configurable launcher for EC2 instances. Create the Launcher (passing an optional dict of its attributes), set its attributes (as described in ...
[ "def", "Launcher", "(", "self", ",", "config", "=", "None", ")", ":", "class", "_launcher", "(", "EC2ApiClient", ")", ":", "\"\"\"Configurable launcher for EC2 instances. Create the Launcher\n (passing an optional dict of its attributes), set its attributes\n (a...
Provides a configurable launcher for EC2 instances.
[ "Provides", "a", "configurable", "launcher", "for", "EC2", "instances", "." ]
fcd4d092c42892ede7c924cafc41e9cf4be3fb9f
https://github.com/RetailMeNotSandbox/acky/blob/fcd4d092c42892ede7c924cafc41e9cf4be3fb9f/acky/ec2.py#L260-L288
41,115
RetailMeNotSandbox/acky
acky/ec2.py
InstanceCollection.events
def events(self, all_instances=None, instance_ids=None, filters=None): """a list of tuples containing instance Id's and event information""" params = {} if filters: params["filters"] = make_filters(filters) if instance_ids: params['InstanceIds'] = instance_ids ...
python
def events(self, all_instances=None, instance_ids=None, filters=None): """a list of tuples containing instance Id's and event information""" params = {} if filters: params["filters"] = make_filters(filters) if instance_ids: params['InstanceIds'] = instance_ids ...
[ "def", "events", "(", "self", ",", "all_instances", "=", "None", ",", "instance_ids", "=", "None", ",", "filters", "=", "None", ")", ":", "params", "=", "{", "}", "if", "filters", ":", "params", "[", "\"filters\"", "]", "=", "make_filters", "(", "filte...
a list of tuples containing instance Id's and event information
[ "a", "list", "of", "tuples", "containing", "instance", "Id", "s", "and", "event", "information" ]
fcd4d092c42892ede7c924cafc41e9cf4be3fb9f
https://github.com/RetailMeNotSandbox/acky/blob/fcd4d092c42892ede7c924cafc41e9cf4be3fb9f/acky/ec2.py#L304-L318
41,116
RetailMeNotSandbox/acky
acky/ec2.py
VolumeCollection.get
def get(self, volume_ids=None, filters=None): """List EBS Volume info.""" params = {} if filters: params["filters"] = make_filters(filters) if isinstance(volume_ids, str): volume_ids = [volume_ids] return self.call("DescribeVolumes", ...
python
def get(self, volume_ids=None, filters=None): """List EBS Volume info.""" params = {} if filters: params["filters"] = make_filters(filters) if isinstance(volume_ids, str): volume_ids = [volume_ids] return self.call("DescribeVolumes", ...
[ "def", "get", "(", "self", ",", "volume_ids", "=", "None", ",", "filters", "=", "None", ")", ":", "params", "=", "{", "}", "if", "filters", ":", "params", "[", "\"filters\"", "]", "=", "make_filters", "(", "filters", ")", "if", "isinstance", "(", "vo...
List EBS Volume info.
[ "List", "EBS", "Volume", "info", "." ]
fcd4d092c42892ede7c924cafc41e9cf4be3fb9f
https://github.com/RetailMeNotSandbox/acky/blob/fcd4d092c42892ede7c924cafc41e9cf4be3fb9f/acky/ec2.py#L473-L483
41,117
RetailMeNotSandbox/acky
acky/ec2.py
VolumeCollection.attach
def attach(self, volume_id, instance_id, device_path): """Attach a volume to an instance, exposing it with a device name.""" return self.call("AttachVolume", VolumeId=volume_id, InstanceId=instance_id, Device=device_path)
python
def attach(self, volume_id, instance_id, device_path): """Attach a volume to an instance, exposing it with a device name.""" return self.call("AttachVolume", VolumeId=volume_id, InstanceId=instance_id, Device=device_path)
[ "def", "attach", "(", "self", ",", "volume_id", ",", "instance_id", ",", "device_path", ")", ":", "return", "self", ".", "call", "(", "\"AttachVolume\"", ",", "VolumeId", "=", "volume_id", ",", "InstanceId", "=", "instance_id", ",", "Device", "=", "device_pa...
Attach a volume to an instance, exposing it with a device name.
[ "Attach", "a", "volume", "to", "an", "instance", "exposing", "it", "with", "a", "device", "name", "." ]
fcd4d092c42892ede7c924cafc41e9cf4be3fb9f
https://github.com/RetailMeNotSandbox/acky/blob/fcd4d092c42892ede7c924cafc41e9cf4be3fb9f/acky/ec2.py#L515-L519
41,118
RetailMeNotSandbox/acky
acky/ec2.py
VolumeCollection.detach
def detach(self, volume_id, instance_id='', device_path='', force=False): """Detach a volume from an instance.""" return self.call("DetachVolume", VolumeId=volume_id, InstanceId=instance_id, Device=device_path, force=force)
python
def detach(self, volume_id, instance_id='', device_path='', force=False): """Detach a volume from an instance.""" return self.call("DetachVolume", VolumeId=volume_id, InstanceId=instance_id, Device=device_path, force=force)
[ "def", "detach", "(", "self", ",", "volume_id", ",", "instance_id", "=", "''", ",", "device_path", "=", "''", ",", "force", "=", "False", ")", ":", "return", "self", ".", "call", "(", "\"DetachVolume\"", ",", "VolumeId", "=", "volume_id", ",", "InstanceI...
Detach a volume from an instance.
[ "Detach", "a", "volume", "from", "an", "instance", "." ]
fcd4d092c42892ede7c924cafc41e9cf4be3fb9f
https://github.com/RetailMeNotSandbox/acky/blob/fcd4d092c42892ede7c924cafc41e9cf4be3fb9f/acky/ec2.py#L521-L525
41,119
solocompt/plugs-core
plugs_core/mixins.py
Slugable.save
def save(self, *args, **kwargs): """ Overrides the save method """ self.slug = self.create_slug() super(Slugable, self).save(*args, **kwargs)
python
def save(self, *args, **kwargs): """ Overrides the save method """ self.slug = self.create_slug() super(Slugable, self).save(*args, **kwargs)
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "slug", "=", "self", ".", "create_slug", "(", ")", "super", "(", "Slugable", ",", "self", ")", ".", "save", "(", "*", "args", ",", "*", "*", "kwargs",...
Overrides the save method
[ "Overrides", "the", "save", "method" ]
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/mixins.py#L12-L17
41,120
solocompt/plugs-core
plugs_core/mixins.py
Slugable.create_slug
def create_slug(self): """ Creates slug, checks if slug is unique, and loop if not """ name = self.slug_source counter = 0 # loops until slug is unique while True: if counter == 0: slug = slugify(name) else: ...
python
def create_slug(self): """ Creates slug, checks if slug is unique, and loop if not """ name = self.slug_source counter = 0 # loops until slug is unique while True: if counter == 0: slug = slugify(name) else: ...
[ "def", "create_slug", "(", "self", ")", ":", "name", "=", "self", ".", "slug_source", "counter", "=", "0", "# loops until slug is unique", "while", "True", ":", "if", "counter", "==", "0", ":", "slug", "=", "slugify", "(", "name", ")", "else", ":", "# us...
Creates slug, checks if slug is unique, and loop if not
[ "Creates", "slug", "checks", "if", "slug", "is", "unique", "and", "loop", "if", "not" ]
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/mixins.py#L19-L41
41,121
MacHu-GWU/crawl_zillow-project
crawl_zillow/spider.py
get_html
def get_html(url, headers=None, timeout=None, errors="strict", wait_time=None, driver=None, zillow_only=False, cache_only=False, zillow_first=False, cache_first=False, random=False, ...
python
def get_html(url, headers=None, timeout=None, errors="strict", wait_time=None, driver=None, zillow_only=False, cache_only=False, zillow_first=False, cache_first=False, random=False, ...
[ "def", "get_html", "(", "url", ",", "headers", "=", "None", ",", "timeout", "=", "None", ",", "errors", "=", "\"strict\"", ",", "wait_time", "=", "None", ",", "driver", "=", "None", ",", "zillow_only", "=", "False", ",", "cache_only", "=", "False", ","...
Use Google Cached Url. :param cache_only: if True, then real zillow site will never be used. :param driver: selenium browser driver。
[ "Use", "Google", "Cached", "Url", "." ]
c6d7ca8e4c80e7e7e963496433ef73df1413c16e
https://github.com/MacHu-GWU/crawl_zillow-project/blob/c6d7ca8e4c80e7e7e963496433ef73df1413c16e/crawl_zillow/spider.py#L85-L148
41,122
RI-imaging/qpformat
examples/convert_txt2tif.py
get_paths
def get_paths(folder, ignore_endswith=ignore_endswith): '''Return hologram file paths Parameters ---------- folder: str or pathlib.Path Path to search folder ignore_endswith: list List of filename ending strings indicating which files should be ignored. ''' folder = ...
python
def get_paths(folder, ignore_endswith=ignore_endswith): '''Return hologram file paths Parameters ---------- folder: str or pathlib.Path Path to search folder ignore_endswith: list List of filename ending strings indicating which files should be ignored. ''' folder = ...
[ "def", "get_paths", "(", "folder", ",", "ignore_endswith", "=", "ignore_endswith", ")", ":", "folder", "=", "pathlib", ".", "Path", "(", "folder", ")", ".", "resolve", "(", ")", "files", "=", "folder", ".", "rglob", "(", "\"*\"", ")", "for", "ie", "in"...
Return hologram file paths Parameters ---------- folder: str or pathlib.Path Path to search folder ignore_endswith: list List of filename ending strings indicating which files should be ignored.
[ "Return", "hologram", "file", "paths" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/examples/convert_txt2tif.py#L27-L42
41,123
contains-io/rcli
rcli/call.py
call
def call(func, args): """Call the function with args normalized and cast to the correct types. Args: func: The function to call. args: The arguments parsed by docopt. Returns: The return value of func. """ assert hasattr(func, '__call__'), 'Cannot call func: {}'.format( ...
python
def call(func, args): """Call the function with args normalized and cast to the correct types. Args: func: The function to call. args: The arguments parsed by docopt. Returns: The return value of func. """ assert hasattr(func, '__call__'), 'Cannot call func: {}'.format( ...
[ "def", "call", "(", "func", ",", "args", ")", ":", "assert", "hasattr", "(", "func", ",", "'__call__'", ")", ",", "'Cannot call func: {}'", ".", "format", "(", "func", ".", "__name__", ")", "raw_func", "=", "(", "func", "if", "isinstance", "(", "func", ...
Call the function with args normalized and cast to the correct types. Args: func: The function to call. args: The arguments parsed by docopt. Returns: The return value of func.
[ "Call", "the", "function", "with", "args", "normalized", "and", "cast", "to", "the", "correct", "types", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/call.py#L45-L78
41,124
contains-io/rcli
rcli/call.py
get_callable
def get_callable(subcommand): # type: (config.RcliEntryPoint) -> Union[FunctionType, MethodType] """Return a callable object from the subcommand. Args: subcommand: A object loaded from an entry point. May be a module, class, or function. Returns: The callable entry point fo...
python
def get_callable(subcommand): # type: (config.RcliEntryPoint) -> Union[FunctionType, MethodType] """Return a callable object from the subcommand. Args: subcommand: A object loaded from an entry point. May be a module, class, or function. Returns: The callable entry point fo...
[ "def", "get_callable", "(", "subcommand", ")", ":", "# type: (config.RcliEntryPoint) -> Union[FunctionType, MethodType]", "_LOGGER", ".", "debug", "(", "'Creating callable from subcommand \"%s\".'", ",", "subcommand", ".", "__name__", ")", "if", "isinstance", "(", "subcommand...
Return a callable object from the subcommand. Args: subcommand: A object loaded from an entry point. May be a module, class, or function. Returns: The callable entry point for the subcommand. If the subcommand is a function, it will be returned unchanged. If the subcommand ...
[ "Return", "a", "callable", "object", "from", "the", "subcommand", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/call.py#L81-L109
41,125
contains-io/rcli
rcli/call.py
_getargspec
def _getargspec(func): """Return a Python 3-like argspec object. Note: args contains varargs and varkw if they exist. This behavior differs from getargspec and getfullargspec. Args: func: The function to inspect. Returns: A named tuple with three parameters: ...
python
def _getargspec(func): """Return a Python 3-like argspec object. Note: args contains varargs and varkw if they exist. This behavior differs from getargspec and getfullargspec. Args: func: The function to inspect. Returns: A named tuple with three parameters: ...
[ "def", "_getargspec", "(", "func", ")", ":", "argspec", "=", "_getspec", "(", "func", ")", "args", "=", "list", "(", "argspec", ".", "args", ")", "if", "argspec", ".", "varargs", ":", "args", "+=", "[", "argspec", ".", "varargs", "]", "if", "argspec"...
Return a Python 3-like argspec object. Note: args contains varargs and varkw if they exist. This behavior differs from getargspec and getfullargspec. Args: func: The function to inspect. Returns: A named tuple with three parameters: args: All named arguments, i...
[ "Return", "a", "Python", "3", "-", "like", "argspec", "object", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/call.py#L112-L135
41,126
contains-io/rcli
rcli/call.py
_normalize
def _normalize(args): # type: (Dict[str, Any]) -> Generator[Tuple[str, str, Any], None, None] """Yield a 3-tuple containing the key, a normalized key, and the value. Args: args: The arguments parsed by docopt. Yields: A 3-tuple that contains the docopt parameter name, the parameter na...
python
def _normalize(args): # type: (Dict[str, Any]) -> Generator[Tuple[str, str, Any], None, None] """Yield a 3-tuple containing the key, a normalized key, and the value. Args: args: The arguments parsed by docopt. Yields: A 3-tuple that contains the docopt parameter name, the parameter na...
[ "def", "_normalize", "(", "args", ")", ":", "# type: (Dict[str, Any]) -> Generator[Tuple[str, str, Any], None, None]", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "args", ")", ":", "nk", "=", "re", ".", "sub", "(", "r'\\W|^(?=\\d)'", ",", "'_'", ...
Yield a 3-tuple containing the key, a normalized key, and the value. Args: args: The arguments parsed by docopt. Yields: A 3-tuple that contains the docopt parameter name, the parameter name normalized to be a valid python identifier, and the value assigned to the parameter.
[ "Yield", "a", "3", "-", "tuple", "containing", "the", "key", "a", "normalized", "key", "and", "the", "value", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/call.py#L138-L156
41,127
erikvw/django-collect-offline-files
django_collect_offline_files/sftp_client.py
SFTPClient.copy
def copy(self, filename=None): """Puts on destination as a temp file, renames on the destination. """ dst = os.path.join(self.dst_path, filename) src = os.path.join(self.src_path, filename) dst_tmp = os.path.join(self.dst_tmp, filename) self.put(src=src, dst=dst_t...
python
def copy(self, filename=None): """Puts on destination as a temp file, renames on the destination. """ dst = os.path.join(self.dst_path, filename) src = os.path.join(self.src_path, filename) dst_tmp = os.path.join(self.dst_tmp, filename) self.put(src=src, dst=dst_t...
[ "def", "copy", "(", "self", ",", "filename", "=", "None", ")", ":", "dst", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dst_path", ",", "filename", ")", "src", "=", "os", ".", "path", ".", "join", "(", "self", ".", "src_path", ",", "...
Puts on destination as a temp file, renames on the destination.
[ "Puts", "on", "destination", "as", "a", "temp", "file", "renames", "on", "the", "destination", "." ]
78f61c823ea3926eb88206b019b5dca3c36017da
https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/sftp_client.py#L38-L46
41,128
AtomHash/evernode
evernode/classes/email.py
Email.__create
def __create(self): """ Construct the email """ self.__data = json.dumps({ 'config_path': self.encode(self.config_path), 'subject': self.encode(self.__subject), 'text': self.encode(self.__text), 'html': self.encode(self.__html), 'files':...
python
def __create(self): """ Construct the email """ self.__data = json.dumps({ 'config_path': self.encode(self.config_path), 'subject': self.encode(self.__subject), 'text': self.encode(self.__text), 'html': self.encode(self.__html), 'files':...
[ "def", "__create", "(", "self", ")", ":", "self", ".", "__data", "=", "json", ".", "dumps", "(", "{", "'config_path'", ":", "self", ".", "encode", "(", "self", ".", "config_path", ")", ",", "'subject'", ":", "self", ".", "encode", "(", "self", ".", ...
Construct the email
[ "Construct", "the", "email" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/email.py#L78-L89
41,129
jeradM/pyxeoma
pyxeoma/xeoma.py
Xeoma.async_get_camera_image
async def async_get_camera_image(self, image_name, username=None, password=None): """ Grab a single image from the Xeoma web server Arguments: image_name: the name of the image to fetch (i.e. image01) username: the username to directly access this image ...
python
async def async_get_camera_image(self, image_name, username=None, password=None): """ Grab a single image from the Xeoma web server Arguments: image_name: the name of the image to fetch (i.e. image01) username: the username to directly access this image ...
[ "async", "def", "async_get_camera_image", "(", "self", ",", "image_name", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "try", ":", "data", "=", "await", "self", ".", "async_fetch_image_data", "(", "image_name", ",", "username", ",", ...
Grab a single image from the Xeoma web server Arguments: image_name: the name of the image to fetch (i.e. image01) username: the username to directly access this image password: the password to directly access this image
[ "Grab", "a", "single", "image", "from", "the", "Xeoma", "web", "server" ]
5bfa19c4968283af0f450acf80b4651cd718f389
https://github.com/jeradM/pyxeoma/blob/5bfa19c4968283af0f450acf80b4651cd718f389/pyxeoma/xeoma.py#L34-L54
41,130
jeradM/pyxeoma
pyxeoma/xeoma.py
Xeoma.async_fetch_image_data
async def async_fetch_image_data(self, image_name, username, password): """ Fetch image data from the Xeoma web server Arguments: image_name: the name of the image to fetch (i.e. image01) username: the username to directly access this image ...
python
async def async_fetch_image_data(self, image_name, username, password): """ Fetch image data from the Xeoma web server Arguments: image_name: the name of the image to fetch (i.e. image01) username: the username to directly access this image ...
[ "async", "def", "async_fetch_image_data", "(", "self", ",", "image_name", ",", "username", ",", "password", ")", ":", "params", "=", "{", "}", "cookies", "=", "self", ".", "get_session_cookie", "(", ")", "if", "username", "is", "not", "None", "and", "passw...
Fetch image data from the Xeoma web server Arguments: image_name: the name of the image to fetch (i.e. image01) username: the username to directly access this image password: the password to directly access this image
[ "Fetch", "image", "data", "from", "the", "Xeoma", "web", "server" ]
5bfa19c4968283af0f450acf80b4651cd718f389
https://github.com/jeradM/pyxeoma/blob/5bfa19c4968283af0f450acf80b4651cd718f389/pyxeoma/xeoma.py#L56-L80
41,131
jeradM/pyxeoma
pyxeoma/xeoma.py
Xeoma.async_get_image_names
async def async_get_image_names(self): """ Parse web server camera view for camera image names """ cookies = self.get_session_cookie() try: async with aiohttp.ClientSession(cookies=cookies) as session: resp = await session.get( ...
python
async def async_get_image_names(self): """ Parse web server camera view for camera image names """ cookies = self.get_session_cookie() try: async with aiohttp.ClientSession(cookies=cookies) as session: resp = await session.get( ...
[ "async", "def", "async_get_image_names", "(", "self", ")", ":", "cookies", "=", "self", ".", "get_session_cookie", "(", ")", "try", ":", "async", "with", "aiohttp", ".", "ClientSession", "(", "cookies", "=", "cookies", ")", "as", "session", ":", "resp", "=...
Parse web server camera view for camera image names
[ "Parse", "web", "server", "camera", "view", "for", "camera", "image", "names" ]
5bfa19c4968283af0f450acf80b4651cd718f389
https://github.com/jeradM/pyxeoma/blob/5bfa19c4968283af0f450acf80b4651cd718f389/pyxeoma/xeoma.py#L82-L114
41,132
jeradM/pyxeoma
pyxeoma/xeoma.py
Xeoma.get_session_cookie
def get_session_cookie(self): """ Create a session cookie object for use by aiohttp """ if self._login is not None and self._password is not None: session_key = self.encode_user(self._login, self._password) return {'sessionkey': session_key} else: ...
python
def get_session_cookie(self): """ Create a session cookie object for use by aiohttp """ if self._login is not None and self._password is not None: session_key = self.encode_user(self._login, self._password) return {'sessionkey': session_key} else: ...
[ "def", "get_session_cookie", "(", "self", ")", ":", "if", "self", ".", "_login", "is", "not", "None", "and", "self", ".", "_password", "is", "not", "None", ":", "session_key", "=", "self", ".", "encode_user", "(", "self", ".", "_login", ",", "self", "....
Create a session cookie object for use by aiohttp
[ "Create", "a", "session", "cookie", "object", "for", "use", "by", "aiohttp" ]
5bfa19c4968283af0f450acf80b4651cd718f389
https://github.com/jeradM/pyxeoma/blob/5bfa19c4968283af0f450acf80b4651cd718f389/pyxeoma/xeoma.py#L121-L130
41,133
mcash/merchant-api-python-sdk
mcash/mapi_client/auth.py
RsaSha256Auth._get_sha256_digest
def _get_sha256_digest(self, content): """Return the sha256 digest of the content in the header format the Merchant API expects. """ content_sha256 = base64.b64encode(SHA256.new(content).digest()) return 'SHA256=' + content_sha256
python
def _get_sha256_digest(self, content): """Return the sha256 digest of the content in the header format the Merchant API expects. """ content_sha256 = base64.b64encode(SHA256.new(content).digest()) return 'SHA256=' + content_sha256
[ "def", "_get_sha256_digest", "(", "self", ",", "content", ")", ":", "content_sha256", "=", "base64", ".", "b64encode", "(", "SHA256", ".", "new", "(", "content", ")", ".", "digest", "(", ")", ")", "return", "'SHA256='", "+", "content_sha256" ]
Return the sha256 digest of the content in the header format the Merchant API expects.
[ "Return", "the", "sha256", "digest", "of", "the", "content", "in", "the", "header", "format", "the", "Merchant", "API", "expects", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/auth.py#L47-L52
41,134
mcash/merchant-api-python-sdk
mcash/mapi_client/auth.py
RsaSha256Auth._sha256_sign
def _sha256_sign(self, method, url, headers, body): """Sign the request with SHA256. """ d = '' sign_headers = method.upper() + '|' + url + '|' for key, value in sorted(headers.items()): if key.startswith('X-Mcash-'): sign_headers += d + key.upper() + ...
python
def _sha256_sign(self, method, url, headers, body): """Sign the request with SHA256. """ d = '' sign_headers = method.upper() + '|' + url + '|' for key, value in sorted(headers.items()): if key.startswith('X-Mcash-'): sign_headers += d + key.upper() + ...
[ "def", "_sha256_sign", "(", "self", ",", "method", ",", "url", ",", "headers", ",", "body", ")", ":", "d", "=", "''", "sign_headers", "=", "method", ".", "upper", "(", ")", "+", "'|'", "+", "url", "+", "'|'", "for", "key", ",", "value", "in", "so...
Sign the request with SHA256.
[ "Sign", "the", "request", "with", "SHA256", "." ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/auth.py#L54-L67
41,135
envi-idl/envipyarclib
envipyarclib/gptoolbox.py
GPToolbox.create_toolbox
def create_toolbox(self, filename): """ Creates a new Python toolbox where each task name is a GPTool in the toolbox. :param filename: the filename of the generated toolbox :param service_name: The name of the ESE service containing the tasks. Only tasks from ...
python
def create_toolbox(self, filename): """ Creates a new Python toolbox where each task name is a GPTool in the toolbox. :param filename: the filename of the generated toolbox :param service_name: The name of the ESE service containing the tasks. Only tasks from ...
[ "def", "create_toolbox", "(", "self", ",", "filename", ")", ":", "filename", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "0", "]", "label", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "# Get task information fir...
Creates a new Python toolbox where each task name is a GPTool in the toolbox. :param filename: the filename of the generated toolbox :param service_name: The name of the ESE service containing the tasks. Only tasks from one service may be used. :param tasks: The li...
[ "Creates", "a", "new", "Python", "toolbox", "where", "each", "task", "name", "is", "a", "GPTool", "in", "the", "toolbox", "." ]
90135652510c3d53c5f51177252c1fea2639bf22
https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptoolbox.py#L86-L121
41,136
envi-idl/envipyarclib
envipyarclib/gptoolbox.py
GPToolbox.create_tool
def create_tool(self, task): """ Creates a new GPTool for the toolbox. """ gp_tool = dict(taskName=task.name, taskDisplayName=task.display_name, taskDescription=task.description, canRunInBackground=True, ...
python
def create_tool(self, task): """ Creates a new GPTool for the toolbox. """ gp_tool = dict(taskName=task.name, taskDisplayName=task.display_name, taskDescription=task.description, canRunInBackground=True, ...
[ "def", "create_tool", "(", "self", ",", "task", ")", ":", "gp_tool", "=", "dict", "(", "taskName", "=", "task", ".", "name", ",", "taskDisplayName", "=", "task", ".", "display_name", ",", "taskDescription", "=", "task", ".", "description", ",", "canRunInBa...
Creates a new GPTool for the toolbox.
[ "Creates", "a", "new", "GPTool", "for", "the", "toolbox", "." ]
90135652510c3d53c5f51177252c1fea2639bf22
https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptoolbox.py#L123-L144
41,137
envi-idl/envipyarclib
envipyarclib/gptoolbox.py
GPToolbox.import_script
def import_script(self, script_name): """Finds the script file and copies it into the toolbox""" filename = os.path.abspath(script_name) with open(filename, 'r') as script_file: self.toolbox_file.write(script_file.read())
python
def import_script(self, script_name): """Finds the script file and copies it into the toolbox""" filename = os.path.abspath(script_name) with open(filename, 'r') as script_file: self.toolbox_file.write(script_file.read())
[ "def", "import_script", "(", "self", ",", "script_name", ")", ":", "filename", "=", "os", ".", "path", ".", "abspath", "(", "script_name", ")", "with", "open", "(", "filename", ",", "'r'", ")", "as", "script_file", ":", "self", ".", "toolbox_file", ".", ...
Finds the script file and copies it into the toolbox
[ "Finds", "the", "script", "file", "and", "copies", "it", "into", "the", "toolbox" ]
90135652510c3d53c5f51177252c1fea2639bf22
https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptoolbox.py#L146-L150
41,138
helixyte/everest
everest/resources/descriptors.py
_relation_attribute.make_relationship
def make_relationship(self, relator, direction= RELATIONSHIP_DIRECTIONS.BIDIRECTIONAL): """ Create a relationship object for this attribute from the given relator and relationship direction. """ if IEntity.providedBy(relator):...
python
def make_relationship(self, relator, direction= RELATIONSHIP_DIRECTIONS.BIDIRECTIONAL): """ Create a relationship object for this attribute from the given relator and relationship direction. """ if IEntity.providedBy(relator):...
[ "def", "make_relationship", "(", "self", ",", "relator", ",", "direction", "=", "RELATIONSHIP_DIRECTIONS", ".", "BIDIRECTIONAL", ")", ":", "if", "IEntity", ".", "providedBy", "(", "relator", ")", ":", "# pylint:disable=E1101", "rel", "=", "DomainRelationship", "("...
Create a relationship object for this attribute from the given relator and relationship direction.
[ "Create", "a", "relationship", "object", "for", "this", "attribute", "from", "the", "given", "relator", "and", "relationship", "direction", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/resources/descriptors.py#L143-L160
41,139
silver-castle/mach9
mach9/blueprints.py
Blueprint.register
def register(self, app, options): """Register the blueprint to the mach9 app.""" url_prefix = options.get('url_prefix', self.url_prefix) # Routes for future in self.routes: # attach the blueprint name to the handler so that it can be # prefixed properly in the r...
python
def register(self, app, options): """Register the blueprint to the mach9 app.""" url_prefix = options.get('url_prefix', self.url_prefix) # Routes for future in self.routes: # attach the blueprint name to the handler so that it can be # prefixed properly in the r...
[ "def", "register", "(", "self", ",", "app", ",", "options", ")", ":", "url_prefix", "=", "options", ".", "get", "(", "'url_prefix'", ",", "self", ".", "url_prefix", ")", "# Routes", "for", "future", "in", "self", ".", "routes", ":", "# attach the blueprint...
Register the blueprint to the mach9 app.
[ "Register", "the", "blueprint", "to", "the", "mach9", "app", "." ]
7a623aab3c70d89d36ade6901b6307e115400c5e
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/blueprints.py#L34-L76
41,140
silver-castle/mach9
mach9/blueprints.py
Blueprint.add_route
def add_route(self, handler, uri, methods=frozenset({'GET'}), host=None, strict_slashes=False): """Create a blueprint route from a function. :param handler: function for handling uri requests. Accepts function, or class instance with a view_class method. ...
python
def add_route(self, handler, uri, methods=frozenset({'GET'}), host=None, strict_slashes=False): """Create a blueprint route from a function. :param handler: function for handling uri requests. Accepts function, or class instance with a view_class method. ...
[ "def", "add_route", "(", "self", ",", "handler", ",", "uri", ",", "methods", "=", "frozenset", "(", "{", "'GET'", "}", ")", ",", "host", "=", "None", ",", "strict_slashes", "=", "False", ")", ":", "# Handle HTTPMethodView differently", "if", "hasattr", "("...
Create a blueprint route from a function. :param handler: function for handling uri requests. Accepts function, or class instance with a view_class method. :param uri: endpoint at which the route will be accessible. :param methods: list of acceptable HTTP methods. ...
[ "Create", "a", "blueprint", "route", "from", "a", "function", "." ]
7a623aab3c70d89d36ade6901b6307e115400c5e
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/blueprints.py#L92-L117
41,141
ponty/confduino
confduino/examples/remove_boards.py
remove_boards_gui
def remove_boards_gui(hwpack=''): """remove boards by GUI.""" if not hwpack: if len(hwpack_names()) > 1: hwpack = psidialogs.choice(hwpack_names(), 'select hardware package to select board from!', title='select') ...
python
def remove_boards_gui(hwpack=''): """remove boards by GUI.""" if not hwpack: if len(hwpack_names()) > 1: hwpack = psidialogs.choice(hwpack_names(), 'select hardware package to select board from!', title='select') ...
[ "def", "remove_boards_gui", "(", "hwpack", "=", "''", ")", ":", "if", "not", "hwpack", ":", "if", "len", "(", "hwpack_names", "(", ")", ")", ">", "1", ":", "hwpack", "=", "psidialogs", ".", "choice", "(", "hwpack_names", "(", ")", ",", "'select hardwar...
remove boards by GUI.
[ "remove", "boards", "by", "GUI", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/examples/remove_boards.py#L10-L31
41,142
BlackEarth/bxml
bxml/builder.py
Builder.single
def single(C, namespace=None): """An element maker with a single namespace that uses that namespace as the default""" if namespace is None: B = C()._ else: B = C(default=namespace, _=namespace)._ return B
python
def single(C, namespace=None): """An element maker with a single namespace that uses that namespace as the default""" if namespace is None: B = C()._ else: B = C(default=namespace, _=namespace)._ return B
[ "def", "single", "(", "C", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "is", "None", ":", "B", "=", "C", "(", ")", ".", "_", "else", ":", "B", "=", "C", "(", "default", "=", "namespace", ",", "_", "=", "namespace", ")", ".", "...
An element maker with a single namespace that uses that namespace as the default
[ "An", "element", "maker", "with", "a", "single", "namespace", "that", "uses", "that", "namespace", "as", "the", "default" ]
8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77
https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/builder.py#L39-L45
41,143
asascience-open/paegan-transport
paegan/transport/bathymetry.py
Bathymetry.intersect
def intersect(self, **kwargs): """ Intersect Point and Bathymetry returns bool """ end_point = kwargs.pop('end_point') depth = self.get_depth(location=end_point) # Bathymetry and a particle's depth are both negative down if depth < 0 and depth > en...
python
def intersect(self, **kwargs): """ Intersect Point and Bathymetry returns bool """ end_point = kwargs.pop('end_point') depth = self.get_depth(location=end_point) # Bathymetry and a particle's depth are both negative down if depth < 0 and depth > en...
[ "def", "intersect", "(", "self", ",", "*", "*", "kwargs", ")", ":", "end_point", "=", "kwargs", ".", "pop", "(", "'end_point'", ")", "depth", "=", "self", ".", "get_depth", "(", "location", "=", "end_point", ")", "# Bathymetry and a particle's depth are both n...
Intersect Point and Bathymetry returns bool
[ "Intersect", "Point", "and", "Bathymetry", "returns", "bool" ]
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/bathymetry.py#L28-L40
41,144
asascience-open/paegan-transport
paegan/transport/bathymetry.py
Bathymetry.react
def react(self, **kwargs): """ The time of recation is ignored hereTime is ignored here and should be handled by whatever called this function. """ react_type = kwargs.get("type", self._type) if react_type == 'hover': return self.__hover(**kwargs) ...
python
def react(self, **kwargs): """ The time of recation is ignored hereTime is ignored here and should be handled by whatever called this function. """ react_type = kwargs.get("type", self._type) if react_type == 'hover': return self.__hover(**kwargs) ...
[ "def", "react", "(", "self", ",", "*", "*", "kwargs", ")", ":", "react_type", "=", "kwargs", ".", "get", "(", "\"type\"", ",", "self", ".", "_type", ")", "if", "react_type", "==", "'hover'", ":", "return", "self", ".", "__hover", "(", "*", "*", "kw...
The time of recation is ignored hereTime is ignored here and should be handled by whatever called this function.
[ "The", "time", "of", "recation", "is", "ignored", "hereTime", "is", "ignored", "here", "and", "should", "be", "handled", "by", "whatever", "called", "this", "function", "." ]
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/bathymetry.py#L45-L59
41,145
asascience-open/paegan-transport
paegan/transport/bathymetry.py
Bathymetry.__hover
def __hover(self, **kwargs): """ This hovers the particle 1m above the bathymetry WHERE IT WOULD HAVE ENDED UP. This is WRONG and we need to compute the location that it actually hit the bathymetry and hover 1m above THAT. """ end_point = kwargs.pop('end_point...
python
def __hover(self, **kwargs): """ This hovers the particle 1m above the bathymetry WHERE IT WOULD HAVE ENDED UP. This is WRONG and we need to compute the location that it actually hit the bathymetry and hover 1m above THAT. """ end_point = kwargs.pop('end_point...
[ "def", "__hover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "end_point", "=", "kwargs", ".", "pop", "(", "'end_point'", ")", "# The location argument here should be the point that intersected the bathymetry,", "# not the end_point that is \"through\" the bathymetry.", "...
This hovers the particle 1m above the bathymetry WHERE IT WOULD HAVE ENDED UP. This is WRONG and we need to compute the location that it actually hit the bathymetry and hover 1m above THAT.
[ "This", "hovers", "the", "particle", "1m", "above", "the", "bathymetry", "WHERE", "IT", "WOULD", "HAVE", "ENDED", "UP", ".", "This", "is", "WRONG", "and", "we", "need", "to", "compute", "the", "location", "that", "it", "actually", "hit", "the", "bathymetry...
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/bathymetry.py#L61-L71
41,146
asascience-open/paegan-transport
paegan/transport/bathymetry.py
Bathymetry.__reverse
def __reverse(self, **kwargs): """ If we hit the bathymetry, set the location to where we came from. """ start_point = kwargs.pop('start_point') return Location4D(latitude=start_point.latitude, longitude=start_point.longitude, depth=start_point.depth)
python
def __reverse(self, **kwargs): """ If we hit the bathymetry, set the location to where we came from. """ start_point = kwargs.pop('start_point') return Location4D(latitude=start_point.latitude, longitude=start_point.longitude, depth=start_point.depth)
[ "def", "__reverse", "(", "self", ",", "*", "*", "kwargs", ")", ":", "start_point", "=", "kwargs", ".", "pop", "(", "'start_point'", ")", "return", "Location4D", "(", "latitude", "=", "start_point", ".", "latitude", ",", "longitude", "=", "start_point", "."...
If we hit the bathymetry, set the location to where we came from.
[ "If", "we", "hit", "the", "bathymetry", "set", "the", "location", "to", "where", "we", "came", "from", "." ]
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/bathymetry.py#L73-L78
41,147
contains-io/rcli
rcli/dispatcher.py
main
def main(): # type: () -> typing.Any """Parse the command line options and launch the requested command. If the command is 'help' then print the help message for the subcommand; if no subcommand is given, print the standard help message. """ colorama.init(wrap=six.PY3) doc = usage.get_prima...
python
def main(): # type: () -> typing.Any """Parse the command line options and launch the requested command. If the command is 'help' then print the help message for the subcommand; if no subcommand is given, print the standard help message. """ colorama.init(wrap=six.PY3) doc = usage.get_prima...
[ "def", "main", "(", ")", ":", "# type: () -> typing.Any", "colorama", ".", "init", "(", "wrap", "=", "six", ".", "PY3", ")", "doc", "=", "usage", ".", "get_primary_command_usage", "(", ")", "allow_subcommands", "=", "'<command>'", "in", "doc", "args", "=", ...
Parse the command line options and launch the requested command. If the command is 'help' then print the help message for the subcommand; if no subcommand is given, print the standard help message.
[ "Parse", "the", "command", "line", "options", "and", "launch", "the", "requested", "command", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/dispatcher.py#L34-L58
41,148
contains-io/rcli
rcli/dispatcher.py
_get_subcommand
def _get_subcommand(name): # type: (str) -> config.RcliEntryPoint """Return the function for the specified subcommand. Args: name: The name of a subcommand. Returns: The loadable object from the entry point represented by the subcommand. """ _LOGGER.debug('Accessing subcommand ...
python
def _get_subcommand(name): # type: (str) -> config.RcliEntryPoint """Return the function for the specified subcommand. Args: name: The name of a subcommand. Returns: The loadable object from the entry point represented by the subcommand. """ _LOGGER.debug('Accessing subcommand ...
[ "def", "_get_subcommand", "(", "name", ")", ":", "# type: (str) -> config.RcliEntryPoint", "_LOGGER", ".", "debug", "(", "'Accessing subcommand \"%s\".'", ",", "name", ")", "if", "name", "not", "in", "settings", ".", "subcommands", ":", "raise", "ValueError", "(", ...
Return the function for the specified subcommand. Args: name: The name of a subcommand. Returns: The loadable object from the entry point represented by the subcommand.
[ "Return", "the", "function", "for", "the", "specified", "subcommand", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/dispatcher.py#L61-L78
41,149
contains-io/rcli
rcli/dispatcher.py
_run_command
def _run_command(argv): # type: (typing.List[str]) -> typing.Any """Run the command with the given CLI options and exit. Command functions are expected to have a __doc__ string that is parseable by docopt. Args: argv: The list of command line arguments supplied for a command. The ...
python
def _run_command(argv): # type: (typing.List[str]) -> typing.Any """Run the command with the given CLI options and exit. Command functions are expected to have a __doc__ string that is parseable by docopt. Args: argv: The list of command line arguments supplied for a command. The ...
[ "def", "_run_command", "(", "argv", ")", ":", "# type: (typing.List[str]) -> typing.Any", "command_name", ",", "argv", "=", "_get_command_and_argv", "(", "argv", ")", "_LOGGER", ".", "info", "(", "'Running command \"%s %s\" with args: %s'", ",", "settings", ".", "comman...
Run the command with the given CLI options and exit. Command functions are expected to have a __doc__ string that is parseable by docopt. Args: argv: The list of command line arguments supplied for a command. The first argument is expected to be the name of the command to be run. ...
[ "Run", "the", "command", "with", "the", "given", "CLI", "options", "and", "exit", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/dispatcher.py#L81-L104
41,150
contains-io/rcli
rcli/dispatcher.py
_get_command_and_argv
def _get_command_and_argv(argv): # type: (typing.List[str]) -> typing.Tuple[str, typing.List[str]] """Extract the command name and arguments to pass to docopt. Args: argv: The argument list being used to run the command. Returns: A tuple containing the name of the command and the argum...
python
def _get_command_and_argv(argv): # type: (typing.List[str]) -> typing.Tuple[str, typing.List[str]] """Extract the command name and arguments to pass to docopt. Args: argv: The argument list being used to run the command. Returns: A tuple containing the name of the command and the argum...
[ "def", "_get_command_and_argv", "(", "argv", ")", ":", "# type: (typing.List[str]) -> typing.Tuple[str, typing.List[str]]", "command_name", "=", "argv", "[", "0", "]", "if", "not", "command_name", ":", "argv", "=", "argv", "[", "1", ":", "]", "elif", "command_name",...
Extract the command name and arguments to pass to docopt. Args: argv: The argument list being used to run the command. Returns: A tuple containing the name of the command and the arguments to pass to docopt.
[ "Extract", "the", "command", "name", "and", "arguments", "to", "pass", "to", "docopt", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/dispatcher.py#L107-L123
41,151
contains-io/rcli
rcli/dispatcher.py
_get_parsed_args
def _get_parsed_args(command_name, doc, argv): # type: (str, str, typing.List[str]) -> typing.Dict[str, typing.Any] """Parse the docstring with docopt. Args: command_name: The name of the subcommand to parse. doc: A docopt-parseable string. argv: The list of arguments to pass to doc...
python
def _get_parsed_args(command_name, doc, argv): # type: (str, str, typing.List[str]) -> typing.Dict[str, typing.Any] """Parse the docstring with docopt. Args: command_name: The name of the subcommand to parse. doc: A docopt-parseable string. argv: The list of arguments to pass to doc...
[ "def", "_get_parsed_args", "(", "command_name", ",", "doc", ",", "argv", ")", ":", "# type: (str, str, typing.List[str]) -> typing.Dict[str, typing.Any]", "_LOGGER", ".", "debug", "(", "'Parsing docstring: \"\"\"%s\"\"\" with arguments %s.'", ",", "doc", ",", "argv", ")", "...
Parse the docstring with docopt. Args: command_name: The name of the subcommand to parse. doc: A docopt-parseable string. argv: The list of arguments to pass to docopt during parsing. Returns: The docopt results dictionary. If the subcommand has the same name as the pri...
[ "Parse", "the", "docstring", "with", "docopt", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/dispatcher.py#L126-L144
41,152
Jarn/jarn.mkrelease
jarn/mkrelease/exit.py
trace
def trace(msg): """Print a trace message to stderr if environment variable is set. """ if os.environ.get('JARN_TRACE') == '1': print('TRACE:', msg, file=sys.stderr)
python
def trace(msg): """Print a trace message to stderr if environment variable is set. """ if os.environ.get('JARN_TRACE') == '1': print('TRACE:', msg, file=sys.stderr)
[ "def", "trace", "(", "msg", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "'JARN_TRACE'", ")", "==", "'1'", ":", "print", "(", "'TRACE:'", ",", "msg", ",", "file", "=", "sys", ".", "stderr", ")" ]
Print a trace message to stderr if environment variable is set.
[ "Print", "a", "trace", "message", "to", "stderr", "if", "environment", "variable", "is", "set", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/exit.py#L27-L31
41,153
timothydmorton/orbitutils
orbitutils/kepler.py
Efn
def Efn(Ms,eccs): """works for -2pi < Ms < 2pi, e <= 0.97""" Ms = np.atleast_1d(Ms) eccs = np.atleast_1d(eccs) unit = np.floor(Ms / (2*np.pi)) Es = EFN((Ms % (2*np.pi)),eccs) Es += unit*(2*np.pi) return Es
python
def Efn(Ms,eccs): """works for -2pi < Ms < 2pi, e <= 0.97""" Ms = np.atleast_1d(Ms) eccs = np.atleast_1d(eccs) unit = np.floor(Ms / (2*np.pi)) Es = EFN((Ms % (2*np.pi)),eccs) Es += unit*(2*np.pi) return Es
[ "def", "Efn", "(", "Ms", ",", "eccs", ")", ":", "Ms", "=", "np", ".", "atleast_1d", "(", "Ms", ")", "eccs", "=", "np", ".", "atleast_1d", "(", "eccs", ")", "unit", "=", "np", ".", "floor", "(", "Ms", "/", "(", "2", "*", "np", ".", "pi", ")"...
works for -2pi < Ms < 2pi, e <= 0.97
[ "works", "for", "-", "2pi", "<", "Ms", "<", "2pi", "e", "<", "=", "0", ".", "97" ]
949c6b901e519458d80b8d7427916c0698e4013e
https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/kepler.py#L20-L27
41,154
SeattleTestbed/seash
seash_modules.py
enable_modules_from_last_session
def enable_modules_from_last_session(seashcommanddict): """ Enable every module that isn't marked as disabled in the modules folder. This function is meant to be called when seash is initializing and nowhere else. A module is marked as disabled when there is a modulename.disabled file. """ successfully_...
python
def enable_modules_from_last_session(seashcommanddict): """ Enable every module that isn't marked as disabled in the modules folder. This function is meant to be called when seash is initializing and nowhere else. A module is marked as disabled when there is a modulename.disabled file. """ successfully_...
[ "def", "enable_modules_from_last_session", "(", "seashcommanddict", ")", ":", "successfully_enabled_modules", "=", "[", "]", "modules_to_enable", "=", "get_enabled_modules", "(", ")", "for", "modulename", "in", "modules_to_enable", ":", "# There are no bad side effects to sea...
Enable every module that isn't marked as disabled in the modules folder. This function is meant to be called when seash is initializing and nowhere else. A module is marked as disabled when there is a modulename.disabled file.
[ "Enable", "every", "module", "that", "isn", "t", "marked", "as", "disabled", "in", "the", "modules", "folder", ".", "This", "function", "is", "meant", "to", "be", "called", "when", "seash", "is", "initializing", "and", "nowhere", "else", ".", "A", "module"...
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/seash_modules.py#L450-L478
41,155
SeattleTestbed/seash
seash_modules.py
_ensure_module_folder_exists
def _ensure_module_folder_exists(): """ Checks to see if the module folder exists. If it does not, create it. If there is an existing file with the same name, we raise a RuntimeError. """ if not os.path.isdir(MODULES_FOLDER_PATH): try: os.mkdir(MODULES_FOLDER_PATH) except OSError, e: if "...
python
def _ensure_module_folder_exists(): """ Checks to see if the module folder exists. If it does not, create it. If there is an existing file with the same name, we raise a RuntimeError. """ if not os.path.isdir(MODULES_FOLDER_PATH): try: os.mkdir(MODULES_FOLDER_PATH) except OSError, e: if "...
[ "def", "_ensure_module_folder_exists", "(", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "MODULES_FOLDER_PATH", ")", ":", "try", ":", "os", ".", "mkdir", "(", "MODULES_FOLDER_PATH", ")", "except", "OSError", ",", "e", ":", "if", "\"file alr...
Checks to see if the module folder exists. If it does not, create it. If there is an existing file with the same name, we raise a RuntimeError.
[ "Checks", "to", "see", "if", "the", "module", "folder", "exists", ".", "If", "it", "does", "not", "create", "it", ".", "If", "there", "is", "an", "existing", "file", "with", "the", "same", "name", "we", "raise", "a", "RuntimeError", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/seash_modules.py#L598-L608
41,156
helixyte/everest
everest/configuration.py
Configurator.get_configuration_from_settings
def get_configuration_from_settings(self, setting_info): """ Returns a dictionary with configuration names as keys and setting values extracted from this configurator's settings as values. :param setting_info: Sequence of 2-tuples containing the configuration name as the first...
python
def get_configuration_from_settings(self, setting_info): """ Returns a dictionary with configuration names as keys and setting values extracted from this configurator's settings as values. :param setting_info: Sequence of 2-tuples containing the configuration name as the first...
[ "def", "get_configuration_from_settings", "(", "self", ",", "setting_info", ")", ":", "settings", "=", "self", ".", "get_settings", "(", ")", "return", "dict", "(", "[", "(", "name", ",", "settings", ".", "get", "(", "key", ")", ")", "for", "(", "name", ...
Returns a dictionary with configuration names as keys and setting values extracted from this configurator's settings as values. :param setting_info: Sequence of 2-tuples containing the configuration name as the first and the setting name as the second element.
[ "Returns", "a", "dictionary", "with", "configuration", "names", "as", "keys", "and", "setting", "values", "extracted", "from", "this", "configurator", "s", "settings", "as", "values", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/configuration.py#L171-L182
41,157
helixyte/everest
everest/configuration.py
Configurator.add_repository
def add_repository(self, name, repository_type, repository_class, aggregate_class, make_default, configuration): """ Generic method for adding a repository. """ repo_mgr = self.get_registered_utility(IRepositoryManager) if name is None: # If no ...
python
def add_repository(self, name, repository_type, repository_class, aggregate_class, make_default, configuration): """ Generic method for adding a repository. """ repo_mgr = self.get_registered_utility(IRepositoryManager) if name is None: # If no ...
[ "def", "add_repository", "(", "self", ",", "name", ",", "repository_type", ",", "repository_class", ",", "aggregate_class", ",", "make_default", ",", "configuration", ")", ":", "repo_mgr", "=", "self", ".", "get_registered_utility", "(", "IRepositoryManager", ")", ...
Generic method for adding a repository.
[ "Generic", "method", "for", "adding", "a", "repository", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/configuration.py#L237-L252
41,158
dfm/ugly
ugly/models.py
encrypt_email
def encrypt_email(email): """ The default encryption function for storing emails in the database. This uses AES and the encryption key defined in the applications configuration. :param email: The email address. """ aes = SimpleAES(flask.current_app.config["AES_KEY"]) return aes.enc...
python
def encrypt_email(email): """ The default encryption function for storing emails in the database. This uses AES and the encryption key defined in the applications configuration. :param email: The email address. """ aes = SimpleAES(flask.current_app.config["AES_KEY"]) return aes.enc...
[ "def", "encrypt_email", "(", "email", ")", ":", "aes", "=", "SimpleAES", "(", "flask", ".", "current_app", ".", "config", "[", "\"AES_KEY\"", "]", ")", "return", "aes", ".", "encrypt", "(", "email", ")" ]
The default encryption function for storing emails in the database. This uses AES and the encryption key defined in the applications configuration. :param email: The email address.
[ "The", "default", "encryption", "function", "for", "storing", "emails", "in", "the", "database", ".", "This", "uses", "AES", "and", "the", "encryption", "key", "defined", "in", "the", "applications", "configuration", "." ]
bc09834849184552619ee926d7563ed37630accb
https://github.com/dfm/ugly/blob/bc09834849184552619ee926d7563ed37630accb/ugly/models.py#L40-L50
41,159
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client_example.py
MapiClientExample.shortlink_scanned
def shortlink_scanned(self, data): """Called when a shortlink_scanned event is received """ # Inform log that we received an event self.logger.info("Received shortlink_scanned event") data = json.loads(data) customer_token = str(data['object']['id']) response = s...
python
def shortlink_scanned(self, data): """Called when a shortlink_scanned event is received """ # Inform log that we received an event self.logger.info("Received shortlink_scanned event") data = json.loads(data) customer_token = str(data['object']['id']) response = s...
[ "def", "shortlink_scanned", "(", "self", ",", "data", ")", ":", "# Inform log that we received an event", "self", ".", "logger", ".", "info", "(", "\"Received shortlink_scanned event\"", ")", "data", "=", "json", ".", "loads", "(", "data", ")", "customer_token", "...
Called when a shortlink_scanned event is received
[ "Called", "when", "a", "shortlink_scanned", "event", "is", "received" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client_example.py#L22-L42
41,160
mcash/merchant-api-python-sdk
mcash/mapi_client/mapi_client_example.py
MapiClientExample.pusher_connected
def pusher_connected(self, data): """Called when the pusherclient is connected """ # Inform user that pusher is done connecting self.logger.info("Pusherclient connected") # Bind the events we want to listen to self.callback_client.bind("payment_authorized", ...
python
def pusher_connected(self, data): """Called when the pusherclient is connected """ # Inform user that pusher is done connecting self.logger.info("Pusherclient connected") # Bind the events we want to listen to self.callback_client.bind("payment_authorized", ...
[ "def", "pusher_connected", "(", "self", ",", "data", ")", ":", "# Inform user that pusher is done connecting", "self", ".", "logger", ".", "info", "(", "\"Pusherclient connected\"", ")", "# Bind the events we want to listen to", "self", ".", "callback_client", ".", "bind"...
Called when the pusherclient is connected
[ "Called", "when", "the", "pusherclient", "is", "connected" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/mapi_client_example.py#L53-L63
41,161
callowayproject/Calloway
calloway/apps/django_ext/managers.py
CachingQuerySet.get
def get(self, *args, **kwargs): """ Checks the cache to see if there's a cached entry for this pk. If not, fetches using super then stores the result in cache. Most of the logic here was gathered from a careful reading of ``django.db.models.sql.query.add_filter`` """ ...
python
def get(self, *args, **kwargs): """ Checks the cache to see if there's a cached entry for this pk. If not, fetches using super then stores the result in cache. Most of the logic here was gathered from a careful reading of ``django.db.models.sql.query.add_filter`` """ ...
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "query", ".", "where", ":", "# If there is any other ``where`` filter on this QuerySet just call", "# super. There will be a where clause if this QuerySet has already", "# b...
Checks the cache to see if there's a cached entry for this pk. If not, fetches using super then stores the result in cache. Most of the logic here was gathered from a careful reading of ``django.db.models.sql.query.add_filter``
[ "Checks", "the", "cache", "to", "see", "if", "there", "s", "a", "cached", "entry", "for", "this", "pk", ".", "If", "not", "fetches", "using", "super", "then", "stores", "the", "result", "in", "cache", ".", "Most", "of", "the", "logic", "here", "was", ...
d22e98d41fbd298ab6393ba7bd84a75528be9f81
https://github.com/callowayproject/Calloway/blob/d22e98d41fbd298ab6393ba7bd84a75528be9f81/calloway/apps/django_ext/managers.py#L62-L87
41,162
calmjs/nunja
src/nunja/engine.py
Engine.fetch_path
def fetch_path(self, name): """ Fetch contents from the path retrieved via lookup_path. No caching will be done. """ with codecs.open(self.lookup_path(name), encoding='utf-8') as fd: return fd.read()
python
def fetch_path(self, name): """ Fetch contents from the path retrieved via lookup_path. No caching will be done. """ with codecs.open(self.lookup_path(name), encoding='utf-8') as fd: return fd.read()
[ "def", "fetch_path", "(", "self", ",", "name", ")", ":", "with", "codecs", ".", "open", "(", "self", ".", "lookup_path", "(", "name", ")", ",", "encoding", "=", "'utf-8'", ")", "as", "fd", ":", "return", "fd", ".", "read", "(", ")" ]
Fetch contents from the path retrieved via lookup_path. No caching will be done.
[ "Fetch", "contents", "from", "the", "path", "retrieved", "via", "lookup_path", "." ]
37ba114ca2239322718fd9994bb078c037682c33
https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/engine.py#L71-L79
41,163
calmjs/nunja
src/nunja/engine.py
Engine.execute
def execute(self, mold_id, data, wrapper_tag='div'): """ Execute a mold `mold_id` by rendering through ``env``. This is done using its default template, with data provided as dict. This returns the wrapped content, which contains the bits that the client-side on-load sc...
python
def execute(self, mold_id, data, wrapper_tag='div'): """ Execute a mold `mold_id` by rendering through ``env``. This is done using its default template, with data provided as dict. This returns the wrapped content, which contains the bits that the client-side on-load sc...
[ "def", "execute", "(", "self", ",", "mold_id", ",", "data", ",", "wrapper_tag", "=", "'div'", ")", ":", "template", "=", "self", ".", "load_mold", "(", "mold_id", ")", "kwargs", "=", "{", "}", "kwargs", ".", "update", "(", "data", ")", "kwargs", "[",...
Execute a mold `mold_id` by rendering through ``env``. This is done using its default template, with data provided as dict. This returns the wrapped content, which contains the bits that the client-side on-load script trigger will execute the index.js defined for this mold; if ...
[ "Execute", "a", "mold", "mold_id", "by", "rendering", "through", "env", "." ]
37ba114ca2239322718fd9994bb078c037682c33
https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/engine.py#L101-L122
41,164
calmjs/nunja
src/nunja/engine.py
Engine.render
def render(self, mold_id, data): """ Render a mold `mold_id`. No wrappers are applied as only the default template defined for the mold is rendered. """ template = self.load_mold(mold_id) return template.render(**data)
python
def render(self, mold_id, data): """ Render a mold `mold_id`. No wrappers are applied as only the default template defined for the mold is rendered. """ template = self.load_mold(mold_id) return template.render(**data)
[ "def", "render", "(", "self", ",", "mold_id", ",", "data", ")", ":", "template", "=", "self", ".", "load_mold", "(", "mold_id", ")", "return", "template", ".", "render", "(", "*", "*", "data", ")" ]
Render a mold `mold_id`. No wrappers are applied as only the default template defined for the mold is rendered.
[ "Render", "a", "mold", "mold_id", ".", "No", "wrappers", "are", "applied", "as", "only", "the", "default", "template", "defined", "for", "the", "mold", "is", "rendered", "." ]
37ba114ca2239322718fd9994bb078c037682c33
https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/engine.py#L124-L131
41,165
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._get_model_table
def _get_model_table(self, part): """ Returns a list that represents the table. :param part: The table header, table footer or table body. :type part: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The list that represents the table. :rtype: list(list(hatemile...
python
def _get_model_table(self, part): """ Returns a list that represents the table. :param part: The table header, table footer or table body. :type part: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The list that represents the table. :rtype: list(list(hatemile...
[ "def", "_get_model_table", "(", "self", ",", "part", ")", ":", "rows", "=", "self", ".", "parser", ".", "find", "(", "part", ")", ".", "find_children", "(", "'tr'", ")", ".", "list_results", "(", ")", "table", "=", "[", "]", "for", "row", "in", "ro...
Returns a list that represents the table. :param part: The table header, table footer or table body. :type part: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The list that represents the table. :rtype: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement))
[ "Returns", "a", "list", "that", "represents", "the", "table", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L46-L62
41,166
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._get_valid_model_table
def _get_valid_model_table(self, ros): """ Returns a list that represents the table with the rowspans. :param ros: The list that represents the table without the rowspans. :type ros: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return The list that represents th...
python
def _get_valid_model_table(self, ros): """ Returns a list that represents the table with the rowspans. :param ros: The list that represents the table without the rowspans. :type ros: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return The list that represents th...
[ "def", "_get_valid_model_table", "(", "self", ",", "ros", ")", ":", "# pylint: disable=no-self-use", "new_table", "=", "[", "]", "if", "bool", "(", "ros", ")", ":", "length_table", "=", "len", "(", "ros", ")", "for", "row_index", "in", "range", "(", "0", ...
Returns a list that represents the table with the rowspans. :param ros: The list that represents the table without the rowspans. :type ros: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return The list that represents the table with the rowspans. :rtype: list(list(hatemi...
[ "Returns", "a", "list", "that", "represents", "the", "table", "with", "the", "rowspans", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L64-L111
41,167
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._get_model_row
def _get_model_row(self, row): """ Returns a list that represents the line of table with the colspans. :param row: The list that represents the line of table without the colspans. :type row: list(hatemile.util.html.htmldomelement.HTMLDOMElement) :return: The ...
python
def _get_model_row(self, row): """ Returns a list that represents the line of table with the colspans. :param row: The list that represents the line of table without the colspans. :type row: list(hatemile.util.html.htmldomelement.HTMLDOMElement) :return: The ...
[ "def", "_get_model_row", "(", "self", ",", "row", ")", ":", "# pylint: disable=no-self-use", "new_row", "=", "[", "]", "+", "row", "size", "=", "len", "(", "row", ")", "for", "i", "in", "range", "(", "0", ",", "size", ")", ":", "cell", "=", "row", ...
Returns a list that represents the line of table with the colspans. :param row: The list that represents the line of table without the colspans. :type row: list(hatemile.util.html.htmldomelement.HTMLDOMElement) :return: The list that represents the line of table with the col...
[ "Returns", "a", "list", "that", "represents", "the", "line", "of", "table", "with", "the", "colspans", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L113-L134
41,168
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._validate_header
def _validate_header(self, hed): """ Validate the list that represents the table header. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return: True if the table header is valid or False if the tabl...
python
def _validate_header(self, hed): """ Validate the list that represents the table header. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return: True if the table header is valid or False if the tabl...
[ "def", "_validate_header", "(", "self", ",", "hed", ")", ":", "# pylint: disable=no-self-use", "if", "not", "bool", "(", "hed", ")", ":", "return", "False", "length", "=", "-", "1", "for", "row", "in", "hed", ":", "if", "not", "bool", "(", "row", ")", ...
Validate the list that represents the table header. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return: True if the table header is valid or False if the table header is not valid. :rtyp...
[ "Validate", "the", "list", "that", "represents", "the", "table", "header", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L136-L158
41,169
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._get_cells_headers_ids
def _get_cells_headers_ids(self, hed, index): """ Returns a list with ids of rows of same column. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :param index: The index of columns. :type inde...
python
def _get_cells_headers_ids(self, hed, index): """ Returns a list with ids of rows of same column. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :param index: The index of columns. :type inde...
[ "def", "_get_cells_headers_ids", "(", "self", ",", "hed", ",", "index", ")", ":", "# pylint: disable=no-self-use", "ids", "=", "[", "]", "for", "row", "in", "hed", ":", "if", "row", "[", "index", "]", ".", "get_tag_name", "(", ")", "==", "'TH'", ":", "...
Returns a list with ids of rows of same column. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :param index: The index of columns. :type index: int :return: The list with ids of rows of same column. ...
[ "Returns", "a", "list", "with", "ids", "of", "rows", "of", "same", "column", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L160-L177
41,170
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._associate_data_cells_with_header_cells_of_row
def _associate_data_cells_with_header_cells_of_row(self, element): """ Associate the data cell with header cell of row. :param element: The table body or table footer. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ table = self._get_model_table(elem...
python
def _associate_data_cells_with_header_cells_of_row(self, element): """ Associate the data cell with header cell of row. :param element: The table body or table footer. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ table = self._get_model_table(elem...
[ "def", "_associate_data_cells_with_header_cells_of_row", "(", "self", ",", "element", ")", ":", "table", "=", "self", ".", "_get_model_table", "(", "element", ")", "for", "row", "in", "table", ":", "headers_ids", "=", "[", "]", "for", "cell", "in", "row", ":...
Associate the data cell with header cell of row. :param element: The table body or table footer. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Associate", "the", "data", "cell", "with", "header", "cell", "of", "row", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L179-L205
41,171
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
AccessibleAssociationImplementation._prepare_header_cells
def _prepare_header_cells(self, table_header): """ Set the scope of header cells of table header. :param table_header: The table header. :type table_header: hatemile.util.html.htmldomelement.HTMLDOMElement """ cells = self.parser.find(table_header).find_children( ...
python
def _prepare_header_cells(self, table_header): """ Set the scope of header cells of table header. :param table_header: The table header. :type table_header: hatemile.util.html.htmldomelement.HTMLDOMElement """ cells = self.parser.find(table_header).find_children( ...
[ "def", "_prepare_header_cells", "(", "self", ",", "table_header", ")", ":", "cells", "=", "self", ".", "parser", ".", "find", "(", "table_header", ")", ".", "find_children", "(", "'tr'", ")", ".", "find_children", "(", "'th'", ")", ".", "list_results", "("...
Set the scope of header cells of table header. :param table_header: The table header. :type table_header: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Set", "the", "scope", "of", "header", "cells", "of", "table", "header", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L207-L221
41,172
AtomHash/evernode
evernode/classes/security.py
Security.encrypt
def encrypt(clear_text) -> str: """ Use config.json key to encrypt """ if not isinstance(clear_text, bytes): clear_text = str.encode(clear_text) cipher = Fernet(current_app.config['KEY']) return cipher.encrypt(clear_text).decode("utf-8")
python
def encrypt(clear_text) -> str: """ Use config.json key to encrypt """ if not isinstance(clear_text, bytes): clear_text = str.encode(clear_text) cipher = Fernet(current_app.config['KEY']) return cipher.encrypt(clear_text).decode("utf-8")
[ "def", "encrypt", "(", "clear_text", ")", "->", "str", ":", "if", "not", "isinstance", "(", "clear_text", ",", "bytes", ")", ":", "clear_text", "=", "str", ".", "encode", "(", "clear_text", ")", "cipher", "=", "Fernet", "(", "current_app", ".", "config",...
Use config.json key to encrypt
[ "Use", "config", ".", "json", "key", "to", "encrypt" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/security.py#L30-L35
41,173
AtomHash/evernode
evernode/classes/security.py
Security.decrypt
def decrypt(crypt_text) -> str: """ Use config.json key to decrypt """ cipher = Fernet(current_app.config['KEY']) if not isinstance(crypt_text, bytes): crypt_text = str.encode(crypt_text) return cipher.decrypt(crypt_text).decode("utf-8")
python
def decrypt(crypt_text) -> str: """ Use config.json key to decrypt """ cipher = Fernet(current_app.config['KEY']) if not isinstance(crypt_text, bytes): crypt_text = str.encode(crypt_text) return cipher.decrypt(crypt_text).decode("utf-8")
[ "def", "decrypt", "(", "crypt_text", ")", "->", "str", ":", "cipher", "=", "Fernet", "(", "current_app", ".", "config", "[", "'KEY'", "]", ")", "if", "not", "isinstance", "(", "crypt_text", ",", "bytes", ")", ":", "crypt_text", "=", "str", ".", "encode...
Use config.json key to decrypt
[ "Use", "config", ".", "json", "key", "to", "decrypt" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/security.py#L38-L43
41,174
rackerlabs/python-lunrclient
lunrclient/tools.py
Tools.get_volume
def get_volume(self, id): """ return volume information if the argument is an id or a path """ # If the id is actually a path if exists(id): with open(id) as file: size = os.lseek(file.fileno(), 0, os.SEEK_END) return {'path': id, 'size': s...
python
def get_volume(self, id): """ return volume information if the argument is an id or a path """ # If the id is actually a path if exists(id): with open(id) as file: size = os.lseek(file.fileno(), 0, os.SEEK_END) return {'path': id, 'size': s...
[ "def", "get_volume", "(", "self", ",", "id", ")", ":", "# If the id is actually a path", "if", "exists", "(", "id", ")", ":", "with", "open", "(", "id", ")", "as", "file", ":", "size", "=", "os", ".", "lseek", "(", "file", ".", "fileno", "(", ")", ...
return volume information if the argument is an id or a path
[ "return", "volume", "information", "if", "the", "argument", "is", "an", "id", "or", "a", "path" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/tools.py#L57-L66
41,175
rackerlabs/python-lunrclient
lunrclient/tools.py
Tools.randomize
def randomize(self, device=None, percent=100, silent=False): """ Writes random data to the beginning of each 4MB block on a block device this is useful when performance testing the backup process (Without any optional arguments will randomize the first 32k of each 4MB block on 1...
python
def randomize(self, device=None, percent=100, silent=False): """ Writes random data to the beginning of each 4MB block on a block device this is useful when performance testing the backup process (Without any optional arguments will randomize the first 32k of each 4MB block on 1...
[ "def", "randomize", "(", "self", ",", "device", "=", "None", ",", "percent", "=", "100", ",", "silent", "=", "False", ")", ":", "volume", "=", "self", ".", "get_volume", "(", "device", ")", "# The number of blocks in the volume", "blocks", "=", "int", "(",...
Writes random data to the beginning of each 4MB block on a block device this is useful when performance testing the backup process (Without any optional arguments will randomize the first 32k of each 4MB block on 100 percent of the device)
[ "Writes", "random", "data", "to", "the", "beginning", "of", "each", "4MB", "block", "on", "a", "block", "device", "this", "is", "useful", "when", "performance", "testing", "the", "backup", "process" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/tools.py#L78-L111
41,176
rackerlabs/python-lunrclient
lunrclient/tools.py
Tools.backup
def backup(self, id=None, src=None, timestamp=None): """ This runs a backup job outside of the storage api, which is useful for performance testing backups """ # Set basic Logging logging.basicConfig() # Get the lunr logger log = logger.get_logger() ...
python
def backup(self, id=None, src=None, timestamp=None): """ This runs a backup job outside of the storage api, which is useful for performance testing backups """ # Set basic Logging logging.basicConfig() # Get the lunr logger log = logger.get_logger() ...
[ "def", "backup", "(", "self", ",", "id", "=", "None", ",", "src", "=", "None", ",", "timestamp", "=", "None", ")", ":", "# Set basic Logging", "logging", ".", "basicConfig", "(", ")", "# Get the lunr logger", "log", "=", "logger", ".", "get_logger", "(", ...
This runs a backup job outside of the storage api, which is useful for performance testing backups
[ "This", "runs", "a", "backup", "job", "outside", "of", "the", "storage", "api", "which", "is", "useful", "for", "performance", "testing", "backups" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/tools.py#L176-L216
41,177
Yipit/eventlib
eventlib/util.py
get_ip
def get_ip(request): """Return the IP address inside the HTTP_X_FORWARDED_FOR var inside the `request` object. The return of this function can be overrided by the `LOCAL_GEOLOCATION_IP` variable in the `conf` module. This function will skip local IPs (starting with 10. and equals to 127.0.0.1)...
python
def get_ip(request): """Return the IP address inside the HTTP_X_FORWARDED_FOR var inside the `request` object. The return of this function can be overrided by the `LOCAL_GEOLOCATION_IP` variable in the `conf` module. This function will skip local IPs (starting with 10. and equals to 127.0.0.1)...
[ "def", "get_ip", "(", "request", ")", ":", "if", "getsetting", "(", "'LOCAL_GEOLOCATION_IP'", ")", ":", "return", "getsetting", "(", "'LOCAL_GEOLOCATION_IP'", ")", "forwarded_for", "=", "request", ".", "META", ".", "get", "(", "'HTTP_X_FORWARDED_FOR'", ")", "if"...
Return the IP address inside the HTTP_X_FORWARDED_FOR var inside the `request` object. The return of this function can be overrided by the `LOCAL_GEOLOCATION_IP` variable in the `conf` module. This function will skip local IPs (starting with 10. and equals to 127.0.0.1).
[ "Return", "the", "IP", "address", "inside", "the", "HTTP_X_FORWARDED_FOR", "var", "inside", "the", "request", "object", "." ]
0cf29e5251a59fcbfc727af5f5157a3bb03832e2
https://github.com/Yipit/eventlib/blob/0cf29e5251a59fcbfc727af5f5157a3bb03832e2/eventlib/util.py#L23-L46
41,178
Yipit/eventlib
eventlib/util.py
ConnectionManager.get_connection
def get_connection(self): """Return a valid redis connection based on the following settings * `REDIS_CONNECTIONS` * `EVENTLIB_REDIS_CONFIG_NAME` The first one is a dictionary in the following format: >>> { ... 'server1': {'HOST': 'redis-server-1', 'POST': 90...
python
def get_connection(self): """Return a valid redis connection based on the following settings * `REDIS_CONNECTIONS` * `EVENTLIB_REDIS_CONFIG_NAME` The first one is a dictionary in the following format: >>> { ... 'server1': {'HOST': 'redis-server-1', 'POST': 90...
[ "def", "get_connection", "(", "self", ")", ":", "if", "self", ".", "conn", ":", "return", "self", ".", "conn", "redis_configs", "=", "getsetting", "(", "'REDIS_CONNECTIONS'", ")", "if", "redis_configs", ":", "config_name", "=", "getsetting", "(", "'EVENTLIB_RE...
Return a valid redis connection based on the following settings * `REDIS_CONNECTIONS` * `EVENTLIB_REDIS_CONFIG_NAME` The first one is a dictionary in the following format: >>> { ... 'server1': {'HOST': 'redis-server-1', 'POST': 9001}, ... 'server2': {'HOS...
[ "Return", "a", "valid", "redis", "connection", "based", "on", "the", "following", "settings" ]
0cf29e5251a59fcbfc727af5f5157a3bb03832e2
https://github.com/Yipit/eventlib/blob/0cf29e5251a59fcbfc727af5f5157a3bb03832e2/eventlib/util.py#L54-L83
41,179
Jarn/jarn.mkrelease
jarn/mkrelease/setuptools.py
Setuptools._run_setup_py
def _run_setup_py(self, args, echo=True, echo2=True, ff=''): """Run setup.py with monkey-patched setuptools. The patch forces setuptools to use the file-finder 'ff'. If 'ff' is the empty string, the patch is not applied. 'args' is the list of arguments that should be passed to ...
python
def _run_setup_py(self, args, echo=True, echo2=True, ff=''): """Run setup.py with monkey-patched setuptools. The patch forces setuptools to use the file-finder 'ff'. If 'ff' is the empty string, the patch is not applied. 'args' is the list of arguments that should be passed to ...
[ "def", "_run_setup_py", "(", "self", ",", "args", ",", "echo", "=", "True", ",", "echo2", "=", "True", ",", "ff", "=", "''", ")", ":", "python", "=", "self", ".", "python", "if", "ff", ":", "setup_py", "=", "'-c\"%s\"'", "%", "(", "RUN_SETUP", "%",...
Run setup.py with monkey-patched setuptools. The patch forces setuptools to use the file-finder 'ff'. If 'ff' is the empty string, the patch is not applied. 'args' is the list of arguments that should be passed to setup.py.
[ "Run", "setup", ".", "py", "with", "monkey", "-", "patched", "setuptools", "." ]
844377f37a3cdc0a154148790a926f991019ec4a
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setuptools.py#L192-L211
41,180
helixyte/everest
everest/run.py
app_factory
def app_factory(global_settings, **local_settings): # pylint: disable=W0613 """ Default factory for creating a WSGI application using the everest configurator and root factory. :param dict global_settings: Global settings extracted from an ini file. Not used in this default app factory. :pa...
python
def app_factory(global_settings, **local_settings): # pylint: disable=W0613 """ Default factory for creating a WSGI application using the everest configurator and root factory. :param dict global_settings: Global settings extracted from an ini file. Not used in this default app factory. :pa...
[ "def", "app_factory", "(", "global_settings", ",", "*", "*", "local_settings", ")", ":", "# pylint: disable=W0613", "config", "=", "Configurator", "(", ")", "config", ".", "setup_registry", "(", "settings", "=", "local_settings", ",", "root_factory", "=", "RootFac...
Default factory for creating a WSGI application using the everest configurator and root factory. :param dict global_settings: Global settings extracted from an ini file. Not used in this default app factory. :param dict local_settings: App settings extracted from an ini file.
[ "Default", "factory", "for", "creating", "a", "WSGI", "application", "using", "the", "everest", "configurator", "and", "root", "factory", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/run.py#L18-L40
41,181
Overboard/httpfind
httpfind/httpfind.py
fetch_page
async def fetch_page(session, host): """ Perform the page fetch from an individual host. `session` - An aiohttp [client session](http://aiohttp.readthedocs.io/en/stable/client_reference.html#client-session) `host` - URL to fetch `return` tuple with the following: * The host parameter ...
python
async def fetch_page(session, host): """ Perform the page fetch from an individual host. `session` - An aiohttp [client session](http://aiohttp.readthedocs.io/en/stable/client_reference.html#client-session) `host` - URL to fetch `return` tuple with the following: * The host parameter ...
[ "async", "def", "fetch_page", "(", "session", ",", "host", ")", ":", "await", "asyncio", ".", "sleep", "(", "random", ".", "randint", "(", "0", ",", "25", ")", "*", "0.1", ")", "start", "=", "time", ".", "time", "(", ")", "logger", ".", "info", "...
Perform the page fetch from an individual host. `session` - An aiohttp [client session](http://aiohttp.readthedocs.io/en/stable/client_reference.html#client-session) `host` - URL to fetch `return` tuple with the following: * The host parameter * A vague status string * Text ...
[ "Perform", "the", "page", "fetch", "from", "an", "individual", "host", "." ]
2c372daa66dcc7158e8bb179b29d8001d473bc4a
https://github.com/Overboard/httpfind/blob/2c372daa66dcc7158e8bb179b29d8001d473bc4a/httpfind/httpfind.py#L17-L65
41,182
Overboard/httpfind
httpfind/httpfind.py
asynchronous
async def asynchronous(urls=None, re_filter=None): """ Asynchronous request manager for session. Returns list of responses that match the filter. `urls` - tuple of URLs to request `re_filter` - a compiled regular expression [object](https://docs.python.org/3/library/re.html#re-objects) """ ...
python
async def asynchronous(urls=None, re_filter=None): """ Asynchronous request manager for session. Returns list of responses that match the filter. `urls` - tuple of URLs to request `re_filter` - a compiled regular expression [object](https://docs.python.org/3/library/re.html#re-objects) """ ...
[ "async", "def", "asynchronous", "(", "urls", "=", "None", ",", "re_filter", "=", "None", ")", ":", "class", "_URLBase", "(", "str", ")", ":", "\"\"\" Convenient access to hostname (ip) portion of the URL \"\"\"", "@", "property", "def", "hostname", "(", "self", ")...
Asynchronous request manager for session. Returns list of responses that match the filter. `urls` - tuple of URLs to request `re_filter` - a compiled regular expression [object](https://docs.python.org/3/library/re.html#re-objects)
[ "Asynchronous", "request", "manager", "for", "session", ".", "Returns", "list", "of", "responses", "that", "match", "the", "filter", "." ]
2c372daa66dcc7158e8bb179b29d8001d473bc4a
https://github.com/Overboard/httpfind/blob/2c372daa66dcc7158e8bb179b29d8001d473bc4a/httpfind/httpfind.py#L68-L102
41,183
Overboard/httpfind
httpfind/httpfind.py
url_generator
def url_generator(network=None, path=''): """ Return a tuple of URLs with path, one for each host on network `network` - IP address and subnet mask compatible with [ipaddress library](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network) `path` - Path portion of a URL as defined by ...
python
def url_generator(network=None, path=''): """ Return a tuple of URLs with path, one for each host on network `network` - IP address and subnet mask compatible with [ipaddress library](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network) `path` - Path portion of a URL as defined by ...
[ "def", "url_generator", "(", "network", "=", "None", ",", "path", "=", "''", ")", ":", "network_object", "=", "ipaddress", ".", "ip_network", "(", "network", ")", "if", "network_object", ".", "num_addresses", ">", "256", ":", "# will need to batch process this c...
Return a tuple of URLs with path, one for each host on network `network` - IP address and subnet mask compatible with [ipaddress library](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network) `path` - Path portion of a URL as defined by [url(un)split](https://docs.python.org/3/libr...
[ "Return", "a", "tuple", "of", "URLs", "with", "path", "one", "for", "each", "host", "on", "network" ]
2c372daa66dcc7158e8bb179b29d8001d473bc4a
https://github.com/Overboard/httpfind/blob/2c372daa66dcc7158e8bb179b29d8001d473bc4a/httpfind/httpfind.py#L105-L124
41,184
Overboard/httpfind
httpfind/httpfind.py
survey
def survey(network=None, path='', pattern='', log=False): """ Search network for hosts with a response to path that matches pattern `network` - IP address and subnet mask compatible with [ipaddress library](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network) `path` - Path portion ...
python
def survey(network=None, path='', pattern='', log=False): """ Search network for hosts with a response to path that matches pattern `network` - IP address and subnet mask compatible with [ipaddress library](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network) `path` - Path portion ...
[ "def", "survey", "(", "network", "=", "None", ",", "path", "=", "''", ",", "pattern", "=", "''", ",", "log", "=", "False", ")", ":", "if", "log", ":", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "else", ":", "logger", ".", "setL...
Search network for hosts with a response to path that matches pattern `network` - IP address and subnet mask compatible with [ipaddress library](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network) `path` - Path portion of a URL as defined by [url(un)split](https://docs.python.org...
[ "Search", "network", "for", "hosts", "with", "a", "response", "to", "path", "that", "matches", "pattern" ]
2c372daa66dcc7158e8bb179b29d8001d473bc4a
https://github.com/Overboard/httpfind/blob/2c372daa66dcc7158e8bb179b29d8001d473bc4a/httpfind/httpfind.py#L127-L154
41,185
contains-io/rcli
rcli/display.py
hidden_cursor
def hidden_cursor(): """Temporarily hide the terminal cursor.""" if sys.stdout.isatty(): _LOGGER.debug('Hiding cursor.') print('\x1B[?25l', end='') sys.stdout.flush() try: yield finally: if sys.stdout.isatty(): _LOGGER.debug('Showing cursor.') ...
python
def hidden_cursor(): """Temporarily hide the terminal cursor.""" if sys.stdout.isatty(): _LOGGER.debug('Hiding cursor.') print('\x1B[?25l', end='') sys.stdout.flush() try: yield finally: if sys.stdout.isatty(): _LOGGER.debug('Showing cursor.') ...
[ "def", "hidden_cursor", "(", ")", ":", "if", "sys", ".", "stdout", ".", "isatty", "(", ")", ":", "_LOGGER", ".", "debug", "(", "'Hiding cursor.'", ")", "print", "(", "'\\x1B[?25l'", ",", "end", "=", "''", ")", "sys", ".", "stdout", ".", "flush", "(",...
Temporarily hide the terminal cursor.
[ "Temporarily", "hide", "the", "terminal", "cursor", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/display.py#L64-L76
41,186
contains-io/rcli
rcli/display.py
display_status
def display_status(): """Display an OK or FAILED message for the context block.""" def print_status(msg, color): """Print the status message. Args: msg: The message to display (e.g. OK or FAILED). color: The ANSI color code to use in displaying the message. """ ...
python
def display_status(): """Display an OK or FAILED message for the context block.""" def print_status(msg, color): """Print the status message. Args: msg: The message to display (e.g. OK or FAILED). color: The ANSI color code to use in displaying the message. """ ...
[ "def", "display_status", "(", ")", ":", "def", "print_status", "(", "msg", ",", "color", ")", ":", "\"\"\"Print the status message.\n\n Args:\n msg: The message to display (e.g. OK or FAILED).\n color: The ANSI color code to use in displaying the message.\n ...
Display an OK or FAILED message for the context block.
[ "Display", "an", "OK", "or", "FAILED", "message", "for", "the", "context", "block", "." ]
cdd6191a0e0a19bc767f84921650835d099349cf
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/display.py#L80-L113
41,187
mcash/merchant-api-python-sdk
mcash/mapi_client/pusherconnector.py
PusherConnector._pusher_connect_handler
def _pusher_connect_handler(self, data): """Event handler for the connection_established event. Binds the shortlink_scanned event """ self.channel = self.pusher.subscribe(self.pos_callback_chan) for listener in self.pusher_connected_listeners: listener(data)
python
def _pusher_connect_handler(self, data): """Event handler for the connection_established event. Binds the shortlink_scanned event """ self.channel = self.pusher.subscribe(self.pos_callback_chan) for listener in self.pusher_connected_listeners: listener(data)
[ "def", "_pusher_connect_handler", "(", "self", ",", "data", ")", ":", "self", ".", "channel", "=", "self", ".", "pusher", ".", "subscribe", "(", "self", ".", "pos_callback_chan", ")", "for", "listener", "in", "self", ".", "pusher_connected_listeners", ":", "...
Event handler for the connection_established event. Binds the shortlink_scanned event
[ "Event", "handler", "for", "the", "connection_established", "event", ".", "Binds", "the", "shortlink_scanned", "event" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/pusherconnector.py#L33-L39
41,188
mcash/merchant-api-python-sdk
mcash/mapi_client/pusherconnector.py
PusherConnector._runForever
def _runForever(self, stop_event): """Runs the main loop Arguments: stop_event: threading.Event() as a stop signal """ while(not stop_event.is_set()): state = self.pusher.connection.state if (state is not "connecting" and state is...
python
def _runForever(self, stop_event): """Runs the main loop Arguments: stop_event: threading.Event() as a stop signal """ while(not stop_event.is_set()): state = self.pusher.connection.state if (state is not "connecting" and state is...
[ "def", "_runForever", "(", "self", ",", "stop_event", ")", ":", "while", "(", "not", "stop_event", ".", "is_set", "(", ")", ")", ":", "state", "=", "self", ".", "pusher", ".", "connection", ".", "state", "if", "(", "state", "is", "not", "\"connecting\"...
Runs the main loop Arguments: stop_event: threading.Event() as a stop signal
[ "Runs", "the", "main", "loop" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/pusherconnector.py#L50-L65
41,189
mcash/merchant-api-python-sdk
mcash/mapi_client/pusherconnector.py
PusherConnector.stop
def stop(self): """Stops the pusherclient cleanly """ self.pusherthread_stop.set() self.pusher.disconnect() # wait until pusher is down while self.pusher.connection.state is "connected": sleep(0.1) logging.info("shutting down pusher connector thread")
python
def stop(self): """Stops the pusherclient cleanly """ self.pusherthread_stop.set() self.pusher.disconnect() # wait until pusher is down while self.pusher.connection.state is "connected": sleep(0.1) logging.info("shutting down pusher connector thread")
[ "def", "stop", "(", "self", ")", ":", "self", ".", "pusherthread_stop", ".", "set", "(", ")", "self", ".", "pusher", ".", "disconnect", "(", ")", "# wait until pusher is down", "while", "self", ".", "pusher", ".", "connection", ".", "state", "is", "\"conne...
Stops the pusherclient cleanly
[ "Stops", "the", "pusherclient", "cleanly" ]
ebe8734126790354b71077aca519ff263235944e
https://github.com/mcash/merchant-api-python-sdk/blob/ebe8734126790354b71077aca519ff263235944e/mcash/mapi_client/pusherconnector.py#L67-L76
41,190
dariusbakunas/rawdisk
rawdisk/scheme/gpt.py
Gpt.load
def load(self, filename, bs=512): """Loads GPT partition table. Args: filename (str): path to file or device to open for reading bs (uint): Block size of the volume, default: 512 Raises: IOError: If file does not exist or not readable """ wit...
python
def load(self, filename, bs=512): """Loads GPT partition table. Args: filename (str): path to file or device to open for reading bs (uint): Block size of the volume, default: 512 Raises: IOError: If file does not exist or not readable """ wit...
[ "def", "load", "(", "self", ",", "filename", ",", "bs", "=", "512", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "f", ":", "f", ".", "seek", "(", "GPT_HEADER_OFFSET", "+", "0x0C", ")", "header_size", "=", "struct", ".", "unpac...
Loads GPT partition table. Args: filename (str): path to file or device to open for reading bs (uint): Block size of the volume, default: 512 Raises: IOError: If file does not exist or not readable
[ "Loads", "GPT", "partition", "table", "." ]
1dc9d0b377fe5da3c406ccec4abc238c54167403
https://github.com/dariusbakunas/rawdisk/blob/1dc9d0b377fe5da3c406ccec4abc238c54167403/rawdisk/scheme/gpt.py#L66-L87
41,191
cstatz/maui
maui/backend/index.py
IndexMapper.global_to_local
def global_to_local(self, index): """ Calculate local index from global index :param index: input index :return: local index for data """ if (type(index) is int) or (type(index) is slice): if len(self.__mask) > 1: raise IndexError('check length of par...
python
def global_to_local(self, index): """ Calculate local index from global index :param index: input index :return: local index for data """ if (type(index) is int) or (type(index) is slice): if len(self.__mask) > 1: raise IndexError('check length of par...
[ "def", "global_to_local", "(", "self", ",", "index", ")", ":", "if", "(", "type", "(", "index", ")", "is", "int", ")", "or", "(", "type", "(", "index", ")", "is", "slice", ")", ":", "if", "len", "(", "self", ".", "__mask", ")", ">", "1", ":", ...
Calculate local index from global index :param index: input index :return: local index for data
[ "Calculate", "local", "index", "from", "global", "index" ]
db99986e93699ee20c5cffdd5b4ee446f8607c5d
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/backend/index.py#L158-L202
41,192
cstatz/maui
maui/backend/index.py
IndexMapper.int_global_to_local_start
def int_global_to_local_start(self, index, axis=0): """ Calculate local index from global index from start_index :param index: global index as integer :param axis: current axis to process :return: """ if index >= self.__mask[axis].stop-self.__halos[1][axis]: ...
python
def int_global_to_local_start(self, index, axis=0): """ Calculate local index from global index from start_index :param index: global index as integer :param axis: current axis to process :return: """ if index >= self.__mask[axis].stop-self.__halos[1][axis]: ...
[ "def", "int_global_to_local_start", "(", "self", ",", "index", ",", "axis", "=", "0", ")", ":", "if", "index", ">=", "self", ".", "__mask", "[", "axis", "]", ".", "stop", "-", "self", ".", "__halos", "[", "1", "]", "[", "axis", "]", ":", "return", ...
Calculate local index from global index from start_index :param index: global index as integer :param axis: current axis to process :return:
[ "Calculate", "local", "index", "from", "global", "index", "from", "start_index" ]
db99986e93699ee20c5cffdd5b4ee446f8607c5d
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/backend/index.py#L204-L217
41,193
cstatz/maui
maui/backend/index.py
IndexMapper.int_global_to_local_stop
def int_global_to_local_stop(self, index, axis=0): """ Calculate local index from global index from stop_index :param index: global index as integer :param axis: current axis to process :return: """ if index < self.__mask[axis].start+self.__halos[0][axis]: re...
python
def int_global_to_local_stop(self, index, axis=0): """ Calculate local index from global index from stop_index :param index: global index as integer :param axis: current axis to process :return: """ if index < self.__mask[axis].start+self.__halos[0][axis]: re...
[ "def", "int_global_to_local_stop", "(", "self", ",", "index", ",", "axis", "=", "0", ")", ":", "if", "index", "<", "self", ".", "__mask", "[", "axis", "]", ".", "start", "+", "self", ".", "__halos", "[", "0", "]", "[", "axis", "]", ":", "return", ...
Calculate local index from global index from stop_index :param index: global index as integer :param axis: current axis to process :return:
[ "Calculate", "local", "index", "from", "global", "index", "from", "stop_index" ]
db99986e93699ee20c5cffdd5b4ee446f8607c5d
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/backend/index.py#L219-L232
41,194
cstatz/maui
maui/backend/index.py
IndexMapper.int_global_to_local
def int_global_to_local(self, index, axis=0): """ Calculate local index from global index for integer input :param index: global index as integer :param axis: current axis to process :return: """ # Warum >= an dieser Stelle. Eigentlich sollte > ausreichend sein! Test! ...
python
def int_global_to_local(self, index, axis=0): """ Calculate local index from global index for integer input :param index: global index as integer :param axis: current axis to process :return: """ # Warum >= an dieser Stelle. Eigentlich sollte > ausreichend sein! Test! ...
[ "def", "int_global_to_local", "(", "self", ",", "index", ",", "axis", "=", "0", ")", ":", "# Warum >= an dieser Stelle. Eigentlich sollte > ausreichend sein! Test!", "if", "index", ">=", "self", ".", "__mask", "[", "axis", "]", ".", "stop", "-", "self", ".", "__...
Calculate local index from global index for integer input :param index: global index as integer :param axis: current axis to process :return:
[ "Calculate", "local", "index", "from", "global", "index", "for", "integer", "input" ]
db99986e93699ee20c5cffdd5b4ee446f8607c5d
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/backend/index.py#L234-L249
41,195
cstatz/maui
maui/backend/index.py
IndexBoundsHandler.int_out_of_bounds
def int_out_of_bounds(self, index, axis=0): """ examples if index is out of local processing bounds function is used to perform examples for index of type integer :param index: global index to examples as type int :param axis: current axis to examples :return: return input or ra...
python
def int_out_of_bounds(self, index, axis=0): """ examples if index is out of local processing bounds function is used to perform examples for index of type integer :param index: global index to examples as type int :param axis: current axis to examples :return: return input or ra...
[ "def", "int_out_of_bounds", "(", "self", ",", "index", ",", "axis", "=", "0", ")", ":", "#if index >= self._global_shape[axis]:", "if", "index", ">", "self", ".", "_global_shape", "[", "axis", "]", ":", "raise", "IndexError", "(", "'index is larger than the upper ...
examples if index is out of local processing bounds function is used to perform examples for index of type integer :param index: global index to examples as type int :param axis: current axis to examples :return: return input or raise error
[ "examples", "if", "index", "is", "out", "of", "local", "processing", "bounds" ]
db99986e93699ee20c5cffdd5b4ee446f8607c5d
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/backend/index.py#L264-L285
41,196
cstatz/maui
maui/backend/index.py
IndexBoundsHandler.out_of_bounds
def out_of_bounds(self, index): """ Check index for out of bounds :param index: index as integer, tuple or slice :return: local index as tuple """ if type(index) is int: return self.int_out_of_bounds(index) elif type(index) is slice: return self....
python
def out_of_bounds(self, index): """ Check index for out of bounds :param index: index as integer, tuple or slice :return: local index as tuple """ if type(index) is int: return self.int_out_of_bounds(index) elif type(index) is slice: return self....
[ "def", "out_of_bounds", "(", "self", ",", "index", ")", ":", "if", "type", "(", "index", ")", "is", "int", ":", "return", "self", ".", "int_out_of_bounds", "(", "index", ")", "elif", "type", "(", "index", ")", "is", "slice", ":", "return", "self", "....
Check index for out of bounds :param index: index as integer, tuple or slice :return: local index as tuple
[ "Check", "index", "for", "out", "of", "bounds" ]
db99986e93699ee20c5cffdd5b4ee446f8607c5d
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/backend/index.py#L304-L333
41,197
silver-castle/mach9
mach9/server.py
Server.get_server_setting
def get_server_setting(self, protocol, host='127.0.0.1', port=8000, debug=False, ssl=None, sock=None, workers=1, loop=None, backlog=100, has_log=True): '''Helper function used by `run`.''' if isinstance(ssl, dict): # try common aliaseses...
python
def get_server_setting(self, protocol, host='127.0.0.1', port=8000, debug=False, ssl=None, sock=None, workers=1, loop=None, backlog=100, has_log=True): '''Helper function used by `run`.''' if isinstance(ssl, dict): # try common aliaseses...
[ "def", "get_server_setting", "(", "self", ",", "protocol", ",", "host", "=", "'127.0.0.1'", ",", "port", "=", "8000", ",", "debug", "=", "False", ",", "ssl", "=", "None", ",", "sock", "=", "None", ",", "workers", "=", "1", ",", "loop", "=", "None", ...
Helper function used by `run`.
[ "Helper", "function", "used", "by", "run", "." ]
7a623aab3c70d89d36ade6901b6307e115400c5e
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/server.py#L40-L95
41,198
RI-imaging/qpformat
qpformat/file_formats/series_hdf5_qpimage.py
SeriesHdf5Qpimage.verify
def verify(path): """Verify that `path` has the qpimage series file format""" valid = False try: h5 = h5py.File(path, mode="r") qpi0 = h5["qpi_0"] except (OSError, KeyError): pass else: if ("qpimage version" in qpi0.attrs and ...
python
def verify(path): """Verify that `path` has the qpimage series file format""" valid = False try: h5 = h5py.File(path, mode="r") qpi0 = h5["qpi_0"] except (OSError, KeyError): pass else: if ("qpimage version" in qpi0.attrs and ...
[ "def", "verify", "(", "path", ")", ":", "valid", "=", "False", "try", ":", "h5", "=", "h5py", ".", "File", "(", "path", ",", "mode", "=", "\"r\"", ")", "qpi0", "=", "h5", "[", "\"qpi_0\"", "]", "except", "(", "OSError", ",", "KeyError", ")", ":",...
Verify that `path` has the qpimage series file format
[ "Verify", "that", "path", "has", "the", "qpimage", "series", "file", "format" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/series_hdf5_qpimage.py#L63-L78
41,199
callowayproject/Calloway
calloway/apps/django_ext/management/commands/generate_reqs.py
generate_requirements
def generate_requirements(output_path=None): """ Loop through the INSTALLED_APPS and create a set of requirements for pip. if output_path is ``None`` then write to standard out, otherwise write to the path. """ from django.conf import settings reqs = set() for app in settings.I...
python
def generate_requirements(output_path=None): """ Loop through the INSTALLED_APPS and create a set of requirements for pip. if output_path is ``None`` then write to standard out, otherwise write to the path. """ from django.conf import settings reqs = set() for app in settings.I...
[ "def", "generate_requirements", "(", "output_path", "=", "None", ")", ":", "from", "django", ".", "conf", "import", "settings", "reqs", "=", "set", "(", ")", "for", "app", "in", "settings", ".", "INSTALLED_APPS", ":", "if", "app", "in", "mapping", ".", "...
Loop through the INSTALLED_APPS and create a set of requirements for pip. if output_path is ``None`` then write to standard out, otherwise write to the path.
[ "Loop", "through", "the", "INSTALLED_APPS", "and", "create", "a", "set", "of", "requirements", "for", "pip", ".", "if", "output_path", "is", "None", "then", "write", "to", "standard", "out", "otherwise", "write", "to", "the", "path", "." ]
d22e98d41fbd298ab6393ba7bd84a75528be9f81
https://github.com/callowayproject/Calloway/blob/d22e98d41fbd298ab6393ba7bd84a75528be9f81/calloway/apps/django_ext/management/commands/generate_reqs.py#L60-L84