repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
GemHQ/round-py
round/applications.py
Application.get_wallets
def get_wallets(self, fetch=False): """Return this Applications's wallets object, populating it if fetch is True.""" return Wallets( self.resource.wallets, self.client, populate=fetch, application=self)
python
def get_wallets(self, fetch=False): """Return this Applications's wallets object, populating it if fetch is True.""" return Wallets( self.resource.wallets, self.client, populate=fetch, application=self)
[ "def", "get_wallets", "(", "self", ",", "fetch", "=", "False", ")", ":", "return", "Wallets", "(", "self", ".", "resource", ".", "wallets", ",", "self", ".", "client", ",", "populate", "=", "fetch", ",", "application", "=", "self", ")" ]
Return this Applications's wallets object, populating it if fetch is True.
[ "Return", "this", "Applications", "s", "wallets", "object", "populating", "it", "if", "fetch", "is", "True", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/applications.py#L107-L111
GemHQ/round-py
round/applications.py
Application.get_netki_domains
def get_netki_domains(self, fetch=False): """Return the Applications NetkiDomains object, populating it if fetch is True.""" return NetkiDomains( self.resource.netki_domains, self.client, populate=fetch)
python
def get_netki_domains(self, fetch=False): """Return the Applications NetkiDomains object, populating it if fetch is True.""" return NetkiDomains( self.resource.netki_domains, self.client, populate=fetch)
[ "def", "get_netki_domains", "(", "self", ",", "fetch", "=", "False", ")", ":", "return", "NetkiDomains", "(", "self", ".", "resource", ".", "netki_domains", ",", "self", ".", "client", ",", "populate", "=", "fetch", ")" ]
Return the Applications NetkiDomains object, populating it if fetch is True.
[ "Return", "the", "Applications", "NetkiDomains", "object", "populating", "it", "if", "fetch", "is", "True", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/applications.py#L135-L139
johnnoone/facts
facts/grafts/system_grafts.py
os_info
def os_info(): """Returns os data. """ return { 'uname': dict(platform.uname()._asdict()), 'path': os.environ.get('PATH', '').split(':'), 'shell': os.environ.get('SHELL', '/bin/sh'), }
python
def os_info(): """Returns os data. """ return { 'uname': dict(platform.uname()._asdict()), 'path': os.environ.get('PATH', '').split(':'), 'shell': os.environ.get('SHELL', '/bin/sh'), }
[ "def", "os_info", "(", ")", ":", "return", "{", "'uname'", ":", "dict", "(", "platform", ".", "uname", "(", ")", ".", "_asdict", "(", ")", ")", ",", "'path'", ":", "os", ".", "environ", ".", "get", "(", "'PATH'", ",", "''", ")", ".", "split", "...
Returns os data.
[ "Returns", "os", "data", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L26-L33
johnnoone/facts
facts/grafts/system_grafts.py
network_info
def network_info(): """Returns hostname, ipv4 and ipv6. """ def extract(host, family): return socket.getaddrinfo(host, None, family)[0][4][0] host = socket.gethostname() response = { 'hostname': host, 'ipv4': None, 'ipv6': None } with suppress(IndexError, soc...
python
def network_info(): """Returns hostname, ipv4 and ipv6. """ def extract(host, family): return socket.getaddrinfo(host, None, family)[0][4][0] host = socket.gethostname() response = { 'hostname': host, 'ipv4': None, 'ipv6': None } with suppress(IndexError, soc...
[ "def", "network_info", "(", ")", ":", "def", "extract", "(", "host", ",", "family", ")", ":", "return", "socket", ".", "getaddrinfo", "(", "host", ",", "None", ",", "family", ")", "[", "0", "]", "[", "4", "]", "[", "0", "]", "host", "=", "socket"...
Returns hostname, ipv4 and ipv6.
[ "Returns", "hostname", "ipv4", "and", "ipv6", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L60-L76
johnnoone/facts
facts/grafts/system_grafts.py
mac_addr_info
def mac_addr_info(): """Returns mac address. """ mac = get_mac() if mac == get_mac(): # not random generated hexa = '%012x' % mac value = ':'.join(hexa[i:i+2] for i in range(0, 12, 2)) else: value = None return {'mac': value}
python
def mac_addr_info(): """Returns mac address. """ mac = get_mac() if mac == get_mac(): # not random generated hexa = '%012x' % mac value = ':'.join(hexa[i:i+2] for i in range(0, 12, 2)) else: value = None return {'mac': value}
[ "def", "mac_addr_info", "(", ")", ":", "mac", "=", "get_mac", "(", ")", "if", "mac", "==", "get_mac", "(", ")", ":", "# not random generated", "hexa", "=", "'%012x'", "%", "mac", "value", "=", "':'", ".", "join", "(", "hexa", "[", "i", ":", "i", "+...
Returns mac address.
[ "Returns", "mac", "address", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L80-L89
johnnoone/facts
facts/grafts/system_grafts.py
interfaces_info
def interfaces_info(): """Returns interfaces data. """ def replace(value): if value == netifaces.AF_LINK: return 'link' if value == netifaces.AF_INET: return 'ipv4' if value == netifaces.AF_INET6: return 'ipv6' return value results = {...
python
def interfaces_info(): """Returns interfaces data. """ def replace(value): if value == netifaces.AF_LINK: return 'link' if value == netifaces.AF_INET: return 'ipv4' if value == netifaces.AF_INET6: return 'ipv6' return value results = {...
[ "def", "interfaces_info", "(", ")", ":", "def", "replace", "(", "value", ")", ":", "if", "value", "==", "netifaces", ".", "AF_LINK", ":", "return", "'link'", "if", "value", "==", "netifaces", ".", "AF_INET", ":", "return", "'ipv4'", "if", "value", "==", ...
Returns interfaces data.
[ "Returns", "interfaces", "data", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L104-L121
johnnoone/facts
facts/grafts/system_grafts.py
gateways_info
def gateways_info(): """Returns gateways data. """ data = netifaces.gateways() results = {'default': {}} with suppress(KeyError): results['ipv4'] = data[netifaces.AF_INET] results['default']['ipv4'] = data['default'][netifaces.AF_INET] with suppress(KeyError): results['i...
python
def gateways_info(): """Returns gateways data. """ data = netifaces.gateways() results = {'default': {}} with suppress(KeyError): results['ipv4'] = data[netifaces.AF_INET] results['default']['ipv4'] = data['default'][netifaces.AF_INET] with suppress(KeyError): results['i...
[ "def", "gateways_info", "(", ")", ":", "data", "=", "netifaces", ".", "gateways", "(", ")", "results", "=", "{", "'default'", ":", "{", "}", "}", "with", "suppress", "(", "KeyError", ")", ":", "results", "[", "'ipv4'", "]", "=", "data", "[", "netifac...
Returns gateways data.
[ "Returns", "gateways", "data", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L125-L138
johnnoone/facts
facts/grafts/system_grafts.py
memory_data
def memory_data(): """Returns memory data. """ vm = psutil.virtual_memory() sw = psutil.swap_memory() return { 'virtual': { 'total': mark(vm.total, 'bytes'), 'free': mark(vm.free, 'bytes'), 'percent': mark(vm.percent, 'percentage') }, 'swa...
python
def memory_data(): """Returns memory data. """ vm = psutil.virtual_memory() sw = psutil.swap_memory() return { 'virtual': { 'total': mark(vm.total, 'bytes'), 'free': mark(vm.free, 'bytes'), 'percent': mark(vm.percent, 'percentage') }, 'swa...
[ "def", "memory_data", "(", ")", ":", "vm", "=", "psutil", ".", "virtual_memory", "(", ")", "sw", "=", "psutil", ".", "swap_memory", "(", ")", "return", "{", "'virtual'", ":", "{", "'total'", ":", "mark", "(", "vm", ".", "total", ",", "'bytes'", ")", ...
Returns memory data.
[ "Returns", "memory", "data", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L152-L169
johnnoone/facts
facts/grafts/system_grafts.py
devices_data
def devices_data(): """Returns devices data. """ response = {} for part in psutil.disk_partitions(): device = part.device response[device] = { 'device': device, 'mountpoint': part.mountpoint, 'fstype': part.fstype, 'opts': part.opts, ...
python
def devices_data(): """Returns devices data. """ response = {} for part in psutil.disk_partitions(): device = part.device response[device] = { 'device': device, 'mountpoint': part.mountpoint, 'fstype': part.fstype, 'opts': part.opts, ...
[ "def", "devices_data", "(", ")", ":", "response", "=", "{", "}", "for", "part", "in", "psutil", ".", "disk_partitions", "(", ")", ":", "device", "=", "part", ".", "device", "response", "[", "device", "]", "=", "{", "'device'", ":", "device", ",", "'m...
Returns devices data.
[ "Returns", "devices", "data", "." ]
train
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L173-L193
mugurbil/gnm
examples/simple_2D/simple_2D.py
integrator
def integrator(integrand,xmin,xmax,n_points,factor=2): ''' Creating theoretical curve for 2D model functions integrator function ''' integral_vector = np.empty([n_points+1]) dx = (xmax-xmin)/n_points # integrate for i in xrange(n_points+1): xnow = xmin + i * dx integral,...
python
def integrator(integrand,xmin,xmax,n_points,factor=2): ''' Creating theoretical curve for 2D model functions integrator function ''' integral_vector = np.empty([n_points+1]) dx = (xmax-xmin)/n_points # integrate for i in xrange(n_points+1): xnow = xmin + i * dx integral,...
[ "def", "integrator", "(", "integrand", ",", "xmin", ",", "xmax", ",", "n_points", ",", "factor", "=", "2", ")", ":", "integral_vector", "=", "np", ".", "empty", "(", "[", "n_points", "+", "1", "]", ")", "dx", "=", "(", "xmax", "-", "xmin", ")", "...
Creating theoretical curve for 2D model functions integrator function
[ "Creating", "theoretical", "curve", "for", "2D", "model", "functions", "integrator", "function" ]
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/examples/simple_2D/simple_2D.py#L94-L110
mugurbil/gnm
examples/simple_2D/simple_2D.py
rotate
def rotate(f,x,theta=0): ''' Returns a function that takes as input the 1D vector along the angle given a function that takes in 2D input ''' f_R = lambda b: f(np.array([[x*np.cos(theta)-b*np.sin(theta)], [x*np.sin(theta)+b*np.cos(theta)]])) return f_R
python
def rotate(f,x,theta=0): ''' Returns a function that takes as input the 1D vector along the angle given a function that takes in 2D input ''' f_R = lambda b: f(np.array([[x*np.cos(theta)-b*np.sin(theta)], [x*np.sin(theta)+b*np.cos(theta)]])) return f_R
[ "def", "rotate", "(", "f", ",", "x", ",", "theta", "=", "0", ")", ":", "f_R", "=", "lambda", "b", ":", "f", "(", "np", ".", "array", "(", "[", "[", "x", "*", "np", ".", "cos", "(", "theta", ")", "-", "b", "*", "np", ".", "sin", "(", "th...
Returns a function that takes as input the 1D vector along the angle given a function that takes in 2D input
[ "Returns", "a", "function", "that", "takes", "as", "input", "the", "1D", "vector", "along", "the", "angle", "given", "a", "function", "that", "takes", "in", "2D", "input" ]
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/examples/simple_2D/simple_2D.py#L112-L119
django-py/django-doberman
doberman/auth.py
AccessAttempt.check_failed_login
def check_failed_login(self): """ 'Private method', check failed logins, it's used for wath_login decorator """ last_attempt = self.get_last_failed_access_attempt() if not last_attempt: # create a new entry user_access = self._FailedAccessAttemptModel(ip_...
python
def check_failed_login(self): """ 'Private method', check failed logins, it's used for wath_login decorator """ last_attempt = self.get_last_failed_access_attempt() if not last_attempt: # create a new entry user_access = self._FailedAccessAttemptModel(ip_...
[ "def", "check_failed_login", "(", "self", ")", ":", "last_attempt", "=", "self", ".", "get_last_failed_access_attempt", "(", ")", "if", "not", "last_attempt", ":", "# create a new entry", "user_access", "=", "self", ".", "_FailedAccessAttemptModel", "(", "ip_address",...
'Private method', check failed logins, it's used for wath_login decorator
[ "Private", "method", "check", "failed", "logins", "it", "s", "used", "for", "wath_login", "decorator" ]
train
https://github.com/django-py/django-doberman/blob/2e5959737a1b64234ed5a179c93f96a0de1c3e5c/doberman/auth.py#L59-L95
django-py/django-doberman
doberman/auth.py
AccessAttempt.inspect
def inspect(self): """ Inspect access attempt, used for catpcha flow :return: """ last_attempt = self.get_last_failed_access_attempt( ip_address=self.ip, captcha_enabled=True, captcha_passed=False, is_expired=False ) ...
python
def inspect(self): """ Inspect access attempt, used for catpcha flow :return: """ last_attempt = self.get_last_failed_access_attempt( ip_address=self.ip, captcha_enabled=True, captcha_passed=False, is_expired=False ) ...
[ "def", "inspect", "(", "self", ")", ":", "last_attempt", "=", "self", ".", "get_last_failed_access_attempt", "(", "ip_address", "=", "self", ".", "ip", ",", "captcha_enabled", "=", "True", ",", "captcha_passed", "=", "False", ",", "is_expired", "=", "False", ...
Inspect access attempt, used for catpcha flow :return:
[ "Inspect", "access", "attempt", "used", "for", "catpcha", "flow", ":", "return", ":" ]
train
https://github.com/django-py/django-doberman/blob/2e5959737a1b64234ed5a179c93f96a0de1c3e5c/doberman/auth.py#L97-L137
django-py/django-doberman
doberman/auth.py
AccessAttempt.get_lockout_response
def get_lockout_response(self): """ :return: """ return render_to_response( self.template_name, {'user_attempts': self.last_attempt_instance, 'lockout_time': self.block_login_seconds, 'ip_address': self.ip }, context_instanc...
python
def get_lockout_response(self): """ :return: """ return render_to_response( self.template_name, {'user_attempts': self.last_attempt_instance, 'lockout_time': self.block_login_seconds, 'ip_address': self.ip }, context_instanc...
[ "def", "get_lockout_response", "(", "self", ")", ":", "return", "render_to_response", "(", "self", ".", "template_name", ",", "{", "'user_attempts'", ":", "self", ".", "last_attempt_instance", ",", "'lockout_time'", ":", "self", ".", "block_login_seconds", ",", "'...
:return:
[ ":", "return", ":" ]
train
https://github.com/django-py/django-doberman/blob/2e5959737a1b64234ed5a179c93f96a0de1c3e5c/doberman/auth.py#L139-L150
riccardocagnasso/useless
src/useless/PE/__init__.py
PE_File.optional_data_directories
def optional_data_directories(self): """ Data directories entries are somewhat wierd. First of all they have no direct type information in it, the type is assumed from the position inside the table. For this reason there are often "null" entries, with all fields ...
python
def optional_data_directories(self): """ Data directories entries are somewhat wierd. First of all they have no direct type information in it, the type is assumed from the position inside the table. For this reason there are often "null" entries, with all fields ...
[ "def", "optional_data_directories", "(", "self", ")", ":", "base_offset", "=", "self", ".", "pe_header_offset", "+", "COFF_Header", ".", "get_size", "(", ")", "+", "OptionalHeader_StandardFields", ".", "get_size", "(", ")", "+", "OptionalHeader_WindowsFields", ".", ...
Data directories entries are somewhat wierd. First of all they have no direct type information in it, the type is assumed from the position inside the table. For this reason there are often "null" entries, with all fields set to zero. Here we parse all the entries, assi...
[ "Data", "directories", "entries", "are", "somewhat", "wierd", "." ]
train
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/PE/__init__.py#L63-L88
riccardocagnasso/useless
src/useless/PE/__init__.py
PE_File.resolve_rva
def resolve_rva(self, rva): """ RVAs are supposed to be used with the image of the file in memory. There's no direct algorithm to calculate the offset of an RVA in the file. What we do here is to find the section that contains the RVA and then we calc...
python
def resolve_rva(self, rva): """ RVAs are supposed to be used with the image of the file in memory. There's no direct algorithm to calculate the offset of an RVA in the file. What we do here is to find the section that contains the RVA and then we calc...
[ "def", "resolve_rva", "(", "self", ",", "rva", ")", ":", "containing_section", "=", "self", ".", "get_section_of_rva", "(", "rva", ")", "in_section_offset", "=", "containing_section", ".", "PointerToRawData", "-", "containing_section", ".", "VirtualAddress", "return...
RVAs are supposed to be used with the image of the file in memory. There's no direct algorithm to calculate the offset of an RVA in the file. What we do here is to find the section that contains the RVA and then we calculate the offset between the RVA of the section ...
[ "RVAs", "are", "supposed", "to", "be", "used", "with", "the", "image", "of", "the", "file", "in", "memory", ".", "There", "s", "no", "direct", "algorithm", "to", "calculate", "the", "offset", "of", "an", "RVA", "in", "the", "file", "." ]
train
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/PE/__init__.py#L109-L125
riccardocagnasso/useless
src/useless/PE/__init__.py
PE_File.dir_import_table
def dir_import_table(self): """ import table is terminated by a all-null entry, so we have to check for that """ import_header = list(self.optional_data_directories)[1] import_offset = self.resolve_rva(import_header.VirtualAddress) i = 0 while Tru...
python
def dir_import_table(self): """ import table is terminated by a all-null entry, so we have to check for that """ import_header = list(self.optional_data_directories)[1] import_offset = self.resolve_rva(import_header.VirtualAddress) i = 0 while Tru...
[ "def", "dir_import_table", "(", "self", ")", ":", "import_header", "=", "list", "(", "self", ".", "optional_data_directories", ")", "[", "1", "]", "import_offset", "=", "self", ".", "resolve_rva", "(", "import_header", ".", "VirtualAddress", ")", "i", "=", "...
import table is terminated by a all-null entry, so we have to check for that
[ "import", "table", "is", "terminated", "by", "a", "all", "-", "null", "entry", "so", "we", "have", "to", "check", "for", "that" ]
train
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/PE/__init__.py#L135-L153
kemingy/cnprep
cnprep/zh2num.py
get_number
def get_number(message, limit=4): """ convert Chinese to pinyin and extract useful numbers attention: 1. only for integer 2. before apply this method, the message should be preprocessed input: message: the message you want to extract numbers from. limit: limit the lengt...
python
def get_number(message, limit=4): """ convert Chinese to pinyin and extract useful numbers attention: 1. only for integer 2. before apply this method, the message should be preprocessed input: message: the message you want to extract numbers from. limit: limit the lengt...
[ "def", "get_number", "(", "message", ",", "limit", "=", "4", ")", ":", "words", "=", "pinyin", ".", "get_pinyin", "(", "message", ")", ".", "split", "(", "'-'", ")", "numbers", "=", "[", "]", "tmp", "=", "''", "count", "=", "0", "for", "w", "in",...
convert Chinese to pinyin and extract useful numbers attention: 1. only for integer 2. before apply this method, the message should be preprocessed input: message: the message you want to extract numbers from. limit: limit the length of number sequence
[ "convert", "Chinese", "to", "pinyin", "and", "extract", "useful", "numbers" ]
train
https://github.com/kemingy/cnprep/blob/076ea185167adb7e652bea3b81fb6830e162e880/cnprep/zh2num.py#L73-L110
lwcook/horsetail-matching
horsetailmatching/densitymatching.py
DensityMatching.evalMetric
def evalMetric(self, x, method=None): '''Evaluates the density matching metric at a given design point. :param iterable x: values of the design variables, this is passed as the first argument to the function fqoi :return: metric_value - value of the metric evaluated at the design ...
python
def evalMetric(self, x, method=None): '''Evaluates the density matching metric at a given design point. :param iterable x: values of the design variables, this is passed as the first argument to the function fqoi :return: metric_value - value of the metric evaluated at the design ...
[ "def", "evalMetric", "(", "self", ",", "x", ",", "method", "=", "None", ")", ":", "return", "super", "(", "DensityMatching", ",", "self", ")", ".", "evalMetric", "(", "x", ",", "method", ")" ]
Evaluates the density matching metric at a given design point. :param iterable x: values of the design variables, this is passed as the first argument to the function fqoi :return: metric_value - value of the metric evaluated at the design point given by x :rtype: floa...
[ "Evaluates", "the", "density", "matching", "metric", "at", "a", "given", "design", "point", "." ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/densitymatching.py#L114-L134
lwcook/horsetail-matching
horsetailmatching/densitymatching.py
DensityMatching.getPDF
def getPDF(self): '''Function that gets vectors of the pdf and target at the last design evaluated. :return: tuple of q values, pdf values, target values ''' if hasattr(self, '_qplot'): return self._qplot, self._hplot, self._tplot else: raise V...
python
def getPDF(self): '''Function that gets vectors of the pdf and target at the last design evaluated. :return: tuple of q values, pdf values, target values ''' if hasattr(self, '_qplot'): return self._qplot, self._hplot, self._tplot else: raise V...
[ "def", "getPDF", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_qplot'", ")", ":", "return", "self", ".", "_qplot", ",", "self", ".", "_hplot", ",", "self", ".", "_tplot", "else", ":", "raise", "ValueError", "(", "'''The metric has not been...
Function that gets vectors of the pdf and target at the last design evaluated. :return: tuple of q values, pdf values, target values
[ "Function", "that", "gets", "vectors", "of", "the", "pdf", "and", "target", "at", "the", "last", "design", "evaluated", "." ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/densitymatching.py#L152-L165
radjkarl/fancyTools
fancytools/plot/errorBand.py
errorBand
def errorBand(x, yAvg, yStd, yDensity, plt, n_colors=None): """ plot error-band around avg where colour equals to point density """ dmn = yDensity.min() dmx = yDensity.max() if n_colors is None: n_colors = dmx - dmn + 1 print(n_colors) cm = plt.cm.get_cmap('Blues', lut=n_co...
python
def errorBand(x, yAvg, yStd, yDensity, plt, n_colors=None): """ plot error-band around avg where colour equals to point density """ dmn = yDensity.min() dmx = yDensity.max() if n_colors is None: n_colors = dmx - dmn + 1 print(n_colors) cm = plt.cm.get_cmap('Blues', lut=n_co...
[ "def", "errorBand", "(", "x", ",", "yAvg", ",", "yStd", ",", "yDensity", ",", "plt", ",", "n_colors", "=", "None", ")", ":", "dmn", "=", "yDensity", ".", "min", "(", ")", "dmx", "=", "yDensity", ".", "max", "(", ")", "if", "n_colors", "is", "None...
plot error-band around avg where colour equals to point density
[ "plot", "error", "-", "band", "around", "avg", "where", "colour", "equals", "to", "point", "density" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/plot/errorBand.py#L8-L58
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/client.py
getPage
def getPage(url, contextFactory=None, *args, **kwargs): """Download a web page as a string. Download a page. Return a deferred, which will callback with a page (as a string) or errback with a description of the error. See HTTPClientFactory to see what extra args can be passed. """ scheme, host...
python
def getPage(url, contextFactory=None, *args, **kwargs): """Download a web page as a string. Download a page. Return a deferred, which will callback with a page (as a string) or errback with a description of the error. See HTTPClientFactory to see what extra args can be passed. """ scheme, host...
[ "def", "getPage", "(", "url", ",", "contextFactory", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "scheme", ",", "host", ",", "port", ",", "path", "=", "client", ".", "_parse", "(", "url", ")", "factory", "=", "client", ".", ...
Download a web page as a string. Download a page. Return a deferred, which will callback with a page (as a string) or errback with a description of the error. See HTTPClientFactory to see what extra args can be passed.
[ "Download", "a", "web", "page", "as", "a", "string", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/client.py#L41-L58
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/client.py
ClientDataHandler.processResponse
def processResponse(cls, soapdata, **kw): """called by deferred, returns pyobj representing reply. Parameters and Key Words: soapdata -- SOAP Data replytype -- reply type of response """ if len(soapdata) == 0: raise TypeError('Received empty response') # ...
python
def processResponse(cls, soapdata, **kw): """called by deferred, returns pyobj representing reply. Parameters and Key Words: soapdata -- SOAP Data replytype -- reply type of response """ if len(soapdata) == 0: raise TypeError('Received empty response') # ...
[ "def", "processResponse", "(", "cls", ",", "soapdata", ",", "*", "*", "kw", ")", ":", "if", "len", "(", "soapdata", ")", "==", "0", ":", "raise", "TypeError", "(", "'Received empty response'", ")", "# log.msg(\"_\" * 33, time.ctime(time.time()), ", "# ...
called by deferred, returns pyobj representing reply. Parameters and Key Words: soapdata -- SOAP Data replytype -- reply type of response
[ "called", "by", "deferred", "returns", "pyobj", "representing", "reply", ".", "Parameters", "and", "Key", "Words", ":", "soapdata", "--", "SOAP", "Data", "replytype", "--", "reply", "type", "of", "response" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/client.py#L73-L90
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/client.py
DefaultClientHandlerChain.processResponse
def processResponse(self, arg, replytype, **kw): """ Parameters: arg -- deferred replytype -- typecode """ if self.debug: log.msg('--->PROCESS REQUEST\n%s' %arg, debug=1) for h in self.handlers: arg.addCallback(h.processResponse, ...
python
def processResponse(self, arg, replytype, **kw): """ Parameters: arg -- deferred replytype -- typecode """ if self.debug: log.msg('--->PROCESS REQUEST\n%s' %arg, debug=1) for h in self.handlers: arg.addCallback(h.processResponse, ...
[ "def", "processResponse", "(", "self", ",", "arg", ",", "replytype", ",", "*", "*", "kw", ")", ":", "if", "self", ".", "debug", ":", "log", ".", "msg", "(", "'--->PROCESS REQUEST\\n%s'", "%", "arg", ",", "debug", "=", "1", ")", "for", "h", "in", "s...
Parameters: arg -- deferred replytype -- typecode
[ "Parameters", ":", "arg", "--", "deferred", "replytype", "--", "typecode" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/client.py#L166-L178
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/client.py
DefaultClientHandlerChain.processRequest
def processRequest(self, arg, **kw): """ Parameters: arg -- XML Soap data string """ if self.debug: log.msg('===>PROCESS RESPONSE: %s' %str(arg), debug=1) if arg is None: return for h in self.handlers: arg = h.processReque...
python
def processRequest(self, arg, **kw): """ Parameters: arg -- XML Soap data string """ if self.debug: log.msg('===>PROCESS RESPONSE: %s' %str(arg), debug=1) if arg is None: return for h in self.handlers: arg = h.processReque...
[ "def", "processRequest", "(", "self", ",", "arg", ",", "*", "*", "kw", ")", ":", "if", "self", ".", "debug", ":", "log", ".", "msg", "(", "'===>PROCESS RESPONSE: %s'", "%", "str", "(", "arg", ")", ",", "debug", "=", "1", ")", "if", "arg", "is", "...
Parameters: arg -- XML Soap data string
[ "Parameters", ":", "arg", "--", "XML", "Soap", "data", "string" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/client.py#L180-L198
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/client.py
Binding.Send
def Send(self, url, opname, pyobj, nsdict={}, soapaction=None, chain=None, **kw): """Returns a ProcessingChain which needs to be passed to Receive if Send is being called consecutively. """ url = url or self.url cookies = None if chain is not None: ...
python
def Send(self, url, opname, pyobj, nsdict={}, soapaction=None, chain=None, **kw): """Returns a ProcessingChain which needs to be passed to Receive if Send is being called consecutively. """ url = url or self.url cookies = None if chain is not None: ...
[ "def", "Send", "(", "self", ",", "url", ",", "opname", ",", "pyobj", ",", "nsdict", "=", "{", "}", ",", "soapaction", "=", "None", ",", "chain", "=", "None", ",", "*", "*", "kw", ")", ":", "url", "=", "url", "or", "self", ".", "url", "cookies",...
Returns a ProcessingChain which needs to be passed to Receive if Send is being called consecutively.
[ "Returns", "a", "ProcessingChain", "which", "needs", "to", "be", "passed", "to", "Receive", "if", "Send", "is", "being", "called", "consecutively", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/client.py#L246-L281
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/client.py
Binding.Receive
def Receive(self, replytype, chain=None, **kw): """This method allows code to act in a synchronous manner, it waits to return until the deferred fires but it doesn't prevent other queued calls from being executed. Send must be called first, which sets up the chain/factory. ...
python
def Receive(self, replytype, chain=None, **kw): """This method allows code to act in a synchronous manner, it waits to return until the deferred fires but it doesn't prevent other queued calls from being executed. Send must be called first, which sets up the chain/factory. ...
[ "def", "Receive", "(", "self", ",", "replytype", ",", "chain", "=", "None", ",", "*", "*", "kw", ")", ":", "chain", "=", "chain", "or", "self", ".", "chain", "d", "=", "chain", ".", "flow", ".", "deferred", "if", "self", ".", "trace", ":", "def",...
This method allows code to act in a synchronous manner, it waits to return until the deferred fires but it doesn't prevent other queued calls from being executed. Send must be called first, which sets up the chain/factory. WARNING: If defer is set to True, must either call...
[ "This", "method", "allows", "code", "to", "act", "in", "a", "synchronous", "manner", "it", "waits", "to", "return", "until", "the", "deferred", "fires", "but", "it", "doesn", "t", "prevent", "other", "queued", "calls", "from", "being", "executed", ".", "Se...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/client.py#L283-L335
quasipedia/swaggery
swaggery/responses.py
AsyncResponse.stream_array
def stream_array(self, generator): '''Helper function to stream content as an array of JSON values.''' def chunkify(generator): log.debug('Data Stream STARTED') yield '['.encode() # In order to have commas only after the first value, we take the # first va...
python
def stream_array(self, generator): '''Helper function to stream content as an array of JSON values.''' def chunkify(generator): log.debug('Data Stream STARTED') yield '['.encode() # In order to have commas only after the first value, we take the # first va...
[ "def", "stream_array", "(", "self", ",", "generator", ")", ":", "def", "chunkify", "(", "generator", ")", ":", "log", ".", "debug", "(", "'Data Stream STARTED'", ")", "yield", "'['", ".", "encode", "(", ")", "# In order to have commas only after the first value, w...
Helper function to stream content as an array of JSON values.
[ "Helper", "function", "to", "stream", "content", "as", "an", "array", "of", "JSON", "values", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/responses.py#L30-L51
quasipedia/swaggery
swaggery/responses.py
BadResponse.process_500
def process_500(self, request, exception): '''Internal server error.''' id_ = str(uuid.uuid4())[:6].upper() msg = 'Internal server error: 500. Unique error identifier is {}' msg = msg.format(id_) log.error('HTTP 500 [Message - {}]: {}'.format(id_, msg)) log.error('HTTP 50...
python
def process_500(self, request, exception): '''Internal server error.''' id_ = str(uuid.uuid4())[:6].upper() msg = 'Internal server error: 500. Unique error identifier is {}' msg = msg.format(id_) log.error('HTTP 500 [Message - {}]: {}'.format(id_, msg)) log.error('HTTP 50...
[ "def", "process_500", "(", "self", ",", "request", ",", "exception", ")", ":", "id_", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "[", ":", "6", "]", ".", "upper", "(", ")", "msg", "=", "'Internal server error: 500. Unique error identifier is {}'...
Internal server error.
[ "Internal", "server", "error", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/responses.py#L80-L88
GemHQ/round-py
round/accounts.py
Accounts.create
def create(self, name, network): """Create a new Account object and add it to this Accounts collection. Args: name (str): Account name network (str): Type of cryptocurrency. Can be one of, 'bitcoin', ' bitcoin_testnet', 'litecoin', 'dogecoin'. Returns: The new ...
python
def create(self, name, network): """Create a new Account object and add it to this Accounts collection. Args: name (str): Account name network (str): Type of cryptocurrency. Can be one of, 'bitcoin', ' bitcoin_testnet', 'litecoin', 'dogecoin'. Returns: The new ...
[ "def", "create", "(", "self", ",", "name", ",", "network", ")", ":", "if", "not", "network", "in", "SUPPORTED_NETWORKS", ":", "raise", "ValueError", "(", "'Network not valid!'", ")", "account", "=", "self", ".", "wrap", "(", "self", ".", "resource", ".", ...
Create a new Account object and add it to this Accounts collection. Args: name (str): Account name network (str): Type of cryptocurrency. Can be one of, 'bitcoin', ' bitcoin_testnet', 'litecoin', 'dogecoin'. Returns: The new round.Account
[ "Create", "a", "new", "Account", "object", "and", "add", "it", "to", "this", "Accounts", "collection", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L50-L65
GemHQ/round-py
round/accounts.py
Account.update
def update(self, **kwargs): """Update the Account resource with specified content. Args: name (str): Human-readable name for the account Returns: the updated Account object. """ return self.__class__(self.resource.update(kwargs), self.cli...
python
def update(self, **kwargs): """Update the Account resource with specified content. Args: name (str): Human-readable name for the account Returns: the updated Account object. """ return self.__class__(self.resource.update(kwargs), self.cli...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "resource", ".", "update", "(", "kwargs", ")", ",", "self", ".", "client", ",", "wallet", "=", "self", ".", "wallet", ")" ]
Update the Account resource with specified content. Args: name (str): Human-readable name for the account Returns: the updated Account object.
[ "Update", "the", "Account", "resource", "with", "specified", "content", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L89-L99
GemHQ/round-py
round/accounts.py
Account.pay
def pay(self, payees, change_account=None, utxo_confirmations=6, mfa_token=None, redirect_uri=None): """Create, verify, and sign a new Transaction. If this Account is owned by a User object, the user must be redirected to a URL (`mfa_uri`) returned by this call to input their MFA to...
python
def pay(self, payees, change_account=None, utxo_confirmations=6, mfa_token=None, redirect_uri=None): """Create, verify, and sign a new Transaction. If this Account is owned by a User object, the user must be redirected to a URL (`mfa_uri`) returned by this call to input their MFA to...
[ "def", "pay", "(", "self", ",", "payees", ",", "change_account", "=", "None", ",", "utxo_confirmations", "=", "6", ",", "mfa_token", "=", "None", ",", "redirect_uri", "=", "None", ")", ":", "# Check that wallet is unlocked", "if", "self", ".", "wallet", ".",...
Create, verify, and sign a new Transaction. If this Account is owned by a User object, the user must be redirected to a URL (`mfa_uri`) returned by this call to input their MFA token. After they complete that step, the Transaction will be approved and published to the bitcoin network. I...
[ "Create", "verify", "and", "sign", "a", "new", "Transaction", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L101-L191
GemHQ/round-py
round/accounts.py
Account.transactions
def transactions(self, **query): """Fetch and return Transactions involving any Address inside this Account. Note that this call is not cached. If you want to store a copy, you must assign it to a local variable, and call .refresh() when you need updated data Args: ...
python
def transactions(self, **query): """Fetch and return Transactions involving any Address inside this Account. Note that this call is not cached. If you want to store a copy, you must assign it to a local variable, and call .refresh() when you need updated data Args: ...
[ "def", "transactions", "(", "self", ",", "*", "*", "query", ")", ":", "if", "'status'", "in", "query", "and", "isinstance", "(", "query", "[", "'status'", "]", ",", "list", ")", ":", "query", "[", "'status'", "]", "=", "','", ".", "join", "(", "map...
Fetch and return Transactions involving any Address inside this Account. Note that this call is not cached. If you want to store a copy, you must assign it to a local variable, and call .refresh() when you need updated data Args: status (str or list, optional): One or ...
[ "Fetch", "and", "return", "Transactions", "involving", "any", "Address", "inside", "this", "Account", ".", "Note", "that", "this", "call", "is", "not", "cached", ".", "If", "you", "want", "to", "store", "a", "copy", "you", "must", "assign", "it", "to", "...
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L211-L232
GemHQ/round-py
round/accounts.py
Account.get_addresses
def get_addresses(self, fetch=False): """Return the Account's addresses object, populating it if fetch is True.""" return Addresses(self.resource.addresses, self.client, populate=fetch)
python
def get_addresses(self, fetch=False): """Return the Account's addresses object, populating it if fetch is True.""" return Addresses(self.resource.addresses, self.client, populate=fetch)
[ "def", "get_addresses", "(", "self", ",", "fetch", "=", "False", ")", ":", "return", "Addresses", "(", "self", ".", "resource", ".", "addresses", ",", "self", ".", "client", ",", "populate", "=", "fetch", ")" ]
Return the Account's addresses object, populating it if fetch is True.
[ "Return", "the", "Account", "s", "addresses", "object", "populating", "it", "if", "fetch", "is", "True", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L251-L253
GemHQ/round-py
round/accounts.py
Account.get_netki_names
def get_netki_names(self, fetch=False): """Return the Account's NetkiNames object, populating it if fetch is True.""" return NetkiNames(self.resource.netki_names, self.client, populate=fetch)
python
def get_netki_names(self, fetch=False): """Return the Account's NetkiNames object, populating it if fetch is True.""" return NetkiNames(self.resource.netki_names, self.client, populate=fetch)
[ "def", "get_netki_names", "(", "self", ",", "fetch", "=", "False", ")", ":", "return", "NetkiNames", "(", "self", ".", "resource", ".", "netki_names", ",", "self", ".", "client", ",", "populate", "=", "fetch", ")" ]
Return the Account's NetkiNames object, populating it if fetch is True.
[ "Return", "the", "Account", "s", "NetkiNames", "object", "populating", "it", "if", "fetch", "is", "True", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/accounts.py#L261-L263
tonyseek/html5lib-truncation
html5lib_truncation/shortcuts.py
truncate_html
def truncate_html(html, *args, **kwargs): """Truncates HTML string. :param html: The HTML string or parsed element tree (with :func:`html5lib.parse`). :param kwargs: Similar with :class:`.filters.TruncationFilter`. :return: The truncated HTML string. """ if hasattr(html, 'getc...
python
def truncate_html(html, *args, **kwargs): """Truncates HTML string. :param html: The HTML string or parsed element tree (with :func:`html5lib.parse`). :param kwargs: Similar with :class:`.filters.TruncationFilter`. :return: The truncated HTML string. """ if hasattr(html, 'getc...
[ "def", "truncate_html", "(", "html", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "html", ",", "'getchildren'", ")", ":", "etree", "=", "html", "else", ":", "etree", "=", "html5lib", ".", "parse", "(", "html", ")", "wa...
Truncates HTML string. :param html: The HTML string or parsed element tree (with :func:`html5lib.parse`). :param kwargs: Similar with :class:`.filters.TruncationFilter`. :return: The truncated HTML string.
[ "Truncates", "HTML", "string", "." ]
train
https://github.com/tonyseek/html5lib-truncation/blob/b5551e345e583d04dbdf6b97dc2a43a266eec8d6/html5lib_truncation/shortcuts.py#L8-L30
ch3pjw/junction
jcn/util.py
weighted_round_robin
def weighted_round_robin(iterable): '''Takes an iterable of tuples of <item>, <weight> and cycles around them, returning heavier (integer) weighted items more frequently. ''' cyclable_list = [] assigned_weight = 0 still_to_process = [ (item, weight) for item, weight in sorted(ite...
python
def weighted_round_robin(iterable): '''Takes an iterable of tuples of <item>, <weight> and cycles around them, returning heavier (integer) weighted items more frequently. ''' cyclable_list = [] assigned_weight = 0 still_to_process = [ (item, weight) for item, weight in sorted(ite...
[ "def", "weighted_round_robin", "(", "iterable", ")", ":", "cyclable_list", "=", "[", "]", "assigned_weight", "=", "0", "still_to_process", "=", "[", "(", "item", ",", "weight", ")", "for", "item", ",", "weight", "in", "sorted", "(", "iterable", ",", "key",...
Takes an iterable of tuples of <item>, <weight> and cycles around them, returning heavier (integer) weighted items more frequently.
[ "Takes", "an", "iterable", "of", "tuples", "of", "<item", ">", "<weight", ">", "and", "cycles", "around", "them", "returning", "heavier", "(", "integer", ")", "weighted", "items", "more", "frequently", "." ]
train
https://github.com/ch3pjw/junction/blob/7d0c4d279589bee8ae7b3ac4dee2ab425c0b1b0e/jcn/util.py#L62-L78
s-m-i-t-a/flask-musers
flask_musers/models.py
is_allowed
def is_allowed(func): """Check user password, when is correct, then run decorated function. :returns: decorated function """ @wraps(func) def _is_allowed(user, *args, **kwargs): password = kwargs.pop('password', None) if user.check_password(password): return func(user, ...
python
def is_allowed(func): """Check user password, when is correct, then run decorated function. :returns: decorated function """ @wraps(func) def _is_allowed(user, *args, **kwargs): password = kwargs.pop('password', None) if user.check_password(password): return func(user, ...
[ "def", "is_allowed", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "_is_allowed", "(", "user", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "password", "=", "kwargs", ".", "pop", "(", "'password'", ",", "None", ")", "if", ...
Check user password, when is correct, then run decorated function. :returns: decorated function
[ "Check", "user", "password", "when", "is", "correct", "then", "run", "decorated", "function", "." ]
train
https://github.com/s-m-i-t-a/flask-musers/blob/6becb5de4e8908f878ce173560c3cab4b297b0e0/flask_musers/models.py#L78-L100
dossier/dossier.label
dossier/label/run.py
App.do_get
def do_get(self, args): '''Get labels directly connected to a content item.''' for label in self.label_store.directly_connected(args.content_id): if args.value is None or label.value.value == args.value: self.stdout.write('{0}\n'.format(label))
python
def do_get(self, args): '''Get labels directly connected to a content item.''' for label in self.label_store.directly_connected(args.content_id): if args.value is None or label.value.value == args.value: self.stdout.write('{0}\n'.format(label))
[ "def", "do_get", "(", "self", ",", "args", ")", ":", "for", "label", "in", "self", ".", "label_store", ".", "directly_connected", "(", "args", ".", "content_id", ")", ":", "if", "args", ".", "value", "is", "None", "or", "label", ".", "value", ".", "v...
Get labels directly connected to a content item.
[ "Get", "labels", "directly", "connected", "to", "a", "content", "item", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/run.py#L155-L159
dossier/dossier.label
dossier/label/run.py
App.do_connected
def do_connected(self, args): '''Find a connected component from positive labels on an item.''' connected = self.label_store.connected_component(args.content_id) for label in connected: self.stdout.write('{0}\n'.format(label))
python
def do_connected(self, args): '''Find a connected component from positive labels on an item.''' connected = self.label_store.connected_component(args.content_id) for label in connected: self.stdout.write('{0}\n'.format(label))
[ "def", "do_connected", "(", "self", ",", "args", ")", ":", "connected", "=", "self", ".", "label_store", ".", "connected_component", "(", "args", ".", "content_id", ")", "for", "label", "in", "connected", ":", "self", ".", "stdout", ".", "write", "(", "'...
Find a connected component from positive labels on an item.
[ "Find", "a", "connected", "component", "from", "positive", "labels", "on", "an", "item", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/run.py#L165-L169
IntegralDefense/vxstreamlib
bin/vxstreamlib.py
VxStreamSubmissionManager.wait
def wait(self): """Waits for all submitted jobs to complete.""" logging.info("waiting for {} jobs to complete".format(len(self.submissions))) while not self.shutdown: time.sleep(1)
python
def wait(self): """Waits for all submitted jobs to complete.""" logging.info("waiting for {} jobs to complete".format(len(self.submissions))) while not self.shutdown: time.sleep(1)
[ "def", "wait", "(", "self", ")", ":", "logging", ".", "info", "(", "\"waiting for {} jobs to complete\"", ".", "format", "(", "len", "(", "self", ".", "submissions", ")", ")", ")", "while", "not", "self", ".", "shutdown", ":", "time", ".", "sleep", "(", ...
Waits for all submitted jobs to complete.
[ "Waits", "for", "all", "submitted", "jobs", "to", "complete", "." ]
train
https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L185-L189
IntegralDefense/vxstreamlib
bin/vxstreamlib.py
VxStreamServer.download_dropped_files
def download_dropped_files(self, sha256, environment_id, target_dir): """Downloads the dropped files for this sample into target_dir. Returns the list of files extracted.""" download_url = '{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'.format( self.url, s...
python
def download_dropped_files(self, sha256, environment_id, target_dir): """Downloads the dropped files for this sample into target_dir. Returns the list of files extracted.""" download_url = '{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'.format( self.url, s...
[ "def", "download_dropped_files", "(", "self", ",", "sha256", ",", "environment_id", ",", "target_dir", ")", ":", "download_url", "=", "'{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'", ".", "format", "(", "self", ".", "url", ",", "sha256", ",", "...
Downloads the dropped files for this sample into target_dir. Returns the list of files extracted.
[ "Downloads", "the", "dropped", "files", "for", "this", "sample", "into", "target_dir", ".", "Returns", "the", "list", "of", "files", "extracted", "." ]
train
https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L355-L436
IntegralDefense/vxstreamlib
bin/vxstreamlib.py
VxStreamServer.download_memory_dump
def download_memory_dump(self, sha256, environment_id, dest_dir): """Downloads the given memory dump into the given directory. Returns a tuple of a list of files extracted from what was downloaded, and the path to the combined memory dump.""" dest_path = os.path.join(dest_dir, 'memory.zip') if...
python
def download_memory_dump(self, sha256, environment_id, dest_dir): """Downloads the given memory dump into the given directory. Returns a tuple of a list of files extracted from what was downloaded, and the path to the combined memory dump.""" dest_path = os.path.join(dest_dir, 'memory.zip') if...
[ "def", "download_memory_dump", "(", "self", ",", "sha256", ",", "environment_id", ",", "dest_dir", ")", ":", "dest_path", "=", "os", ".", "path", ".", "join", "(", "dest_dir", ",", "'memory.zip'", ")", "if", "self", ".", "download", "(", "sha256", ",", "...
Downloads the given memory dump into the given directory. Returns a tuple of a list of files extracted from what was downloaded, and the path to the combined memory dump.
[ "Downloads", "the", "given", "memory", "dump", "into", "the", "given", "directory", ".", "Returns", "a", "tuple", "of", "a", "list", "of", "files", "extracted", "from", "what", "was", "downloaded", "and", "the", "path", "to", "the", "combined", "memory", "...
train
https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L438-L472
emory-libraries/eulcommon
eulcommon/binfile/outlookexpress.py
MacIndex.messages
def messages(self): '''A generator yielding the :class:`MacIndexMessage` structures in this index file.''' # The file contains the fixed-size file header followed by # fixed-size message structures, followed by minimal message # information (subject, from, to). Start after the ...
python
def messages(self): '''A generator yielding the :class:`MacIndexMessage` structures in this index file.''' # The file contains the fixed-size file header followed by # fixed-size message structures, followed by minimal message # information (subject, from, to). Start after the ...
[ "def", "messages", "(", "self", ")", ":", "# The file contains the fixed-size file header followed by", "# fixed-size message structures, followed by minimal message", "# information (subject, from, to). Start after the file", "# header and then simply return the message structures in", "# sequ...
A generator yielding the :class:`MacIndexMessage` structures in this index file.
[ "A", "generator", "yielding", "the", ":", "class", ":", "MacIndexMessage", "structures", "in", "this", "index", "file", "." ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/outlookexpress.py#L62-L80
emory-libraries/eulcommon
eulcommon/binfile/outlookexpress.py
MacMail.get_message
def get_message(self, offset, size): '''Get an individual :class:`MacMailMessage` within a Mail data file, based on size and offset information from the corresponding :class:`MacIndexMessage`. :param offset: offset within the Mail file where the desired message begins, i.e. ...
python
def get_message(self, offset, size): '''Get an individual :class:`MacMailMessage` within a Mail data file, based on size and offset information from the corresponding :class:`MacIndexMessage`. :param offset: offset within the Mail file where the desired message begins, i.e. ...
[ "def", "get_message", "(", "self", ",", "offset", ",", "size", ")", ":", "return", "MacMailMessage", "(", "size", "=", "size", ",", "mm", "=", "self", ".", "mmap", ",", "offset", "=", "offset", ")" ]
Get an individual :class:`MacMailMessage` within a Mail data file, based on size and offset information from the corresponding :class:`MacIndexMessage`. :param offset: offset within the Mail file where the desired message begins, i.e. :attr:`MacMailMessage.offset` :param siz...
[ "Get", "an", "individual", ":", "class", ":", "MacMailMessage", "within", "a", "Mail", "data", "file", "based", "on", "size", "and", "offset", "information", "from", "the", "corresponding", ":", "class", ":", "MacIndexMessage", "." ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/outlookexpress.py#L113-L123
emory-libraries/eulcommon
eulcommon/binfile/outlookexpress.py
MacMailMessage.data
def data(self): '''email content for this message''' # return data after any initial offset, plus content offset to # skip header, up to the size of this message return self.mmap[self.content_offset + self._offset: self._offset + self.size]
python
def data(self): '''email content for this message''' # return data after any initial offset, plus content offset to # skip header, up to the size of this message return self.mmap[self.content_offset + self._offset: self._offset + self.size]
[ "def", "data", "(", "self", ")", ":", "# return data after any initial offset, plus content offset to", "# skip header, up to the size of this message", "return", "self", ".", "mmap", "[", "self", ".", "content_offset", "+", "self", ".", "_offset", ":", "self", ".", "_o...
email content for this message
[ "email", "content", "for", "this", "message" ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/outlookexpress.py#L166-L170
emory-libraries/eulcommon
eulcommon/binfile/outlookexpress.py
MacFolder.raw_messages
def raw_messages(self): '''A generator yielding a :class:`MacMailMessage` binary object for each message in this folder, based on message index information in :class:`MacIndex` and content in :class:`MacMail`.''' if self.data: # offset for first message, at end of Mai...
python
def raw_messages(self): '''A generator yielding a :class:`MacMailMessage` binary object for each message in this folder, based on message index information in :class:`MacIndex` and content in :class:`MacMail`.''' if self.data: # offset for first message, at end of Mai...
[ "def", "raw_messages", "(", "self", ")", ":", "if", "self", ".", "data", ":", "# offset for first message, at end of Mail data file header", "last_offset", "=", "24", "self", ".", "skipped_chunks", "=", "0", "for", "msginfo", "in", "self", ".", "index", ".", "me...
A generator yielding a :class:`MacMailMessage` binary object for each message in this folder, based on message index information in :class:`MacIndex` and content in :class:`MacMail`.
[ "A", "generator", "yielding", "a", ":", "class", ":", "MacMailMessage", "binary", "object", "for", "each", "message", "in", "this", "folder", "based", "on", "message", "index", "information", "in", ":", "class", ":", "MacIndex", "and", "content", "in", ":", ...
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/outlookexpress.py#L213-L236
fakedrake/overlay_parse
overlay_parse/overlays.py
Overlay.copy
def copy(self, props=None, value=None): """ Copy the Overlay possibly overriding props. """ return Overlay(self.text, (self.start, self.end), props=props or self.props, value=value or self.value)
python
def copy(self, props=None, value=None): """ Copy the Overlay possibly overriding props. """ return Overlay(self.text, (self.start, self.end), props=props or self.props, value=value or self.value)
[ "def", "copy", "(", "self", ",", "props", "=", "None", ",", "value", "=", "None", ")", ":", "return", "Overlay", "(", "self", ".", "text", ",", "(", "self", ".", "start", ",", "self", ".", "end", ")", ",", "props", "=", "props", "or", "self", "...
Copy the Overlay possibly overriding props.
[ "Copy", "the", "Overlay", "possibly", "overriding", "props", "." ]
train
https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L41-L49
fakedrake/overlay_parse
overlay_parse/overlays.py
Overlay.match
def match(self, props=None, rng=None, offset=None): """ Provide any of the args and match or dont. :param props: Should be a subset of my props. :param rng: Exactly match my range. :param offset: I start after this offset. :returns: True if all the provided predicates ma...
python
def match(self, props=None, rng=None, offset=None): """ Provide any of the args and match or dont. :param props: Should be a subset of my props. :param rng: Exactly match my range. :param offset: I start after this offset. :returns: True if all the provided predicates ma...
[ "def", "match", "(", "self", ",", "props", "=", "None", ",", "rng", "=", "None", ",", "offset", "=", "None", ")", ":", "if", "rng", ":", "s", ",", "e", "=", "rng", "else", ":", "e", "=", "s", "=", "None", "return", "(", "(", "e", "is", "Non...
Provide any of the args and match or dont. :param props: Should be a subset of my props. :param rng: Exactly match my range. :param offset: I start after this offset. :returns: True if all the provided predicates match or are None
[ "Provide", "any", "of", "the", "args", "and", "match", "or", "dont", "." ]
train
https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L106-L124
fakedrake/overlay_parse
overlay_parse/overlays.py
OverlayedText.overlays_at
def overlays_at(self, key): """ Key may be a slice or a point. """ if isinstance(key, slice): s, e, _ = key.indices(len(self.text)) else: s = e = key return [o for o in self.overlays if o.start in Rng(s, e)]
python
def overlays_at(self, key): """ Key may be a slice or a point. """ if isinstance(key, slice): s, e, _ = key.indices(len(self.text)) else: s = e = key return [o for o in self.overlays if o.start in Rng(s, e)]
[ "def", "overlays_at", "(", "self", ",", "key", ")", ":", "if", "isinstance", "(", "key", ",", "slice", ")", ":", "s", ",", "e", ",", "_", "=", "key", ".", "indices", "(", "len", "(", "self", ".", "text", ")", ")", "else", ":", "s", "=", "e", ...
Key may be a slice or a point.
[ "Key", "may", "be", "a", "slice", "or", "a", "point", "." ]
train
https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L164-L174
fakedrake/overlay_parse
overlay_parse/overlays.py
OverlayedText.overlay
def overlay(self, matchers, force=False): """ Given a list of matchers create overlays based on them. Normally I will remember what overlays were run this way and will avoid re-running them but you can `force` me to. This is the recommended way of running overlays.c """ ...
python
def overlay(self, matchers, force=False): """ Given a list of matchers create overlays based on them. Normally I will remember what overlays were run this way and will avoid re-running them but you can `force` me to. This is the recommended way of running overlays.c """ ...
[ "def", "overlay", "(", "self", ",", "matchers", ",", "force", "=", "False", ")", ":", "for", "m", "in", "matchers", ":", "if", "m", "in", "self", ".", "_ran_matchers", ":", "continue", "self", ".", "_ran_matchers", ".", "append", "(", "m", ")", "self...
Given a list of matchers create overlays based on them. Normally I will remember what overlays were run this way and will avoid re-running them but you can `force` me to. This is the recommended way of running overlays.c
[ "Given", "a", "list", "of", "matchers", "create", "overlays", "based", "on", "them", ".", "Normally", "I", "will", "remember", "what", "overlays", "were", "run", "this", "way", "and", "will", "avoid", "re", "-", "running", "them", "but", "you", "can", "f...
train
https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L176-L191
fakedrake/overlay_parse
overlay_parse/overlays.py
OverlayedText.get_overlays
def get_overlays(self, **kw): """ See Overlay.match() for arguments. """ return [o for o in self.overlays if o.match(**kw)]
python
def get_overlays(self, **kw): """ See Overlay.match() for arguments. """ return [o for o in self.overlays if o.match(**kw)]
[ "def", "get_overlays", "(", "self", ",", "*", "*", "kw", ")", ":", "return", "[", "o", "for", "o", "in", "self", ".", "overlays", "if", "o", ".", "match", "(", "*", "*", "kw", ")", "]" ]
See Overlay.match() for arguments.
[ "See", "Overlay", ".", "match", "()", "for", "arguments", "." ]
train
https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/overlays.py#L193-L198
goldhand/django-nupages
nupages/managers.py
PageManager.published
def published(self, **kwargs): ''' Returns pages that are both status: Active and have a non-conflicting activate_date / deactivate_date ''' return self.filter( Q(activate_date__lte=timezone.now()) | Q( activate_date__isnull=True), Q(deactivate_date__gte=timezone.now()) | Q( deactivate_date__is...
python
def published(self, **kwargs): ''' Returns pages that are both status: Active and have a non-conflicting activate_date / deactivate_date ''' return self.filter( Q(activate_date__lte=timezone.now()) | Q( activate_date__isnull=True), Q(deactivate_date__gte=timezone.now()) | Q( deactivate_date__is...
[ "def", "published", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "filter", "(", "Q", "(", "activate_date__lte", "=", "timezone", ".", "now", "(", ")", ")", "|", "Q", "(", "activate_date__isnull", "=", "True", ")", ",", "Q", ...
Returns pages that are both status: Active and have a non-conflicting activate_date / deactivate_date
[ "Returns", "pages", "that", "are", "both", "status", ":", "Active", "and", "have", "a", "non", "-", "conflicting", "activate_date", "/", "deactivate_date" ]
train
https://github.com/goldhand/django-nupages/blob/4e54fae7e057f9530c22dc30c03812fd660cb7f4/nupages/managers.py#L9-L18
icio/evil
evil/__init__.py
evil
def evil(expr, lookup, operators, cast, reducer, tokenizer): """evil evaluates an expression according to the eval description given. :param expr: An expression to evaluate. :param lookup: A callable which takes a single pattern argument and returns a set of results. The pattern can be a...
python
def evil(expr, lookup, operators, cast, reducer, tokenizer): """evil evaluates an expression according to the eval description given. :param expr: An expression to evaluate. :param lookup: A callable which takes a single pattern argument and returns a set of results. The pattern can be a...
[ "def", "evil", "(", "expr", ",", "lookup", ",", "operators", ",", "cast", ",", "reducer", ",", "tokenizer", ")", ":", "operators", "=", "OrderedDict", "(", "(", "op", "[", "0", "]", ",", "op", "[", "1", ":", "]", ")", "for", "op", "in", "operator...
evil evaluates an expression according to the eval description given. :param expr: An expression to evaluate. :param lookup: A callable which takes a single pattern argument and returns a set of results. The pattern can be anything that is not an operator token or round br...
[ "evil", "evaluates", "an", "expression", "according", "to", "the", "eval", "description", "given", "." ]
train
https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L13-L137
icio/evil
evil/__init__.py
expr_tokenizer
def expr_tokenizer(expr, operator_tokens): """expr_tokenizer yields the components ("tokens") forming the expression. Tokens are split by whitespace which is never considered a token in its own right. operator_tokens should likely include "(" and ")" and strictly the expression. This means that the wor...
python
def expr_tokenizer(expr, operator_tokens): """expr_tokenizer yields the components ("tokens") forming the expression. Tokens are split by whitespace which is never considered a token in its own right. operator_tokens should likely include "(" and ")" and strictly the expression. This means that the wor...
[ "def", "expr_tokenizer", "(", "expr", ",", "operator_tokens", ")", ":", "operator_tokens", ".", "sort", "(", "key", "=", "len", ",", "reverse", "=", "True", ")", "for", "m", "in", "re", ".", "finditer", "(", "r\"\"\"(\\s+) | # Whitespace\n ...
expr_tokenizer yields the components ("tokens") forming the expression. Tokens are split by whitespace which is never considered a token in its own right. operator_tokens should likely include "(" and ")" and strictly the expression. This means that the word 'test' will be split into ['t', 'e', 'st'] i...
[ "expr_tokenizer", "yields", "the", "components", "(", "tokens", ")", "forming", "the", "expression", "." ]
train
https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L140-L161
icio/evil
evil/__init__.py
op
def op(token, func, left=False, right=False): """op provides a more verbose syntax for declaring operators. :param token: The string token of the operator. Usually a single character. :param func: A callable used to evaluate its arguments. Where the operator is both-sided the callable shou...
python
def op(token, func, left=False, right=False): """op provides a more verbose syntax for declaring operators. :param token: The string token of the operator. Usually a single character. :param func: A callable used to evaluate its arguments. Where the operator is both-sided the callable shou...
[ "def", "op", "(", "token", ",", "func", ",", "left", "=", "False", ",", "right", "=", "False", ")", ":", "both", "=", "(", "left", "==", "right", ")", "return", "(", "token", ",", "func", ",", "OP_BOTH", "if", "both", "else", "OP_LEFT", "if", "le...
op provides a more verbose syntax for declaring operators. :param token: The string token of the operator. Usually a single character. :param func: A callable used to evaluate its arguments. Where the operator is both-sided the callable should accept two arguments. Where it is...
[ "op", "provides", "a", "more", "verbose", "syntax", "for", "declaring", "operators", "." ]
train
https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L164-L180
icio/evil
evil/__init__.py
globlookup
def globlookup(pattern, root): """globlookup finds filesystem objects whose relative path matches the given pattern. :param pattern: The pattern to wish to match relative filepaths to. :param root: The root director to search within. """ for subdir, dirnames, filenames in os.walk(root): ...
python
def globlookup(pattern, root): """globlookup finds filesystem objects whose relative path matches the given pattern. :param pattern: The pattern to wish to match relative filepaths to. :param root: The root director to search within. """ for subdir, dirnames, filenames in os.walk(root): ...
[ "def", "globlookup", "(", "pattern", ",", "root", ")", ":", "for", "subdir", ",", "dirnames", ",", "filenames", "in", "os", ".", "walk", "(", "root", ")", ":", "d", "=", "subdir", "[", "len", "(", "root", ")", "+", "1", ":", "]", "files", "=", ...
globlookup finds filesystem objects whose relative path matches the given pattern. :param pattern: The pattern to wish to match relative filepaths to. :param root: The root director to search within.
[ "globlookup", "finds", "filesystem", "objects", "whose", "relative", "path", "matches", "the", "given", "pattern", "." ]
train
https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L193-L205
sassoo/goldman
goldman/resources/related.py
Resource.on_get
def on_get(self, req, resp, rid, related): """ Find the related model & serialize it back If the parent resource of the related model doesn't exist then abort on a 404. """ signals.pre_req.send(self.model) signals.pre_req_find.send(self.model) if not hasattr(se...
python
def on_get(self, req, resp, rid, related): """ Find the related model & serialize it back If the parent resource of the related model doesn't exist then abort on a 404. """ signals.pre_req.send(self.model) signals.pre_req_find.send(self.model) if not hasattr(se...
[ "def", "on_get", "(", "self", ",", "req", ",", "resp", ",", "rid", ",", "related", ")", ":", "signals", ".", "pre_req", ".", "send", "(", "self", ".", "model", ")", "signals", ".", "pre_req_find", ".", "send", "(", "self", ".", "model", ")", "if", ...
Find the related model & serialize it back If the parent resource of the related model doesn't exist then abort on a 404.
[ "Find", "the", "related", "model", "&", "serialize", "it", "back" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/related.py#L43-L76
PyMLGame/pymlgame
emulator.py
Emu.recv_data
def recv_data(self): """ Grab the next frame and put it on the matrix. """ data, addr = self.sock.recvfrom(self.packetsize) matrix = map(ord, data.strip()) if len(matrix) == self.packetsize: self.matrix = matrix[:-4]
python
def recv_data(self): """ Grab the next frame and put it on the matrix. """ data, addr = self.sock.recvfrom(self.packetsize) matrix = map(ord, data.strip()) if len(matrix) == self.packetsize: self.matrix = matrix[:-4]
[ "def", "recv_data", "(", "self", ")", ":", "data", ",", "addr", "=", "self", ".", "sock", ".", "recvfrom", "(", "self", ".", "packetsize", ")", "matrix", "=", "map", "(", "ord", ",", "data", ".", "strip", "(", ")", ")", "if", "len", "(", "matrix"...
Grab the next frame and put it on the matrix.
[ "Grab", "the", "next", "frame", "and", "put", "it", "on", "the", "matrix", "." ]
train
https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/emulator.py#L67-L74
PyMLGame/pymlgame
emulator.py
Emu.update
def update(self): """ Generate the output from the matrix. """ pixels = len(self.matrix) for x in range(self.width): for y in range(self.height): pixel = y * self.width * 3 + x * 3 #TODO: sometimes the matrix is not as big as it should ...
python
def update(self): """ Generate the output from the matrix. """ pixels = len(self.matrix) for x in range(self.width): for y in range(self.height): pixel = y * self.width * 3 + x * 3 #TODO: sometimes the matrix is not as big as it should ...
[ "def", "update", "(", "self", ")", ":", "pixels", "=", "len", "(", "self", ".", "matrix", ")", "for", "x", "in", "range", "(", "self", ".", "width", ")", ":", "for", "y", "in", "range", "(", "self", ".", "height", ")", ":", "pixel", "=", "y", ...
Generate the output from the matrix.
[ "Generate", "the", "output", "from", "the", "matrix", "." ]
train
https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/emulator.py#L76-L88
PyMLGame/pymlgame
emulator.py
Emu.gameloop
def gameloop(self): """ Loop through all the necessary stuff and end execution when Ctrl+C was hit. """ try: while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() i...
python
def gameloop(self): """ Loop through all the necessary stuff and end execution when Ctrl+C was hit. """ try: while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() i...
[ "def", "gameloop", "(", "self", ")", ":", "try", ":", "while", "True", ":", "for", "event", "in", "pygame", ".", "event", ".", "get", "(", ")", ":", "if", "event", ".", "type", "==", "pygame", ".", "QUIT", ":", "sys", ".", "exit", "(", ")", "if...
Loop through all the necessary stuff and end execution when Ctrl+C was hit.
[ "Loop", "through", "all", "the", "necessary", "stuff", "and", "end", "execution", "when", "Ctrl", "+", "C", "was", "hit", "." ]
train
https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/emulator.py#L97-L114
maxfischer2781/chainlet
chainlet/wrapper.py
getname
def getname(obj): """ Return the most qualified name of an object :param obj: object to fetch name :return: name of ``obj`` """ for name_attribute in ('__qualname__', '__name__'): try: # an object always has a class, as per Python data model return getattr(obj, n...
python
def getname(obj): """ Return the most qualified name of an object :param obj: object to fetch name :return: name of ``obj`` """ for name_attribute in ('__qualname__', '__name__'): try: # an object always has a class, as per Python data model return getattr(obj, n...
[ "def", "getname", "(", "obj", ")", ":", "for", "name_attribute", "in", "(", "'__qualname__'", ",", "'__name__'", ")", ":", "try", ":", "# an object always has a class, as per Python data model", "return", "getattr", "(", "obj", ",", "name_attribute", ",", "getattr",...
Return the most qualified name of an object :param obj: object to fetch name :return: name of ``obj``
[ "Return", "the", "most", "qualified", "name", "of", "an", "object" ]
train
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/wrapper.py#L5-L18
maxfischer2781/chainlet
chainlet/wrapper.py
WrapperMixin.wraplet
def wraplet(cls, *cls_args, **cls_kwargs): """ Create a factory to produce a Wrapper from a slave factory :param cls_args: positional arguments to provide to the Wrapper class :param cls_kwargs: keyword arguments to provide to the Wrapper class :return: .. code:: python...
python
def wraplet(cls, *cls_args, **cls_kwargs): """ Create a factory to produce a Wrapper from a slave factory :param cls_args: positional arguments to provide to the Wrapper class :param cls_kwargs: keyword arguments to provide to the Wrapper class :return: .. code:: python...
[ "def", "wraplet", "(", "cls", ",", "*", "cls_args", ",", "*", "*", "cls_kwargs", ")", ":", "if", "cls", ".", "__init_slave__", "in", "(", "None", ",", "WrapperMixin", ".", "__init_slave__", ")", ":", "raise", "TypeError", "(", "'type %r does not implement th...
Create a factory to produce a Wrapper from a slave factory :param cls_args: positional arguments to provide to the Wrapper class :param cls_kwargs: keyword arguments to provide to the Wrapper class :return: .. code:: python cls_wrapper_factory = cls.wraplet(*cls_args, **cl...
[ "Create", "a", "factory", "to", "produce", "a", "Wrapper", "from", "a", "slave", "factory" ]
train
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/wrapper.py#L87-L164
ronaldguillen/wave
wave/authentication.py
BasicAuthentication.authenticate
def authenticate(self, request): """ Returns a `User` if a correct username and password have been supplied using HTTP Basic authentication. Otherwise returns `None`. """ auth = get_authorization_header(request).split() if not auth or auth[0].lower() != b'basic': ...
python
def authenticate(self, request): """ Returns a `User` if a correct username and password have been supplied using HTTP Basic authentication. Otherwise returns `None`. """ auth = get_authorization_header(request).split() if not auth or auth[0].lower() != b'basic': ...
[ "def", "authenticate", "(", "self", ",", "request", ")", ":", "auth", "=", "get_authorization_header", "(", "request", ")", ".", "split", "(", ")", "if", "not", "auth", "or", "auth", "[", "0", "]", ".", "lower", "(", ")", "!=", "b'basic'", ":", "retu...
Returns a `User` if a correct username and password have been supplied using HTTP Basic authentication. Otherwise returns `None`.
[ "Returns", "a", "User", "if", "a", "correct", "username", "and", "password", "have", "been", "supplied", "using", "HTTP", "Basic", "authentication", ".", "Otherwise", "returns", "None", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/authentication.py#L61-L85
ronaldguillen/wave
wave/authentication.py
BasicAuthentication.authenticate_credentials
def authenticate_credentials(self, userid, password): """ Authenticate the userid and password against username and password. """ credentials = { get_user_model().USERNAME_FIELD: userid, 'password': password } user = authenticate(**credentials) ...
python
def authenticate_credentials(self, userid, password): """ Authenticate the userid and password against username and password. """ credentials = { get_user_model().USERNAME_FIELD: userid, 'password': password } user = authenticate(**credentials) ...
[ "def", "authenticate_credentials", "(", "self", ",", "userid", ",", "password", ")", ":", "credentials", "=", "{", "get_user_model", "(", ")", ".", "USERNAME_FIELD", ":", "userid", ",", "'password'", ":", "password", "}", "user", "=", "authenticate", "(", "*...
Authenticate the userid and password against username and password.
[ "Authenticate", "the", "userid", "and", "password", "against", "username", "and", "password", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/authentication.py#L87-L103
ronaldguillen/wave
wave/authentication.py
SessionAuthentication.enforce_csrf
def enforce_csrf(self, request): """ Enforce CSRF validation for session based authentication. """ reason = CSRFCheck().process_view(request, None, (), {}) if reason: # CSRF failed, bail with explicit error message raise exceptions.PermissionDenied('CSRF F...
python
def enforce_csrf(self, request): """ Enforce CSRF validation for session based authentication. """ reason = CSRFCheck().process_view(request, None, (), {}) if reason: # CSRF failed, bail with explicit error message raise exceptions.PermissionDenied('CSRF F...
[ "def", "enforce_csrf", "(", "self", ",", "request", ")", ":", "reason", "=", "CSRFCheck", "(", ")", ".", "process_view", "(", "request", ",", "None", ",", "(", ")", ",", "{", "}", ")", "if", "reason", ":", "# CSRF failed, bail with explicit error message", ...
Enforce CSRF validation for session based authentication.
[ "Enforce", "CSRF", "validation", "for", "session", "based", "authentication", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/authentication.py#L132-L139
fusionapp/fusion-util
fusion_util/enums.py
filter_enum
def filter_enum(pred, enum): """ Create a new enumeration containing only items filtered from another enumeration. Hidden enum items in the original enumeration are excluded. :type pred: ``Callable[[`EnumItem`], bool]`` :param pred: Predicate that will keep items for which the result is true. ...
python
def filter_enum(pred, enum): """ Create a new enumeration containing only items filtered from another enumeration. Hidden enum items in the original enumeration are excluded. :type pred: ``Callable[[`EnumItem`], bool]`` :param pred: Predicate that will keep items for which the result is true. ...
[ "def", "filter_enum", "(", "pred", ",", "enum", ")", ":", "def", "_items", "(", ")", ":", "for", "item", "in", "enum", ":", "yield", "EnumItem", "(", "item", ".", "value", ",", "item", ".", "desc", ",", "not", "pred", "(", "item", ")", ",", "*", ...
Create a new enumeration containing only items filtered from another enumeration. Hidden enum items in the original enumeration are excluded. :type pred: ``Callable[[`EnumItem`], bool]`` :param pred: Predicate that will keep items for which the result is true. :type enum: Enum :param enum: Enu...
[ "Create", "a", "new", "enumeration", "containing", "only", "items", "filtered", "from", "another", "enumeration", "." ]
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L299-L320
fusionapp/fusion-util
fusion_util/enums.py
Enum.from_pairs
def from_pairs(cls, doc, pairs): """ Construct an enumeration from an iterable of pairs. :param doc: See `Enum.__init__`. :type pairs: ``Iterable[Tuple[unicode, unicode]]`` :param pairs: Iterable to construct the enumeration from. :rtype: Enum """ values ...
python
def from_pairs(cls, doc, pairs): """ Construct an enumeration from an iterable of pairs. :param doc: See `Enum.__init__`. :type pairs: ``Iterable[Tuple[unicode, unicode]]`` :param pairs: Iterable to construct the enumeration from. :rtype: Enum """ values ...
[ "def", "from_pairs", "(", "cls", ",", "doc", ",", "pairs", ")", ":", "values", "=", "(", "EnumItem", "(", "value", ",", "desc", ")", "for", "value", ",", "desc", "in", "pairs", ")", "return", "cls", "(", "doc", "=", "doc", ",", "values", "=", "va...
Construct an enumeration from an iterable of pairs. :param doc: See `Enum.__init__`. :type pairs: ``Iterable[Tuple[unicode, unicode]]`` :param pairs: Iterable to construct the enumeration from. :rtype: Enum
[ "Construct", "an", "enumeration", "from", "an", "iterable", "of", "pairs", "." ]
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L69-L79
fusionapp/fusion-util
fusion_util/enums.py
Enum.get
def get(self, value): """ Get an enumeration item for an enumeration value. :param unicode value: Enumeration value. :raise InvalidEnumItem: If ``value`` does not match any known enumeration value. :rtype: EnumItem """ _nothing = object() item = s...
python
def get(self, value): """ Get an enumeration item for an enumeration value. :param unicode value: Enumeration value. :raise InvalidEnumItem: If ``value`` does not match any known enumeration value. :rtype: EnumItem """ _nothing = object() item = s...
[ "def", "get", "(", "self", ",", "value", ")", ":", "_nothing", "=", "object", "(", ")", "item", "=", "self", ".", "_values", ".", "get", "(", "value", ",", "_nothing", ")", "if", "item", "is", "_nothing", ":", "raise", "InvalidEnumItem", "(", "value"...
Get an enumeration item for an enumeration value. :param unicode value: Enumeration value. :raise InvalidEnumItem: If ``value`` does not match any known enumeration value. :rtype: EnumItem
[ "Get", "an", "enumeration", "item", "for", "an", "enumeration", "value", "." ]
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L89-L102
fusionapp/fusion-util
fusion_util/enums.py
Enum.extra
def extra(self, value, extra_name, default=None): """ Get the additional enumeration value for ``extra_name``. :param unicode value: Enumeration value. :param str extra_name: Extra name. :param default: Default value in the case ``extra_name`` doesn't exist. """ ...
python
def extra(self, value, extra_name, default=None): """ Get the additional enumeration value for ``extra_name``. :param unicode value: Enumeration value. :param str extra_name: Extra name. :param default: Default value in the case ``extra_name`` doesn't exist. """ ...
[ "def", "extra", "(", "self", ",", "value", ",", "extra_name", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", ".", "get", "(", "value", ")", ".", "get", "(", "extra_name", ",", "default", ")", "except", "InvalidEnumItem", ":", "r...
Get the additional enumeration value for ``extra_name``. :param unicode value: Enumeration value. :param str extra_name: Extra name. :param default: Default value in the case ``extra_name`` doesn't exist.
[ "Get", "the", "additional", "enumeration", "value", "for", "extra_name", "." ]
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L123-L134
fusionapp/fusion-util
fusion_util/enums.py
Enum.find_all
def find_all(self, **names): """ Find all items with matching extra values. :param \*\*names: Extra values to match. :rtype: ``Iterable[`EnumItem`]`` """ values = names.items() if len(values) != 1: raise ValueError('Only one query is allowed at a time...
python
def find_all(self, **names): """ Find all items with matching extra values. :param \*\*names: Extra values to match. :rtype: ``Iterable[`EnumItem`]`` """ values = names.items() if len(values) != 1: raise ValueError('Only one query is allowed at a time...
[ "def", "find_all", "(", "self", ",", "*", "*", "names", ")", ":", "values", "=", "names", ".", "items", "(", ")", "if", "len", "(", "values", ")", "!=", "1", ":", "raise", "ValueError", "(", "'Only one query is allowed at a time'", ")", "name", ",", "v...
Find all items with matching extra values. :param \*\*names: Extra values to match. :rtype: ``Iterable[`EnumItem`]``
[ "Find", "all", "items", "with", "matching", "extra", "values", "." ]
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L156-L169
inveniosoftware-attic/invenio-upgrader
invenio_upgrader/upgrades/invenio_upgrader_2015_09_23_legacy_removal.py
LegacyRemoval.do_upgrade
def do_upgrade(self): """Implement your upgrades here.""" sql = text('delete from upgrade where upgrade = :upgrade') for upgrade in self.legacy_upgrades: db.engine.execute(sql, upgrade=upgrade)
python
def do_upgrade(self): """Implement your upgrades here.""" sql = text('delete from upgrade where upgrade = :upgrade') for upgrade in self.legacy_upgrades: db.engine.execute(sql, upgrade=upgrade)
[ "def", "do_upgrade", "(", "self", ")", ":", "sql", "=", "text", "(", "'delete from upgrade where upgrade = :upgrade'", ")", "for", "upgrade", "in", "self", ".", "legacy_upgrades", ":", "db", ".", "engine", ".", "execute", "(", "sql", ",", "upgrade", "=", "up...
Implement your upgrades here.
[ "Implement", "your", "upgrades", "here", "." ]
train
https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/upgrades/invenio_upgrader_2015_09_23_legacy_removal.py#L108-L112
SkyLothar/shcmd
shcmd/utils.py
expand_args
def expand_args(cmd_args): """split command args to args list returns a list of args :param cmd_args: command args, can be tuple, list or str """ if isinstance(cmd_args, (tuple, list)): args_list = list(cmd_args) else: args_list = shlex.split(cmd_args) return args_list
python
def expand_args(cmd_args): """split command args to args list returns a list of args :param cmd_args: command args, can be tuple, list or str """ if isinstance(cmd_args, (tuple, list)): args_list = list(cmd_args) else: args_list = shlex.split(cmd_args) return args_list
[ "def", "expand_args", "(", "cmd_args", ")", ":", "if", "isinstance", "(", "cmd_args", ",", "(", "tuple", ",", "list", ")", ")", ":", "args_list", "=", "list", "(", "cmd_args", ")", "else", ":", "args_list", "=", "shlex", ".", "split", "(", "cmd_args", ...
split command args to args list returns a list of args :param cmd_args: command args, can be tuple, list or str
[ "split", "command", "args", "to", "args", "list", "returns", "a", "list", "of", "args" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/utils.py#L6-L16
brentpayne/phrase
phrase/phrase_dictionary.py
PhraseDictionary.add
def add(self, phrase, id=None): """ Adds a new phrase to the dictionary :param phrase: the new phrase as a list of tokens :param phrase_id: optionally the phrase_id can be set on addition. Beware, if you set one id you should set them all as the auto-generated ids do not tak...
python
def add(self, phrase, id=None): """ Adds a new phrase to the dictionary :param phrase: the new phrase as a list of tokens :param phrase_id: optionally the phrase_id can be set on addition. Beware, if you set one id you should set them all as the auto-generated ids do not tak...
[ "def", "add", "(", "self", ",", "phrase", ",", "id", "=", "None", ")", ":", "phrase_id", "=", "id", "if", "id", "is", "not", "None", "else", "self", ".", "get_next_id", "(", ")", "PhraseDictionary", ".", "_add_phrase", "(", "phrase", ",", "phrase_id", ...
Adds a new phrase to the dictionary :param phrase: the new phrase as a list of tokens :param phrase_id: optionally the phrase_id can be set on addition. Beware, if you set one id you should set them all as the auto-generated ids do not take into account phrase_ids set this way. :ret...
[ "Adds", "a", "new", "phrase", "to", "the", "dictionary", ":", "param", "phrase", ":", "the", "new", "phrase", "as", "a", "list", "of", "tokens", ":", "param", "phrase_id", ":", "optionally", "the", "phrase_id", "can", "be", "set", "on", "addition", ".", ...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/phrase_dictionary.py#L29-L39
brentpayne/phrase
phrase/phrase_dictionary.py
PhraseDictionary._add_phrase
def _add_phrase(cls, phrase, phrase_id, dictionary=None, word_list=None): """ Adds a phrase to a phrase dictionary. :param phrase: list of tokens :param phrase_id: phrase id :param dictionary: phrase dictionary :return: new phrase dictionary """ # @Note: t...
python
def _add_phrase(cls, phrase, phrase_id, dictionary=None, word_list=None): """ Adds a phrase to a phrase dictionary. :param phrase: list of tokens :param phrase_id: phrase id :param dictionary: phrase dictionary :return: new phrase dictionary """ # @Note: t...
[ "def", "_add_phrase", "(", "cls", ",", "phrase", ",", "phrase_id", ",", "dictionary", "=", "None", ",", "word_list", "=", "None", ")", ":", "# @Note: this function is called recursively", "if", "dictionary", "is", "None", ":", "dictionary", "=", "{", "}", "if"...
Adds a phrase to a phrase dictionary. :param phrase: list of tokens :param phrase_id: phrase id :param dictionary: phrase dictionary :return: new phrase dictionary
[ "Adds", "a", "phrase", "to", "a", "phrase", "dictionary", ".", ":", "param", "phrase", ":", "list", "of", "tokens", ":", "param", "phrase_id", ":", "phrase", "id", ":", "param", "dictionary", ":", "phrase", "dictionary", ":", "return", ":", "new", "phras...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/phrase_dictionary.py#L42-L62
brentpayne/phrase
phrase/phrase_dictionary.py
PhraseDictionary.contains_text_tokens
def contains_text_tokens(self, text_tokens): """ Returns true if a phrase in the dictionary matches the list of text tokens :param text_tokens: a list of tokens. Each token a string of text. :return: True/False """ id_run = [] for token in text_tokens: ...
python
def contains_text_tokens(self, text_tokens): """ Returns true if a phrase in the dictionary matches the list of text tokens :param text_tokens: a list of tokens. Each token a string of text. :return: True/False """ id_run = [] for token in text_tokens: ...
[ "def", "contains_text_tokens", "(", "self", ",", "text_tokens", ")", ":", "id_run", "=", "[", "]", "for", "token", "in", "text_tokens", ":", "id", "=", "self", ".", "word_list", ".", "get", "(", "token", ",", "None", ")", "if", "id", "is", "None", ":...
Returns true if a phrase in the dictionary matches the list of text tokens :param text_tokens: a list of tokens. Each token a string of text. :return: True/False
[ "Returns", "true", "if", "a", "phrase", "in", "the", "dictionary", "matches", "the", "list", "of", "text", "tokens", ":", "param", "text_tokens", ":", "a", "list", "of", "tokens", ".", "Each", "token", "a", "string", "of", "text", ".", ":", "return", "...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/phrase_dictionary.py#L72-L84
brentpayne/phrase
phrase/phrase_dictionary.py
PhraseDictionary.return_max_phrase
def return_max_phrase(run, idx, dictionary): """ Finds the maximal phrase in the run starting from the given index. It uses the dictionary to find sequences of ids that can be merged into a phrase. :param run: a run of ids :param idx: the position in the run to start looking fo...
python
def return_max_phrase(run, idx, dictionary): """ Finds the maximal phrase in the run starting from the given index. It uses the dictionary to find sequences of ids that can be merged into a phrase. :param run: a run of ids :param idx: the position in the run to start looking fo...
[ "def", "return_max_phrase", "(", "run", ",", "idx", ",", "dictionary", ")", ":", "if", "idx", "<", "len", "(", "run", ")", "and", "run", "[", "idx", "]", "in", "dictionary", ":", "id", "=", "run", "[", "idx", "]", "rv", ",", "rv_idx", "=", "Phras...
Finds the maximal phrase in the run starting from the given index. It uses the dictionary to find sequences of ids that can be merged into a phrase. :param run: a run of ids :param idx: the position in the run to start looking for a merge sequence :param dictionary: the dictionary to u...
[ "Finds", "the", "maximal", "phrase", "in", "the", "run", "starting", "from", "the", "given", "index", ".", "It", "uses", "the", "dictionary", "to", "find", "sequences", "of", "ids", "that", "can", "be", "merged", "into", "a", "phrase", ".", ":", "param",...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/phrase_dictionary.py#L116-L136
brentpayne/phrase
phrase/phrase_dictionary.py
PhraseDictionary.convert_to_merged_ids
def convert_to_merged_ids(self, id_run): """ Converts any identified phrases in the run into phrase_ids. The dictionary provides all acceptable phrases :param id_run: a run of token ids :param dictionary: a dictionary of acceptable phrases described as there component token ids ...
python
def convert_to_merged_ids(self, id_run): """ Converts any identified phrases in the run into phrase_ids. The dictionary provides all acceptable phrases :param id_run: a run of token ids :param dictionary: a dictionary of acceptable phrases described as there component token ids ...
[ "def", "convert_to_merged_ids", "(", "self", ",", "id_run", ")", ":", "i", "=", "0", "rv", "=", "[", "]", "while", "i", "<", "len", "(", "id_run", ")", ":", "phrase_id", ",", "offset", "=", "self", ".", "max_phrase", "(", "id_run", ",", "i", ")", ...
Converts any identified phrases in the run into phrase_ids. The dictionary provides all acceptable phrases :param id_run: a run of token ids :param dictionary: a dictionary of acceptable phrases described as there component token ids :return: a run of token and phrase ids.
[ "Converts", "any", "identified", "phrases", "in", "the", "run", "into", "phrase_ids", ".", "The", "dictionary", "provides", "all", "acceptable", "phrases", ":", "param", "id_run", ":", "a", "run", "of", "token", "ids", ":", "param", "dictionary", ":", "a", ...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/phrase_dictionary.py#L144-L161
brentpayne/phrase
phrase/phrase_dictionary.py
PhraseDictionary.generate_phrase_detection_function
def generate_phrase_detection_function(cls, min_token_count, max_phrases, exclude_ngram_filter=None): """ This is a factory function for generating a phrase detection function :param cls: the class :param min_token_count: tokens that appear less than this will be ignored in the phrase de...
python
def generate_phrase_detection_function(cls, min_token_count, max_phrases, exclude_ngram_filter=None): """ This is a factory function for generating a phrase detection function :param cls: the class :param min_token_count: tokens that appear less than this will be ignored in the phrase de...
[ "def", "generate_phrase_detection_function", "(", "cls", ",", "min_token_count", ",", "max_phrases", ",", "exclude_ngram_filter", "=", "None", ")", ":", "#if exclude_ngram_filter is None and cls.exclude_ngram_filter:", "# exclude_ngram_filter = cls.exclude_ngram_filter", "def", ...
This is a factory function for generating a phrase detection function :param cls: the class :param min_token_count: tokens that appear less than this will be ignored in the phrase detection function :param max_phrases: the maximum number of phrases to return in the phrase detection function ...
[ "This", "is", "a", "factory", "function", "for", "generating", "a", "phrase", "detection", "function", ":", "param", "cls", ":", "the", "class", ":", "param", "min_token_count", ":", "tokens", "that", "appear", "less", "than", "this", "will", "be", "ignored"...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/phrase_dictionary.py#L199-L222
etcher-be/emiz
emiz/avwx/service.py
get_service
def get_service(station: str) -> Service: """ Returns the preferred service for a given station """ for prefix in PREFERRED: if station.startswith(prefix): return PREFERRED[prefix] # type: ignore return NOAA
python
def get_service(station: str) -> Service: """ Returns the preferred service for a given station """ for prefix in PREFERRED: if station.startswith(prefix): return PREFERRED[prefix] # type: ignore return NOAA
[ "def", "get_service", "(", "station", ":", "str", ")", "->", "Service", ":", "for", "prefix", "in", "PREFERRED", ":", "if", "station", ".", "startswith", "(", "prefix", ")", ":", "return", "PREFERRED", "[", "prefix", "]", "# type: ignore", "return", "NOAA"...
Returns the preferred service for a given station
[ "Returns", "the", "preferred", "service", "for", "a", "given", "station" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L143-L150
etcher-be/emiz
emiz/avwx/service.py
Service.make_err
def make_err(self, body: str, key: str = 'report path') -> InvalidRequest: """ Returns an InvalidRequest exception with formatted error message """ msg = f'Could not find {key} in {self.__class__.__name__} response\n' return InvalidRequest(msg + body)
python
def make_err(self, body: str, key: str = 'report path') -> InvalidRequest: """ Returns an InvalidRequest exception with formatted error message """ msg = f'Could not find {key} in {self.__class__.__name__} response\n' return InvalidRequest(msg + body)
[ "def", "make_err", "(", "self", ",", "body", ":", "str", ",", "key", ":", "str", "=", "'report path'", ")", "->", "InvalidRequest", ":", "msg", "=", "f'Could not find {key} in {self.__class__.__name__} response\\n'", "return", "InvalidRequest", "(", "msg", "+", "b...
Returns an InvalidRequest exception with formatted error message
[ "Returns", "an", "InvalidRequest", "exception", "with", "formatted", "error", "message" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L27-L32
etcher-be/emiz
emiz/avwx/service.py
Service.fetch
def fetch(self, station: str) -> str: """ Fetches a report string from the service """ valid_station(station) try: resp = getattr(requests, self.method.lower())(self.url.format(self.rtype, station)) if resp.status_code != 200: raise SourceE...
python
def fetch(self, station: str) -> str: """ Fetches a report string from the service """ valid_station(station) try: resp = getattr(requests, self.method.lower())(self.url.format(self.rtype, station)) if resp.status_code != 200: raise SourceE...
[ "def", "fetch", "(", "self", ",", "station", ":", "str", ")", "->", "str", ":", "valid_station", "(", "station", ")", "try", ":", "resp", "=", "getattr", "(", "requests", ",", "self", ".", "method", ".", "lower", "(", ")", ")", "(", "self", ".", ...
Fetches a report string from the service
[ "Fetches", "a", "report", "string", "from", "the", "service" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L40-L53
etcher-be/emiz
emiz/avwx/service.py
NOAA._extract
def _extract(self, raw: str, station: str = None) -> str: """ Extracts the raw_report element from XML response """ resp = parsexml(raw) try: report = resp['response']['data'][self.rtype.upper()] except KeyError: raise self.make_err(raw) # ...
python
def _extract(self, raw: str, station: str = None) -> str: """ Extracts the raw_report element from XML response """ resp = parsexml(raw) try: report = resp['response']['data'][self.rtype.upper()] except KeyError: raise self.make_err(raw) # ...
[ "def", "_extract", "(", "self", ",", "raw", ":", "str", ",", "station", ":", "str", "=", "None", ")", "->", "str", ":", "resp", "=", "parsexml", "(", "raw", ")", "try", ":", "report", "=", "resp", "[", "'response'", "]", "[", "'data'", "]", "[", ...
Extracts the raw_report element from XML response
[ "Extracts", "the", "raw_report", "element", "from", "XML", "response" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L70-L90
etcher-be/emiz
emiz/avwx/service.py
AMO._extract
def _extract(self, raw: str, station: str = None) -> str: """ Extracts the report message from XML response """ resp = parsexml(raw) try: report = resp['response']['body']['items']['item'][self.rtype.lower() + 'Msg'] except KeyError: raise self.mak...
python
def _extract(self, raw: str, station: str = None) -> str: """ Extracts the report message from XML response """ resp = parsexml(raw) try: report = resp['response']['body']['items']['item'][self.rtype.lower() + 'Msg'] except KeyError: raise self.mak...
[ "def", "_extract", "(", "self", ",", "raw", ":", "str", ",", "station", ":", "str", "=", "None", ")", "->", "str", ":", "resp", "=", "parsexml", "(", "raw", ")", "try", ":", "report", "=", "resp", "[", "'response'", "]", "[", "'body'", "]", "[", ...
Extracts the report message from XML response
[ "Extracts", "the", "report", "message", "from", "XML", "response" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L100-L117
etcher-be/emiz
emiz/avwx/service.py
MAC._extract
def _extract(self, raw: str, station: str) -> str: # type: ignore """ Extracts the reports message using string finding """ report = raw[raw.find(station.upper() + ' '):] report = report[:report.find(' =')] return report
python
def _extract(self, raw: str, station: str) -> str: # type: ignore """ Extracts the reports message using string finding """ report = raw[raw.find(station.upper() + ' '):] report = report[:report.find(' =')] return report
[ "def", "_extract", "(", "self", ",", "raw", ":", "str", ",", "station", ":", "str", ")", "->", "str", ":", "# type: ignore", "report", "=", "raw", "[", "raw", ".", "find", "(", "station", ".", "upper", "(", ")", "+", "' '", ")", ":", "]", "report...
Extracts the reports message using string finding
[ "Extracts", "the", "reports", "message", "using", "string", "finding" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/service.py#L128-L134
etcher-be/emiz
emiz/weather/mizfile/mizfile_set_metar.py
set_weather_from_metar
def set_weather_from_metar( metar: typing.Union[Metar.Metar, str], in_file: typing.Union[str, Path], out_file: typing.Union[str, Path] = None ) -> typing.Tuple[typing.Union[str, None], typing.Union[str, None]]: """ Applies the weather from a METAR object to a MIZ file Args: ...
python
def set_weather_from_metar( metar: typing.Union[Metar.Metar, str], in_file: typing.Union[str, Path], out_file: typing.Union[str, Path] = None ) -> typing.Tuple[typing.Union[str, None], typing.Union[str, None]]: """ Applies the weather from a METAR object to a MIZ file Args: ...
[ "def", "set_weather_from_metar", "(", "metar", ":", "typing", ".", "Union", "[", "Metar", ".", "Metar", ",", "str", "]", ",", "in_file", ":", "typing", ".", "Union", "[", "str", ",", "Path", "]", ",", "out_file", ":", "typing", ".", "Union", "[", "st...
Applies the weather from a METAR object to a MIZ file Args: metar: metar object in_file: path to MIZ file out_file: path to output MIZ file (will default to in_file) Returns: tuple of error, success
[ "Applies", "the", "weather", "from", "a", "METAR", "object", "to", "a", "MIZ", "file" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/mizfile/mizfile_set_metar.py#L18-L63
bwesterb/tkbd
src/state.py
State._pull_schedule_loop
def _pull_schedule_loop(self): """ Called every 16 minutes to pull a new version of the schedule """ try: self.pull_schedule() delay = 16*60 except ScheduleError, e: self.l.exception("ScheduleError while pulling schedule. "+ "Retr...
python
def _pull_schedule_loop(self): """ Called every 16 minutes to pull a new version of the schedule """ try: self.pull_schedule() delay = 16*60 except ScheduleError, e: self.l.exception("ScheduleError while pulling schedule. "+ "Retr...
[ "def", "_pull_schedule_loop", "(", "self", ")", ":", "try", ":", "self", ".", "pull_schedule", "(", ")", "delay", "=", "16", "*", "60", "except", "ScheduleError", ",", "e", ":", "self", ".", "l", ".", "exception", "(", "\"ScheduleError while pulling schedule...
Called every 16 minutes to pull a new version of the schedule
[ "Called", "every", "16", "minutes", "to", "pull", "a", "new", "version", "of", "the", "schedule" ]
train
https://github.com/bwesterb/tkbd/blob/fcf16977d38a93fe9b7fa198513007ab9921b650/src/state.py#L75-L86
matthewdeanmartin/jiggle_version
jiggle_version/jiggle_class.py
JiggleVersion.leading_whitespace
def leading_whitespace(self, line): # type: (str) -> str """ For preserving indents :param line: :return: """ string = "" for char in line: if char in " \t": string += char continue else: ret...
python
def leading_whitespace(self, line): # type: (str) -> str """ For preserving indents :param line: :return: """ string = "" for char in line: if char in " \t": string += char continue else: ret...
[ "def", "leading_whitespace", "(", "self", ",", "line", ")", ":", "# type: (str) -> str", "string", "=", "\"\"", "for", "char", "in", "line", ":", "if", "char", "in", "\" \\t\"", ":", "string", "+=", "char", "continue", "else", ":", "return", "string", "ret...
For preserving indents :param line: :return:
[ "For", "preserving", "indents", ":", "param", "line", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L161-L174
matthewdeanmartin/jiggle_version
jiggle_version/jiggle_class.py
JiggleVersion.jiggle_source_code
def jiggle_source_code(self): # type: () ->int """ Updates version of central package """ changed = 0 for file_name in self.file_inventory.source_files: to_write = [] # self.create_missing(file_name, file_name) if not os.path.isfile(file_name)...
python
def jiggle_source_code(self): # type: () ->int """ Updates version of central package """ changed = 0 for file_name in self.file_inventory.source_files: to_write = [] # self.create_missing(file_name, file_name) if not os.path.isfile(file_name)...
[ "def", "jiggle_source_code", "(", "self", ")", ":", "# type: () ->int", "changed", "=", "0", "for", "file_name", "in", "self", ".", "file_inventory", ".", "source_files", ":", "to_write", "=", "[", "]", "# self.create_missing(file_name, file_name)", "if", "not", "...
Updates version of central package
[ "Updates", "version", "of", "central", "package" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L176-L227
matthewdeanmartin/jiggle_version
jiggle_version/jiggle_class.py
JiggleVersion.jiggle_setup_py
def jiggle_setup_py(self): # type: () -> int """ Edit a version = "1.2.3" or version="1.2.3", :return: """ changed = 0 setup_py = os.path.join(self.SRC, "setup.py") if not os.path.isfile(setup_py): return changed lines_to_write = [] ne...
python
def jiggle_setup_py(self): # type: () -> int """ Edit a version = "1.2.3" or version="1.2.3", :return: """ changed = 0 setup_py = os.path.join(self.SRC, "setup.py") if not os.path.isfile(setup_py): return changed lines_to_write = [] ne...
[ "def", "jiggle_setup_py", "(", "self", ")", ":", "# type: () -> int", "changed", "=", "0", "setup_py", "=", "os", ".", "path", ".", "join", "(", "self", ".", "SRC", ",", "\"setup.py\"", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "setup_py...
Edit a version = "1.2.3" or version="1.2.3", :return:
[ "Edit", "a", "version", "=", "1", ".", "2", ".", "3", "or", "version", "=", "1", ".", "2", ".", "3", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L249-L335
matthewdeanmartin/jiggle_version
jiggle_version/jiggle_class.py
JiggleVersion.jiggle_all
def jiggle_all(self): # type: () -> int """ All possible files :return: """ changed = 0 changed += self.jiggle_text_file() changed += self.jiggle_source_code() changed += self.jiggle_config_file() changed += self.jiggle_setup_py() # assert...
python
def jiggle_all(self): # type: () -> int """ All possible files :return: """ changed = 0 changed += self.jiggle_text_file() changed += self.jiggle_source_code() changed += self.jiggle_config_file() changed += self.jiggle_setup_py() # assert...
[ "def", "jiggle_all", "(", "self", ")", ":", "# type: () -> int", "changed", "=", "0", "changed", "+=", "self", ".", "jiggle_text_file", "(", ")", "changed", "+=", "self", ".", "jiggle_source_code", "(", ")", "changed", "+=", "self", ".", "jiggle_config_file", ...
All possible files :return:
[ "All", "possible", "files", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L343-L354
matthewdeanmartin/jiggle_version
jiggle_version/jiggle_class.py
JiggleVersion.jiggle_config_file
def jiggle_config_file(self): # type: () ->int """ Update ini, cfg, conf """ changed = 0 # setup.py related. setup.py itself should read __init__.py or __version__.py other_files = ["setup.cfg"] for file_name in other_files: filepath = os.path.join(...
python
def jiggle_config_file(self): # type: () ->int """ Update ini, cfg, conf """ changed = 0 # setup.py related. setup.py itself should read __init__.py or __version__.py other_files = ["setup.cfg"] for file_name in other_files: filepath = os.path.join(...
[ "def", "jiggle_config_file", "(", "self", ")", ":", "# type: () ->int", "changed", "=", "0", "# setup.py related. setup.py itself should read __init__.py or __version__.py", "other_files", "=", "[", "\"setup.cfg\"", "]", "for", "file_name", "in", "other_files", ":", "filepa...
Update ini, cfg, conf
[ "Update", "ini", "cfg", "conf" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L356-L389
matthewdeanmartin/jiggle_version
jiggle_version/jiggle_class.py
JiggleVersion.jiggle_text_file
def jiggle_text_file(self): # type: () -> int """ Update ver strings in a non-python, ordinary text file in root of package (next to setup.py). :return: """ changed = 0 files_to_update = [] for version_txt in self.file_inventory.text_files: if os.pat...
python
def jiggle_text_file(self): # type: () -> int """ Update ver strings in a non-python, ordinary text file in root of package (next to setup.py). :return: """ changed = 0 files_to_update = [] for version_txt in self.file_inventory.text_files: if os.pat...
[ "def", "jiggle_text_file", "(", "self", ")", ":", "# type: () -> int", "changed", "=", "0", "files_to_update", "=", "[", "]", "for", "version_txt", "in", "self", ".", "file_inventory", ".", "text_files", ":", "if", "os", ".", "path", ".", "isfile", "(", "v...
Update ver strings in a non-python, ordinary text file in root of package (next to setup.py). :return:
[ "Update", "ver", "strings", "in", "a", "non", "-", "python", "ordinary", "text", "file", "in", "root", "of", "package", "(", "next", "to", "setup", ".", "py", ")", ".", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/jiggle_class.py#L391-L414
matthewdeanmartin/jiggle_version
jiggle_version/package_info_finder.py
ModuleFinder.name_from_setup_py
def name_from_setup_py(self): # type: () -> str """ Extract likley module name from setup.py args :return: """ source = self.setup_py_source() if not source: return "" for row in source.split("\n"): # if "packages=" in row: ...
python
def name_from_setup_py(self): # type: () -> str """ Extract likley module name from setup.py args :return: """ source = self.setup_py_source() if not source: return "" for row in source.split("\n"): # if "packages=" in row: ...
[ "def", "name_from_setup_py", "(", "self", ")", ":", "# type: () -> str", "source", "=", "self", ".", "setup_py_source", "(", ")", "if", "not", "source", ":", "return", "\"\"", "for", "row", "in", "source", ".", "split", "(", "\"\\n\"", ")", ":", "#", "if...
Extract likley module name from setup.py args :return:
[ "Extract", "likley", "module", "name", "from", "setup", ".", "py", "args", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/package_info_finder.py#L60-L79
matthewdeanmartin/jiggle_version
jiggle_version/package_info_finder.py
ModuleFinder.via_find_packages
def via_find_packages(self): # type: () -> List[str] """ Use find_packages code to find modules. Can find LOTS of modules. :return: """ packages = [] # type: List[str] source = self.setup_py_source() if not source: return packages for row in ...
python
def via_find_packages(self): # type: () -> List[str] """ Use find_packages code to find modules. Can find LOTS of modules. :return: """ packages = [] # type: List[str] source = self.setup_py_source() if not source: return packages for row in ...
[ "def", "via_find_packages", "(", "self", ")", ":", "# type: () -> List[str]", "packages", "=", "[", "]", "# type: List[str]", "source", "=", "self", ".", "setup_py_source", "(", ")", "if", "not", "source", ":", "return", "packages", "for", "row", "in", "source...
Use find_packages code to find modules. Can find LOTS of modules. :return:
[ "Use", "find_packages", "code", "to", "find", "modules", ".", "Can", "find", "LOTS", "of", "modules", ".", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/package_info_finder.py#L135-L158
matthewdeanmartin/jiggle_version
jiggle_version/package_info_finder.py
ModuleFinder.find_project
def find_project(self): # type: () -> List[str] """ Get all candidate projects :return: """ folders = [f for f in os.listdir(".") if os.path.isdir(f)] candidates = [] setup = self.setup_py_source() for folder in folders: if os.path.isfile(fol...
python
def find_project(self): # type: () -> List[str] """ Get all candidate projects :return: """ folders = [f for f in os.listdir(".") if os.path.isdir(f)] candidates = [] setup = self.setup_py_source() for folder in folders: if os.path.isfile(fol...
[ "def", "find_project", "(", "self", ")", ":", "# type: () -> List[str]", "folders", "=", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "\".\"", ")", "if", "os", ".", "path", ".", "isdir", "(", "f", ")", "]", "candidates", "=", "[", "]", "s...
Get all candidate projects :return:
[ "Get", "all", "candidate", "projects", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/package_info_finder.py#L160-L223
matthewdeanmartin/jiggle_version
jiggle_version/package_info_finder.py
ModuleFinder.find_malformed_single_file_project
def find_malformed_single_file_project(self): # type: () -> List[str] """ Take first non-setup.py python file. What a mess. :return: """ files = [f for f in os.listdir(".") if os.path.isfile(f)] candidates = [] # project misnamed & not in setup.py for f...
python
def find_malformed_single_file_project(self): # type: () -> List[str] """ Take first non-setup.py python file. What a mess. :return: """ files = [f for f in os.listdir(".") if os.path.isfile(f)] candidates = [] # project misnamed & not in setup.py for f...
[ "def", "find_malformed_single_file_project", "(", "self", ")", ":", "# type: () -> List[str]", "files", "=", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "\".\"", ")", "if", "os", ".", "path", ".", "isfile", "(", "f", ")", "]", "candidates", "=...
Take first non-setup.py python file. What a mess. :return:
[ "Take", "first", "non", "-", "setup", ".", "py", "python", "file", ".", "What", "a", "mess", ".", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/package_info_finder.py#L229-L268
matthewdeanmartin/jiggle_version
jiggle_version/package_info_finder.py
ModuleFinder.find_single_file_project
def find_single_file_project(self): # type: () -> List[str] """ Find well formed singler file project :return: """ files = [f for f in os.listdir(".") if os.path.isfile(f)] candidates = [] setup_source = self.setup_py_source() for file in files: ...
python
def find_single_file_project(self): # type: () -> List[str] """ Find well formed singler file project :return: """ files = [f for f in os.listdir(".") if os.path.isfile(f)] candidates = [] setup_source = self.setup_py_source() for file in files: ...
[ "def", "find_single_file_project", "(", "self", ")", ":", "# type: () -> List[str]", "files", "=", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "\".\"", ")", "if", "os", ".", "path", ".", "isfile", "(", "f", ")", "]", "candidates", "=", "[", ...
Find well formed singler file project :return:
[ "Find", "well", "formed", "singler", "file", "project", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/package_info_finder.py#L270-L290
matthewdeanmartin/jiggle_version
jiggle_version/package_info_finder.py
ModuleFinder.validate_found_project
def validate_found_project(self, candidates): # type: (List[str]) -> None """ Should be only 1 project :param candidates: :return: """ if len(candidates) > 1: message = "Found multiple possible projects : " + unicode(candidates) logger.error(messa...
python
def validate_found_project(self, candidates): # type: (List[str]) -> None """ Should be only 1 project :param candidates: :return: """ if len(candidates) > 1: message = "Found multiple possible projects : " + unicode(candidates) logger.error(messa...
[ "def", "validate_found_project", "(", "self", ",", "candidates", ")", ":", "# type: (List[str]) -> None", "if", "len", "(", "candidates", ")", ">", "1", ":", "message", "=", "\"Found multiple possible projects : \"", "+", "unicode", "(", "candidates", ")", "logger",...
Should be only 1 project :param candidates: :return:
[ "Should", "be", "only", "1", "project", ":", "param", "candidates", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/package_info_finder.py#L292-L308
Nixiware/viper
nx/viper/application.py
Application._getConfiguration
def _getConfiguration(self): """ Load application configuration files. :return: <dict> """ configDirectoryPath = os.path.join("application", "config") config = Config(configDirectoryPath) configData = config.getData() # setting application parameters ...
python
def _getConfiguration(self): """ Load application configuration files. :return: <dict> """ configDirectoryPath = os.path.join("application", "config") config = Config(configDirectoryPath) configData = config.getData() # setting application parameters ...
[ "def", "_getConfiguration", "(", "self", ")", ":", "configDirectoryPath", "=", "os", ".", "path", ".", "join", "(", "\"application\"", ",", "\"config\"", ")", "config", "=", "Config", "(", "configDirectoryPath", ")", "configData", "=", "config", ".", "getData"...
Load application configuration files. :return: <dict>
[ "Load", "application", "configuration", "files", "." ]
train
https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L42-L57