Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
8,700
bcbnz/pylabels
labels/sheet.py
Sheet.preview
def preview(self, page, filelike, format='png', dpi=72, background_colour=0xFFFFFF): """Render a preview image of a page. Parameters ---------- page: positive integer Which page to render. Must be in the range [1, page_count] filelike: path or file-like object ...
python
def preview(self, page, filelike, format='png', dpi=72, background_colour=0xFFFFFF): """Render a preview image of a page. Parameters ---------- page: positive integer Which page to render. Must be in the range [1, page_count] filelike: path or file-like object ...
['def', 'preview', '(', 'self', ',', 'page', ',', 'filelike', ',', 'format', '=', "'png'", ',', 'dpi', '=', '72', ',', 'background_colour', '=', '0xFFFFFF', ')', ':', '# Check the page number.', 'if', 'page', '<', '1', 'or', 'page', '>', 'self', '.', 'page_count', ':', 'raise', 'ValueError', '(', '"Invalid page number;...
Render a preview image of a page. Parameters ---------- page: positive integer Which page to render. Must be in the range [1, page_count] filelike: path or file-like object Can be a filename as a string, a Python file object, or something which behave...
['Render', 'a', 'preview', 'image', 'of', 'a', 'page', '.']
train
https://github.com/bcbnz/pylabels/blob/ecdb4ca48061d8f1dc0fcfe2d55ce2b89e0e5ec6/labels/sheet.py#L494-L553
8,701
hardbyte/python-can
can/interfaces/systec/ucan.py
UcanServer.get_hardware_info
def get_hardware_info(self): """ Returns the extended hardware information of a device. With multi-channel USB-CANmoduls the information for both CAN channels are returned separately. :return: Tuple with extended hardware information structure (see structure :class:`Hardware...
python
def get_hardware_info(self): """ Returns the extended hardware information of a device. With multi-channel USB-CANmoduls the information for both CAN channels are returned separately. :return: Tuple with extended hardware information structure (see structure :class:`Hardware...
['def', 'get_hardware_info', '(', 'self', ')', ':', 'hw_info_ex', '=', 'HardwareInfoEx', '(', ')', 'can_info_ch0', ',', 'can_info_ch1', '=', 'ChannelInfo', '(', ')', ',', 'ChannelInfo', '(', ')', 'UcanGetHardwareInfoEx2', '(', 'self', '.', '_handle', ',', 'byref', '(', 'hw_info_ex', ')', ',', 'byref', '(', 'can_info_ch...
Returns the extended hardware information of a device. With multi-channel USB-CANmoduls the information for both CAN channels are returned separately. :return: Tuple with extended hardware information structure (see structure :class:`HardwareInfoEx`) and structures with informat...
['Returns', 'the', 'extended', 'hardware', 'information', 'of', 'a', 'device', '.', 'With', 'multi', '-', 'channel', 'USB', '-', 'CANmoduls', 'the', 'information', 'for', 'both', 'CAN', 'channels', 'are', 'returned', 'separately', '.']
train
https://github.com/hardbyte/python-can/blob/cdc5254d96072df7739263623f3e920628a7d214/can/interfaces/systec/ucan.py#L484-L497
8,702
af/turrentine
turrentine/views.py
PageView._mark_html_fields_as_safe
def _mark_html_fields_as_safe(self, page): """ Mark the html content as safe so we don't have to use the safe template tag in all cms templates: """ page.title = mark_safe(page.title) page.content = mark_safe(page.content) return page
python
def _mark_html_fields_as_safe(self, page): """ Mark the html content as safe so we don't have to use the safe template tag in all cms templates: """ page.title = mark_safe(page.title) page.content = mark_safe(page.content) return page
['def', '_mark_html_fields_as_safe', '(', 'self', ',', 'page', ')', ':', 'page', '.', 'title', '=', 'mark_safe', '(', 'page', '.', 'title', ')', 'page', '.', 'content', '=', 'mark_safe', '(', 'page', '.', 'content', ')', 'return', 'page']
Mark the html content as safe so we don't have to use the safe template tag in all cms templates:
['Mark', 'the', 'html', 'content', 'as', 'safe', 'so', 'we', 'don', 't', 'have', 'to', 'use', 'the', 'safe', 'template', 'tag', 'in', 'all', 'cms', 'templates', ':']
train
https://github.com/af/turrentine/blob/bbbd5139744ccc6264595cc8960784e5c308c009/turrentine/views.py#L91-L98
8,703
hydraplatform/hydra-base
hydra_base/lib/users.py
get_perm_by_code
def get_perm_by_code(perm_code,**kwargs): """ Get a permission by its code """ try: perm = db.DBSession.query(Perm).filter(Perm.code==perm_code).one() return perm except NoResultFound: raise ResourceNotFoundError("Permission not found (perm_code={})".format(perm_code))
python
def get_perm_by_code(perm_code,**kwargs): """ Get a permission by its code """ try: perm = db.DBSession.query(Perm).filter(Perm.code==perm_code).one() return perm except NoResultFound: raise ResourceNotFoundError("Permission not found (perm_code={})".format(perm_code))
['def', 'get_perm_by_code', '(', 'perm_code', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'perm', '=', 'db', '.', 'DBSession', '.', 'query', '(', 'Perm', ')', '.', 'filter', '(', 'Perm', '.', 'code', '==', 'perm_code', ')', '.', 'one', '(', ')', 'return', 'perm', 'except', 'NoResultFound', ':', 'raise', 'ResourceNot...
Get a permission by its code
['Get', 'a', 'permission', 'by', 'its', 'code']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/users.py#L447-L456
8,704
ninuxorg/nodeshot
nodeshot/community/profiles/serializers.py
ChangePasswordSerializer.validate_current_password
def validate_current_password(self, value): """ current password check """ if self.instance and self.instance.has_usable_password() and not self.instance.check_password(value): raise serializers.ValidationError(_('Current password is not correct')) return value
python
def validate_current_password(self, value): """ current password check """ if self.instance and self.instance.has_usable_password() and not self.instance.check_password(value): raise serializers.ValidationError(_('Current password is not correct')) return value
['def', 'validate_current_password', '(', 'self', ',', 'value', ')', ':', 'if', 'self', '.', 'instance', 'and', 'self', '.', 'instance', '.', 'has_usable_password', '(', ')', 'and', 'not', 'self', '.', 'instance', '.', 'check_password', '(', 'value', ')', ':', 'raise', 'serializers', '.', 'ValidationError', '(', '_', '...
current password check
['current', 'password', 'check']
train
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/community/profiles/serializers.py#L264-L268
8,705
josuebrunel/myql
myql/contrib/finance/stockscraper/stockretriever.py
StockRetriever.get_historical_info
def get_historical_info(self, symbol,items=None, startDate=None, endDate=None, limit=None): """get_historical_info() uses the csv datatable to retrieve all available historical data on a typical historical prices page """ startDate, endDate = self.__get_time_range(startDate, endDate) res...
python
def get_historical_info(self, symbol,items=None, startDate=None, endDate=None, limit=None): """get_historical_info() uses the csv datatable to retrieve all available historical data on a typical historical prices page """ startDate, endDate = self.__get_time_range(startDate, endDate) res...
['def', 'get_historical_info', '(', 'self', ',', 'symbol', ',', 'items', '=', 'None', ',', 'startDate', '=', 'None', ',', 'endDate', '=', 'None', ',', 'limit', '=', 'None', ')', ':', 'startDate', ',', 'endDate', '=', 'self', '.', '__get_time_range', '(', 'startDate', ',', 'endDate', ')', 'response', '=', 'self', '.', '...
get_historical_info() uses the csv datatable to retrieve all available historical data on a typical historical prices page
['get_historical_info', '()', 'uses', 'the', 'csv', 'datatable', 'to', 'retrieve', 'all', 'available', 'historical', 'data', 'on', 'a', 'typical', 'historical', 'prices', 'page']
train
https://github.com/josuebrunel/myql/blob/891bad29cc83a81b3f5ebc4d0401d6f2c22f119e/myql/contrib/finance/stockscraper/stockretriever.py#L49-L54
8,706
linkedin/Zopkio
zopkio/utils.py
load_module
def load_module(filename): """ Loads a module by filename """ basename = os.path.basename(filename) path = os.path.dirname(filename) sys.path.append(path) # TODO(tlan) need to figure out how to handle errors thrown here return __import__(os.path.splitext(basename)[0])
python
def load_module(filename): """ Loads a module by filename """ basename = os.path.basename(filename) path = os.path.dirname(filename) sys.path.append(path) # TODO(tlan) need to figure out how to handle errors thrown here return __import__(os.path.splitext(basename)[0])
['def', 'load_module', '(', 'filename', ')', ':', 'basename', '=', 'os', '.', 'path', '.', 'basename', '(', 'filename', ')', 'path', '=', 'os', '.', 'path', '.', 'dirname', '(', 'filename', ')', 'sys', '.', 'path', '.', 'append', '(', 'path', ')', '# TODO(tlan) need to figure out how to handle errors thrown here', 'ret...
Loads a module by filename
['Loads', 'a', 'module', 'by', 'filename']
train
https://github.com/linkedin/Zopkio/blob/a06e35a884cd26eedca0aac8ba6b9b40c417a01c/zopkio/utils.py#L58-L66
8,707
jeffrimko/Auxly
lib/auxly/shell.py
silent
def silent(cmd, **kwargs): """Calls the given shell command. Output will not be displayed. Returns the status code. **Examples**: :: auxly.shell.silent("ls") """ return call(cmd, shell=True, stdout=NULL, stderr=NULL, **kwargs)
python
def silent(cmd, **kwargs): """Calls the given shell command. Output will not be displayed. Returns the status code. **Examples**: :: auxly.shell.silent("ls") """ return call(cmd, shell=True, stdout=NULL, stderr=NULL, **kwargs)
['def', 'silent', '(', 'cmd', ',', '*', '*', 'kwargs', ')', ':', 'return', 'call', '(', 'cmd', ',', 'shell', '=', 'True', ',', 'stdout', '=', 'NULL', ',', 'stderr', '=', 'NULL', ',', '*', '*', 'kwargs', ')']
Calls the given shell command. Output will not be displayed. Returns the status code. **Examples**: :: auxly.shell.silent("ls")
['Calls', 'the', 'given', 'shell', 'command', '.', 'Output', 'will', 'not', 'be', 'displayed', '.', 'Returns', 'the', 'status', 'code', '.']
train
https://github.com/jeffrimko/Auxly/blob/5aae876bcb6ca117c81d904f9455764cdc78cd48/lib/auxly/shell.py#L32-L40
8,708
CSchoel/nolds
nolds/datasets.py
load_qrandom
def load_qrandom(): """ Loads a set of 10000 random numbers generated by qrandom. This dataset can be used when you want to do some limited tests with "true" random data without an internet connection. Returns: int array the dataset """ fname = "datasets/qrandom.npy" with pkg_resources.resou...
python
def load_qrandom(): """ Loads a set of 10000 random numbers generated by qrandom. This dataset can be used when you want to do some limited tests with "true" random data without an internet connection. Returns: int array the dataset """ fname = "datasets/qrandom.npy" with pkg_resources.resou...
['def', 'load_qrandom', '(', ')', ':', 'fname', '=', '"datasets/qrandom.npy"', 'with', 'pkg_resources', '.', 'resource_stream', '(', '__name__', ',', 'fname', ')', 'as', 'f', ':', 'return', 'np', '.', 'load', '(', 'f', ')']
Loads a set of 10000 random numbers generated by qrandom. This dataset can be used when you want to do some limited tests with "true" random data without an internet connection. Returns: int array the dataset
['Loads', 'a', 'set', 'of', '10000', 'random', 'numbers', 'generated', 'by', 'qrandom', '.']
train
https://github.com/CSchoel/nolds/blob/8a5ecc472d67ac08b571bd68967287668ca9058e/nolds/datasets.py#L87-L100
8,709
baverman/supplement
supplement/remote.py
Environment.get_location
def get_location(self, project_path, source, position, filename): """Return line number and file path where name under cursor is defined If line is None location wasn't finded. If file path is None, defenition is located in the same source. :param project_path: absolute project path ...
python
def get_location(self, project_path, source, position, filename): """Return line number and file path where name under cursor is defined If line is None location wasn't finded. If file path is None, defenition is located in the same source. :param project_path: absolute project path ...
['def', 'get_location', '(', 'self', ',', 'project_path', ',', 'source', ',', 'position', ',', 'filename', ')', ':', 'return', 'self', '.', '_call', '(', "'get_location'", ',', 'project_path', ',', 'source', ',', 'position', ',', 'filename', ')']
Return line number and file path where name under cursor is defined If line is None location wasn't finded. If file path is None, defenition is located in the same source. :param project_path: absolute project path :param source: unicode or byte string code source :param positi...
['Return', 'line', 'number', 'and', 'file', 'path', 'where', 'name', 'under', 'cursor', 'is', 'defined']
train
https://github.com/baverman/supplement/blob/955002fe5a5749c9f0d89002f0006ec4fcd35bc9/supplement/remote.py#L125-L137
8,710
noahbenson/neuropythy
neuropythy/freesurfer/core.py
to_subject_paths
def to_subject_paths(paths): ''' to_subject_paths(paths) accepts either a string that is a :-separated list of directories or a list of directories and yields a list of all the existing directories. ''' if paths is None: return [] if pimms.is_str(paths): paths = paths.split(':') paths = [os...
python
def to_subject_paths(paths): ''' to_subject_paths(paths) accepts either a string that is a :-separated list of directories or a list of directories and yields a list of all the existing directories. ''' if paths is None: return [] if pimms.is_str(paths): paths = paths.split(':') paths = [os...
['def', 'to_subject_paths', '(', 'paths', ')', ':', 'if', 'paths', 'is', 'None', ':', 'return', '[', ']', 'if', 'pimms', '.', 'is_str', '(', 'paths', ')', ':', 'paths', '=', 'paths', '.', 'split', '(', "':'", ')', 'paths', '=', '[', 'os', '.', 'path', '.', 'expanduser', '(', 'p', ')', 'for', 'p', 'in', 'paths', ']', 'r...
to_subject_paths(paths) accepts either a string that is a :-separated list of directories or a list of directories and yields a list of all the existing directories.
['to_subject_paths', '(', 'paths', ')', 'accepts', 'either', 'a', 'string', 'that', 'is', 'a', ':', '-', 'separated', 'list', 'of', 'directories', 'or', 'a', 'list', 'of', 'directories', 'and', 'yields', 'a', 'list', 'of', 'all', 'the', 'existing', 'directories', '.']
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/freesurfer/core.py#L22-L30
8,711
lazygunner/xunleipy
xunleipy/rsa_lib.py
extendedEuclid
def extendedEuclid(a, b): """return a tuple of three values: x, y and z, such that x is the GCD of a and b, and x = y * a + z * b""" if a == 0: return b, 0, 1 else: g, y, x = extendedEuclid(b % a, a) return g, x - (b // a) * y, y
python
def extendedEuclid(a, b): """return a tuple of three values: x, y and z, such that x is the GCD of a and b, and x = y * a + z * b""" if a == 0: return b, 0, 1 else: g, y, x = extendedEuclid(b % a, a) return g, x - (b // a) * y, y
['def', 'extendedEuclid', '(', 'a', ',', 'b', ')', ':', 'if', 'a', '==', '0', ':', 'return', 'b', ',', '0', ',', '1', 'else', ':', 'g', ',', 'y', ',', 'x', '=', 'extendedEuclid', '(', 'b', '%', 'a', ',', 'a', ')', 'return', 'g', ',', 'x', '-', '(', 'b', '//', 'a', ')', '*', 'y', ',', 'y']
return a tuple of three values: x, y and z, such that x is the GCD of a and b, and x = y * a + z * b
['return', 'a', 'tuple', 'of', 'three', 'values', ':', 'x', 'y', 'and', 'z', 'such', 'that', 'x', 'is', 'the', 'GCD', 'of', 'a', 'and', 'b', 'and', 'x', '=', 'y', '*', 'a', '+', 'z', '*', 'b']
train
https://github.com/lazygunner/xunleipy/blob/cded7598a7bf04495156bae2d747883d1eacb3f4/xunleipy/rsa_lib.py#L33-L40
8,712
toumorokoshi/sprinter
sprinter/core/globals.py
load_global_config
def load_global_config(config_path): """ Load a global configuration object, and query for any required variables along the way """ config = configparser.RawConfigParser() if os.path.exists(config_path): logger.debug("Checking and setting global parameters...") config.read(config_path) e...
python
def load_global_config(config_path): """ Load a global configuration object, and query for any required variables along the way """ config = configparser.RawConfigParser() if os.path.exists(config_path): logger.debug("Checking and setting global parameters...") config.read(config_path) e...
['def', 'load_global_config', '(', 'config_path', ')', ':', 'config', '=', 'configparser', '.', 'RawConfigParser', '(', ')', 'if', 'os', '.', 'path', '.', 'exists', '(', 'config_path', ')', ':', 'logger', '.', 'debug', '(', '"Checking and setting global parameters..."', ')', 'config', '.', 'read', '(', 'config_path', '...
Load a global configuration object, and query for any required variables along the way
['Load', 'a', 'global', 'configuration', 'object', 'and', 'query', 'for', 'any', 'required', 'variables', 'along', 'the', 'way']
train
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L34-L53
8,713
PythonCharmers/python-future
src/future/utils/__init__.py
_get_caller_globals_and_locals
def _get_caller_globals_and_locals(): """ Returns the globals and locals of the calling frame. Is there an alternative to frame hacking here? """ caller_frame = inspect.stack()[2] myglobals = caller_frame[0].f_globals mylocals = caller_frame[0].f_locals return myglobals, mylocals
python
def _get_caller_globals_and_locals(): """ Returns the globals and locals of the calling frame. Is there an alternative to frame hacking here? """ caller_frame = inspect.stack()[2] myglobals = caller_frame[0].f_globals mylocals = caller_frame[0].f_locals return myglobals, mylocals
['def', '_get_caller_globals_and_locals', '(', ')', ':', 'caller_frame', '=', 'inspect', '.', 'stack', '(', ')', '[', '2', ']', 'myglobals', '=', 'caller_frame', '[', '0', ']', '.', 'f_globals', 'mylocals', '=', 'caller_frame', '[', '0', ']', '.', 'f_locals', 'return', 'myglobals', ',', 'mylocals']
Returns the globals and locals of the calling frame. Is there an alternative to frame hacking here?
['Returns', 'the', 'globals', 'and', 'locals', 'of', 'the', 'calling', 'frame', '.']
train
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/utils/__init__.py#L360-L369
8,714
sourceperl/pyModbusTCP
pyModbusTCP/utils.py
word_list_to_long
def word_list_to_long(val_list, big_endian=True): """Word list (16 bits int) to long list (32 bits int) By default word_list_to_long() use big endian order. For use little endian, set big_endian param to False. :param val_list: list of 16 bits int value :type val_list: list ...
python
def word_list_to_long(val_list, big_endian=True): """Word list (16 bits int) to long list (32 bits int) By default word_list_to_long() use big endian order. For use little endian, set big_endian param to False. :param val_list: list of 16 bits int value :type val_list: list ...
['def', 'word_list_to_long', '(', 'val_list', ',', 'big_endian', '=', 'True', ')', ':', '# allocate list for long int', 'long_list', '=', '[', 'None', ']', '*', 'int', '(', 'len', '(', 'val_list', ')', '/', '2', ')', '# fill registers list with register items', 'for', 'i', ',', 'item', 'in', 'enumerate', '(', 'long_lis...
Word list (16 bits int) to long list (32 bits int) By default word_list_to_long() use big endian order. For use little endian, set big_endian param to False. :param val_list: list of 16 bits int value :type val_list: list :param big_endian: True for big endian/False for little ...
['Word', 'list', '(', '16', 'bits', 'int', ')', 'to', 'long', 'list', '(', '32', 'bits', 'int', ')']
train
https://github.com/sourceperl/pyModbusTCP/blob/993f6e2f5ab52eba164be049e42cea560c3751a5/pyModbusTCP/utils.py#L65-L87
8,715
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/mp_elevation.py
ElevationModel.GetElevation
def GetElevation(self, latitude, longitude, timeout=0): '''Returns the altitude (m ASL) of a given lat/long pair, or None if unknown''' if latitude is None or longitude is None: return None if self.database == 'srtm': TileID = (numpy.floor(latitude), numpy.floor(longitude...
python
def GetElevation(self, latitude, longitude, timeout=0): '''Returns the altitude (m ASL) of a given lat/long pair, or None if unknown''' if latitude is None or longitude is None: return None if self.database == 'srtm': TileID = (numpy.floor(latitude), numpy.floor(longitude...
['def', 'GetElevation', '(', 'self', ',', 'latitude', ',', 'longitude', ',', 'timeout', '=', '0', ')', ':', 'if', 'latitude', 'is', 'None', 'or', 'longitude', 'is', 'None', ':', 'return', 'None', 'if', 'self', '.', 'database', '==', "'srtm'", ':', 'TileID', '=', '(', 'numpy', '.', 'floor', '(', 'latitude', ')', ',', 'n...
Returns the altitude (m ASL) of a given lat/long pair, or None if unknown
['Returns', 'the', 'altitude', '(', 'm', 'ASL', ')', 'of', 'a', 'given', 'lat', '/', 'long', 'pair', 'or', 'None', 'if', 'unknown']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_elevation.py#L34-L57
8,716
twilio/twilio-python
twilio/rest/authy/v1/service/entity/__init__.py
EntityContext.factors
def factors(self): """ Access the factors :returns: twilio.rest.authy.v1.service.entity.factor.FactorList :rtype: twilio.rest.authy.v1.service.entity.factor.FactorList """ if self._factors is None: self._factors = FactorList( self._version, ...
python
def factors(self): """ Access the factors :returns: twilio.rest.authy.v1.service.entity.factor.FactorList :rtype: twilio.rest.authy.v1.service.entity.factor.FactorList """ if self._factors is None: self._factors = FactorList( self._version, ...
['def', 'factors', '(', 'self', ')', ':', 'if', 'self', '.', '_factors', 'is', 'None', ':', 'self', '.', '_factors', '=', 'FactorList', '(', 'self', '.', '_version', ',', 'service_sid', '=', 'self', '.', '_solution', '[', "'service_sid'", ']', ',', 'identity', '=', 'self', '.', '_solution', '[', "'identity'", ']', ',',...
Access the factors :returns: twilio.rest.authy.v1.service.entity.factor.FactorList :rtype: twilio.rest.authy.v1.service.entity.factor.FactorList
['Access', 'the', 'factors']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/authy/v1/service/entity/__init__.py#L270-L283
8,717
ihmeuw/vivarium
src/vivarium/interface/utilities.py
log_progress
def log_progress(sequence, every=None, size=None, name='Items'): """Taken from https://github.com/alexanderkuk/log-progress""" from ipywidgets import IntProgress, HTML, VBox from IPython.display import display is_iterator = False if size is None: try: size = len(sequence) ...
python
def log_progress(sequence, every=None, size=None, name='Items'): """Taken from https://github.com/alexanderkuk/log-progress""" from ipywidgets import IntProgress, HTML, VBox from IPython.display import display is_iterator = False if size is None: try: size = len(sequence) ...
['def', 'log_progress', '(', 'sequence', ',', 'every', '=', 'None', ',', 'size', '=', 'None', ',', 'name', '=', "'Items'", ')', ':', 'from', 'ipywidgets', 'import', 'IntProgress', ',', 'HTML', ',', 'VBox', 'from', 'IPython', '.', 'display', 'import', 'display', 'is_iterator', '=', 'False', 'if', 'size', 'is', 'None', '...
Taken from https://github.com/alexanderkuk/log-progress
['Taken', 'from', 'https', ':', '//', 'github', '.', 'com', '/', 'alexanderkuk', '/', 'log', '-', 'progress']
train
https://github.com/ihmeuw/vivarium/blob/c5f5d50f775c8bf337d3aae1ff7c57c025a8e258/src/vivarium/interface/utilities.py#L21-L76
8,718
pydata/xarray
xarray/core/variable.py
Variable.quantile
def quantile(self, q, dim=None, interpolation='linear'): """Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float in range of [0,1] (or sequence of floats) Quantile to ...
python
def quantile(self, q, dim=None, interpolation='linear'): """Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float in range of [0,1] (or sequence of floats) Quantile to ...
['def', 'quantile', '(', 'self', ',', 'q', ',', 'dim', '=', 'None', ',', 'interpolation', '=', "'linear'", ')', ':', 'if', 'isinstance', '(', 'self', '.', 'data', ',', 'dask_array_type', ')', ':', 'raise', 'TypeError', '(', '"quantile does not work for arrays stored as dask "', '"arrays. Load the data via .compute() or...
Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float in range of [0,1] (or sequence of floats) Quantile to compute, which must be between 0 and 1 inclusive. ...
['Compute', 'the', 'qth', 'quantile', 'of', 'the', 'data', 'along', 'the', 'specified', 'dimension', '.']
train
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L1510-L1573
8,719
arista-eosplus/pyeapi
pyeapi/eapilib.py
EapiConnection.authentication
def authentication(self, username, password): """Configures the user authentication for eAPI This method configures the username and password combination to use for authenticating to eAPI. Args: username (str): The username to use to authenticate the eAPI co...
python
def authentication(self, username, password): """Configures the user authentication for eAPI This method configures the username and password combination to use for authenticating to eAPI. Args: username (str): The username to use to authenticate the eAPI co...
['def', 'authentication', '(', 'self', ',', 'username', ',', 'password', ')', ':', '_auth_text', '=', "'{}:{}'", '.', 'format', '(', 'username', ',', 'password', ')', '# Work around for Python 2.7/3.x compatibility', 'if', 'int', '(', 'sys', '.', 'version', '[', '0', ']', ')', '>', '2', ':', '# For Python 3.x', '_auth_...
Configures the user authentication for eAPI This method configures the username and password combination to use for authenticating to eAPI. Args: username (str): The username to use to authenticate the eAPI connection with password (str): The password in...
['Configures', 'the', 'user', 'authentication', 'for', 'eAPI']
train
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/eapilib.py#L230-L257
8,720
msiemens/tinydb
tinydb/database.py
Table.upsert
def upsert(self, document, cond): """ Update a document, if it exist - insert it otherwise. Note: this will update *all* documents matching the query. :param document: the document to insert or the fields to update :param cond: which document to look for :returns: a lis...
python
def upsert(self, document, cond): """ Update a document, if it exist - insert it otherwise. Note: this will update *all* documents matching the query. :param document: the document to insert or the fields to update :param cond: which document to look for :returns: a lis...
['def', 'upsert', '(', 'self', ',', 'document', ',', 'cond', ')', ':', 'updated_docs', '=', 'self', '.', 'update', '(', 'document', ',', 'cond', ')', 'if', 'updated_docs', ':', 'return', 'updated_docs', 'else', ':', 'return', '[', 'self', '.', 'insert', '(', 'document', ')', ']']
Update a document, if it exist - insert it otherwise. Note: this will update *all* documents matching the query. :param document: the document to insert or the fields to update :param cond: which document to look for :returns: a list containing the updated document's ID
['Update', 'a', 'document', 'if', 'it', 'exist', '-', 'insert', 'it', 'otherwise', '.']
train
https://github.com/msiemens/tinydb/blob/10052cb1ae6a3682d26eb4272c44e3b020aa5877/tinydb/database.py#L566-L581
8,721
prezi/django-zipkin
django_zipkin/_thrift/zipkinQuery/ZipkinQuery.py
Client.getServiceNamesToTraceIds
def getServiceNamesToTraceIds(self, time_stamp, service_name, rpc_name): """ Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired with the lists of every trace Ids (list<i64>) from the server to client. The three arguments specify epoch time in micro...
python
def getServiceNamesToTraceIds(self, time_stamp, service_name, rpc_name): """ Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired with the lists of every trace Ids (list<i64>) from the server to client. The three arguments specify epoch time in micro...
['def', 'getServiceNamesToTraceIds', '(', 'self', ',', 'time_stamp', ',', 'service_name', ',', 'rpc_name', ')', ':', 'self', '.', 'send_getServiceNamesToTraceIds', '(', 'time_stamp', ',', 'service_name', ',', 'rpc_name', ')', 'return', 'self', '.', 'recv_getServiceNamesToTraceIds', '(', ')']
Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired with the lists of every trace Ids (list<i64>) from the server to client. The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps contains the key ...
['Given', 'a', 'time', 'stamp', 'server', 'service', 'name', 'and', 'rpc', 'name', 'fetch', 'all', 'of', 'the', 'client', 'services', 'calling', 'in', 'paired', 'with', 'the', 'lists', 'of', 'every', 'trace', 'Ids', '(', 'list<i64', '>', ')', 'from', 'the', 'server', 'to', 'client', '.']
train
https://github.com/prezi/django-zipkin/blob/158d04cf9c2fe0adcb4cda66a250d9e41eae33f3/django_zipkin/_thrift/zipkinQuery/ZipkinQuery.py#L928-L942
8,722
pokerregion/poker
poker/room/pokerstars.py
Notes.add_label
def add_label(self, name, color): """Add a new label. It's id will automatically be calculated.""" color_upper = color.upper() if not self._color_re.match(color_upper): raise ValueError('Invalid color: {}'.format(color)) labels_tag = self.root[0] last_id = int(labels...
python
def add_label(self, name, color): """Add a new label. It's id will automatically be calculated.""" color_upper = color.upper() if not self._color_re.match(color_upper): raise ValueError('Invalid color: {}'.format(color)) labels_tag = self.root[0] last_id = int(labels...
['def', 'add_label', '(', 'self', ',', 'name', ',', 'color', ')', ':', 'color_upper', '=', 'color', '.', 'upper', '(', ')', 'if', 'not', 'self', '.', '_color_re', '.', 'match', '(', 'color_upper', ')', ':', 'raise', 'ValueError', '(', "'Invalid color: {}'", '.', 'format', '(', 'color', ')', ')', 'labels_tag', '=', 'sel...
Add a new label. It's id will automatically be calculated.
['Add', 'a', 'new', 'label', '.', 'It', 's', 'id', 'will', 'automatically', 'be', 'calculated', '.']
train
https://github.com/pokerregion/poker/blob/2d8cf208fdf2b26bdc935972dcbe7a983a9e9768/poker/room/pokerstars.py#L417-L430
8,723
20c/xbahn
xbahn/connection/link.py
Link.cut
def cut(self, name, disconnect=False): """ Cut a wire (undo a wire() call) Arguments: - name (str): name of the wire Keyword Arguments: - disconnect (bool): if True also disconnect all connections on the specified wire """ wir...
python
def cut(self, name, disconnect=False): """ Cut a wire (undo a wire() call) Arguments: - name (str): name of the wire Keyword Arguments: - disconnect (bool): if True also disconnect all connections on the specified wire """ wir...
['def', 'cut', '(', 'self', ',', 'name', ',', 'disconnect', '=', 'False', ')', ':', 'wire', '=', 'getattr', '(', 'self', ',', 'name', ',', 'None', ')', 'if', 'wire', 'and', 'isinstance', '(', 'wire', ',', 'Wire', ')', ':', 'if', 'name', '!=', '"main"', ':', 'delattr', '(', 'self', ',', 'name', ')', 'if', 'disconnect', ...
Cut a wire (undo a wire() call) Arguments: - name (str): name of the wire Keyword Arguments: - disconnect (bool): if True also disconnect all connections on the specified wire
['Cut', 'a', 'wire', '(', 'undo', 'a', 'wire', '()', 'call', ')']
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/link.py#L201-L225
8,724
spyder-ide/conda-manager
conda_manager/api/download_api.py
NetworkProxyFactory.proxy_servers
def proxy_servers(self): """ Return the proxy servers available. First env variables will be searched and updated with values from condarc config file. """ proxy_servers = {} if self._load_rc_func is None: return proxy_servers else: ...
python
def proxy_servers(self): """ Return the proxy servers available. First env variables will be searched and updated with values from condarc config file. """ proxy_servers = {} if self._load_rc_func is None: return proxy_servers else: ...
['def', 'proxy_servers', '(', 'self', ')', ':', 'proxy_servers', '=', '{', '}', 'if', 'self', '.', '_load_rc_func', 'is', 'None', ':', 'return', 'proxy_servers', 'else', ':', 'HTTP_PROXY', '=', 'os', '.', 'environ', '.', 'get', '(', "'HTTP_PROXY'", ')', 'HTTPS_PROXY', '=', 'os', '.', 'environ', '.', 'get', '(', "'HTTPS...
Return the proxy servers available. First env variables will be searched and updated with values from condarc config file.
['Return', 'the', 'proxy', 'servers', 'available', '.']
train
https://github.com/spyder-ide/conda-manager/blob/89a2126cbecefc92185cf979347ccac1c5ee5d9d/conda_manager/api/download_api.py#L72-L95
8,725
Opentrons/opentrons
api/src/opentrons/hardware_control/types.py
Axis.gantry_axes
def gantry_axes(cls) -> Tuple['Axis', 'Axis', 'Axis', 'Axis']: """ The axes which are tied to the gantry and require the deck calibration transform """ return (cls.X, cls.Y, cls.Z, cls.A)
python
def gantry_axes(cls) -> Tuple['Axis', 'Axis', 'Axis', 'Axis']: """ The axes which are tied to the gantry and require the deck calibration transform """ return (cls.X, cls.Y, cls.Z, cls.A)
['def', 'gantry_axes', '(', 'cls', ')', '->', 'Tuple', '[', "'Axis'", ',', "'Axis'", ',', "'Axis'", ',', "'Axis'", ']', ':', 'return', '(', 'cls', '.', 'X', ',', 'cls', '.', 'Y', ',', 'cls', '.', 'Z', ',', 'cls', '.', 'A', ')']
The axes which are tied to the gantry and require the deck calibration transform
['The', 'axes', 'which', 'are', 'tied', 'to', 'the', 'gantry', 'and', 'require', 'the', 'deck', 'calibration', 'transform']
train
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/hardware_control/types.py#L22-L26
8,726
zsimic/runez
src/runez/config.py
to_dict
def to_dict(value, prefix=None, separators="=,"): """ Args: value: Value to turn into a dict prefix (str | unicode | None): Optional prefix for keys (if provided, `prefix.` is added to all keys) separators (str | unicode): 2 chars: 1st is assignment separator, 2nd is key-value pair separ...
python
def to_dict(value, prefix=None, separators="=,"): """ Args: value: Value to turn into a dict prefix (str | unicode | None): Optional prefix for keys (if provided, `prefix.` is added to all keys) separators (str | unicode): 2 chars: 1st is assignment separator, 2nd is key-value pair separ...
['def', 'to_dict', '(', 'value', ',', 'prefix', '=', 'None', ',', 'separators', '=', '"=,"', ')', ':', 'if', 'not', 'value', 'or', 'isinstance', '(', 'value', ',', 'dict', ')', ':', 'return', 'value', 'or', '{', '}', 'result', '=', '{', '}', 'for', 'val', 'in', 'flattened', '(', 'value', ',', 'split', '=', '(', 'separa...
Args: value: Value to turn into a dict prefix (str | unicode | None): Optional prefix for keys (if provided, `prefix.` is added to all keys) separators (str | unicode): 2 chars: 1st is assignment separator, 2nd is key-value pair separator Returns: (dict): Parse key/values
['Args', ':', 'value', ':', 'Value', 'to', 'turn', 'into', 'a', 'dict', 'prefix', '(', 'str', '|', 'unicode', '|', 'None', ')', ':', 'Optional', 'prefix', 'for', 'keys', '(', 'if', 'provided', 'prefix', '.', 'is', 'added', 'to', 'all', 'keys', ')', 'separators', '(', 'str', '|', 'unicode', ')', ':', '2', 'chars', ':', ...
train
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/config.py#L407-L434
8,727
saltstack/salt
salt/modules/ldap3.py
add
def add(connect_spec, dn, attributes): '''Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each ...
python
def add(connect_spec, dn, attributes): '''Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each ...
['def', 'add', '(', 'connect_spec', ',', 'dn', ',', 'attributes', ')', ':', 'l', '=', 'connect', '(', 'connect_spec', ')', '# convert the "iterable of values" to lists in case that\'s what', "# addModlist() expects (also to ensure that the caller's objects", '# are not modified)', 'attributes', '=', 'dict', '(', '(', '...
Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each of the new entry's attributes to a non...
['Add', 'an', 'entry', 'to', 'an', 'LDAP', 'database', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L372-L417
8,728
nitmir/django-cas-server
cas_server/utils.py
regexpr_validator
def regexpr_validator(value): """ Test that ``value`` is a valid regular expression :param unicode value: A regular expression to test :raises ValidationError: if ``value`` is not a valid regular expression """ try: re.compile(value) except re.error: raise Valida...
python
def regexpr_validator(value): """ Test that ``value`` is a valid regular expression :param unicode value: A regular expression to test :raises ValidationError: if ``value`` is not a valid regular expression """ try: re.compile(value) except re.error: raise Valida...
['def', 'regexpr_validator', '(', 'value', ')', ':', 'try', ':', 're', '.', 'compile', '(', 'value', ')', 'except', 're', '.', 'error', ':', 'raise', 'ValidationError', '(', '_', '(', '\'"%(value)s" is not a valid regular expression\'', ')', ',', 'params', '=', '{', "'value'", ':', 'value', '}', ')']
Test that ``value`` is a valid regular expression :param unicode value: A regular expression to test :raises ValidationError: if ``value`` is not a valid regular expression
['Test', 'that', 'value', 'is', 'a', 'valid', 'regular', 'expression']
train
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L736-L749
8,729
pantsbuild/pex
pex/util.py
CacheHelper.hash
def hash(cls, path, digest=None, hasher=sha1): """Return the digest of a single file in a memory-efficient manner.""" if digest is None: digest = hasher() with open(path, 'rb') as fh: cls.update_hash(fh, digest) return digest.hexdigest()
python
def hash(cls, path, digest=None, hasher=sha1): """Return the digest of a single file in a memory-efficient manner.""" if digest is None: digest = hasher() with open(path, 'rb') as fh: cls.update_hash(fh, digest) return digest.hexdigest()
['def', 'hash', '(', 'cls', ',', 'path', ',', 'digest', '=', 'None', ',', 'hasher', '=', 'sha1', ')', ':', 'if', 'digest', 'is', 'None', ':', 'digest', '=', 'hasher', '(', ')', 'with', 'open', '(', 'path', ',', "'rb'", ')', 'as', 'fh', ':', 'cls', '.', 'update_hash', '(', 'fh', ',', 'digest', ')', 'return', 'digest', '...
Return the digest of a single file in a memory-efficient manner.
['Return', 'the', 'digest', 'of', 'a', 'single', 'file', 'in', 'a', 'memory', '-', 'efficient', 'manner', '.']
train
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/util.py#L115-L121
8,730
python-gitlab/python-gitlab
gitlab/v4/objects.py
ProjectExport.download
def download(self, streamed=False, action=None, chunk_size=1024, **kwargs): """Download the archive of a project export. Args: streamed (bool): If True the data will be processed by chunks of `chunk_size` and each chunk is passed to `action` for reatment ...
python
def download(self, streamed=False, action=None, chunk_size=1024, **kwargs): """Download the archive of a project export. Args: streamed (bool): If True the data will be processed by chunks of `chunk_size` and each chunk is passed to `action` for reatment ...
['def', 'download', '(', 'self', ',', 'streamed', '=', 'False', ',', 'action', '=', 'None', ',', 'chunk_size', '=', '1024', ',', '*', '*', 'kwargs', ')', ':', 'path', '=', "'/projects/%s/export/download'", '%', 'self', '.', 'project_id', 'result', '=', 'self', '.', 'manager', '.', 'gitlab', '.', 'http_get', '(', 'path'...
Download the archive of a project export. Args: streamed (bool): If True the data will be processed by chunks of `chunk_size` and each chunk is passed to `action` for reatment action (callable): Callable responsible of dealing with chunk of ...
['Download', 'the', 'archive', 'of', 'a', 'project', 'export', '.']
train
https://github.com/python-gitlab/python-gitlab/blob/16de1b03fde3dbbe8f851614dd1d8c09de102fe5/gitlab/v4/objects.py#L3212-L3234
8,731
Robpol86/libnl
libnl/handlers.py
nl_msg_in_handler_debug
def nl_msg_in_handler_debug(msg, arg): """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L114.""" ofd = arg or _LOGGER.debug ofd('-- Debug: Received Message:') nl_msg_dump(msg, ofd) return NL_OK
python
def nl_msg_in_handler_debug(msg, arg): """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L114.""" ofd = arg or _LOGGER.debug ofd('-- Debug: Received Message:') nl_msg_dump(msg, ofd) return NL_OK
['def', 'nl_msg_in_handler_debug', '(', 'msg', ',', 'arg', ')', ':', 'ofd', '=', 'arg', 'or', '_LOGGER', '.', 'debug', 'ofd', '(', "'-- Debug: Received Message:'", ')', 'nl_msg_dump', '(', 'msg', ',', 'ofd', ')', 'return', 'NL_OK']
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L114.
['https', ':', '//', 'github', '.', 'com', '/', 'thom311', '/', 'libnl', '/', 'blob', '/', 'libnl3_2_25', '/', 'lib', '/', 'handlers', '.', 'c#L114', '.']
train
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/handlers.py#L108-L113
8,732
qubole/qds-sdk-py
qds_sdk/commands.py
Command.cancel_id
def cancel_id(cls, id): """ Cancels command denoted by this id Args: `id`: command id """ conn = Qubole.agent() data = {"status": "kill"} return conn.put(cls.element_path(id), data)
python
def cancel_id(cls, id): """ Cancels command denoted by this id Args: `id`: command id """ conn = Qubole.agent() data = {"status": "kill"} return conn.put(cls.element_path(id), data)
['def', 'cancel_id', '(', 'cls', ',', 'id', ')', ':', 'conn', '=', 'Qubole', '.', 'agent', '(', ')', 'data', '=', '{', '"status"', ':', '"kill"', '}', 'return', 'conn', '.', 'put', '(', 'cls', '.', 'element_path', '(', 'id', ')', ',', 'data', ')']
Cancels command denoted by this id Args: `id`: command id
['Cancels', 'command', 'denoted', 'by', 'this', 'id']
train
https://github.com/qubole/qds-sdk-py/blob/77210fb64e5a7d567aedeea3b742a1d872fd0e5e/qds_sdk/commands.py#L181-L190
8,733
JdeRobot/base
src/libs/comm_py/comm/ice/sonarIceClient.py
Sonar.getSonarData
def getSonarData(self): ''' Returns last LaserData. @return last JdeRobotTypes LaserData saved ''' if self.hasproxy(): self.lock.acquire() sonar = self.sonar self.lock.release() return sonar return None
python
def getSonarData(self): ''' Returns last LaserData. @return last JdeRobotTypes LaserData saved ''' if self.hasproxy(): self.lock.acquire() sonar = self.sonar self.lock.release() return sonar return None
['def', 'getSonarData', '(', 'self', ')', ':', 'if', 'self', '.', 'hasproxy', '(', ')', ':', 'self', '.', 'lock', '.', 'acquire', '(', ')', 'sonar', '=', 'self', '.', 'sonar', 'self', '.', 'lock', '.', 'release', '(', ')', 'return', 'sonar', 'return', 'None']
Returns last LaserData. @return last JdeRobotTypes LaserData saved
['Returns', 'last', 'LaserData', '.']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ice/sonarIceClient.py#L97-L110
8,734
portfors-lab/sparkle
sparkle/run/protocol_runner.py
ProtocolRunner.set_comment
def set_comment(self, cellid, comment): """Saves the provided comment to the current dataset. :param cellid: number of the current cell :type cellid: int :param comment: a message to add documentation to data :type comment: str """ info = {'cellid': cellid, 'comm...
python
def set_comment(self, cellid, comment): """Saves the provided comment to the current dataset. :param cellid: number of the current cell :type cellid: int :param comment: a message to add documentation to data :type comment: str """ info = {'cellid': cellid, 'comm...
['def', 'set_comment', '(', 'self', ',', 'cellid', ',', 'comment', ')', ':', 'info', '=', '{', "'cellid'", ':', 'cellid', ',', "'comment'", ':', 'comment', '}', 'self', '.', 'datafile', '.', 'set_metadata', '(', 'self', '.', 'current_dataset_name', ',', 'info', ')']
Saves the provided comment to the current dataset. :param cellid: number of the current cell :type cellid: int :param comment: a message to add documentation to data :type comment: str
['Saves', 'the', 'provided', 'comment', 'to', 'the', 'current', 'dataset', '.']
train
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/protocol_runner.py#L82-L91
8,735
pyviz/geoviews
geoviews/util.py
geom_dict_to_array_dict
def geom_dict_to_array_dict(geom_dict, coord_names=['Longitude', 'Latitude']): """ Converts a dictionary containing an geometry key to a dictionary of x- and y-coordinate arrays and if present a list-of-lists of hole array. """ x, y = coord_names geom = geom_dict['geometry'] new_dict = {...
python
def geom_dict_to_array_dict(geom_dict, coord_names=['Longitude', 'Latitude']): """ Converts a dictionary containing an geometry key to a dictionary of x- and y-coordinate arrays and if present a list-of-lists of hole array. """ x, y = coord_names geom = geom_dict['geometry'] new_dict = {...
['def', 'geom_dict_to_array_dict', '(', 'geom_dict', ',', 'coord_names', '=', '[', "'Longitude'", ',', "'Latitude'", ']', ')', ':', 'x', ',', 'y', '=', 'coord_names', 'geom', '=', 'geom_dict', '[', "'geometry'", ']', 'new_dict', '=', '{', 'k', ':', 'v', 'for', 'k', ',', 'v', 'in', 'geom_dict', '.', 'items', '(', ')', '...
Converts a dictionary containing an geometry key to a dictionary of x- and y-coordinate arrays and if present a list-of-lists of hole array.
['Converts', 'a', 'dictionary', 'containing', 'an', 'geometry', 'key', 'to', 'a', 'dictionary', 'of', 'x', '-', 'and', 'y', '-', 'coordinate', 'arrays', 'and', 'if', 'present', 'a', 'list', '-', 'of', '-', 'lists', 'of', 'hole', 'array', '.']
train
https://github.com/pyviz/geoviews/blob/cc70ac2d5a96307769bc6192eaef8576c3d24b30/geoviews/util.py#L92-L119
8,736
jeremymcrae/denovonear
denovonear/ensembl_requester.py
EnsemblRequest.get_chrom_for_transcript
def get_chrom_for_transcript(self, transcript_id, hgnc_id): """ obtain the sequence for a transcript from ensembl """ headers = {"content-type": "application/json"} self.attempt = 0 ext = "/overlap/id/{}?feature=gene".format(transcript_id) r = self.ense...
python
def get_chrom_for_transcript(self, transcript_id, hgnc_id): """ obtain the sequence for a transcript from ensembl """ headers = {"content-type": "application/json"} self.attempt = 0 ext = "/overlap/id/{}?feature=gene".format(transcript_id) r = self.ense...
['def', 'get_chrom_for_transcript', '(', 'self', ',', 'transcript_id', ',', 'hgnc_id', ')', ':', 'headers', '=', '{', '"content-type"', ':', '"application/json"', '}', 'self', '.', 'attempt', '=', '0', 'ext', '=', '"/overlap/id/{}?feature=gene"', '.', 'format', '(', 'transcript_id', ')', 'r', '=', 'self', '.', 'ensembl...
obtain the sequence for a transcript from ensembl
['obtain', 'the', 'sequence', 'for', 'a', 'transcript', 'from', 'ensembl']
train
https://github.com/jeremymcrae/denovonear/blob/feaab0fc77e89d70b31e8092899e4f0e68bac9fe/denovonear/ensembl_requester.py#L308-L322
8,737
jtwhite79/pyemu
pyemu/en.py
ParameterEnsemble.from_parfiles
def from_parfiles(cls,pst,parfile_names,real_names=None): """ create a parameter ensemble from parfiles. Accepts parfiles with less than the parameters in the control (get NaNs in the ensemble) or extra parameters in the parfiles (get dropped) Parameters: pst : pyemu.Pst ...
python
def from_parfiles(cls,pst,parfile_names,real_names=None): """ create a parameter ensemble from parfiles. Accepts parfiles with less than the parameters in the control (get NaNs in the ensemble) or extra parameters in the parfiles (get dropped) Parameters: pst : pyemu.Pst ...
['def', 'from_parfiles', '(', 'cls', ',', 'pst', ',', 'parfile_names', ',', 'real_names', '=', 'None', ')', ':', 'if', 'isinstance', '(', 'pst', ',', 'str', ')', ':', 'pst', '=', 'pyemu', '.', 'Pst', '(', 'pst', ')', 'dfs', '=', '{', '}', 'if', 'real_names', 'is', 'not', 'None', ':', 'assert', 'len', '(', 'real_names',...
create a parameter ensemble from parfiles. Accepts parfiles with less than the parameters in the control (get NaNs in the ensemble) or extra parameters in the parfiles (get dropped) Parameters: pst : pyemu.Pst parfile_names : list of str par file names ...
['create', 'a', 'parameter', 'ensemble', 'from', 'parfiles', '.', 'Accepts', 'parfiles', 'with', 'less', 'than', 'the', 'parameters', 'in', 'the', 'control', '(', 'get', 'NaNs', 'in', 'the', 'ensemble', ')', 'or', 'extra', 'parameters', 'in', 'the', 'parfiles', '(', 'get', 'dropped', ')']
train
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/en.py#L1673-L1738
8,738
sternoru/goscalecms
goscale/models.py
GoscaleCMSPlugin._format
def _format(self, posts): """ This method is called by get_content() method""" if posts.__class__ == Post: # format a single post return posts.dict() formated_posts = [] for post in posts: formated_posts.append(post.dict()) return formated_post...
python
def _format(self, posts): """ This method is called by get_content() method""" if posts.__class__ == Post: # format a single post return posts.dict() formated_posts = [] for post in posts: formated_posts.append(post.dict()) return formated_post...
['def', '_format', '(', 'self', ',', 'posts', ')', ':', 'if', 'posts', '.', '__class__', '==', 'Post', ':', '# format a single post', 'return', 'posts', '.', 'dict', '(', ')', 'formated_posts', '=', '[', ']', 'for', 'post', 'in', 'posts', ':', 'formated_posts', '.', 'append', '(', 'post', '.', 'dict', '(', ')', ')', 'r...
This method is called by get_content() method
['This', 'method', 'is', 'called', 'by', 'get_content', '()', 'method']
train
https://github.com/sternoru/goscalecms/blob/7eee50357c47ebdfe3e573a8b4be3b67892d229e/goscale/models.py#L282-L290
8,739
LonamiWebs/Telethon
telethon/tl/custom/message.py
Message._set_buttons
def _set_buttons(self, chat, bot): """ Helper methods to set the buttons given the input sender and chat. """ if isinstance(self.reply_markup, ( types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)): self._buttons = [[ MessageButton(self._client...
python
def _set_buttons(self, chat, bot): """ Helper methods to set the buttons given the input sender and chat. """ if isinstance(self.reply_markup, ( types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)): self._buttons = [[ MessageButton(self._client...
['def', '_set_buttons', '(', 'self', ',', 'chat', ',', 'bot', ')', ':', 'if', 'isinstance', '(', 'self', '.', 'reply_markup', ',', '(', 'types', '.', 'ReplyInlineMarkup', ',', 'types', '.', 'ReplyKeyboardMarkup', ')', ')', ':', 'self', '.', '_buttons', '=', '[', '[', 'MessageButton', '(', 'self', '.', '_client', ',', '...
Helper methods to set the buttons given the input sender and chat.
['Helper', 'methods', 'to', 'set', 'the', 'buttons', 'given', 'the', 'input', 'sender', 'and', 'chat', '.']
train
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L834-L844
8,740
crytic/slither
slither/core/declarations/contract.py
Contract.get_functions_writing_to_variable
def get_functions_writing_to_variable(self, variable): ''' Return the functions writting the variable ''' return [f for f in self.functions if f.is_writing(variable)]
python
def get_functions_writing_to_variable(self, variable): ''' Return the functions writting the variable ''' return [f for f in self.functions if f.is_writing(variable)]
['def', 'get_functions_writing_to_variable', '(', 'self', ',', 'variable', ')', ':', 'return', '[', 'f', 'for', 'f', 'in', 'self', '.', 'functions', 'if', 'f', '.', 'is_writing', '(', 'variable', ')', ']']
Return the functions writting the variable
['Return', 'the', 'functions', 'writting', 'the', 'variable']
train
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/core/declarations/contract.py#L345-L349
8,741
AtteqCom/zsl
src/zsl/resource/model_resource.py
ModelResource._save_one
def _save_one(self, model, ctx): """ Saves the created instance. """ assert isinstance(ctx, ResourceQueryContext) self._orm.add(model) self._orm.flush()
python
def _save_one(self, model, ctx): """ Saves the created instance. """ assert isinstance(ctx, ResourceQueryContext) self._orm.add(model) self._orm.flush()
['def', '_save_one', '(', 'self', ',', 'model', ',', 'ctx', ')', ':', 'assert', 'isinstance', '(', 'ctx', ',', 'ResourceQueryContext', ')', 'self', '.', '_orm', '.', 'add', '(', 'model', ')', 'self', '.', '_orm', '.', 'flush', '(', ')']
Saves the created instance.
['Saves', 'the', 'created', 'instance', '.']
train
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/resource/model_resource.py#L297-L304
8,742
hadrianl/huobi
huobitrade/service.py
HBRestAPI.get_last_ticker
def get_last_ticker(self, symbol, _async=False): """ 获取tradedetail :param symbol :return: """ params = {'symbol': symbol} url = u.MARKET_URL + '/market/trade' return http_get_request(url, params, _async=_async)
python
def get_last_ticker(self, symbol, _async=False): """ 获取tradedetail :param symbol :return: """ params = {'symbol': symbol} url = u.MARKET_URL + '/market/trade' return http_get_request(url, params, _async=_async)
['def', 'get_last_ticker', '(', 'self', ',', 'symbol', ',', '_async', '=', 'False', ')', ':', 'params', '=', '{', "'symbol'", ':', 'symbol', '}', 'url', '=', 'u', '.', 'MARKET_URL', '+', "'/market/trade'", 'return', 'http_get_request', '(', 'url', ',', 'params', ',', '_async', '=', '_async', ')']
获取tradedetail :param symbol :return:
['获取tradedetail', ':', 'param', 'symbol', ':', 'return', ':']
train
https://github.com/hadrianl/huobi/blob/bbfa2036703ee84a76d5d8e9f89c25fc8a55f2c7/huobitrade/service.py#L88-L97
8,743
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
AdvancedTag.getElementById
def getElementById(self, _id): ''' getElementById - Search children of this tag for a tag containing an id @param _id - String of id @return - AdvancedTag or None ''' for child in self.children: if child.getAttribute('id') == _id: ...
python
def getElementById(self, _id): ''' getElementById - Search children of this tag for a tag containing an id @param _id - String of id @return - AdvancedTag or None ''' for child in self.children: if child.getAttribute('id') == _id: ...
['def', 'getElementById', '(', 'self', ',', '_id', ')', ':', 'for', 'child', 'in', 'self', '.', 'children', ':', 'if', 'child', '.', 'getAttribute', '(', "'id'", ')', '==', '_id', ':', 'return', 'child', 'found', '=', 'child', '.', 'getElementById', '(', '_id', ')', 'if', 'found', 'is', 'not', 'None', ':', 'return', 'f...
getElementById - Search children of this tag for a tag containing an id @param _id - String of id @return - AdvancedTag or None
['getElementById', '-', 'Search', 'children', 'of', 'this', 'tag', 'for', 'a', 'tag', 'containing', 'an', 'id']
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1781-L1795
8,744
matthewdeanmartin/jiggle_version
jiggle_version/main.py
process_docopts
def process_docopts(test=None): # type: (Optional[Dict[str,Any]])->None """ Just process the command line options and commands :return: """ if test: arguments = test else: arguments = docopt(__doc__, version="Jiggle Version {0}".format(__version__)) logger.debug(arguments) ...
python
def process_docopts(test=None): # type: (Optional[Dict[str,Any]])->None """ Just process the command line options and commands :return: """ if test: arguments = test else: arguments = docopt(__doc__, version="Jiggle Version {0}".format(__version__)) logger.debug(arguments) ...
['def', 'process_docopts', '(', 'test', '=', 'None', ')', ':', '# type: (Optional[Dict[str,Any]])->None', 'if', 'test', ':', 'arguments', '=', 'test', 'else', ':', 'arguments', '=', 'docopt', '(', '__doc__', ',', 'version', '=', '"Jiggle Version {0}"', '.', 'format', '(', '__version__', ')', ')', 'logger', '.', 'debug'...
Just process the command line options and commands :return:
['Just', 'process', 'the', 'command', 'line', 'options', 'and', 'commands', ':', 'return', ':']
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/main.py#L86-L150
8,745
ttinies/sc2players
sc2players/playerRecord.py
PlayerRecord.apmAggregate
def apmAggregate(self, **criteria): """collect all match history's apm data to report player's calculated MMR""" apms = [m.apm(self) for m in self.matchSubset(**criteria)] if not apms: return 0 # no apm information without match history return sum(apms) / len(apms)
python
def apmAggregate(self, **criteria): """collect all match history's apm data to report player's calculated MMR""" apms = [m.apm(self) for m in self.matchSubset(**criteria)] if not apms: return 0 # no apm information without match history return sum(apms) / len(apms)
['def', 'apmAggregate', '(', 'self', ',', '*', '*', 'criteria', ')', ':', 'apms', '=', '[', 'm', '.', 'apm', '(', 'self', ')', 'for', 'm', 'in', 'self', '.', 'matchSubset', '(', '*', '*', 'criteria', ')', ']', 'if', 'not', 'apms', ':', 'return', '0', '# no apm information without match history', 'return', 'sum', '(', '...
collect all match history's apm data to report player's calculated MMR
['collect', 'all', 'match', 'history', 's', 'apm', 'data', 'to', 'report', 'player', 's', 'calculated', 'MMR']
train
https://github.com/ttinies/sc2players/blob/fd9b37c268bf1005d9ef73a25e65ed97c8b7895f/sc2players/playerRecord.py#L229-L233
8,746
PrefPy/prefpy
prefpy/preference.py
Preference.getOrderVectorEGMM
def getOrderVectorEGMM(self): """ Returns a list of lists. Each list represents tiers of candidates. candidates in earlier tiers are preferred to candidates appearing in later tiers. Candidates in the same tier are preferred equally. """ # We sort the candidates based o...
python
def getOrderVectorEGMM(self): """ Returns a list of lists. Each list represents tiers of candidates. candidates in earlier tiers are preferred to candidates appearing in later tiers. Candidates in the same tier are preferred equally. """ # We sort the candidates based o...
['def', 'getOrderVectorEGMM', '(', 'self', ')', ':', '# We sort the candidates based on the number of incoming edges they have in the graph. If ', '# two candidates have the same number, we assume that they are tied.', 'incEdgesMap', '=', 'self', '.', 'getIncEdgesMap', '(', ')', 'sortedKeys', '=', 'sorted', '(', 'incEd...
Returns a list of lists. Each list represents tiers of candidates. candidates in earlier tiers are preferred to candidates appearing in later tiers. Candidates in the same tier are preferred equally.
['Returns', 'a', 'list', 'of', 'lists', '.', 'Each', 'list', 'represents', 'tiers', 'of', 'candidates', '.', 'candidates', 'in', 'earlier', 'tiers', 'are', 'preferred', 'to', 'candidates', 'appearing', 'in', 'later', 'tiers', '.', 'Candidates', 'in', 'the', 'same', 'tier', 'are', 'preferred', 'equally', '.']
train
https://github.com/PrefPy/prefpy/blob/f395ba3782f05684fa5de0cece387a6da9391d02/prefpy/preference.py#L139-L163
8,747
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/extensions_v1beta1_api.py
ExtensionsV1beta1Api.read_namespaced_replica_set
def read_namespaced_replica_set(self, name, namespace, **kwargs): # noqa: E501 """read_namespaced_replica_set # noqa: E501 read the specified ReplicaSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=T...
python
def read_namespaced_replica_set(self, name, namespace, **kwargs): # noqa: E501 """read_namespaced_replica_set # noqa: E501 read the specified ReplicaSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=T...
['def', 'read_namespaced_replica_set', '(', 'self', ',', 'name', ',', 'namespace', ',', '*', '*', 'kwargs', ')', ':', '# noqa: E501', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'async_req'", ')', ':', 'return', 'self', '.', 'read_namespaced_replica_set_with_http_info'...
read_namespaced_replica_set # noqa: E501 read the specified ReplicaSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_namespaced_replica_set(name, namespace, async_req=True) ...
['read_namespaced_replica_set', '#', 'noqa', ':', 'E501']
train
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/extensions_v1beta1_api.py#L6383-L6407
8,748
fermiPy/fermipy
fermipy/gtanalysis.py
GTAnalysis.free_source
def free_source(self, name, free=True, pars=None, **kwargs): """Free/Fix parameters of a source. Parameters ---------- name : str Source name. free : bool Choose whether to free (free=True) or fix (free=False) source parameters. par...
python
def free_source(self, name, free=True, pars=None, **kwargs): """Free/Fix parameters of a source. Parameters ---------- name : str Source name. free : bool Choose whether to free (free=True) or fix (free=False) source parameters. par...
['def', 'free_source', '(', 'self', ',', 'name', ',', 'free', '=', 'True', ',', 'pars', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'free_pars', '=', 'self', '.', 'get_free_param_vector', '(', ')', 'loglevel', '=', 'kwargs', '.', 'pop', '(', "'loglevel'", ',', 'self', '.', 'loglevel', ')', '# Find the source', 'src...
Free/Fix parameters of a source. Parameters ---------- name : str Source name. free : bool Choose whether to free (free=True) or fix (free=False) source parameters. pars : list Set a list of parameters to be freed/fixed for this...
['Free', '/', 'Fix', 'parameters', 'of', 'a', 'source', '.']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1906-L1982
8,749
tasdikrahman/vocabulary
vocabulary/vocabulary.py
Vocabulary.antonym
def antonym(phrase, format="json"): """ queries the bighugelabs API for the antonym. The results include - "syn" (synonym) - "ant" (antonym) - "rel" (related terms) - "sim" (similar terms) - "usr" (user suggestions) But currently parsing only the ant...
python
def antonym(phrase, format="json"): """ queries the bighugelabs API for the antonym. The results include - "syn" (synonym) - "ant" (antonym) - "rel" (related terms) - "sim" (similar terms) - "usr" (user suggestions) But currently parsing only the ant...
['def', 'antonym', '(', 'phrase', ',', 'format', '=', '"json"', ')', ':', 'base_url', '=', 'Vocabulary', '.', '__get_api_link', '(', '"bighugelabs"', ')', 'url', '=', 'base_url', '.', 'format', '(', 'word', '=', 'phrase', ')', 'json_obj', '=', 'Vocabulary', '.', '__return_json', '(', 'url', ')', 'if', 'not', 'json_obj'...
queries the bighugelabs API for the antonym. The results include - "syn" (synonym) - "ant" (antonym) - "rel" (related terms) - "sim" (similar terms) - "usr" (user suggestions) But currently parsing only the antonym as I have already done - synonym (using glo...
['queries', 'the', 'bighugelabs', 'API', 'for', 'the', 'antonym', '.', 'The', 'results', 'include', '-', 'syn', '(', 'synonym', ')', '-', 'ant', '(', 'antonym', ')', '-', 'rel', '(', 'related', 'terms', ')', '-', 'sim', '(', 'similar', 'terms', ')', '-', 'usr', '(', 'user', 'suggestions', ')']
train
https://github.com/tasdikrahman/vocabulary/blob/54403c5981af25dc3457796b57048ae27f09e9be/vocabulary/vocabulary.py#L258-L301
8,750
koszullab/instaGRAAL
instagraal/simu_single.py
simulation.modify_sub_vect_frags
def modify_sub_vect_frags(self): "include repeated frags" modified_vect_frags = dict() init_vect_frags = self.sub_level.S_o_A_frags # init_max_id_d = init_vect_frags["id"].max() max_id_F = len(init_vect_frags["id"]) max_id_C = init_vect_frags["id_c"].max() + 1 #...
python
def modify_sub_vect_frags(self): "include repeated frags" modified_vect_frags = dict() init_vect_frags = self.sub_level.S_o_A_frags # init_max_id_d = init_vect_frags["id"].max() max_id_F = len(init_vect_frags["id"]) max_id_C = init_vect_frags["id_c"].max() + 1 #...
['def', 'modify_sub_vect_frags', '(', 'self', ')', ':', 'modified_vect_frags', '=', 'dict', '(', ')', 'init_vect_frags', '=', 'self', '.', 'sub_level', '.', 'S_o_A_frags', '# init_max_id_d = init_vect_frags["id"].max()', 'max_id_F', '=', 'len', '(', 'init_vect_frags', '[', '"id"', ']', ')', 'max_id_C', '=', 'init_vect_...
include repeated frags
['include', 'repeated', 'frags']
train
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/simu_single.py#L452-L637
8,751
adafruit/Adafruit_CircuitPython_ADS1x15
adafruit_ads1x15/ads1x15.py
ADS1x15._read
def _read(self, pin): """Perform an ADC read. Returns the signed integer result of the read.""" config = _ADS1X15_CONFIG_OS_SINGLE config |= (pin & 0x07) << _ADS1X15_CONFIG_MUX_OFFSET config |= _ADS1X15_CONFIG_GAIN[self.gain] config |= self.mode config |= self.rate_config...
python
def _read(self, pin): """Perform an ADC read. Returns the signed integer result of the read.""" config = _ADS1X15_CONFIG_OS_SINGLE config |= (pin & 0x07) << _ADS1X15_CONFIG_MUX_OFFSET config |= _ADS1X15_CONFIG_GAIN[self.gain] config |= self.mode config |= self.rate_config...
['def', '_read', '(', 'self', ',', 'pin', ')', ':', 'config', '=', '_ADS1X15_CONFIG_OS_SINGLE', 'config', '|=', '(', 'pin', '&', '0x07', ')', '<<', '_ADS1X15_CONFIG_MUX_OFFSET', 'config', '|=', '_ADS1X15_CONFIG_GAIN', '[', 'self', '.', 'gain', ']', 'config', '|=', 'self', '.', 'mode', 'config', '|=', 'self', '.', 'rate...
Perform an ADC read. Returns the signed integer result of the read.
['Perform', 'an', 'ADC', 'read', '.', 'Returns', 'the', 'signed', 'integer', 'result', 'of', 'the', 'read', '.']
train
https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/5ba760c6de40824386f1df343603eab77d3e336c/adafruit_ads1x15/ads1x15.py#L151-L164
8,752
mikedh/trimesh
trimesh/base.py
Trimesh.contains
def contains(self, points): """ Given a set of points, determine whether or not they are inside the mesh. This raises an error if called on a non- watertight mesh. Parameters --------- points : (n, 3) float Points in cartesian space Returns ---...
python
def contains(self, points): """ Given a set of points, determine whether or not they are inside the mesh. This raises an error if called on a non- watertight mesh. Parameters --------- points : (n, 3) float Points in cartesian space Returns ---...
['def', 'contains', '(', 'self', ',', 'points', ')', ':', 'if', 'not', 'self', '.', 'is_watertight', ':', 'log', '.', 'warning', '(', "'Mesh is non- watertight for contained point query!'", ')', 'contains', '=', 'self', '.', 'ray', '.', 'contains_points', '(', 'points', ')', 'return', 'contains']
Given a set of points, determine whether or not they are inside the mesh. This raises an error if called on a non- watertight mesh. Parameters --------- points : (n, 3) float Points in cartesian space Returns --------- contains : (n, ) bool W...
['Given', 'a', 'set', 'of', 'points', 'determine', 'whether', 'or', 'not', 'they', 'are', 'inside', 'the', 'mesh', '.', 'This', 'raises', 'an', 'error', 'if', 'called', 'on', 'a', 'non', '-', 'watertight', 'mesh', '.']
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/base.py#L2503-L2521
8,753
kislyuk/aegea
aegea/packages/github3/gists/gist.py
Gist.iter_forks
def iter_forks(self, number=-1, etag=None): """Iterator of forks of this gist. .. versionchanged:: 0.9 Added params ``number`` and ``etag``. :param int number: (optional), number of forks to iterate over. Default: -1 will iterate over all forks of this gist. :p...
python
def iter_forks(self, number=-1, etag=None): """Iterator of forks of this gist. .. versionchanged:: 0.9 Added params ``number`` and ``etag``. :param int number: (optional), number of forks to iterate over. Default: -1 will iterate over all forks of this gist. :p...
['def', 'iter_forks', '(', 'self', ',', 'number', '=', '-', '1', ',', 'etag', '=', 'None', ')', ':', 'url', '=', 'self', '.', '_build_url', '(', "'forks'", ',', 'base_url', '=', 'self', '.', '_api', ')', 'return', 'self', '.', '_iter', '(', 'int', '(', 'number', ')', ',', 'url', ',', 'Gist', ',', 'etag', '=', 'etag', '...
Iterator of forks of this gist. .. versionchanged:: 0.9 Added params ``number`` and ``etag``. :param int number: (optional), number of forks to iterate over. Default: -1 will iterate over all forks of this gist. :param str etag: (optional), ETag from a previous request...
['Iterator', 'of', 'forks', 'of', 'this', 'gist', '.']
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L237-L252
8,754
jazzband/django-queued-storage
queued_storage/backends.py
QueuedStorage.transfer
def transfer(self, name, cache_key=None): """ Transfers the file with the given name to the remote storage backend by queuing the task. :param name: file name :type name: str :param cache_key: the cache key to set after a successful task run :type cache_key: str ...
python
def transfer(self, name, cache_key=None): """ Transfers the file with the given name to the remote storage backend by queuing the task. :param name: file name :type name: str :param cache_key: the cache key to set after a successful task run :type cache_key: str ...
['def', 'transfer', '(', 'self', ',', 'name', ',', 'cache_key', '=', 'None', ')', ':', 'if', 'cache_key', 'is', 'None', ':', 'cache_key', '=', 'self', '.', 'get_cache_key', '(', 'name', ')', 'return', 'self', '.', 'task', '.', 'delay', '(', 'name', ',', 'cache_key', ',', 'self', '.', 'local_path', ',', 'self', '.', 're...
Transfers the file with the given name to the remote storage backend by queuing the task. :param name: file name :type name: str :param cache_key: the cache key to set after a successful task run :type cache_key: str :rtype: task result
['Transfers', 'the', 'file', 'with', 'the', 'given', 'name', 'to', 'the', 'remote', 'storage', 'backend', 'by', 'queuing', 'the', 'task', '.']
train
https://github.com/jazzband/django-queued-storage/blob/f8225d88a01ef5ca8001aeb3f7f80818a022a12d/queued_storage/backends.py#L206-L221
8,755
vmware/pyvmomi
pyVmomi/Differ.py
Differ.DiffDataObjects
def DiffDataObjects(self, oldObj, newObj): """Diff Data Objects""" if oldObj == newObj: return True if not oldObj or not newObj: __Log__.debug('DiffDataObjects: One of the objects in None') return False oldType = Type(oldObj) newType = Type(newObj) if oldTy...
python
def DiffDataObjects(self, oldObj, newObj): """Diff Data Objects""" if oldObj == newObj: return True if not oldObj or not newObj: __Log__.debug('DiffDataObjects: One of the objects in None') return False oldType = Type(oldObj) newType = Type(newObj) if oldTy...
['def', 'DiffDataObjects', '(', 'self', ',', 'oldObj', ',', 'newObj', ')', ':', 'if', 'oldObj', '==', 'newObj', ':', 'return', 'True', 'if', 'not', 'oldObj', 'or', 'not', 'newObj', ':', '__Log__', '.', 'debug', '(', "'DiffDataObjects: One of the objects in None'", ')', 'return', 'False', 'oldType', '=', 'Type', '(', 'o...
Diff Data Objects
['Diff', 'Data', 'Objects']
train
https://github.com/vmware/pyvmomi/blob/3ffcb23bf77d757175c0d5216ba9a25345d824cd/pyVmomi/Differ.py#L169-L222
8,756
NiklasRosenstein-Python/nr-deprecated
nr/archive.py
open
def open(filename=None, file=None, mode='r', suffix=None, options=None): """ Opens the archive at the specified *filename* or from the file-like object *file* using the appropriate opener. A specific opener can be specified by passing the *suffix* argument. # Parameters filename (str): A filename to open t...
python
def open(filename=None, file=None, mode='r', suffix=None, options=None): """ Opens the archive at the specified *filename* or from the file-like object *file* using the appropriate opener. A specific opener can be specified by passing the *suffix* argument. # Parameters filename (str): A filename to open t...
['def', 'open', '(', 'filename', '=', 'None', ',', 'file', '=', 'None', ',', 'mode', '=', "'r'", ',', 'suffix', '=', 'None', ',', 'options', '=', 'None', ')', ':', 'if', 'mode', 'not', 'in', '(', "'r'", ',', "'w'", ',', "'a'", ')', ':', 'raise', 'ValueError', '(', '"invalid mode: {0!r}"', '.', 'format', '(', 'mode', ')...
Opens the archive at the specified *filename* or from the file-like object *file* using the appropriate opener. A specific opener can be specified by passing the *suffix* argument. # Parameters filename (str): A filename to open the archive from. file (file-like): A file-like object as source/destination. ...
['Opens', 'the', 'archive', 'at', 'the', 'specified', '*', 'filename', '*', 'or', 'from', 'the', 'file', '-', 'like', 'object', '*', 'file', '*', 'using', 'the', 'appropriate', 'opener', '.', 'A', 'specific', 'opener', 'can', 'be', 'specified', 'by', 'passing', 'the', '*', 'suffix', '*', 'argument', '.']
train
https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/archive.py#L90-L142
8,757
openeemeter/eeweather
eeweather/validation.py
valid_zcta_or_raise
def valid_zcta_or_raise(zcta): """ Check if ZCTA is valid and raise eeweather.UnrecognizedZCTAError if not. """ conn = metadata_db_connection_proxy.get_connection() cur = conn.cursor() cur.execute( """ select exists ( select zcta_id from zcta_metadata ...
python
def valid_zcta_or_raise(zcta): """ Check if ZCTA is valid and raise eeweather.UnrecognizedZCTAError if not. """ conn = metadata_db_connection_proxy.get_connection() cur = conn.cursor() cur.execute( """ select exists ( select zcta_id from zcta_metadata ...
['def', 'valid_zcta_or_raise', '(', 'zcta', ')', ':', 'conn', '=', 'metadata_db_connection_proxy', '.', 'get_connection', '(', ')', 'cur', '=', 'conn', '.', 'cursor', '(', ')', 'cur', '.', 'execute', '(', '"""\n select exists (\n select\n zcta_id\n from\n zcta_metadata\n wher...
Check if ZCTA is valid and raise eeweather.UnrecognizedZCTAError if not.
['Check', 'if', 'ZCTA', 'is', 'valid', 'and', 'raise', 'eeweather', '.', 'UnrecognizedZCTAError', 'if', 'not', '.']
train
https://github.com/openeemeter/eeweather/blob/d32b7369b26edfa3ee431c60457afeb0593123a7/eeweather/validation.py#L27-L49
8,758
sarugaku/mork
src/mork/virtualenv.py
VirtualEnv.get_sys_path
def get_sys_path(cls, python_path): """Get the :data:`sys.path` data for a given python executable. :param str python_path: Path to a specific python executable. :return: The system path information for that python runtime. :rtype: list """ command = [python_path, "-c",...
python
def get_sys_path(cls, python_path): """Get the :data:`sys.path` data for a given python executable. :param str python_path: Path to a specific python executable. :return: The system path information for that python runtime. :rtype: list """ command = [python_path, "-c",...
['def', 'get_sys_path', '(', 'cls', ',', 'python_path', ')', ':', 'command', '=', '[', 'python_path', ',', '"-c"', ',', '"import json, sys; print(json.dumps(sys.path))"', ']', 'c', '=', 'vistir', '.', 'misc', '.', 'run', '(', 'command', ',', 'return_object', '=', 'True', ',', 'block', '=', 'True', ',', 'nospin', '=', '...
Get the :data:`sys.path` data for a given python executable. :param str python_path: Path to a specific python executable. :return: The system path information for that python runtime. :rtype: list
['Get', 'the', ':', 'data', ':', 'sys', '.', 'path', 'data', 'for', 'a', 'given', 'python', 'executable', '.']
train
https://github.com/sarugaku/mork/blob/c1a7cd63c490ed7fbecb7714fd5590d2609366de/src/mork/virtualenv.py#L138-L150
8,759
dtcooper/python-fitparse
fitparse/records.py
Crc.update
def update(self, byte_arr): """Read bytes and update the CRC computed.""" if byte_arr: self.value = self.calculate(byte_arr, self.value)
python
def update(self, byte_arr): """Read bytes and update the CRC computed.""" if byte_arr: self.value = self.calculate(byte_arr, self.value)
['def', 'update', '(', 'self', ',', 'byte_arr', ')', ':', 'if', 'byte_arr', ':', 'self', '.', 'value', '=', 'self', '.', 'calculate', '(', 'byte_arr', ',', 'self', '.', 'value', ')']
Read bytes and update the CRC computed.
['Read', 'bytes', 'and', 'update', 'the', 'CRC', 'computed', '.']
train
https://github.com/dtcooper/python-fitparse/blob/40fa2918c3e91bd8f89908ad3bad81c1c1189dd2/fitparse/records.py#L365-L368
8,760
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger.configure_discord_logger
def configure_discord_logger( self, discord_webhook=None, discord_recipient=None, log_level='ERROR', log_format=ReportingFormats.PRETTY_PRINT.value, custom_args='' ): """logger for sending messages to Discord. Easy way to alert humans ...
python
def configure_discord_logger( self, discord_webhook=None, discord_recipient=None, log_level='ERROR', log_format=ReportingFormats.PRETTY_PRINT.value, custom_args='' ): """logger for sending messages to Discord. Easy way to alert humans ...
['def', 'configure_discord_logger', '(', 'self', ',', 'discord_webhook', '=', 'None', ',', 'discord_recipient', '=', 'None', ',', 'log_level', '=', "'ERROR'", ',', 'log_format', '=', 'ReportingFormats', '.', 'PRETTY_PRINT', '.', 'value', ',', 'custom_args', '=', "''", ')', ':', '# Override defaults if required #', 'dis...
logger for sending messages to Discord. Easy way to alert humans of issues Note: Will try to overwrite minimum log level to enable requested log_level Will warn and not attach hipchat logger if missing webhook key Learn more about webhooks: https://support.discordapp.com/hc...
['logger', 'for', 'sending', 'messages', 'to', 'Discord', '.', 'Easy', 'way', 'to', 'alert', 'humans', 'of', 'issues']
train
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L243-L302
8,761
gboeing/osmnx
osmnx/projection.py
project_graph
def project_graph(G, to_crs=None): """ Project a graph from lat-long to the UTM zone appropriate for its geographic location. Parameters ---------- G : networkx multidigraph the networkx graph to be projected to_crs : dict if not None, just project to this CRS instead of to ...
python
def project_graph(G, to_crs=None): """ Project a graph from lat-long to the UTM zone appropriate for its geographic location. Parameters ---------- G : networkx multidigraph the networkx graph to be projected to_crs : dict if not None, just project to this CRS instead of to ...
['def', 'project_graph', '(', 'G', ',', 'to_crs', '=', 'None', ')', ':', 'G_proj', '=', 'G', '.', 'copy', '(', ')', 'start_time', '=', 'time', '.', 'time', '(', ')', '# create a GeoDataFrame of the nodes, name it, convert osmid to str', 'nodes', ',', 'data', '=', 'zip', '(', '*', 'G_proj', '.', 'nodes', '(', 'data', '=...
Project a graph from lat-long to the UTM zone appropriate for its geographic location. Parameters ---------- G : networkx multidigraph the networkx graph to be projected to_crs : dict if not None, just project to this CRS instead of to UTM Returns ------- networkx multi...
['Project', 'a', 'graph', 'from', 'lat', '-', 'long', 'to', 'the', 'UTM', 'zone', 'appropriate', 'for', 'its', 'geographic', 'location', '.']
train
https://github.com/gboeing/osmnx/blob/be59fd313bcb68af8fc79242c56194f1247e26e2/osmnx/projection.py#L126-L214
8,762
bxlab/bx-python
lib/bx/align/epo.py
Chain.bedInterval
def bedInterval(self, who): "return a BED6 entry, thus DOES coordinate conversion for minus strands" if who == 't': st, en = self.tStart, self.tEnd if self.tStrand == '-': st, en = self.tSize-en, self.tSize-st return (self.tName, st, en, self.id, self...
python
def bedInterval(self, who): "return a BED6 entry, thus DOES coordinate conversion for minus strands" if who == 't': st, en = self.tStart, self.tEnd if self.tStrand == '-': st, en = self.tSize-en, self.tSize-st return (self.tName, st, en, self.id, self...
['def', 'bedInterval', '(', 'self', ',', 'who', ')', ':', 'if', 'who', '==', "'t'", ':', 'st', ',', 'en', '=', 'self', '.', 'tStart', ',', 'self', '.', 'tEnd', 'if', 'self', '.', 'tStrand', '==', "'-'", ':', 'st', ',', 'en', '=', 'self', '.', 'tSize', '-', 'en', ',', 'self', '.', 'tSize', '-', 'st', 'return', '(', 'sel...
return a BED6 entry, thus DOES coordinate conversion for minus strands
['return', 'a', 'BED6', 'entry', 'thus', 'DOES', 'coordinate', 'conversion', 'for', 'minus', 'strands']
train
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx/align/epo.py#L135-L148
8,763
pyQode/pyqode.core
pyqode/core/api/code_edit.py
CodeEdit.cut
def cut(self): """ Cuts the selected text or the whole line if no text was selected. """ tc = self.textCursor() helper = TextHelper(self) tc.beginEditBlock() no_selection = False sText = tc.selection().toPlainText() if not helper.current_line_text(...
python
def cut(self): """ Cuts the selected text or the whole line if no text was selected. """ tc = self.textCursor() helper = TextHelper(self) tc.beginEditBlock() no_selection = False sText = tc.selection().toPlainText() if not helper.current_line_text(...
['def', 'cut', '(', 'self', ')', ':', 'tc', '=', 'self', '.', 'textCursor', '(', ')', 'helper', '=', 'TextHelper', '(', 'self', ')', 'tc', '.', 'beginEditBlock', '(', ')', 'no_selection', '=', 'False', 'sText', '=', 'tc', '.', 'selection', '(', ')', '.', 'toPlainText', '(', ')', 'if', 'not', 'helper', '.', 'current_lin...
Cuts the selected text or the whole line if no text was selected.
['Cuts', 'the', 'selected', 'text', 'or', 'the', 'whole', 'line', 'if', 'no', 'text', 'was', 'selected', '.']
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/code_edit.py#L869-L888
8,764
gbiggs/rtctree
rtctree/component.py
Component.activate_conf_set
def activate_conf_set(self, set_name): '''Activate a configuration set by name. @raises NoSuchConfSetError ''' with self._mutex: if not set_name in self.conf_sets: raise exceptions.NoSuchConfSetError(set_name) self._conf.activate_configuration_se...
python
def activate_conf_set(self, set_name): '''Activate a configuration set by name. @raises NoSuchConfSetError ''' with self._mutex: if not set_name in self.conf_sets: raise exceptions.NoSuchConfSetError(set_name) self._conf.activate_configuration_se...
['def', 'activate_conf_set', '(', 'self', ',', 'set_name', ')', ':', 'with', 'self', '.', '_mutex', ':', 'if', 'not', 'set_name', 'in', 'self', '.', 'conf_sets', ':', 'raise', 'exceptions', '.', 'NoSuchConfSetError', '(', 'set_name', ')', 'self', '.', '_conf', '.', 'activate_configuration_set', '(', 'set_name', ')']
Activate a configuration set by name. @raises NoSuchConfSetError
['Activate', 'a', 'configuration', 'set', 'by', 'name', '.']
train
https://github.com/gbiggs/rtctree/blob/bd725a47ac87c259c8bce06156ccc9ab71111c26/rtctree/component.py#L1056-L1065
8,765
gmr/helper
helper/unix.py
Daemon._get_pidfile_path
def _get_pidfile_path(self): """Return the normalized path for the pidfile, raising an exception if it can not written to. :return: str :raises: ValueError :raises: OSError """ if self.config.daemon.pidfile: pidfile = path.abspath(self.config.daemon....
python
def _get_pidfile_path(self): """Return the normalized path for the pidfile, raising an exception if it can not written to. :return: str :raises: ValueError :raises: OSError """ if self.config.daemon.pidfile: pidfile = path.abspath(self.config.daemon....
['def', '_get_pidfile_path', '(', 'self', ')', ':', 'if', 'self', '.', 'config', '.', 'daemon', '.', 'pidfile', ':', 'pidfile', '=', 'path', '.', 'abspath', '(', 'self', '.', 'config', '.', 'daemon', '.', 'pidfile', ')', 'if', 'not', 'os', '.', 'access', '(', 'path', '.', 'dirname', '(', 'pidfile', ')', ',', 'os', '.',...
Return the normalized path for the pidfile, raising an exception if it can not written to. :return: str :raises: ValueError :raises: OSError
['Return', 'the', 'normalized', 'path', 'for', 'the', 'pidfile', 'raising', 'an', 'exception', 'if', 'it', 'can', 'not', 'written', 'to', '.']
train
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L219-L243
8,766
aws/aws-encryption-sdk-python
src/aws_encryption_sdk/internal/formatting/encryption_context.py
serialize_encryption_context
def serialize_encryption_context(encryption_context): """Serializes the contents of a dictionary into a byte string. :param dict encryption_context: Dictionary of encrytion context keys/values. :returns: Serialized encryption context :rtype: bytes """ if not encryption_context: return b...
python
def serialize_encryption_context(encryption_context): """Serializes the contents of a dictionary into a byte string. :param dict encryption_context: Dictionary of encrytion context keys/values. :returns: Serialized encryption context :rtype: bytes """ if not encryption_context: return b...
['def', 'serialize_encryption_context', '(', 'encryption_context', ')', ':', 'if', 'not', 'encryption_context', ':', 'return', 'bytes', '(', ')', 'serialized_context', '=', 'bytearray', '(', ')', 'dict_size', '=', 'len', '(', 'encryption_context', ')', 'if', 'dict_size', '>', 'aws_encryption_sdk', '.', 'internal', '.',...
Serializes the contents of a dictionary into a byte string. :param dict encryption_context: Dictionary of encrytion context keys/values. :returns: Serialized encryption context :rtype: bytes
['Serializes', 'the', 'contents', 'of', 'a', 'dictionary', 'into', 'a', 'byte', 'string', '.']
train
https://github.com/aws/aws-encryption-sdk-python/blob/d182155d5fb1ef176d9e7d0647679737d5146495/src/aws_encryption_sdk/internal/formatting/encryption_context.py#L50-L96
8,767
tehmaze/natural
natural/phone.py
meid
def meid(number, separator=u' '): ''' Printable Mobile Equipment Identifier (MEID) number. >>> print(meid(123456789012345678)) 1B 69B4BA 630F34 6 >>> print(meid('1B69B4BA630F34')) 1B 69B4BA 630F34 6 ''' if isinstance(number, six.string_types): number = re.sub(r'[\s-]', '', numb...
python
def meid(number, separator=u' '): ''' Printable Mobile Equipment Identifier (MEID) number. >>> print(meid(123456789012345678)) 1B 69B4BA 630F34 6 >>> print(meid('1B69B4BA630F34')) 1B 69B4BA 630F34 6 ''' if isinstance(number, six.string_types): number = re.sub(r'[\s-]', '', numb...
['def', 'meid', '(', 'number', ',', 'separator', '=', "u' '", ')', ':', 'if', 'isinstance', '(', 'number', ',', 'six', '.', 'string_types', ')', ':', 'number', '=', 're', '.', 'sub', '(', "r'[\\s-]'", ',', "''", ',', 'number', ')', 'try', ':', 'number', '=', "'%014X'", '%', 'int', '(', 'number', ',', '16', ')', 'except...
Printable Mobile Equipment Identifier (MEID) number. >>> print(meid(123456789012345678)) 1B 69B4BA 630F34 6 >>> print(meid('1B69B4BA630F34')) 1B 69B4BA 630F34 6
['Printable', 'Mobile', 'Equipment', 'Identifier', '(', 'MEID', ')', 'number', '.']
train
https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/phone.py#L189-L231
8,768
gofed/gofedlib
gofedlib/snapshot/capturer.py
ProjectCapturer.capture
def capture(self, commit = ""): """Capture the current state of a project based on its provider Commit is relevant only for upstream providers. If empty, the latest commit from provider repository is taken. It is ignored for distribution providers. :param provider: project provider, e.g. upstream repository...
python
def capture(self, commit = ""): """Capture the current state of a project based on its provider Commit is relevant only for upstream providers. If empty, the latest commit from provider repository is taken. It is ignored for distribution providers. :param provider: project provider, e.g. upstream repository...
['def', 'capture', '(', 'self', ',', 'commit', '=', '""', ')', ':', 'self', '.', '_validateProvider', '(', 'self', '.', '_provider', ')', '# get client for repository', '# TODO(jchaloup): read config file to switch between local and remove clients', '# TODO(jchaloup): remote client can cover gofed infratructure or any ...
Capture the current state of a project based on its provider Commit is relevant only for upstream providers. If empty, the latest commit from provider repository is taken. It is ignored for distribution providers. :param provider: project provider, e.g. upstream repository, distribution builder :type provi...
['Capture', 'the', 'current', 'state', 'of', 'a', 'project', 'based', 'on', 'its', 'provider']
train
https://github.com/gofed/gofedlib/blob/0674c248fe3d8706f98f912996b65af469f96b10/gofedlib/snapshot/capturer.py#L25-L51
8,769
glitchassassin/lackey
lackey/PlatformManagerWindows.py
PlatformManagerWindows.getWindowRect
def getWindowRect(self, hwnd): """ Returns a rect (x,y,w,h) for the specified window's area """ rect = ctypes.wintypes.RECT() if ctypes.windll.user32.GetWindowRect(hwnd, ctypes.byref(rect)): x1 = rect.left y1 = rect.top x2 = rect.right y2 = rect.bo...
python
def getWindowRect(self, hwnd): """ Returns a rect (x,y,w,h) for the specified window's area """ rect = ctypes.wintypes.RECT() if ctypes.windll.user32.GetWindowRect(hwnd, ctypes.byref(rect)): x1 = rect.left y1 = rect.top x2 = rect.right y2 = rect.bo...
['def', 'getWindowRect', '(', 'self', ',', 'hwnd', ')', ':', 'rect', '=', 'ctypes', '.', 'wintypes', '.', 'RECT', '(', ')', 'if', 'ctypes', '.', 'windll', '.', 'user32', '.', 'GetWindowRect', '(', 'hwnd', ',', 'ctypes', '.', 'byref', '(', 'rect', ')', ')', ':', 'x1', '=', 'rect', '.', 'left', 'y1', '=', 'rect', '.', 't...
Returns a rect (x,y,w,h) for the specified window's area
['Returns', 'a', 'rect', '(', 'x', 'y', 'w', 'h', ')', 'for', 'the', 'specified', 'window', 's', 'area']
train
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L547-L556
8,770
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
Expansions._from_dict
def _from_dict(cls, _dict): """Initialize a Expansions object from a json dictionary.""" args = {} if 'expansions' in _dict: args['expansions'] = [ Expansion._from_dict(x) for x in (_dict.get('expansions')) ] else: raise ValueError( ...
python
def _from_dict(cls, _dict): """Initialize a Expansions object from a json dictionary.""" args = {} if 'expansions' in _dict: args['expansions'] = [ Expansion._from_dict(x) for x in (_dict.get('expansions')) ] else: raise ValueError( ...
['def', '_from_dict', '(', 'cls', ',', '_dict', ')', ':', 'args', '=', '{', '}', 'if', "'expansions'", 'in', '_dict', ':', 'args', '[', "'expansions'", ']', '=', '[', 'Expansion', '.', '_from_dict', '(', 'x', ')', 'for', 'x', 'in', '(', '_dict', '.', 'get', '(', "'expansions'", ')', ')', ']', 'else', ':', 'raise', 'Val...
Initialize a Expansions object from a json dictionary.
['Initialize', 'a', 'Expansions', 'object', 'from', 'a', 'json', 'dictionary', '.']
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L5960-L5971
8,771
ANCIR/granoloader
granoloader/command.py
schema
def schema(ctx, schema): """ Load schema definitions from a YAML file. """ data = yaml.load(schema) if not isinstance(data, (list, tuple)): data = [data] with click.progressbar(data, label=schema.name) as bar: for schema in bar: ctx.obj['grano'].schemata.upsert(schema)
python
def schema(ctx, schema): """ Load schema definitions from a YAML file. """ data = yaml.load(schema) if not isinstance(data, (list, tuple)): data = [data] with click.progressbar(data, label=schema.name) as bar: for schema in bar: ctx.obj['grano'].schemata.upsert(schema)
['def', 'schema', '(', 'ctx', ',', 'schema', ')', ':', 'data', '=', 'yaml', '.', 'load', '(', 'schema', ')', 'if', 'not', 'isinstance', '(', 'data', ',', '(', 'list', ',', 'tuple', ')', ')', ':', 'data', '=', '[', 'data', ']', 'with', 'click', '.', 'progressbar', '(', 'data', ',', 'label', '=', 'schema', '.', 'name', '...
Load schema definitions from a YAML file.
['Load', 'schema', 'definitions', 'from', 'a', 'YAML', 'file', '.']
train
https://github.com/ANCIR/granoloader/blob/c48b1bd50403dd611340c5f51637f7c5ca54059c/granoloader/command.py#L111-L118
8,772
BernardFW/bernard
src/bernard/i18n/translator.py
unserialize
def unserialize(wd: WordDictionary, text: Dict): """ Transforms back a serialized value of `serialize()` """ if not isinstance(text, Mapping): raise ValueError('Text has not the right format') try: t = text['type'] if t == 'string': return text['value'] ...
python
def unserialize(wd: WordDictionary, text: Dict): """ Transforms back a serialized value of `serialize()` """ if not isinstance(text, Mapping): raise ValueError('Text has not the right format') try: t = text['type'] if t == 'string': return text['value'] ...
['def', 'unserialize', '(', 'wd', ':', 'WordDictionary', ',', 'text', ':', 'Dict', ')', ':', 'if', 'not', 'isinstance', '(', 'text', ',', 'Mapping', ')', ':', 'raise', 'ValueError', '(', "'Text has not the right format'", ')', 'try', ':', 't', '=', 'text', '[', "'type'", ']', 'if', 't', '==', "'string'", ':', 'return',...
Transforms back a serialized value of `serialize()`
['Transforms', 'back', 'a', 'serialized', 'value', 'of', 'serialize', '()']
train
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/translator.py#L574-L604
8,773
tundish/turberfield-dialogue
turberfield/dialogue/model.py
SceneScript.scripts
def scripts(cls, pkg, metadata, paths=[], **kwargs): """This class method is the preferred way to create SceneScript objects. :param str pkg: The dotted name of the package containing the scripts. :param metadata: A mapping or data object. This parameter permits searching among scri...
python
def scripts(cls, pkg, metadata, paths=[], **kwargs): """This class method is the preferred way to create SceneScript objects. :param str pkg: The dotted name of the package containing the scripts. :param metadata: A mapping or data object. This parameter permits searching among scri...
['def', 'scripts', '(', 'cls', ',', 'pkg', ',', 'metadata', ',', 'paths', '=', '[', ']', ',', '*', '*', 'kwargs', ')', ':', 'for', 'path', 'in', 'paths', ':', 'try', ':', 'fP', '=', 'pkg_resources', '.', 'resource_filename', '(', 'pkg', ',', 'path', ')', 'except', 'ImportError', ':', 'cls', '.', 'log', '.', 'warning', ...
This class method is the preferred way to create SceneScript objects. :param str pkg: The dotted name of the package containing the scripts. :param metadata: A mapping or data object. This parameter permits searching among scripts against particular criteria. Its use is application specific...
['This', 'class', 'method', 'is', 'the', 'preferred', 'way', 'to', 'create', 'SceneScript', 'objects', '.']
train
https://github.com/tundish/turberfield-dialogue/blob/e7ccf7c19ae162e2f315ddf2642394e858529b4a/turberfield/dialogue/model.py#L271-L301
8,774
proycon/pynlpl
pynlpl/datatypes.py
Trie.size
def size(self): """Size is number of nodes under the trie, including the current node""" if self.children: return sum( ( c.size() for c in self.children.values() ) ) + 1 else: return 1
python
def size(self): """Size is number of nodes under the trie, including the current node""" if self.children: return sum( ( c.size() for c in self.children.values() ) ) + 1 else: return 1
['def', 'size', '(', 'self', ')', ':', 'if', 'self', '.', 'children', ':', 'return', 'sum', '(', '(', 'c', '.', 'size', '(', ')', 'for', 'c', 'in', 'self', '.', 'children', '.', 'values', '(', ')', ')', ')', '+', '1', 'else', ':', 'return', '1']
Size is number of nodes under the trie, including the current node
['Size', 'is', 'number', 'of', 'nodes', 'under', 'the', 'trie', 'including', 'the', 'current', 'node']
train
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/datatypes.py#L361-L366
8,775
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_detach
def volume_detach(self, name, timeout=300): ''' Detach a block device ''' try: volume = self.volume_show(name) except KeyError as exc: raise SaltCloudSystemExit('Unable to find {0} volume: {1}'.format(name, exc))...
python
def volume_detach(self, name, timeout=300): ''' Detach a block device ''' try: volume = self.volume_show(name) except KeyError as exc: raise SaltCloudSystemExit('Unable to find {0} volume: {1}'.format(name, exc))...
['def', 'volume_detach', '(', 'self', ',', 'name', ',', 'timeout', '=', '300', ')', ':', 'try', ':', 'volume', '=', 'self', '.', 'volume_show', '(', 'name', ')', 'except', 'KeyError', 'as', 'exc', ':', 'raise', 'SaltCloudSystemExit', '(', "'Unable to find {0} volume: {1}'", '.', 'format', '(', 'name', ',', 'exc', ')', ...
Detach a block device
['Detach', 'a', 'block', 'device']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L647-L681
8,776
PMEAL/OpenPNM
openpnm/models/geometry/pore_surface_area.py
cube
def cube(target, pore_diameter='pore.diameter', throat_area='throat.area'): r""" Calculates internal surface area of pore bodies assuming they are cubes then subtracts the area of the neighboring throats. Parameters ---------- target : OpenPNM Object The object for which these values ar...
python
def cube(target, pore_diameter='pore.diameter', throat_area='throat.area'): r""" Calculates internal surface area of pore bodies assuming they are cubes then subtracts the area of the neighboring throats. Parameters ---------- target : OpenPNM Object The object for which these values ar...
['def', 'cube', '(', 'target', ',', 'pore_diameter', '=', "'pore.diameter'", ',', 'throat_area', '=', "'throat.area'", ')', ':', 'network', '=', 'target', '.', 'project', '.', 'network', 'D', '=', 'target', '[', 'pore_diameter', ']', 'Tn', '=', 'network', '.', 'find_neighbor_throats', '(', 'pores', '=', 'target', '.', ...
r""" Calculates internal surface area of pore bodies assuming they are cubes then subtracts the area of the neighboring throats. Parameters ---------- target : OpenPNM Object The object for which these values are being calculated. This controls the length of the calculated array, a...
['r', 'Calculates', 'internal', 'surface', 'area', 'of', 'pore', 'bodies', 'assuming', 'they', 'are', 'cubes', 'then', 'subtracts', 'the', 'area', 'of', 'the', 'neighboring', 'throats', '.']
train
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/models/geometry/pore_surface_area.py#L35-L59
8,777
pandas-dev/pandas
pandas/core/arrays/datetimes.py
_to_M8
def _to_M8(key, tz=None): """ Timestamp-like => dt64 """ if not isinstance(key, Timestamp): # this also converts strings key = Timestamp(key) if key.tzinfo is not None and tz is not None: # Don't tz_localize(None) if key is already tz-aware key = key.tz_co...
python
def _to_M8(key, tz=None): """ Timestamp-like => dt64 """ if not isinstance(key, Timestamp): # this also converts strings key = Timestamp(key) if key.tzinfo is not None and tz is not None: # Don't tz_localize(None) if key is already tz-aware key = key.tz_co...
['def', '_to_M8', '(', 'key', ',', 'tz', '=', 'None', ')', ':', 'if', 'not', 'isinstance', '(', 'key', ',', 'Timestamp', ')', ':', '# this also converts strings', 'key', '=', 'Timestamp', '(', 'key', ')', 'if', 'key', '.', 'tzinfo', 'is', 'not', 'None', 'and', 'tz', 'is', 'not', 'None', ':', "# Don't tz_localize(None) ...
Timestamp-like => dt64
['Timestamp', '-', 'like', '=', '>', 'dt64']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/datetimes.py#L72-L85
8,778
rosenbrockc/acorn
acorn/ipython.py
InteractiveDecorator.post_run_cell
def post_run_cell(self): """Runs after the user-entered code in a cell has been executed. It detects any new, decoratable objects that haven't been decorated yet and then decorates them. """ #We just want to detect any new, decoratable objects that haven't been #decorated...
python
def post_run_cell(self): """Runs after the user-entered code in a cell has been executed. It detects any new, decoratable objects that haven't been decorated yet and then decorates them. """ #We just want to detect any new, decoratable objects that haven't been #decorated...
['def', 'post_run_cell', '(', 'self', ')', ':', "#We just want to detect any new, decoratable objects that haven't been", '#decorated yet.', 'decorlist', '=', '{', 'k', ':', '[', ']', 'for', 'k', 'in', 'self', '.', 'atypes', '}', 'for', 'atype', 'in', 'self', '.', 'atypes', ':', 'for', 'n', ',', 'o', 'in', 'self', '.',...
Runs after the user-entered code in a cell has been executed. It detects any new, decoratable objects that haven't been decorated yet and then decorates them.
['Runs', 'after', 'the', 'user', '-', 'entered', 'code', 'in', 'a', 'cell', 'has', 'been', 'executed', '.', 'It', 'detects', 'any', 'new', 'decoratable', 'objects', 'that', 'haven', 't', 'been', 'decorated', 'yet', 'and', 'then', 'decorates', 'them', '.']
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/ipython.py#L329-L387
8,779
bitlabstudio/django-development-fabfile
development_fabfile/fabfile/utils.py
require_server
def require_server(fn): """ Checks if the user has called the task with a server name. Fabric tasks decorated with this decorator must be called like so:: fab <server name> <task name> If no server name is given, the task will not be executed. """ @wraps(fn) def wrapper(*args, **...
python
def require_server(fn): """ Checks if the user has called the task with a server name. Fabric tasks decorated with this decorator must be called like so:: fab <server name> <task name> If no server name is given, the task will not be executed. """ @wraps(fn) def wrapper(*args, **...
['def', 'require_server', '(', 'fn', ')', ':', '@', 'wraps', '(', 'fn', ')', 'def', 'wrapper', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'env', '.', 'machine', 'is', 'None', ':', 'abort', '(', 'red', '(', "'ERROR: You must provide a server name to call this'", "' task!'", ')', ')', 'return', 'fn', '(',...
Checks if the user has called the task with a server name. Fabric tasks decorated with this decorator must be called like so:: fab <server name> <task name> If no server name is given, the task will not be executed.
['Checks', 'if', 'the', 'user', 'has', 'called', 'the', 'task', 'with', 'a', 'server', 'name', '.']
train
https://github.com/bitlabstudio/django-development-fabfile/blob/a135c6eb5bdd0b496a7eccfd271aca558dd99243/development_fabfile/fabfile/utils.py#L9-L26
8,780
projectshift/shift-boiler
boiler/user/views_social.py
BaseSocial.next
def next(self): """ Where to redirect after authorization """ next = request.args.get('next') if next is None: params = self.default_redirect_params next = url_for(self.default_redirect_endpoint, **params) return next
python
def next(self): """ Where to redirect after authorization """ next = request.args.get('next') if next is None: params = self.default_redirect_params next = url_for(self.default_redirect_endpoint, **params) return next
['def', 'next', '(', 'self', ')', ':', 'next', '=', 'request', '.', 'args', '.', 'get', '(', "'next'", ')', 'if', 'next', 'is', 'None', ':', 'params', '=', 'self', '.', 'default_redirect_params', 'next', '=', 'url_for', '(', 'self', '.', 'default_redirect_endpoint', ',', '*', '*', 'params', ')', 'return', 'next']
Where to redirect after authorization
['Where', 'to', 'redirect', 'after', 'authorization']
train
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/views_social.py#L60-L66
8,781
Chilipp/psyplot
psyplot/config/rcsetup.py
validate_bool
def validate_bool(b): """Convert b to a boolean or raise""" if isinstance(b, six.string_types): b = b.lower() if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True): return True elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): return False else: raise ValueEr...
python
def validate_bool(b): """Convert b to a boolean or raise""" if isinstance(b, six.string_types): b = b.lower() if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True): return True elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): return False else: raise ValueEr...
['def', 'validate_bool', '(', 'b', ')', ':', 'if', 'isinstance', '(', 'b', ',', 'six', '.', 'string_types', ')', ':', 'b', '=', 'b', '.', 'lower', '(', ')', 'if', 'b', 'in', '(', "'t'", ',', "'y'", ',', "'yes'", ',', "'on'", ',', "'true'", ',', "'1'", ',', '1', ',', 'True', ')', ':', 'return', 'True', 'elif', 'b', 'in'...
Convert b to a boolean or raise
['Convert', 'b', 'to', 'a', 'boolean', 'or', 'raise']
train
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L1020-L1029
8,782
IdentityPython/pysaml2
src/saml2/mdie.py
to_dict
def to_dict(_dict, onts, mdb_safe=False): """ Convert a pysaml2 SAML2 message class instance into a basic dictionary format. The export interface. :param _dict: The pysaml2 metadata instance :param onts: List of schemas to use for the conversion :return: The converted information """ ...
python
def to_dict(_dict, onts, mdb_safe=False): """ Convert a pysaml2 SAML2 message class instance into a basic dictionary format. The export interface. :param _dict: The pysaml2 metadata instance :param onts: List of schemas to use for the conversion :return: The converted information """ ...
['def', 'to_dict', '(', '_dict', ',', 'onts', ',', 'mdb_safe', '=', 'False', ')', ':', 'res', '=', '{', '}', 'if', 'isinstance', '(', '_dict', ',', 'SamlBase', ')', ':', 'res', '[', '"__class__"', ']', '=', '"%s&%s"', '%', '(', '_dict', '.', 'c_namespace', ',', '_dict', '.', 'c_tag', ')', 'for', 'key', 'in', '_dict', '...
Convert a pysaml2 SAML2 message class instance into a basic dictionary format. The export interface. :param _dict: The pysaml2 metadata instance :param onts: List of schemas to use for the conversion :return: The converted information
['Convert', 'a', 'pysaml2', 'SAML2', 'message', 'class', 'instance', 'into', 'a', 'basic', 'dictionary', 'format', '.', 'The', 'export', 'interface', '.']
train
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/mdie.py#L46-L87
8,783
ga4gh/ga4gh-server
oidc-provider/simple_op/src/provider/server/server.py
pyoidcMiddleware
def pyoidcMiddleware(func): """Common wrapper for the underlying pyoidc library functions. Reads GET params and POST data before passing it on the library and converts the response from oic.utils.http_util to wsgi. :param func: underlying library function """ def wrapper(environ, start_response...
python
def pyoidcMiddleware(func): """Common wrapper for the underlying pyoidc library functions. Reads GET params and POST data before passing it on the library and converts the response from oic.utils.http_util to wsgi. :param func: underlying library function """ def wrapper(environ, start_response...
['def', 'pyoidcMiddleware', '(', 'func', ')', ':', 'def', 'wrapper', '(', 'environ', ',', 'start_response', ')', ':', 'data', '=', 'get_or_post', '(', 'environ', ')', 'cookies', '=', 'environ', '.', 'get', '(', '"HTTP_COOKIE"', ',', '""', ')', 'resp', '=', 'func', '(', 'request', '=', 'data', ',', 'cookie', '=', 'cooki...
Common wrapper for the underlying pyoidc library functions. Reads GET params and POST data before passing it on the library and converts the response from oic.utils.http_util to wsgi. :param func: underlying library function
['Common', 'wrapper', 'for', 'the', 'underlying', 'pyoidc', 'library', 'functions', '.', 'Reads', 'GET', 'params', 'and', 'POST', 'data', 'before', 'passing', 'it', 'on', 'the', 'library', 'and', 'converts', 'the', 'response', 'from', 'oic', '.', 'utils', '.', 'http_util', 'to', 'wsgi', '.', ':', 'param', 'func', ':', ...
train
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/oidc-provider/simple_op/src/provider/server/server.py#L70-L83
8,784
wmayner/pyphi
pyphi/utils.py
all_states
def all_states(n, big_endian=False): """Return all binary states for a system. Args: n (int): The number of elements in the system. big_endian (bool): Whether to return the states in big-endian order instead of little-endian order. Yields: tuple[int]: The next state of ...
python
def all_states(n, big_endian=False): """Return all binary states for a system. Args: n (int): The number of elements in the system. big_endian (bool): Whether to return the states in big-endian order instead of little-endian order. Yields: tuple[int]: The next state of ...
['def', 'all_states', '(', 'n', ',', 'big_endian', '=', 'False', ')', ':', 'if', 'n', '==', '0', ':', 'return', 'for', 'state', 'in', 'product', '(', '(', '0', ',', '1', ')', ',', 'repeat', '=', 'n', ')', ':', 'if', 'big_endian', ':', 'yield', 'state', 'else', ':', 'yield', 'state', '[', ':', ':', '-', '1', ']']
Return all binary states for a system. Args: n (int): The number of elements in the system. big_endian (bool): Whether to return the states in big-endian order instead of little-endian order. Yields: tuple[int]: The next state of an ``n``-element system, in little-endian ...
['Return', 'all', 'binary', 'states', 'for', 'a', 'system', '.']
train
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/utils.py#L27-L46
8,785
boriel/zxbasic
zxbpp.py
p_ifdef_else
def p_ifdef_else(p): """ ifdef : ifdefelsea ifdefelseb ENDIF """ global ENABLED p[0] = p[1] + p[2] p[0] += ['#line %i "%s"' % (p.lineno(3) + 1, CURRENT_FILE[-1])] ENABLED = IFDEFS[-1][0] IFDEFS.pop()
python
def p_ifdef_else(p): """ ifdef : ifdefelsea ifdefelseb ENDIF """ global ENABLED p[0] = p[1] + p[2] p[0] += ['#line %i "%s"' % (p.lineno(3) + 1, CURRENT_FILE[-1])] ENABLED = IFDEFS[-1][0] IFDEFS.pop()
['def', 'p_ifdef_else', '(', 'p', ')', ':', 'global', 'ENABLED', 'p', '[', '0', ']', '=', 'p', '[', '1', ']', '+', 'p', '[', '2', ']', 'p', '[', '0', ']', '+=', '[', '\'#line %i "%s"\'', '%', '(', 'p', '.', 'lineno', '(', '3', ')', '+', '1', ',', 'CURRENT_FILE', '[', '-', '1', ']', ')', ']', 'ENABLED', '=', 'IFDEFS', '...
ifdef : ifdefelsea ifdefelseb ENDIF
['ifdef', ':', 'ifdefelsea', 'ifdefelseb', 'ENDIF']
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L506-L514
8,786
lemieuxl/pyGenClean
pyGenClean/NoCallHetero/heterozygosity_plot.py
compute_heterozygosity
def compute_heterozygosity(in_prefix, nb_samples): """Computes the heterozygosity ratio of samples (from tped).""" tped_name = in_prefix + ".tped" tfam_name = in_prefix + ".tfam" # The function we want to use check_heterozygosity = np.vectorize(is_heterozygous) # The autosomes autosomes = ...
python
def compute_heterozygosity(in_prefix, nb_samples): """Computes the heterozygosity ratio of samples (from tped).""" tped_name = in_prefix + ".tped" tfam_name = in_prefix + ".tfam" # The function we want to use check_heterozygosity = np.vectorize(is_heterozygous) # The autosomes autosomes = ...
['def', 'compute_heterozygosity', '(', 'in_prefix', ',', 'nb_samples', ')', ':', 'tped_name', '=', 'in_prefix', '+', '".tped"', 'tfam_name', '=', 'in_prefix', '+', '".tfam"', '# The function we want to use', 'check_heterozygosity', '=', 'np', '.', 'vectorize', '(', 'is_heterozygous', ')', '# The autosomes', 'autosomes'...
Computes the heterozygosity ratio of samples (from tped).
['Computes', 'the', 'heterozygosity', 'ratio', 'of', 'samples', '(', 'from', 'tped', ')', '.']
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/NoCallHetero/heterozygosity_plot.py#L141-L179
8,787
facebook/pyre-check
sapp/sapp/analysis_output.py
AnalysisOutput.file_names
def file_names(self) -> Iterable[str]: """Generates all file names that are used to generate file_handles. """ if self.is_sharded(): yield from ShardedFile(self.filename_spec).get_filenames() elif self.filename_spec: yield self.filename_spec
python
def file_names(self) -> Iterable[str]: """Generates all file names that are used to generate file_handles. """ if self.is_sharded(): yield from ShardedFile(self.filename_spec).get_filenames() elif self.filename_spec: yield self.filename_spec
['def', 'file_names', '(', 'self', ')', '->', 'Iterable', '[', 'str', ']', ':', 'if', 'self', '.', 'is_sharded', '(', ')', ':', 'yield', 'from', 'ShardedFile', '(', 'self', '.', 'filename_spec', ')', '.', 'get_filenames', '(', ')', 'elif', 'self', '.', 'filename_spec', ':', 'yield', 'self', '.', 'filename_spec']
Generates all file names that are used to generate file_handles.
['Generates', 'all', 'file', 'names', 'that', 'are', 'used', 'to', 'generate', 'file_handles', '.']
train
https://github.com/facebook/pyre-check/blob/4a9604d943d28ef20238505a51acfb1f666328d7/sapp/sapp/analysis_output.py#L121-L127
8,788
tanghaibao/jcvi
jcvi/projects/str.py
simulate
def simulate(args): """ %prog simulate run_dir 1 300 Simulate BAMs with varying inserts with dwgsim. The above command will simulate between 1 to 300 CAGs in the HD region, in a directory called `run_dir`. """ p = OptionParser(simulate.__doc__) p.add_option("--method", choices=("wgsim",...
python
def simulate(args): """ %prog simulate run_dir 1 300 Simulate BAMs with varying inserts with dwgsim. The above command will simulate between 1 to 300 CAGs in the HD region, in a directory called `run_dir`. """ p = OptionParser(simulate.__doc__) p.add_option("--method", choices=("wgsim",...
['def', 'simulate', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'simulate', '.', '__doc__', ')', 'p', '.', 'add_option', '(', '"--method"', ',', 'choices', '=', '(', '"wgsim"', ',', '"eagle"', ')', ',', 'default', '=', '"eagle"', ',', 'help', '=', '"Read simulator"', ')', 'p', '.', 'add_option', '(', '"--ref"...
%prog simulate run_dir 1 300 Simulate BAMs with varying inserts with dwgsim. The above command will simulate between 1 to 300 CAGs in the HD region, in a directory called `run_dir`.
['%prog', 'simulate', 'run_dir', '1', '300']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/projects/str.py#L1339-L1407
8,789
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_slurm_info
def _slurm_info(queue): """Returns machine information for a slurm job scheduler. """ cl = "sinfo -h -p {} --format '%c %m %D'".format(queue) num_cpus, mem, num_nodes = subprocess.check_output(shlex.split(cl)).decode().split() # if the queue contains multiple memory configurations, the minimum value...
python
def _slurm_info(queue): """Returns machine information for a slurm job scheduler. """ cl = "sinfo -h -p {} --format '%c %m %D'".format(queue) num_cpus, mem, num_nodes = subprocess.check_output(shlex.split(cl)).decode().split() # if the queue contains multiple memory configurations, the minimum value...
['def', '_slurm_info', '(', 'queue', ')', ':', 'cl', '=', '"sinfo -h -p {} --format \'%c %m %D\'"', '.', 'format', '(', 'queue', ')', 'num_cpus', ',', 'mem', ',', 'num_nodes', '=', 'subprocess', '.', 'check_output', '(', 'shlex', '.', 'split', '(', 'cl', ')', ')', '.', 'decode', '(', ')', '.', 'split', '(', ')', "# if ...
Returns machine information for a slurm job scheduler.
['Returns', 'machine', 'information', 'for', 'a', 'slurm', 'job', 'scheduler', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L61-L75
8,790
listen-lavender/webcrawl
webcrawl/daemon.py
Daemon.monitor
def monitor(self, timeout): """ Monitor the process, check whether it runs out of time. """ def check(self, timeout): time.sleep(timeout) self.stop() wather = threading.Thread(target=check) wather.setDaemon(True) wather.start()
python
def monitor(self, timeout): """ Monitor the process, check whether it runs out of time. """ def check(self, timeout): time.sleep(timeout) self.stop() wather = threading.Thread(target=check) wather.setDaemon(True) wather.start()
['def', 'monitor', '(', 'self', ',', 'timeout', ')', ':', 'def', 'check', '(', 'self', ',', 'timeout', ')', ':', 'time', '.', 'sleep', '(', 'timeout', ')', 'self', '.', 'stop', '(', ')', 'wather', '=', 'threading', '.', 'Thread', '(', 'target', '=', 'check', ')', 'wather', '.', 'setDaemon', '(', 'True', ')', 'wather', ...
Monitor the process, check whether it runs out of time.
['Monitor', 'the', 'process', 'check', 'whether', 'it', 'runs', 'out', 'of', 'time', '.']
train
https://github.com/listen-lavender/webcrawl/blob/905dcfa6e6934aac764045660c0efcef28eae1e6/webcrawl/daemon.py#L164-L174
8,791
nicolargo/glances
glances/plugins/glances_memswap.py
Plugin.update
def update(self): """Update swap memory stats using the input method.""" # Init new stats stats = self.get_init_value() if self.input_method == 'local': # Update stats using the standard system lib # Grab SWAP using the psutil swap_memory method sm_st...
python
def update(self): """Update swap memory stats using the input method.""" # Init new stats stats = self.get_init_value() if self.input_method == 'local': # Update stats using the standard system lib # Grab SWAP using the psutil swap_memory method sm_st...
['def', 'update', '(', 'self', ')', ':', '# Init new stats', 'stats', '=', 'self', '.', 'get_init_value', '(', ')', 'if', 'self', '.', 'input_method', '==', "'local'", ':', '# Update stats using the standard system lib', '# Grab SWAP using the psutil swap_memory method', 'sm_stats', '=', 'psutil', '.', 'swap_memory', '...
Update swap memory stats using the input method.
['Update', 'swap', 'memory', 'stats', 'using', 'the', 'input', 'method', '.']
train
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_memswap.py#L60-L128
8,792
SHDShim/pytheos
pytheos/scales/objs.py
JHEOS.cal_pth
def cal_pth(self, v, temp): """ calculate thermal pressure :param v: unit-cell volume in A^3 :param temp: temperature in K :return: thermal pressure in GPa """ params_t = self._set_params(self.params_therm) return constq_pth(v, temp, *params_t, self.n, se...
python
def cal_pth(self, v, temp): """ calculate thermal pressure :param v: unit-cell volume in A^3 :param temp: temperature in K :return: thermal pressure in GPa """ params_t = self._set_params(self.params_therm) return constq_pth(v, temp, *params_t, self.n, se...
['def', 'cal_pth', '(', 'self', ',', 'v', ',', 'temp', ')', ':', 'params_t', '=', 'self', '.', '_set_params', '(', 'self', '.', 'params_therm', ')', 'return', 'constq_pth', '(', 'v', ',', 'temp', ',', '*', 'params_t', ',', 'self', '.', 'n', ',', 'self', '.', 'z', ',', 't_ref', '=', 'self', '.', 't_ref', ',', 'three_r',...
calculate thermal pressure :param v: unit-cell volume in A^3 :param temp: temperature in K :return: thermal pressure in GPa
['calculate', 'thermal', 'pressure']
train
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L377-L387
8,793
rbarrois/confutils
confutils/configfile.py
Section.remove
def remove(self, line): """Delete all lines matching the given line.""" nb = 0 for block in self.blocks: nb += block.remove(line) return nb
python
def remove(self, line): """Delete all lines matching the given line.""" nb = 0 for block in self.blocks: nb += block.remove(line) return nb
['def', 'remove', '(', 'self', ',', 'line', ')', ':', 'nb', '=', '0', 'for', 'block', 'in', 'self', '.', 'blocks', ':', 'nb', '+=', 'block', '.', 'remove', '(', 'line', ')', 'return', 'nb']
Delete all lines matching the given line.
['Delete', 'all', 'lines', 'matching', 'the', 'given', 'line', '.']
train
https://github.com/rbarrois/confutils/blob/26bbb3f31c09a99ee2104263a9e97d6d3fc8e4f4/confutils/configfile.py#L227-L233
8,794
takuti/flurs
flurs/utils/feature_hash.py
feature_hash
def feature_hash(feature, dim, seed=123): """Feature hashing. Args: feature (str): Target feature represented as string. dim (int): Number of dimensions for a hash value. seed (float): Seed of a MurmurHash3 hash function. Returns: numpy 1d array: one-hot-encoded feature vec...
python
def feature_hash(feature, dim, seed=123): """Feature hashing. Args: feature (str): Target feature represented as string. dim (int): Number of dimensions for a hash value. seed (float): Seed of a MurmurHash3 hash function. Returns: numpy 1d array: one-hot-encoded feature vec...
['def', 'feature_hash', '(', 'feature', ',', 'dim', ',', 'seed', '=', '123', ')', ':', 'vec', '=', 'np', '.', 'zeros', '(', 'dim', ')', 'i', '=', 'mmh3', '.', 'hash', '(', 'feature', ',', 'seed', ')', '%', 'dim', 'vec', '[', 'i', ']', '=', '1', 'return', 'vec']
Feature hashing. Args: feature (str): Target feature represented as string. dim (int): Number of dimensions for a hash value. seed (float): Seed of a MurmurHash3 hash function. Returns: numpy 1d array: one-hot-encoded feature vector for `s`.
['Feature', 'hashing', '.']
train
https://github.com/takuti/flurs/blob/a998fc180b45db7eaf38dbbbf8125a93100b8a8c/flurs/utils/feature_hash.py#L27-L42
8,795
rigetti/grove
grove/amplification/amplification.py
decomposed_diffusion_program
def decomposed_diffusion_program(qubits: List[int]) -> Program: """ Constructs the diffusion operator used in Grover's Algorithm, acted on both sides by an a Hadamard gate on each qubit. Note that this means that the matrix representation of this operator is diag(1, -1, ..., -1). In particular, this dec...
python
def decomposed_diffusion_program(qubits: List[int]) -> Program: """ Constructs the diffusion operator used in Grover's Algorithm, acted on both sides by an a Hadamard gate on each qubit. Note that this means that the matrix representation of this operator is diag(1, -1, ..., -1). In particular, this dec...
['def', 'decomposed_diffusion_program', '(', 'qubits', ':', 'List', '[', 'int', ']', ')', '->', 'Program', ':', 'program', '=', 'Program', '(', ')', 'if', 'len', '(', 'qubits', ')', '==', '1', ':', 'program', '.', 'inst', '(', 'Z', '(', 'qubits', '[', '0', ']', ')', ')', 'else', ':', 'program', '.', 'inst', '(', '[', '...
Constructs the diffusion operator used in Grover's Algorithm, acted on both sides by an a Hadamard gate on each qubit. Note that this means that the matrix representation of this operator is diag(1, -1, ..., -1). In particular, this decomposes the diffusion operator, which is a :math:`2**{len(qubits)}\times...
['Constructs', 'the', 'diffusion', 'operator', 'used', 'in', 'Grover', 's', 'Algorithm', 'acted', 'on', 'both', 'sides', 'by', 'an', 'a', 'Hadamard', 'gate', 'on', 'each', 'qubit', '.', 'Note', 'that', 'this', 'means', 'that', 'the', 'matrix', 'representation', 'of', 'this', 'operator', 'is', 'diag', '(', '1', '-', '1'...
train
https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/amplification/amplification.py#L86-L118
8,796
numenta/htmresearch
projects/sdr_paper/scalar_sdrs.py
plotMatches2
def plotMatches2(listofNValues, errors, listOfScales, scaleErrors, fileName = "images/scalar_matches.pdf"): """ Plot two figures side by side in an aspect ratio appropriate for the paper. """ w, h = figaspect(0.4) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(w,h)) plotMat...
python
def plotMatches2(listofNValues, errors, listOfScales, scaleErrors, fileName = "images/scalar_matches.pdf"): """ Plot two figures side by side in an aspect ratio appropriate for the paper. """ w, h = figaspect(0.4) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(w,h)) plotMat...
['def', 'plotMatches2', '(', 'listofNValues', ',', 'errors', ',', 'listOfScales', ',', 'scaleErrors', ',', 'fileName', '=', '"images/scalar_matches.pdf"', ')', ':', 'w', ',', 'h', '=', 'figaspect', '(', '0.4', ')', 'fig', ',', '(', 'ax1', ',', 'ax2', ')', '=', 'plt', '.', 'subplots', '(', '1', ',', '2', ',', 'figsize',...
Plot two figures side by side in an aspect ratio appropriate for the paper.
['Plot', 'two', 'figures', 'side', 'by', 'side', 'in', 'an', 'aspect', 'ratio', 'appropriate', 'for', 'the', 'paper', '.']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/sdr_paper/scalar_sdrs.py#L570-L583
8,797
wmayner/pyphi
pyphi/validate.py
tpm
def tpm(tpm, check_independence=True): """Validate a TPM. The TPM can be in * 2-dimensional state-by-state form, * 2-dimensional state-by-node form, or * multidimensional state-by-node form. """ see_tpm_docs = ( 'See the documentation on TPM conventions and the `pyphi.N...
python
def tpm(tpm, check_independence=True): """Validate a TPM. The TPM can be in * 2-dimensional state-by-state form, * 2-dimensional state-by-node form, or * multidimensional state-by-node form. """ see_tpm_docs = ( 'See the documentation on TPM conventions and the `pyphi.N...
['def', 'tpm', '(', 'tpm', ',', 'check_independence', '=', 'True', ')', ':', 'see_tpm_docs', '=', '(', "'See the documentation on TPM conventions and the `pyphi.Network` '", "'object for more information on TPM forms.'", ')', '# Cast to np.array.', 'tpm', '=', 'np', '.', 'array', '(', 'tpm', ')', '# Get the number of n...
Validate a TPM. The TPM can be in * 2-dimensional state-by-state form, * 2-dimensional state-by-node form, or * multidimensional state-by-node form.
['Validate', 'a', 'TPM', '.']
train
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/validate.py#L34-L71
8,798
quantopian/zipline
zipline/pipeline/filters/filter.py
binary_operator
def binary_operator(op): """ Factory function for making binary operator methods on a Filter subclass. Returns a function "binary_operator" suitable for implementing functions like __and__ or __or__. """ # When combining a Filter with a NumericalExpression, we use this # attrgetter instance...
python
def binary_operator(op): """ Factory function for making binary operator methods on a Filter subclass. Returns a function "binary_operator" suitable for implementing functions like __and__ or __or__. """ # When combining a Filter with a NumericalExpression, we use this # attrgetter instance...
['def', 'binary_operator', '(', 'op', ')', ':', '# When combining a Filter with a NumericalExpression, we use this', '# attrgetter instance to defer to the commuted interpretation of the', '# NumericalExpression operator.', 'commuted_method_getter', '=', 'attrgetter', '(', 'method_name_for_op', '(', 'op', ',', 'commute...
Factory function for making binary operator methods on a Filter subclass. Returns a function "binary_operator" suitable for implementing functions like __and__ or __or__.
['Factory', 'function', 'for', 'making', 'binary', 'operator', 'methods', 'on', 'a', 'Filter', 'subclass', '.']
train
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/filters/filter.py#L62-L112
8,799
materialsproject/pymatgen
pymatgen/analysis/adsorption.py
get_rot
def get_rot(slab): """ Gets the transformation to rotate the z axis into the miller index """ new_z = get_mi_vec(slab) a, b, c = slab.lattice.matrix new_x = a / np.linalg.norm(a) new_y = np.cross(new_z, new_x) x, y, z = np.eye(3) rot_matrix = np.array([np.dot(*el) for el in ...
python
def get_rot(slab): """ Gets the transformation to rotate the z axis into the miller index """ new_z = get_mi_vec(slab) a, b, c = slab.lattice.matrix new_x = a / np.linalg.norm(a) new_y = np.cross(new_z, new_x) x, y, z = np.eye(3) rot_matrix = np.array([np.dot(*el) for el in ...
['def', 'get_rot', '(', 'slab', ')', ':', 'new_z', '=', 'get_mi_vec', '(', 'slab', ')', 'a', ',', 'b', ',', 'c', '=', 'slab', '.', 'lattice', '.', 'matrix', 'new_x', '=', 'a', '/', 'np', '.', 'linalg', '.', 'norm', '(', 'a', ')', 'new_y', '=', 'np', '.', 'cross', '(', 'new_z', ',', 'new_x', ')', 'x', ',', 'y', ',', 'z'...
Gets the transformation to rotate the z axis into the miller index
['Gets', 'the', 'transformation', 'to', 'rotate', 'the', 'z', 'axis', 'into', 'the', 'miller', 'index']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L576-L590