repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
lingthio/Flask-User
example_apps/pynamodb_app.py
https://github.com/lingthio/Flask-User/blob/a379fa0a281789618c484b459cb41236779b95b1/example_apps/pynamodb_app.py#L37-L122
def create_app(): """ Flask application factory """ # Setup Flask app and app.config app = Flask(__name__) app.config.from_object(__name__ + '.ConfigClass') # Initialize Flask extensions db = None mail = Mail(app) # Initialize Flask-Mail # Define the User data model. Make sure to add...
[ "def", "create_app", "(", ")", ":", "# Setup Flask app and app.config", "app", "=", "Flask", "(", "__name__", ")", "app", ".", "config", ".", "from_object", "(", "__name__", "+", "'.ConfigClass'", ")", "# Initialize Flask extensions", "db", "=", "None", "mail", ...
Flask application factory
[ "Flask", "application", "factory" ]
python
train
klen/adrest
adrest/mixin/handler.py
https://github.com/klen/adrest/blob/8b75c67123cffabe5ed98c222bb7ab43c904d89c/adrest/mixin/handler.py#L130-L145
def handle_request(self, request, **resources): """ Get a method for request and execute. :return object: method result """ if not request.method in self._meta.callmap.keys(): raise HttpError( 'Unknown or unsupported method \'%s\'' % request.method, ...
[ "def", "handle_request", "(", "self", ",", "request", ",", "*", "*", "resources", ")", ":", "if", "not", "request", ".", "method", "in", "self", ".", "_meta", ".", "callmap", ".", "keys", "(", ")", ":", "raise", "HttpError", "(", "'Unknown or unsupported...
Get a method for request and execute. :return object: method result
[ "Get", "a", "method", "for", "request", "and", "execute", "." ]
python
train
watson-developer-cloud/python-sdk
ibm_watson/tone_analyzer_v3.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/tone_analyzer_v3.py#L114-L208
def tone(self, tone_input, sentences=None, tones=None, content_language=None, accept_language=None, content_type=None, **kwargs): """ Analyze general tone. Use the general purpose endpoint to analyze the ...
[ "def", "tone", "(", "self", ",", "tone_input", ",", "sentences", "=", "None", ",", "tones", "=", "None", ",", "content_language", "=", "None", ",", "accept_language", "=", "None", ",", "content_type", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if...
Analyze general tone. Use the general purpose endpoint to analyze the tone of your input content. The service analyzes the content for emotional and language tones. The method always analyzes the tone of the full document; by default, it also analyzes the tone of each individual sentenc...
[ "Analyze", "general", "tone", "." ]
python
train
evolbioinfo/pastml
pastml/ml.py
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/ml.py#L496-L563
def choose_ancestral_states_mppa(tree, feature, states, force_joint=True): """ Chooses node ancestral states based on their marginal probabilities using MPPA method. :param force_joint: make sure that Joint state is chosen even if it has a low probability. :type force_joint: bool :param tree: tree ...
[ "def", "choose_ancestral_states_mppa", "(", "tree", ",", "feature", ",", "states", ",", "force_joint", "=", "True", ")", ":", "lh_feature", "=", "get_personalized_feature_name", "(", "feature", ",", "LH", ")", "allowed_state_feature", "=", "get_personalized_feature_na...
Chooses node ancestral states based on their marginal probabilities using MPPA method. :param force_joint: make sure that Joint state is chosen even if it has a low probability. :type force_joint: bool :param tree: tree of interest :type tree: ete3.Tree :param feature: character for which the ances...
[ "Chooses", "node", "ancestral", "states", "based", "on", "their", "marginal", "probabilities", "using", "MPPA", "method", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/licensing/licensing_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/licensing/licensing_client.py#L88-L107
def assign_available_account_entitlement(self, user_id, dont_notify_user=None, origin=None): """AssignAvailableAccountEntitlement. [Preview API] Assign an available entitilement to a user :param str user_id: The user to which to assign the entitilement :param bool dont_notify_user: ...
[ "def", "assign_available_account_entitlement", "(", "self", ",", "user_id", ",", "dont_notify_user", "=", "None", ",", "origin", "=", "None", ")", ":", "query_parameters", "=", "{", "}", "if", "user_id", "is", "not", "None", ":", "query_parameters", "[", "'use...
AssignAvailableAccountEntitlement. [Preview API] Assign an available entitilement to a user :param str user_id: The user to which to assign the entitilement :param bool dont_notify_user: :param str origin: :rtype: :class:`<AccountEntitlement> <azure.devops.v5_0.licensing.models.A...
[ "AssignAvailableAccountEntitlement", ".", "[", "Preview", "API", "]", "Assign", "an", "available", "entitilement", "to", "a", "user", ":", "param", "str", "user_id", ":", "The", "user", "to", "which", "to", "assign", "the", "entitilement", ":", "param", "bool"...
python
train
saltstack/salt
salt/utils/botomod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L256-L273
def assign_funcs(modname, service, module=None, pack=None): ''' Assign _get_conn and _cache_id functions to the named module. .. code-block:: python __utils__['boto.assign_partials'](__name__, 'ec2') ''' if pack: global __salt__ # pylint: disable=W0601 __salt__ = pack ...
[ "def", "assign_funcs", "(", "modname", ",", "service", ",", "module", "=", "None", ",", "pack", "=", "None", ")", ":", "if", "pack", ":", "global", "__salt__", "# pylint: disable=W0601", "__salt__", "=", "pack", "mod", "=", "sys", ".", "modules", "[", "m...
Assign _get_conn and _cache_id functions to the named module. .. code-block:: python __utils__['boto.assign_partials'](__name__, 'ec2')
[ "Assign", "_get_conn", "and", "_cache_id", "functions", "to", "the", "named", "module", "." ]
python
train
Azure/azure-cli-extensions
src/alias/azext_alias/argument.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/alias/azext_alias/argument.py#L66-L86
def normalize_placeholders(arg, inject_quotes=False): """ Normalize placeholders' names so that the template can be ingested into Jinja template engine. - Jinja does not accept numbers as placeholder names, so add a "_" before the numbers to make them valid placeholder names. - Surround placehol...
[ "def", "normalize_placeholders", "(", "arg", ",", "inject_quotes", "=", "False", ")", ":", "number_placeholders", "=", "re", ".", "findall", "(", "r'{{\\s*\\d+\\s*}}'", ",", "arg", ")", "for", "number_placeholder", "in", "number_placeholders", ":", "number", "=", ...
Normalize placeholders' names so that the template can be ingested into Jinja template engine. - Jinja does not accept numbers as placeholder names, so add a "_" before the numbers to make them valid placeholder names. - Surround placeholders expressions with "" so we can preserve spaces inside the posi...
[ "Normalize", "placeholders", "names", "so", "that", "the", "template", "can", "be", "ingested", "into", "Jinja", "template", "engine", ".", "-", "Jinja", "does", "not", "accept", "numbers", "as", "placeholder", "names", "so", "add", "a", "_", "before", "the"...
python
train
pytroll/pyspectral
rsr_convert_scripts/msi_reader.py
https://github.com/pytroll/pyspectral/blob/fd296c0e0bdf5364fa180134a1292665d6bc50a3/rsr_convert_scripts/msi_reader.py#L95-L127
def _load(self, scale=0.001): """Load the Sentinel-2 MSI relative spectral responses """ with open_workbook(self.path) as wb_: for sheet in wb_.sheets(): if sheet.name not in SHEET_HEADERS.keys(): continue plt_short_name = PLATFOR...
[ "def", "_load", "(", "self", ",", "scale", "=", "0.001", ")", ":", "with", "open_workbook", "(", "self", ".", "path", ")", "as", "wb_", ":", "for", "sheet", "in", "wb_", ".", "sheets", "(", ")", ":", "if", "sheet", ".", "name", "not", "in", "SHEE...
Load the Sentinel-2 MSI relative spectral responses
[ "Load", "the", "Sentinel", "-", "2", "MSI", "relative", "spectral", "responses" ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/__init__.py#L403-L424
def _set_media_form_factor(self, v, load=False): """ Setter method for media_form_factor, mapped from YANG variable /brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/media_form_factor (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_media_fo...
[ "def", "_set_media_form_factor", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",",...
Setter method for media_form_factor, mapped from YANG variable /brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/media_form_factor (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_media_form_factor is considered as a private method. Backends loo...
[ "Setter", "method", "for", "media_form_factor", "mapped", "from", "YANG", "variable", "/", "brocade_interface_ext_rpc", "/", "get_media_detail", "/", "output", "/", "interface", "/", "qsfpp", "/", "media_form_factor", "(", "enumeration", ")", "If", "this", "variable...
python
train
MasterOdin/pylint_runner
pylint_runner/main.py
https://github.com/MasterOdin/pylint_runner/blob/b8ec3324e568e172d38fc0b6fa6f5551b229de07/pylint_runner/main.py#L114-L143
def get_files_from_dir(self, current_dir): """ Recursively walk through a directory and get all python files and then walk through any potential directories that are found off current directory, so long as not within self.IGNORE_FOLDERS :return: all python files that were found o...
[ "def", "get_files_from_dir", "(", "self", ",", "current_dir", ")", ":", "if", "current_dir", "[", "-", "1", "]", "!=", "\"/\"", "and", "current_dir", "!=", "\".\"", ":", "current_dir", "+=", "\"/\"", "files", "=", "[", "]", "for", "dir_file", "in", "os",...
Recursively walk through a directory and get all python files and then walk through any potential directories that are found off current directory, so long as not within self.IGNORE_FOLDERS :return: all python files that were found off current_dir
[ "Recursively", "walk", "through", "a", "directory", "and", "get", "all", "python", "files", "and", "then", "walk", "through", "any", "potential", "directories", "that", "are", "found", "off", "current", "directory", "so", "long", "as", "not", "within", "self",...
python
train
marti1125/culqipy1_2
culqipy1_2/utils.py
https://github.com/marti1125/culqipy1_2/blob/e48ed496819009a642211f048631a5e3d4b1a16c/culqipy1_2/utils.py#L41-L73
def get_result(self): """ Returns an http response object. """ timeout = 60 if self.method == "GET": timeout = 360 headers = { "Authorization": "Bearer " + self.key, "content-type": "application/json" } response = None...
[ "def", "get_result", "(", "self", ")", ":", "timeout", "=", "60", "if", "self", ".", "method", "==", "\"GET\"", ":", "timeout", "=", "360", "headers", "=", "{", "\"Authorization\"", ":", "\"Bearer \"", "+", "self", ".", "key", ",", "\"content-type\"", ":...
Returns an http response object.
[ "Returns", "an", "http", "response", "object", "." ]
python
train
hydpy-dev/hydpy
hydpy/auxs/statstools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/statstools.py#L241-L257
def corr(sim=None, obs=None, node=None, skip_nan=False): """Calculate the product-moment correlation coefficient after Pearson. >>> from hydpy import round_ >>> from hydpy import corr >>> round_(corr(sim=[0.5, 1.0, 1.5], obs=[1.0, 2.0, 3.0])) 1.0 >>> round_(corr(sim=[4.0, 2.0, 0.0], obs=[1.0, 2...
[ "def", "corr", "(", "sim", "=", "None", ",", "obs", "=", "None", ",", "node", "=", "None", ",", "skip_nan", "=", "False", ")", ":", "sim", ",", "obs", "=", "prepare_arrays", "(", "sim", ",", "obs", ",", "node", ",", "skip_nan", ")", "return", "nu...
Calculate the product-moment correlation coefficient after Pearson. >>> from hydpy import round_ >>> from hydpy import corr >>> round_(corr(sim=[0.5, 1.0, 1.5], obs=[1.0, 2.0, 3.0])) 1.0 >>> round_(corr(sim=[4.0, 2.0, 0.0], obs=[1.0, 2.0, 3.0])) -1.0 >>> round_(corr(sim=[1.0, 2.0, 1.0], obs...
[ "Calculate", "the", "product", "-", "moment", "correlation", "coefficient", "after", "Pearson", "." ]
python
train
matthew-brett/delocate
delocate/tools.py
https://github.com/matthew-brett/delocate/blob/ed48de15fce31c3f52f1a9f32cae1b02fc55aa60/delocate/tools.py#L197-L222
def get_install_names(filename): """ Return install names from library named in `filename` Returns tuple of install names tuple will be empty if no install names, or if this is not an object file. Parameters ---------- filename : str filename of library Returns ------- in...
[ "def", "get_install_names", "(", "filename", ")", ":", "lines", "=", "_cmd_out_err", "(", "[", "'otool'", ",", "'-L'", ",", "filename", "]", ")", "if", "not", "_line0_says_object", "(", "lines", "[", "0", "]", ",", "filename", ")", ":", "return", "(", ...
Return install names from library named in `filename` Returns tuple of install names tuple will be empty if no install names, or if this is not an object file. Parameters ---------- filename : str filename of library Returns ------- install_names : tuple tuple of inst...
[ "Return", "install", "names", "from", "library", "named", "in", "filename" ]
python
train
google/pyringe
pyringe/payload/libpython.py
https://github.com/google/pyringe/blob/76dff5d1ac29cd5e7bf32677654a83291a15ad8a/pyringe/payload/libpython.py#L273-L337
def subclass_from_type(cls, t): ''' Given a PyTypeObjectPtr instance wrapping a gdb.Value that's a (PyTypeObject*), determine the corresponding subclass of PyObjectPtr to use Ideally, we would look up the symbols for the global types, but that isn't working yet: ...
[ "def", "subclass_from_type", "(", "cls", ",", "t", ")", ":", "try", ":", "tp_name", "=", "t", ".", "field", "(", "'tp_name'", ")", ".", "string", "(", ")", "tp_flags", "=", "int", "(", "t", ".", "field", "(", "'tp_flags'", ")", ")", "except", "Runt...
Given a PyTypeObjectPtr instance wrapping a gdb.Value that's a (PyTypeObject*), determine the corresponding subclass of PyObjectPtr to use Ideally, we would look up the symbols for the global types, but that isn't working yet: (gdb) python print gdb.lookup_symbol('PyList_Type'...
[ "Given", "a", "PyTypeObjectPtr", "instance", "wrapping", "a", "gdb", ".", "Value", "that", "s", "a", "(", "PyTypeObject", "*", ")", "determine", "the", "corresponding", "subclass", "of", "PyObjectPtr", "to", "use" ]
python
train
9wfox/tornadoweb
tornadoweb/app.py
https://github.com/9wfox/tornadoweb/blob/2286b66fbe10e4d9f212b979664c15fa17adf378/tornadoweb/app.py#L87-L101
def _run_server(self): """ 启动 HTTP Server """ try: if __conf__.DEBUG: self._webapp.listen(self._port) else: server = HTTPServer(self._webapp) server.bind(self._port) server.start(0) ...
[ "def", "_run_server", "(", "self", ")", ":", "try", ":", "if", "__conf__", ".", "DEBUG", ":", "self", ".", "_webapp", ".", "listen", "(", "self", ".", "_port", ")", "else", ":", "server", "=", "HTTPServer", "(", "self", ".", "_webapp", ")", "server",...
启动 HTTP Server
[ "启动", "HTTP", "Server" ]
python
train
3ll3d00d/vibe
backend/src/core/reactor.py
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/core/reactor.py#L23-L34
def _accept(self): """ Work loop runs forever (or until running is False) :return: """ logger.warning("Reactor " + self._name + " is starting") while self.running: try: self._completeTask() except: logger.exception("...
[ "def", "_accept", "(", "self", ")", ":", "logger", ".", "warning", "(", "\"Reactor \"", "+", "self", ".", "_name", "+", "\" is starting\"", ")", "while", "self", ".", "running", ":", "try", ":", "self", ".", "_completeTask", "(", ")", "except", ":", "l...
Work loop runs forever (or until running is False) :return:
[ "Work", "loop", "runs", "forever", "(", "or", "until", "running", "is", "False", ")", ":", "return", ":" ]
python
train
klen/makesite
makesite/install.py
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/install.py#L46-L90
def clone_source(self): " Clone source and prepare templates " print_header('Clone src: %s' % self.src, '-') # Get source source_dir = self._get_source() # Append settings from source self.read(op.join(source_dir, settings.CFGNAME)) self.templates += (self.arg...
[ "def", "clone_source", "(", "self", ")", ":", "print_header", "(", "'Clone src: %s'", "%", "self", ".", "src", ",", "'-'", ")", "# Get source", "source_dir", "=", "self", ".", "_get_source", "(", ")", "# Append settings from source", "self", ".", "read", "(", ...
Clone source and prepare templates
[ "Clone", "source", "and", "prepare", "templates" ]
python
train
quintusdias/glymur
glymur/jp2k.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2k.py#L1850-L1865
def _validate_label(self, boxes): """ Label boxes can only be inside association, codestream headers, or compositing layer header boxes. """ for box in boxes: if box.box_id != 'asoc': if hasattr(box, 'box'): for boxi in box.box: ...
[ "def", "_validate_label", "(", "self", ",", "boxes", ")", ":", "for", "box", "in", "boxes", ":", "if", "box", ".", "box_id", "!=", "'asoc'", ":", "if", "hasattr", "(", "box", ",", "'box'", ")", ":", "for", "boxi", "in", "box", ".", "box", ":", "i...
Label boxes can only be inside association, codestream headers, or compositing layer header boxes.
[ "Label", "boxes", "can", "only", "be", "inside", "association", "codestream", "headers", "or", "compositing", "layer", "header", "boxes", "." ]
python
train
zetaops/zengine
zengine/views/task_manager_actions.py
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/task_manager_actions.py#L65-L90
def select_role(self): """ The workflow method to be assigned to the person with the same role and unit as the user. .. code-block:: python # request: { 'task_inv_key': string, } """ roles = [(m.key,...
[ "def", "select_role", "(", "self", ")", ":", "roles", "=", "[", "(", "m", ".", "key", ",", "m", ".", "__unicode__", "(", ")", ")", "for", "m", "in", "RoleModel", ".", "objects", ".", "filter", "(", "abstract_role", "=", "self", ".", "current", ".",...
The workflow method to be assigned to the person with the same role and unit as the user. .. code-block:: python # request: { 'task_inv_key': string, }
[ "The", "workflow", "method", "to", "be", "assigned", "to", "the", "person", "with", "the", "same", "role", "and", "unit", "as", "the", "user", ".", "..", "code", "-", "block", "::", "python" ]
python
train
pantsbuild/pex
pex/translator.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/translator.py#L133-L146
def translate(self, package, into=None): """From a binary package, translate to a local binary distribution.""" if not package.local: raise ValueError('BinaryTranslator cannot translate remote packages.') if not isinstance(package, self._package_type): return None if not package.compatible(s...
[ "def", "translate", "(", "self", ",", "package", ",", "into", "=", "None", ")", ":", "if", "not", "package", ".", "local", ":", "raise", "ValueError", "(", "'BinaryTranslator cannot translate remote packages.'", ")", "if", "not", "isinstance", "(", "package", ...
From a binary package, translate to a local binary distribution.
[ "From", "a", "binary", "package", "translate", "to", "a", "local", "binary", "distribution", "." ]
python
train
zhmcclient/python-zhmcclient
zhmcclient_mock/_urihandler.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient_mock/_urihandler.py#L929-L940
def get(method, hmc, uri, uri_parms, logon_required): """Operation: List CPCs.""" query_str = uri_parms[0] result_cpcs = [] filter_args = parse_query_parms(method, uri, query_str) for cpc in hmc.cpcs.list(filter_args): result_cpc = {} for prop in cpc.prope...
[ "def", "get", "(", "method", ",", "hmc", ",", "uri", ",", "uri_parms", ",", "logon_required", ")", ":", "query_str", "=", "uri_parms", "[", "0", "]", "result_cpcs", "=", "[", "]", "filter_args", "=", "parse_query_parms", "(", "method", ",", "uri", ",", ...
Operation: List CPCs.
[ "Operation", ":", "List", "CPCs", "." ]
python
train
yyuu/botornado
boto/dynamodb/layer2.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/dynamodb/layer2.py#L593-L684
def query(self, table, hash_key, range_key_condition=None, attributes_to_get=None, request_limit=None, max_results=None, consistent_read=False, scan_index_forward=True, exclusive_start_key=None, item_class=Item): """ Perform a query on the table. ...
[ "def", "query", "(", "self", ",", "table", ",", "hash_key", ",", "range_key_condition", "=", "None", ",", "attributes_to_get", "=", "None", ",", "request_limit", "=", "None", ",", "max_results", "=", "None", ",", "consistent_read", "=", "False", ",", "scan_i...
Perform a query on the table. :type table: :class:`boto.dynamodb.table.Table` :param table: The Table object that is being queried. :type hash_key: int|long|float|str|unicode :param hash_key: The HashKey of the requested item. The type of the value must mat...
[ "Perform", "a", "query", "on", "the", "table", ".", ":", "type", "table", ":", ":", "class", ":", "boto", ".", "dynamodb", ".", "table", ".", "Table", ":", "param", "table", ":", "The", "Table", "object", "that", "is", "being", "queried", ".", ":", ...
python
train
danilobellini/audiolazy
examples/pi.py
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/examples/pi.py#L41-L46
def atan_mgl(x, n=10): """ Finds the arctan using the Madhava-Gregory-Leibniz series. """ acc = 1 / (1 - z ** -1) # Accumulator filter return acc(mgl_seq(x)).skip(n-1).take()
[ "def", "atan_mgl", "(", "x", ",", "n", "=", "10", ")", ":", "acc", "=", "1", "/", "(", "1", "-", "z", "**", "-", "1", ")", "# Accumulator filter", "return", "acc", "(", "mgl_seq", "(", "x", ")", ")", ".", "skip", "(", "n", "-", "1", ")", "....
Finds the arctan using the Madhava-Gregory-Leibniz series.
[ "Finds", "the", "arctan", "using", "the", "Madhava", "-", "Gregory", "-", "Leibniz", "series", "." ]
python
train
peri-source/peri
peri/comp/comp.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/comp.py#L88-L99
def get_values(self, params): """ Get the value of a list or single parameter. Parameters ---------- params : string, list of string name of parameters which to retrieve """ return util.delistify( [self.param_dict[p] for p in util.listify(...
[ "def", "get_values", "(", "self", ",", "params", ")", ":", "return", "util", ".", "delistify", "(", "[", "self", ".", "param_dict", "[", "p", "]", "for", "p", "in", "util", ".", "listify", "(", "params", ")", "]", ",", "params", ")" ]
Get the value of a list or single parameter. Parameters ---------- params : string, list of string name of parameters which to retrieve
[ "Get", "the", "value", "of", "a", "list", "or", "single", "parameter", "." ]
python
valid
RiotGames/cloud-inquisitor
backend/cloud_inquisitor/plugins/types/enforcements.py
https://github.com/RiotGames/cloud-inquisitor/blob/181dc2566ca59fc855f695b7fcc2c3b934e6ee9f/backend/cloud_inquisitor/plugins/types/enforcements.py#L30-L49
def get_all(cls, account_id=None, location=None): """ Return all Enforcements args: `account_id` : Unique Account Identifier `location` : Region associated with the Resource returns: list of enforcement objects """ qry = db.Enforcements.filt...
[ "def", "get_all", "(", "cls", ",", "account_id", "=", "None", ",", "location", "=", "None", ")", ":", "qry", "=", "db", ".", "Enforcements", ".", "filter", "(", ")", "if", "account_id", ":", "qry", "=", "qry", ".", "filter", "(", "account_id", "==", ...
Return all Enforcements args: `account_id` : Unique Account Identifier `location` : Region associated with the Resource returns: list of enforcement objects
[ "Return", "all", "Enforcements" ]
python
train
PyMySQL/Tornado-MySQL
tornado_mysql/connections.py
https://github.com/PyMySQL/Tornado-MySQL/blob/75d3466e4332e43b2bf853799f1122dec5da60bc/tornado_mysql/connections.py#L588-L594
def close(self): """Close the socket without sending quit message.""" stream = self._stream if stream is None: return self._stream = None stream.close()
[ "def", "close", "(", "self", ")", ":", "stream", "=", "self", ".", "_stream", "if", "stream", "is", "None", ":", "return", "self", ".", "_stream", "=", "None", "stream", ".", "close", "(", ")" ]
Close the socket without sending quit message.
[ "Close", "the", "socket", "without", "sending", "quit", "message", "." ]
python
train
chaoss/grimoirelab-sirmordred
sirmordred/task_enrich.py
https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_enrich.py#L268-L302
def __autorefresh_studies(self, cfg): """Execute autorefresh for areas of code study if configured""" if 'studies' not in self.conf[self.backend_section] or \ 'enrich_areas_of_code:git' not in self.conf[self.backend_section]['studies']: logger.debug("Not doing autorefresh fo...
[ "def", "__autorefresh_studies", "(", "self", ",", "cfg", ")", ":", "if", "'studies'", "not", "in", "self", ".", "conf", "[", "self", ".", "backend_section", "]", "or", "'enrich_areas_of_code:git'", "not", "in", "self", ".", "conf", "[", "self", ".", "backe...
Execute autorefresh for areas of code study if configured
[ "Execute", "autorefresh", "for", "areas", "of", "code", "study", "if", "configured" ]
python
valid
bids-standard/pybids
bids/variables/variables.py
https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/variables/variables.py#L432-L469
def resample(self, sampling_rate, inplace=False, kind='linear'): '''Resample the Variable to the specified sampling rate. Parameters ---------- sampling_rate : :obj:`int`, :obj:`float` Target sampling rate (in Hz). inplace : :obj:`bool`, optional If True,...
[ "def", "resample", "(", "self", ",", "sampling_rate", ",", "inplace", "=", "False", ",", "kind", "=", "'linear'", ")", ":", "if", "not", "inplace", ":", "var", "=", "self", ".", "clone", "(", ")", "var", ".", "resample", "(", "sampling_rate", ",", "T...
Resample the Variable to the specified sampling rate. Parameters ---------- sampling_rate : :obj:`int`, :obj:`float` Target sampling rate (in Hz). inplace : :obj:`bool`, optional If True, performs resampling in-place. If False, returns a resampled cop...
[ "Resample", "the", "Variable", "to", "the", "specified", "sampling", "rate", "." ]
python
train
blazelibs/blazeutils
blazeutils/decorators.py
https://github.com/blazelibs/blazeutils/blob/c94476325146007553cbddeeb9ef83394756babf/blazeutils/decorators.py#L106-L130
def _num_required_args(func): """ Number of args for func >>> def foo(a, b, c=None): ... return a + b + c >>> _num_required_args(foo) 2 >>> def bar(*args): ... return sum(args) >>> print(_num_required_args(bar)) None borrowed from: https:/...
[ "def", "_num_required_args", "(", "func", ")", ":", "try", ":", "spec", "=", "inspect", ".", "getargspec", "(", "func", ")", "if", "spec", ".", "varargs", ":", "return", "None", "num_defaults", "=", "len", "(", "spec", ".", "defaults", ")", "if", "spec...
Number of args for func >>> def foo(a, b, c=None): ... return a + b + c >>> _num_required_args(foo) 2 >>> def bar(*args): ... return sum(args) >>> print(_num_required_args(bar)) None borrowed from: https://github.com/pytoolz/toolz
[ "Number", "of", "args", "for", "func" ]
python
train
volafiled/python-volapi
setup.py
https://github.com/volafiled/python-volapi/blob/5f0bc03dbde703264ac6ed494e2050761f688a3e/setup.py#L22-L34
def find_version(filename): """ Search for assignment of __version__ string in given file and return what it is assigned to. """ with open(filename, "r") as filep: version_file = filep.read() version_match = re.search( r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, ...
[ "def", "find_version", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "\"r\"", ")", "as", "filep", ":", "version_file", "=", "filep", ".", "read", "(", ")", "version_match", "=", "re", ".", "search", "(", "r\"^__version__ = ['\\\"]([^'\\\"]...
Search for assignment of __version__ string in given file and return what it is assigned to.
[ "Search", "for", "assignment", "of", "__version__", "string", "in", "given", "file", "and", "return", "what", "it", "is", "assigned", "to", "." ]
python
train
baliame/http-hmac-python
httphmac/request.py
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/request.py#L130-L139
def with_url(self, url): """Sets the request's URL and returns the request itself. Automatically sets the Host header according to the URL. Keyword arguments: url -- a string representing the URL the set for the request """ self.url = URL(url) self.header["Host"]...
[ "def", "with_url", "(", "self", ",", "url", ")", ":", "self", ".", "url", "=", "URL", "(", "url", ")", "self", ".", "header", "[", "\"Host\"", "]", "=", "self", ".", "url", ".", "host", "return", "self" ]
Sets the request's URL and returns the request itself. Automatically sets the Host header according to the URL. Keyword arguments: url -- a string representing the URL the set for the request
[ "Sets", "the", "request", "s", "URL", "and", "returns", "the", "request", "itself", ".", "Automatically", "sets", "the", "Host", "header", "according", "to", "the", "URL", "." ]
python
train
aestrivex/bctpy
bct/algorithms/reference.py
https://github.com/aestrivex/bctpy/blob/4cb0e759eb4a038750b07e23bd29958c400684b8/bct/algorithms/reference.py#L689-L718
def makerandCIJ_dir(n, k, seed=None): ''' This function generates a directed random network Parameters ---------- N : int number of vertices K : int number of edges seed : hashable, optional If None (default), use the np.random's global random state to generate rando...
[ "def", "makerandCIJ_dir", "(", "n", ",", "k", ",", "seed", "=", "None", ")", ":", "rng", "=", "get_rng", "(", "seed", ")", "ix", ",", "=", "np", ".", "where", "(", "np", ".", "logical_not", "(", "np", ".", "eye", "(", "n", ")", ")", ".", "fla...
This function generates a directed random network Parameters ---------- N : int number of vertices K : int number of edges seed : hashable, optional If None (default), use the np.random's global random state to generate random numbers. Otherwise, use a new np.random....
[ "This", "function", "generates", "a", "directed", "random", "network" ]
python
train
cohorte/cohorte-herald
python/herald/transports/peer_contact.py
https://github.com/cohorte/cohorte-herald/blob/bb3445d0031c8b3abad71e6219cc559b49faa3ee/python/herald/transports/peer_contact.py#L68-L86
def __load_dump(self, message): """ Calls the hook method to modify the loaded peer description before giving it to the directory :param message: The received Herald message :return: The updated peer description """ dump = message.content if self._hook is...
[ "def", "__load_dump", "(", "self", ",", "message", ")", ":", "dump", "=", "message", ".", "content", "if", "self", ".", "_hook", "is", "not", "None", ":", "# Call the hook", "try", ":", "updated_dump", "=", "self", ".", "_hook", "(", "message", ",", "d...
Calls the hook method to modify the loaded peer description before giving it to the directory :param message: The received Herald message :return: The updated peer description
[ "Calls", "the", "hook", "method", "to", "modify", "the", "loaded", "peer", "description", "before", "giving", "it", "to", "the", "directory" ]
python
train
cyrus-/cypy
cypy/__init__.py
https://github.com/cyrus-/cypy/blob/04bb59e91fa314e8cf987743189c77a9b6bc371d/cypy/__init__.py#L210-L252
def prog_iter(bounded_iterable, delta=0.01, line_size=50): '''Wraps the provided sequence with an iterator that tracks its progress on the console. >>> for i in prog_iter(xrange(100)): pass .................................................. ................................................
[ "def", "prog_iter", "(", "bounded_iterable", ",", "delta", "=", "0.01", ",", "line_size", "=", "50", ")", ":", "# TODO: Technically, this should have a __len__.", "global", "_prog_iterin_loop", "if", "not", "_prog_iterin_loop", ":", "startTime", "=", "_time", ".", "...
Wraps the provided sequence with an iterator that tracks its progress on the console. >>> for i in prog_iter(xrange(100)): pass .................................................. .................................................. (0.000331163406372 s) More specifical...
[ "Wraps", "the", "provided", "sequence", "with", "an", "iterator", "that", "tracks", "its", "progress", "on", "the", "console", "." ]
python
train
hydpy-dev/hydpy
hydpy/models/dam/dam_model.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_model.py#L708-L731
def calc_requiredremoterelease_v2(self): """Get the required remote release of the last simulation step. Required log sequence: |LoggedRequiredRemoteRelease| Calculated flux sequence: |RequiredRemoteRelease| Basic equation: :math:`RequiredRemoteRelease = LoggedRequiredRemoteRelease`...
[ "def", "calc_requiredremoterelease_v2", "(", "self", ")", ":", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "fastaccess", "log", "=", "self", ".", "sequences", ".", "logs", ".", "fastaccess", "flu", ".", "requiredremoterelease", "=", "log", ".",...
Get the required remote release of the last simulation step. Required log sequence: |LoggedRequiredRemoteRelease| Calculated flux sequence: |RequiredRemoteRelease| Basic equation: :math:`RequiredRemoteRelease = LoggedRequiredRemoteRelease` Example: >>> from hydpy.models.da...
[ "Get", "the", "required", "remote", "release", "of", "the", "last", "simulation", "step", "." ]
python
train
nicolargo/glances
glances/ports_list.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/ports_list.py#L53-L135
def load(self, config): """Load the ports list from the configuration file.""" ports_list = [] if config is None: logger.debug("No configuration file available. Cannot load ports list.") elif not config.has_section(self._section): logger.debug("No [%s] section in...
[ "def", "load", "(", "self", ",", "config", ")", ":", "ports_list", "=", "[", "]", "if", "config", "is", "None", ":", "logger", ".", "debug", "(", "\"No configuration file available. Cannot load ports list.\"", ")", "elif", "not", "config", ".", "has_section", ...
Load the ports list from the configuration file.
[ "Load", "the", "ports", "list", "from", "the", "configuration", "file", "." ]
python
train
dmonroy/chilero
chilero/web/__init__.py
https://github.com/dmonroy/chilero/blob/8f1118a60cb7eab3f9ad31cb8a14b30bc102893d/chilero/web/__init__.py#L25-L41
def run(cls, routes, *args, **kwargs): # pragma: no cover """ Run a web application. :param cls: Application class :param routes: list of routes :param args: additional arguments :param kwargs: additional keyword arguments :return: None """ app = init(cls, routes, *args, **kwargs) ...
[ "def", "run", "(", "cls", ",", "routes", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "app", "=", "init", "(", "cls", ",", "routes", ",", "*", "args", ",", "*", "*", "kwargs", ")", "HOST", "=", "os", ".", "getenv", ...
Run a web application. :param cls: Application class :param routes: list of routes :param args: additional arguments :param kwargs: additional keyword arguments :return: None
[ "Run", "a", "web", "application", "." ]
python
train
mitsei/dlkit
dlkit/handcar/repository/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/sessions.py#L994-L1014
def can_create_asset_content(self, asset_id=None): """Tests if this user can create content for ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``Asset`` will result in a ``PermissionDenied``. This is int...
[ "def", "can_create_asset_content", "(", "self", ",", "asset_id", "=", "None", ")", ":", "url_path", "=", "construct_url", "(", "'authorization'", ",", "bank_id", "=", "self", ".", "_catalog_idstr", ")", "return", "self", ".", "_get_request", "(", "url_path", "...
Tests if this user can create content for ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to ...
[ "Tests", "if", "this", "user", "can", "create", "content", "for", "Assets", "." ]
python
train
jalmeroth/pymusiccast
pymusiccast/__init__.py
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/__init__.py#L272-L276
def set_playback(self, playback): """Send Playback command.""" req_url = ENDPOINTS["setPlayback"].format(self._ip_address) params = {"playback": playback} return request(req_url, params=params)
[ "def", "set_playback", "(", "self", ",", "playback", ")", ":", "req_url", "=", "ENDPOINTS", "[", "\"setPlayback\"", "]", ".", "format", "(", "self", ".", "_ip_address", ")", "params", "=", "{", "\"playback\"", ":", "playback", "}", "return", "request", "("...
Send Playback command.
[ "Send", "Playback", "command", "." ]
python
train
bpsmith/tia
tia/rlab/table.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/rlab/table.py#L450-L462
def apply_format(self, fmtfct): """ For each cell in the region, invoke fmtfct(cell_value) and store result in the formatted_values :param fmtfct: function(cell_value) which should return a formatted value for display :return: self """ for ridx in range(self.nrows): ...
[ "def", "apply_format", "(", "self", ",", "fmtfct", ")", ":", "for", "ridx", "in", "range", "(", "self", ".", "nrows", ")", ":", "for", "cidx", "in", "range", "(", "self", ".", "ncols", ")", ":", "# MUST set the parent as local view is immutable", "riloc", ...
For each cell in the region, invoke fmtfct(cell_value) and store result in the formatted_values :param fmtfct: function(cell_value) which should return a formatted value for display :return: self
[ "For", "each", "cell", "in", "the", "region", "invoke", "fmtfct", "(", "cell_value", ")", "and", "store", "result", "in", "the", "formatted_values", ":", "param", "fmtfct", ":", "function", "(", "cell_value", ")", "which", "should", "return", "a", "formatted...
python
train
bunq/sdk_python
bunq/sdk/json/converter.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/json/converter.py#L195-L217
def _deserialize_dict_attributes(cls, cls_context, dict_): """ :type cls_context: type :type dict_: dict :rtype: dict """ dict_deserialized = {} for key in dict_.keys(): key_deserialized = cls._deserialize_key(key) value_specs = cls._get...
[ "def", "_deserialize_dict_attributes", "(", "cls", ",", "cls_context", ",", "dict_", ")", ":", "dict_deserialized", "=", "{", "}", "for", "key", "in", "dict_", ".", "keys", "(", ")", ":", "key_deserialized", "=", "cls", ".", "_deserialize_key", "(", "key", ...
:type cls_context: type :type dict_: dict :rtype: dict
[ ":", "type", "cls_context", ":", "type", ":", "type", "dict_", ":", "dict" ]
python
train
zhanglab/psamm
psamm/gapfill.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/gapfill.py#L36-L49
def _find_integer_tolerance(epsilon, v_max, min_tol): """Find appropriate integer tolerance for gap-filling problems.""" int_tol = min(epsilon / (10 * v_max), 0.1) min_tol = max(1e-10, min_tol) if int_tol < min_tol: eps_lower = min_tol * 10 * v_max logger.warning( 'When the m...
[ "def", "_find_integer_tolerance", "(", "epsilon", ",", "v_max", ",", "min_tol", ")", ":", "int_tol", "=", "min", "(", "epsilon", "/", "(", "10", "*", "v_max", ")", ",", "0.1", ")", "min_tol", "=", "max", "(", "1e-10", ",", "min_tol", ")", "if", "int_...
Find appropriate integer tolerance for gap-filling problems.
[ "Find", "appropriate", "integer", "tolerance", "for", "gap", "-", "filling", "problems", "." ]
python
train
PyCQA/pylint
pylint/checkers/utils.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L1128-L1158
def is_registered_in_singledispatch_function(node: astroid.FunctionDef) -> bool: """Check if the given function node is a singledispatch function.""" singledispatch_qnames = ( "functools.singledispatch", "singledispatch.singledispatch", ) if not isinstance(node, astroid.FunctionDef): ...
[ "def", "is_registered_in_singledispatch_function", "(", "node", ":", "astroid", ".", "FunctionDef", ")", "->", "bool", ":", "singledispatch_qnames", "=", "(", "\"functools.singledispatch\"", ",", "\"singledispatch.singledispatch\"", ",", ")", "if", "not", "isinstance", ...
Check if the given function node is a singledispatch function.
[ "Check", "if", "the", "given", "function", "node", "is", "a", "singledispatch", "function", "." ]
python
test
jazzband/django-ddp
dddp/websocket.py
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/websocket.py#L233-L288
def process_ddp(self, data): """Process a single DDP message.""" msg_id = data.get('id', None) try: msg = data.pop('msg') except KeyError: self.reply( 'error', reason='Bad request', offendingMessage=data, ) r...
[ "def", "process_ddp", "(", "self", ",", "data", ")", ":", "msg_id", "=", "data", ".", "get", "(", "'id'", ",", "None", ")", "try", ":", "msg", "=", "data", ".", "pop", "(", "'msg'", ")", "except", "KeyError", ":", "self", ".", "reply", "(", "'err...
Process a single DDP message.
[ "Process", "a", "single", "DDP", "message", "." ]
python
test
TomasTomecek/sen
sen/tui/widgets/list/common.py
https://github.com/TomasTomecek/sen/blob/239b4868125814e8bf5527708119fc08b35f6cc0/sen/tui/widgets/list/common.py#L23-L42
def strip_from_ansi_esc_sequences(text): """ find ANSI escape sequences in text and remove them :param text: str :return: list, should be passed to ListBox """ # esc[ + values + control character # h, l, p commands are complicated, let's ignore them seq_regex = r"\x1b\[[0-9;]*[mKJusDCBA...
[ "def", "strip_from_ansi_esc_sequences", "(", "text", ")", ":", "# esc[ + values + control character", "# h, l, p commands are complicated, let's ignore them", "seq_regex", "=", "r\"\\x1b\\[[0-9;]*[mKJusDCBAfH]\"", "regex", "=", "re", ".", "compile", "(", "seq_regex", ")", "star...
find ANSI escape sequences in text and remove them :param text: str :return: list, should be passed to ListBox
[ "find", "ANSI", "escape", "sequences", "in", "text", "and", "remove", "them" ]
python
train
thebigmunch/gmusicapi-wrapper
gmusicapi_wrapper/base.py
https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/base.py#L129-L193
def get_local_playlist_songs( playlist, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False, exclude_patterns=None): """Load songs from local playlist. Parameters: playlist (str): An M3U(8) playlist filepath. include_filters (list): A list of ``(field, pattern)`` tuples. ...
[ "def", "get_local_playlist_songs", "(", "playlist", ",", "include_filters", "=", "None", ",", "exclude_filters", "=", "None", ",", "all_includes", "=", "False", ",", "all_excludes", "=", "False", ",", "exclude_patterns", "=", "None", ")", ":", "logger", ".", "...
Load songs from local playlist. Parameters: playlist (str): An M3U(8) playlist filepath. include_filters (list): A list of ``(field, pattern)`` tuples. Fields are any valid mutagen metadata fields. Patterns are Python regex patterns. Local songs are filtered out if the given metadata field values don'...
[ "Load", "songs", "from", "local", "playlist", "." ]
python
valid
lmjohns3/theanets
theanets/graph.py
https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L240-L365
def itertrain(self, train, valid=None, algo='rmsprop', subalgo='rmsprop', save_every=0, save_progress=None, **kwargs): '''Train our network, one batch at a time. This method yields a series of ``(train, valid)`` monitor pairs. The ``train`` value is a dictionary mapping names ...
[ "def", "itertrain", "(", "self", ",", "train", ",", "valid", "=", "None", ",", "algo", "=", "'rmsprop'", ",", "subalgo", "=", "'rmsprop'", ",", "save_every", "=", "0", ",", "save_progress", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'rng'...
Train our network, one batch at a time. This method yields a series of ``(train, valid)`` monitor pairs. The ``train`` value is a dictionary mapping names to monitor values evaluated on the training dataset. The ``valid`` value is also a dictionary mapping names to values, but these val...
[ "Train", "our", "network", "one", "batch", "at", "a", "time", "." ]
python
test
wmayner/pyphi
pyphi/subsystem.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/subsystem.py#L614-L621
def phi_cause_mip(self, mechanism, purview): """Return the |small_phi| of the cause MIP. This is the distance between the unpartitioned cause repertoire and the MIP cause repertoire. """ mip = self.cause_mip(mechanism, purview) return mip.phi if mip else 0
[ "def", "phi_cause_mip", "(", "self", ",", "mechanism", ",", "purview", ")", ":", "mip", "=", "self", ".", "cause_mip", "(", "mechanism", ",", "purview", ")", "return", "mip", ".", "phi", "if", "mip", "else", "0" ]
Return the |small_phi| of the cause MIP. This is the distance between the unpartitioned cause repertoire and the MIP cause repertoire.
[ "Return", "the", "|small_phi|", "of", "the", "cause", "MIP", "." ]
python
train
markfinger/python-js-host
js_host/manager.py
https://github.com/markfinger/python-js-host/blob/7727138c1eae779335d55fb4d7734698225a6322/js_host/manager.py#L69-L83
def stop_host(self, config_file): """ Stops a managed host specified by `config_file`. """ res = self.send_json_request('host/stop', data={'config': config_file}) if res.status_code != 200: raise UnexpectedResponse( 'Attempted to stop a JSHost. Respon...
[ "def", "stop_host", "(", "self", ",", "config_file", ")", ":", "res", "=", "self", ".", "send_json_request", "(", "'host/stop'", ",", "data", "=", "{", "'config'", ":", "config_file", "}", ")", "if", "res", ".", "status_code", "!=", "200", ":", "raise", ...
Stops a managed host specified by `config_file`.
[ "Stops", "a", "managed", "host", "specified", "by", "config_file", "." ]
python
train
zsethna/OLGA
olga/load_model.py
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L499-L540
def read_igor_V_gene_parameters(params_file_name): """Load raw genV from file. genV is a list of genomic V information. Each element is a list of three elements. The first is the name of the V allele, the second is the genomic sequence trimmed to the CDR3 region for productive sequences, and the ...
[ "def", "read_igor_V_gene_parameters", "(", "params_file_name", ")", ":", "params_file", "=", "open", "(", "params_file_name", ",", "'r'", ")", "V_gene_info", "=", "{", "}", "in_V_gene_sec", "=", "False", "for", "line", "in", "params_file", ":", "if", "line", "...
Load raw genV from file. genV is a list of genomic V information. Each element is a list of three elements. The first is the name of the V allele, the second is the genomic sequence trimmed to the CDR3 region for productive sequences, and the last is the full germline sequence. For this 'raw gen...
[ "Load", "raw", "genV", "from", "file", ".", "genV", "is", "a", "list", "of", "genomic", "V", "information", ".", "Each", "element", "is", "a", "list", "of", "three", "elements", ".", "The", "first", "is", "the", "name", "of", "the", "V", "allele", "t...
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L65-L75
def _arg_repr(self, arg): """ Get a useful (and not too large) represetation of an argument. """ r = repr(arg) max = 40 if len(r) > max: if hasattr(arg, 'shape'): r = 'array:' + 'x'.join([repr(s) for s in arg.shape]) else: r...
[ "def", "_arg_repr", "(", "self", ",", "arg", ")", ":", "r", "=", "repr", "(", "arg", ")", "max", "=", "40", "if", "len", "(", "r", ")", ">", "max", ":", "if", "hasattr", "(", "arg", ",", "'shape'", ")", ":", "r", "=", "'array:'", "+", "'x'", ...
Get a useful (and not too large) represetation of an argument.
[ "Get", "a", "useful", "(", "and", "not", "too", "large", ")", "represetation", "of", "an", "argument", "." ]
python
train
inspirehep/harvesting-kit
harvestingkit/inspire_cds_package/from_inspire.py
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/from_inspire.py#L257-L266
def update_hidden_notes(self): """Remove hidden notes and tag a CERN if detected.""" if not self.tag_as_cern: notes = record_get_field_instances(self.record, tag="595") for field in notes: for dummy, value in field[0]...
[ "def", "update_hidden_notes", "(", "self", ")", ":", "if", "not", "self", ".", "tag_as_cern", ":", "notes", "=", "record_get_field_instances", "(", "self", ".", "record", ",", "tag", "=", "\"595\"", ")", "for", "field", "in", "notes", ":", "for", "dummy", ...
Remove hidden notes and tag a CERN if detected.
[ "Remove", "hidden", "notes", "and", "tag", "a", "CERN", "if", "detected", "." ]
python
valid
explosion/spaCy
spacy/displacy/__init__.py
https://github.com/explosion/spaCy/blob/8ee4100f8ffb336886208a1ea827bf4c745e2709/spacy/displacy/__init__.py#L64-L102
def serve( docs, style="dep", page=True, minify=False, options={}, manual=False, port=5000, host="0.0.0.0", ): """Serve displaCy visualisation. docs (list or Doc): Document(s) to visualise. style (unicode): Visualisation style, 'dep' or 'ent'. page (bool): Render markup ...
[ "def", "serve", "(", "docs", ",", "style", "=", "\"dep\"", ",", "page", "=", "True", ",", "minify", "=", "False", ",", "options", "=", "{", "}", ",", "manual", "=", "False", ",", "port", "=", "5000", ",", "host", "=", "\"0.0.0.0\"", ",", ")", ":"...
Serve displaCy visualisation. docs (list or Doc): Document(s) to visualise. style (unicode): Visualisation style, 'dep' or 'ent'. page (bool): Render markup as full HTML page. minify (bool): Minify HTML markup. options (dict): Visualiser-specific options, e.g. colors. manual (bool): Don't parse...
[ "Serve", "displaCy", "visualisation", "." ]
python
train
jonbretman/jinja-to-js
jinja_to_js/__init__.py
https://github.com/jonbretman/jinja-to-js/blob/0a784b10a83d37a3171c5797547e9fc460c51289/jinja_to_js/__init__.py#L424-L436
def _process_getattr(self, node, **kwargs): """ Processes a `GetAttr` node. e.g. {{ foo.bar }} """ with self._interpolation(): with self._python_bool_wrapper(**kwargs) as new_kwargs: if is_loop_helper(node): self._process_loop_helper(node,...
[ "def", "_process_getattr", "(", "self", ",", "node", ",", "*", "*", "kwargs", ")", ":", "with", "self", ".", "_interpolation", "(", ")", ":", "with", "self", ".", "_python_bool_wrapper", "(", "*", "*", "kwargs", ")", "as", "new_kwargs", ":", "if", "is_...
Processes a `GetAttr` node. e.g. {{ foo.bar }}
[ "Processes", "a", "GetAttr", "node", ".", "e", ".", "g", ".", "{{", "foo", ".", "bar", "}}" ]
python
train
fstab50/metal
metal/cli.py
https://github.com/fstab50/metal/blob/0488bbdd516a508909267cc44191f632e21156ba/metal/cli.py#L123-L138
def set(self, mode, disable): """ create logger object, enable or disable logging """ global logger try: if logger: if disable: logger.disabled = True else: if mode in ('STREAM', 'FILE'): logger = log...
[ "def", "set", "(", "self", ",", "mode", ",", "disable", ")", ":", "global", "logger", "try", ":", "if", "logger", ":", "if", "disable", ":", "logger", ".", "disabled", "=", "True", "else", ":", "if", "mode", "in", "(", "'STREAM'", ",", "'FILE'", ")...
create logger object, enable or disable logging
[ "create", "logger", "object", "enable", "or", "disable", "logging" ]
python
train
inspirehep/inspire-schemas
inspire_schemas/builders/authors.py
https://github.com/inspirehep/inspire-schemas/blob/34bc124b62fba565b6b40d1a3c15103a23a05edb/inspire_schemas/builders/authors.py#L135-L156
def add_email_address(self, email, hidden=None): """Add email address. Args: :param email: email of the author. :type email: string :param hidden: if email is public or not. :type hidden: boolean """ existing_emails = get_value(self.obj, ...
[ "def", "add_email_address", "(", "self", ",", "email", ",", "hidden", "=", "None", ")", ":", "existing_emails", "=", "get_value", "(", "self", ".", "obj", ",", "'email_addresses'", ",", "[", "]", ")", "found_email", "=", "next", "(", "(", "existing_email",...
Add email address. Args: :param email: email of the author. :type email: string :param hidden: if email is public or not. :type hidden: boolean
[ "Add", "email", "address", "." ]
python
train
brainiak/brainiak
brainiak/factoranalysis/htfa.py
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/factoranalysis/htfa.py#L811-L841
def fit(self, X, R): """Compute Hierarchical Topographical Factor Analysis Model [Manning2014-1][Manning2014-2] Parameters ---------- X : list of 2D arrays, element i has shape=[voxels_i, samples] Each element in the list contains the fMRI data of one subject. ...
[ "def", "fit", "(", "self", ",", "X", ",", "R", ")", ":", "self", ".", "_check_input", "(", "X", ",", "R", ")", "if", "self", ".", "verbose", ":", "logger", ".", "info", "(", "\"Start to fit HTFA\"", ")", "self", ".", "n_dim", "=", "R", "[", "0", ...
Compute Hierarchical Topographical Factor Analysis Model [Manning2014-1][Manning2014-2] Parameters ---------- X : list of 2D arrays, element i has shape=[voxels_i, samples] Each element in the list contains the fMRI data of one subject. R : list of 2D arrays, el...
[ "Compute", "Hierarchical", "Topographical", "Factor", "Analysis", "Model", "[", "Manning2014", "-", "1", "]", "[", "Manning2014", "-", "2", "]" ]
python
train
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/table.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/table.py#L337-L365
def read_row(self, row_key, filter_=None): """Read a single row from this table. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_read_row] :end-before: [END bigtable_read_row] :type row_key: bytes :param row_key: The key...
[ "def", "read_row", "(", "self", ",", "row_key", ",", "filter_", "=", "None", ")", ":", "row_set", "=", "RowSet", "(", ")", "row_set", ".", "add_row_key", "(", "row_key", ")", "result_iter", "=", "iter", "(", "self", ".", "read_rows", "(", "filter_", "=...
Read a single row from this table. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_read_row] :end-before: [END bigtable_read_row] :type row_key: bytes :param row_key: The key of the row to read from. :type filter_: :cla...
[ "Read", "a", "single", "row", "from", "this", "table", "." ]
python
train
tk0miya/tk.phpautodoc
src/phply/phpparse.py
https://github.com/tk0miya/tk.phpautodoc/blob/cf789f64abaf76351485cee231a075227e665fb6/src/phply/phpparse.py#L328-L333
def p_new_else_single(p): '''new_else_single : empty | ELSE COLON inner_statement_list''' if len(p) == 4: p[0] = ast.Else(ast.Block(p[3], lineno=p.lineno(2)), lineno=p.lineno(1))
[ "def", "p_new_else_single", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "4", ":", "p", "[", "0", "]", "=", "ast", ".", "Else", "(", "ast", ".", "Block", "(", "p", "[", "3", "]", ",", "lineno", "=", "p", ".", "lineno", "(", "2", ...
new_else_single : empty | ELSE COLON inner_statement_list
[ "new_else_single", ":", "empty", "|", "ELSE", "COLON", "inner_statement_list" ]
python
train
ryanjdillon/pylleo
pylleo/lleoio.py
https://github.com/ryanjdillon/pylleo/blob/b9b999fef19eaeccce4f207ab1b6198287c1bfec/pylleo/lleoio.py#L106-L240
def read_data(meta, path_dir, sample_f=1, decimate=False, overwrite=False): '''Read accelerometry data from leonardo txt files Args ---- meta: dict Dictionary of meta data from header lines of lleo data files path_dir: str Parent directory containing lleo data files sample_f: in...
[ "def", "read_data", "(", "meta", ",", "path_dir", ",", "sample_f", "=", "1", ",", "decimate", "=", "False", ",", "overwrite", "=", "False", ")", ":", "import", "os", "import", "pandas", "from", ".", "import", "utils", "def", "_generate_datetimes", "(", "...
Read accelerometry data from leonardo txt files Args ---- meta: dict Dictionary of meta data from header lines of lleo data files path_dir: str Parent directory containing lleo data files sample_f: int Return every `sample_f` data points Returns ------- acc: pan...
[ "Read", "accelerometry", "data", "from", "leonardo", "txt", "files" ]
python
train
Zsailer/phylopandas
phylopandas/seqio/read.py
https://github.com/Zsailer/phylopandas/blob/f163c4a2b9369eb32f6c8f3793f711f6fe4e6130/phylopandas/seqio/read.py#L119-L139
def _read_function(schema): """Add a write method for named schema to a class. """ def func( filename, seq_label='sequence', alphabet=None, use_uids=True, **kwargs): # Use generic write class to write data. return _read( filename=filename, ...
[ "def", "_read_function", "(", "schema", ")", ":", "def", "func", "(", "filename", ",", "seq_label", "=", "'sequence'", ",", "alphabet", "=", "None", ",", "use_uids", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Use generic write class to write data.", ...
Add a write method for named schema to a class.
[ "Add", "a", "write", "method", "for", "named", "schema", "to", "a", "class", "." ]
python
train
saltstack/salt
salt/modules/virt.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2215-L2255
def vm_state(vm_=None, **kwargs): ''' Return list of all the vms and their state. If you pass a VM name in as an argument then it will return info for just the named VM, otherwise it will return all VMs. :param vm_: name of the domain :param connection: libvirt connection URI, overriding defau...
[ "def", "vm_state", "(", "vm_", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "_info", "(", "dom", ")", ":", "'''\n Compute domain state\n '''", "state", "=", "''", "raw", "=", "dom", ".", "info", "(", ")", "state", "=", "VIRT_STATE...
Return list of all the vms and their state. If you pass a VM name in as an argument then it will return info for just the named VM, otherwise it will return all VMs. :param vm_: name of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :p...
[ "Return", "list", "of", "all", "the", "vms", "and", "their", "state", "." ]
python
train
LIVVkit/LIVVkit
livvkit/components/performance.py
https://github.com/LIVVkit/LIVVkit/blob/680120cd437e408673e62e535fc0a246c7fc17db/livvkit/components/performance.py#L312-L354
def generate_scaling_plot(timing_data, title, ylabel, description, plot_file): """ Generate a scaling plot. Args: timing_data: data returned from a `*_scaling` method title: the title of the plot ylabel: the y-axis label of the plot description: a description of the plot ...
[ "def", "generate_scaling_plot", "(", "timing_data", ",", "title", ",", "ylabel", ",", "description", ",", "plot_file", ")", ":", "proc_counts", "=", "timing_data", "[", "'proc_counts'", "]", "if", "len", "(", "proc_counts", ")", ">", "2", ":", "plt", ".", ...
Generate a scaling plot. Args: timing_data: data returned from a `*_scaling` method title: the title of the plot ylabel: the y-axis label of the plot description: a description of the plot plot_file: the file to write out to Returns: an image element containing ...
[ "Generate", "a", "scaling", "plot", "." ]
python
train
charettes/django-mutant
mutant/models/model/__init__.py
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/models/model/__init__.py#L436-L460
def clean(self): """ Make sure the lookup makes sense """ if self.lookup == '?': # Randomly sort return else: lookups = self.lookup.split(LOOKUP_SEP) opts = self.model_def.model_class()._meta valid = True while len(look...
[ "def", "clean", "(", "self", ")", ":", "if", "self", ".", "lookup", "==", "'?'", ":", "# Randomly sort", "return", "else", ":", "lookups", "=", "self", ".", "lookup", ".", "split", "(", "LOOKUP_SEP", ")", "opts", "=", "self", ".", "model_def", ".", "...
Make sure the lookup makes sense
[ "Make", "sure", "the", "lookup", "makes", "sense" ]
python
train
ambitioninc/rabbitmq-admin
rabbitmq_admin/api.py
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L429-L460
def create_user_permission(self, name, vhost, configure=None, write=None, read=None): """ Create a user permission :param name: The user's na...
[ "def", "create_user_permission", "(", "self", ",", "name", ",", "vhost", ",", "configure", "=", "None", ",", "write", "=", "None", ",", "read", "=", "None", ")", ":", "data", "=", "{", "'configure'", ":", "configure", "or", "'.*'", ",", "'write'", ":",...
Create a user permission :param name: The user's name :type name: str :param vhost: The vhost to assign the permission to :type vhost: str :param configure: A regex for the user permission. Default is ``.*`` :type configure: str :param write: A regex for the user...
[ "Create", "a", "user", "permission", ":", "param", "name", ":", "The", "user", "s", "name", ":", "type", "name", ":", "str", ":", "param", "vhost", ":", "The", "vhost", "to", "assign", "the", "permission", "to", ":", "type", "vhost", ":", "str" ]
python
train
juju/charm-helpers
charmhelpers/core/host.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/host.py#L447-L486
def chage(username, lastday=None, expiredate=None, inactive=None, mindays=None, maxdays=None, root=None, warndays=None): """Change user password expiry information :param str username: User to update :param str lastday: Set when password was changed in YYYY-MM-DD format :param str expiredate:...
[ "def", "chage", "(", "username", ",", "lastday", "=", "None", ",", "expiredate", "=", "None", ",", "inactive", "=", "None", ",", "mindays", "=", "None", ",", "maxdays", "=", "None", ",", "root", "=", "None", ",", "warndays", "=", "None", ")", ":", ...
Change user password expiry information :param str username: User to update :param str lastday: Set when password was changed in YYYY-MM-DD format :param str expiredate: Set when user's account will no longer be accessible in YYYY-MM-DD format. -1 will ...
[ "Change", "user", "password", "expiry", "information" ]
python
train
relekang/python-semantic-release
semantic_release/vcs_helpers.py
https://github.com/relekang/python-semantic-release/blob/76123f410180599a19e7c48da413880185bbea20/semantic_release/vcs_helpers.py#L130-L155
def push_new_version(gh_token: str = None, owner: str = None, name: str = None): """ Runs git push and git push --tags. :param gh_token: Github token used to push. :param owner: Organisation or user that owns the repository. :param name: Name of repository. :raises GitError: if GitCommandError ...
[ "def", "push_new_version", "(", "gh_token", ":", "str", "=", "None", ",", "owner", ":", "str", "=", "None", ",", "name", ":", "str", "=", "None", ")", ":", "check_repo", "(", ")", "server", "=", "'origin'", "if", "gh_token", ":", "server", "=", "'htt...
Runs git push and git push --tags. :param gh_token: Github token used to push. :param owner: Organisation or user that owns the repository. :param name: Name of repository. :raises GitError: if GitCommandError is raised
[ "Runs", "git", "push", "and", "git", "push", "--", "tags", "." ]
python
train
palantir/python-language-server
pyls/_utils.py
https://github.com/palantir/python-language-server/blob/96e08d85635382d17024c352306c4759f124195d/pyls/_utils.py#L78-L96
def merge_dicts(dict_a, dict_b): """Recursively merge dictionary b into dictionary a. If override_nones is True, then """ def _merge_dicts_(a, b): for key in set(a.keys()).union(b.keys()): if key in a and key in b: if isinstance(a[key], dict) and isinstance(b[key], d...
[ "def", "merge_dicts", "(", "dict_a", ",", "dict_b", ")", ":", "def", "_merge_dicts_", "(", "a", ",", "b", ")", ":", "for", "key", "in", "set", "(", "a", ".", "keys", "(", ")", ")", ".", "union", "(", "b", ".", "keys", "(", ")", ")", ":", "if"...
Recursively merge dictionary b into dictionary a. If override_nones is True, then
[ "Recursively", "merge", "dictionary", "b", "into", "dictionary", "a", "." ]
python
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L275-L295
def create_xml_file_from_string(self, content, destination=None): """ Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for xml file :type destination: str :rtype: returns file name of xml file ...
[ "def", "create_xml_file_from_string", "(", "self", ",", "content", ",", "destination", "=", "None", ")", ":", "header_file", "=", "utils", ".", "create_temp_file_name", "(", "suffix", "=", "'.h'", ")", "try", ":", "with", "open", "(", "header_file", ",", "\"...
Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for xml file :type destination: str :rtype: returns file name of xml file
[ "Creates", "XML", "file", "from", "text", "." ]
python
train
secdev/scapy
scapy/layers/tls/keyexchange.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L73-L86
def phantom_decorate(f, get_or_add): """ Decorator for version-dependent fields. If get_or_add is True (means get), we return s, self.phantom_value. If it is False (means add), we return s. """ def wrapper(*args): self, pkt, s = args[:3] if phantom_mode(pkt): if get_o...
[ "def", "phantom_decorate", "(", "f", ",", "get_or_add", ")", ":", "def", "wrapper", "(", "*", "args", ")", ":", "self", ",", "pkt", ",", "s", "=", "args", "[", ":", "3", "]", "if", "phantom_mode", "(", "pkt", ")", ":", "if", "get_or_add", ":", "r...
Decorator for version-dependent fields. If get_or_add is True (means get), we return s, self.phantom_value. If it is False (means add), we return s.
[ "Decorator", "for", "version", "-", "dependent", "fields", ".", "If", "get_or_add", "is", "True", "(", "means", "get", ")", "we", "return", "s", "self", ".", "phantom_value", ".", "If", "it", "is", "False", "(", "means", "add", ")", "we", "return", "s"...
python
train
kgiusti/pyngus
pyngus/link.py
https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L171-L178
def target_address(self): """Return the authorative target of the link.""" # If link is a receiver, target is determined by the local # value, else use the remote. if self._pn_link.is_receiver: return self._pn_link.target.address else: return self._pn_link...
[ "def", "target_address", "(", "self", ")", ":", "# If link is a receiver, target is determined by the local", "# value, else use the remote.", "if", "self", ".", "_pn_link", ".", "is_receiver", ":", "return", "self", ".", "_pn_link", ".", "target", ".", "address", "else...
Return the authorative target of the link.
[ "Return", "the", "authorative", "target", "of", "the", "link", "." ]
python
test
assemblerflow/flowcraft
flowcraft/templates/process_newick.py
https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_newick.py#L53-L85
def main(newick): """Main executor of the process_newick template. Parameters ---------- newick : str path to the newick file. """ logger.info("Starting newick file processing") print(newick) tree = dendropy.Tree.get(file=open(newick, 'r'), schema="newick") tree.reroot_...
[ "def", "main", "(", "newick", ")", ":", "logger", ".", "info", "(", "\"Starting newick file processing\"", ")", "print", "(", "newick", ")", "tree", "=", "dendropy", ".", "Tree", ".", "get", "(", "file", "=", "open", "(", "newick", ",", "'r'", ")", ","...
Main executor of the process_newick template. Parameters ---------- newick : str path to the newick file.
[ "Main", "executor", "of", "the", "process_newick", "template", "." ]
python
test
DataBiosphere/dsub
dsub/providers/google_v2.py
https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L405-L416
def _map(self, event): """Extract elements from an operation event and map to a named event.""" description = event.get('description', '') start_time = google_base.parse_rfc3339_utc_string( event.get('timestamp', '')) for name, regex in _EVENT_REGEX_MAP.items(): match = regex.match(descri...
[ "def", "_map", "(", "self", ",", "event", ")", ":", "description", "=", "event", ".", "get", "(", "'description'", ",", "''", ")", "start_time", "=", "google_base", ".", "parse_rfc3339_utc_string", "(", "event", ".", "get", "(", "'timestamp'", ",", "''", ...
Extract elements from an operation event and map to a named event.
[ "Extract", "elements", "from", "an", "operation", "event", "and", "map", "to", "a", "named", "event", "." ]
python
valid
angr/angr
angr/analyses/cfg/cfg_base.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L367-L401
def _to_snippet(self, cfg_node=None, addr=None, size=None, thumb=False, jumpkind=None, base_state=None): """ Convert a CFGNode instance to a CodeNode object. :param angr.analyses.CFGNode cfg_node: The CFGNode instance. :param int addr: Address of the node. Only used when `cfg_node` is N...
[ "def", "_to_snippet", "(", "self", ",", "cfg_node", "=", "None", ",", "addr", "=", "None", ",", "size", "=", "None", ",", "thumb", "=", "False", ",", "jumpkind", "=", "None", ",", "base_state", "=", "None", ")", ":", "if", "cfg_node", "is", "not", ...
Convert a CFGNode instance to a CodeNode object. :param angr.analyses.CFGNode cfg_node: The CFGNode instance. :param int addr: Address of the node. Only used when `cfg_node` is None. :param bool thumb: Whether this is in THUMB mode or not. Only used for ARM code and when `cfg_node` is None. ...
[ "Convert", "a", "CFGNode", "instance", "to", "a", "CodeNode", "object", "." ]
python
train
urbn/Caesium
caesium/document.py
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L640-L663
def patch(self, predicate_value, attrs, predicate_attribute="_id"): """Update an existing document via a $set query, this will apply only these attributes. :param predicate_value: The value of the predicate :param dict attrs: The dictionary to apply to this object :param str predicate_a...
[ "def", "patch", "(", "self", ",", "predicate_value", ",", "attrs", ",", "predicate_attribute", "=", "\"_id\"", ")", ":", "if", "predicate_attribute", "==", "\"_id\"", "and", "not", "isinstance", "(", "predicate_value", ",", "ObjectId", ")", ":", "predicate_value...
Update an existing document via a $set query, this will apply only these attributes. :param predicate_value: The value of the predicate :param dict attrs: The dictionary to apply to this object :param str predicate_attribute: The attribute to query for to find the object to set this data ond ...
[ "Update", "an", "existing", "document", "via", "a", "$set", "query", "this", "will", "apply", "only", "these", "attributes", "." ]
python
train
chrisrink10/basilisp
src/basilisp/lang/list.py
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/list.py#L86-L90
def list(members, meta=None) -> List: # pylint:disable=redefined-builtin """Creates a new list.""" return List( # pylint: disable=abstract-class-instantiated plist(iterable=members), meta=meta )
[ "def", "list", "(", "members", ",", "meta", "=", "None", ")", "->", "List", ":", "# pylint:disable=redefined-builtin", "return", "List", "(", "# pylint: disable=abstract-class-instantiated", "plist", "(", "iterable", "=", "members", ")", ",", "meta", "=", "meta", ...
Creates a new list.
[ "Creates", "a", "new", "list", "." ]
python
test
quantopian/pyfolio
pyfolio/plotting.py
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1025-L1061
def plot_gross_leverage(returns, positions, ax=None, **kwargs): """ Plots gross leverage versus date. Gross leverage is the sum of long and short exposure per share divided by net asset value. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. ...
[ "def", "plot_gross_leverage", "(", "returns", ",", "positions", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "gl", "=", "timeseries", ".", "gross_lev", "(", "posit...
Plots gross leverage versus date. Gross leverage is the sum of long and short exposure per share divided by net asset value. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. position...
[ "Plots", "gross", "leverage", "versus", "date", "." ]
python
valid
DAI-Lab/Copulas
copulas/multivariate/gaussian.py
https://github.com/DAI-Lab/Copulas/blob/821df61c3d36a6b81ef2883935f935c2eaaa862c/copulas/multivariate/gaussian.py#L159-L172
def probability_density(self, X): """Compute probability density function for given copula family. Args: X: `numpy.ndarray` or `pandas.DataFrame` Returns: np.array: Probability density for the input values. """ self.check_fit() # make cov positi...
[ "def", "probability_density", "(", "self", ",", "X", ")", ":", "self", ".", "check_fit", "(", ")", "# make cov positive semi-definite", "covariance", "=", "self", ".", "covariance", "*", "np", ".", "identity", "(", "self", ".", "covariance", ".", "shape", "[...
Compute probability density function for given copula family. Args: X: `numpy.ndarray` or `pandas.DataFrame` Returns: np.array: Probability density for the input values.
[ "Compute", "probability", "density", "function", "for", "given", "copula", "family", "." ]
python
train
limodou/uliweb
uliweb/utils/generic.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/utils/generic.py#L340-L378
def get_fields(model, fields, meta=None): """ Acording to model and fields to get fields list Each field element is a two elements tuple, just like: (name, field_obj) """ model = get_model(model) if fields is not None: f = fields elif meta and hasattr(model, meta): ...
[ "def", "get_fields", "(", "model", ",", "fields", ",", "meta", "=", "None", ")", ":", "model", "=", "get_model", "(", "model", ")", "if", "fields", "is", "not", "None", ":", "f", "=", "fields", "elif", "meta", "and", "hasattr", "(", "model", ",", "...
Acording to model and fields to get fields list Each field element is a two elements tuple, just like: (name, field_obj)
[ "Acording", "to", "model", "and", "fields", "to", "get", "fields", "list", "Each", "field", "element", "is", "a", "two", "elements", "tuple", "just", "like", ":", "(", "name", "field_obj", ")" ]
python
train
Qiskit/qiskit-terra
qiskit/pulse/timeslots.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/timeslots.py#L179-L189
def ch_start_time(self, *channels: List[Channel]) -> int: """Return earliest start time in this collection. Args: *channels: Channels over which to obtain start_time. """ intervals = list(itertools.chain(*(self._table[chan] for chan in channels ...
[ "def", "ch_start_time", "(", "self", ",", "*", "channels", ":", "List", "[", "Channel", "]", ")", "->", "int", ":", "intervals", "=", "list", "(", "itertools", ".", "chain", "(", "*", "(", "self", ".", "_table", "[", "chan", "]", "for", "chan", "in...
Return earliest start time in this collection. Args: *channels: Channels over which to obtain start_time.
[ "Return", "earliest", "start", "time", "in", "this", "collection", "." ]
python
test
opencivicdata/pupa
pupa/importers/base.py
https://github.com/opencivicdata/pupa/blob/18e0ddc4344804987ee0f2227bf600375538dbd5/pupa/importers/base.py#L219-L243
def import_data(self, data_items): """ import a bunch of dicts together """ # keep counts of all actions record = { 'insert': 0, 'update': 0, 'noop': 0, 'start': utcnow(), 'records': { 'insert': [], 'update': [], ...
[ "def", "import_data", "(", "self", ",", "data_items", ")", ":", "# keep counts of all actions", "record", "=", "{", "'insert'", ":", "0", ",", "'update'", ":", "0", ",", "'noop'", ":", "0", ",", "'start'", ":", "utcnow", "(", ")", ",", "'records'", ":", ...
import a bunch of dicts together
[ "import", "a", "bunch", "of", "dicts", "together" ]
python
train
i3visio/osrframework
osrframework/thirdparties/pipl_com/lib/thumbnail.py
https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/thumbnail.py#L37-L100
def generate_thumbnail_url(image_url, height, width, favicon_domain=None, zoom_face=True, api_key=None): """Take an image URL and generate a thumbnail URL for that image. Args: image_url -- unicode (or utf8 encoded str), URL of the image you want to th...
[ "def", "generate_thumbnail_url", "(", "image_url", ",", "height", ",", "width", ",", "favicon_domain", "=", "None", ",", "zoom_face", "=", "True", ",", "api_key", "=", "None", ")", ":", "if", "not", "(", "api_key", "or", "default_api_key", ")", ":", "raise...
Take an image URL and generate a thumbnail URL for that image. Args: image_url -- unicode (or utf8 encoded str), URL of the image you want to thumbnail. height -- int, requested thumbnail height in pixels, maximum 500. width -- int, requested thumbnail width in pixels, max...
[ "Take", "an", "image", "URL", "and", "generate", "a", "thumbnail", "URL", "for", "that", "image", ".", "Args", ":", "image_url", "--", "unicode", "(", "or", "utf8", "encoded", "str", ")", "URL", "of", "the", "image", "you", "want", "to", "thumbnail", "...
python
train
Shopify/shopify_python_api
shopify/session.py
https://github.com/Shopify/shopify_python_api/blob/88d3ba332fb2cd331f87517a16f2c2d4296cee90/shopify/session.py#L131-L138
def calculate_hmac(cls, params): """ Calculate the HMAC of the given parameters in line with Shopify's rules for OAuth authentication. See http://docs.shopify.com/api/authentication/oauth#verification. """ encoded_params = cls.__encoded_params_for_signature(params) # Gene...
[ "def", "calculate_hmac", "(", "cls", ",", "params", ")", ":", "encoded_params", "=", "cls", ".", "__encoded_params_for_signature", "(", "params", ")", "# Generate the hex digest for the sorted parameters using the secret.", "return", "hmac", ".", "new", "(", "cls", ".",...
Calculate the HMAC of the given parameters in line with Shopify's rules for OAuth authentication. See http://docs.shopify.com/api/authentication/oauth#verification.
[ "Calculate", "the", "HMAC", "of", "the", "given", "parameters", "in", "line", "with", "Shopify", "s", "rules", "for", "OAuth", "authentication", ".", "See", "http", ":", "//", "docs", ".", "shopify", ".", "com", "/", "api", "/", "authentication", "/", "o...
python
train
lreis2415/PyGeoC
pygeoc/hydro.py
https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/hydro.py#L130-L135
def downstream_index(dir_value, i, j, alg='taudem'): """find downslope coordinate for D8 direction.""" assert alg.lower() in FlowModelConst.d8_deltas delta = FlowModelConst.d8_deltas.get(alg.lower()) drow, dcol = delta[int(dir_value)] return i + drow, j + dcol
[ "def", "downstream_index", "(", "dir_value", ",", "i", ",", "j", ",", "alg", "=", "'taudem'", ")", ":", "assert", "alg", ".", "lower", "(", ")", "in", "FlowModelConst", ".", "d8_deltas", "delta", "=", "FlowModelConst", ".", "d8_deltas", ".", "get", "(", ...
find downslope coordinate for D8 direction.
[ "find", "downslope", "coordinate", "for", "D8", "direction", "." ]
python
train
nicolargo/glances
glances/plugins/glances_plugin.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L625-L659
def manage_action(self, stat_name, trigger, header, action_key): """Manage the action for the current stat.""" # Here is a command line for the current trigger ? try: command, repeat = self.get_li...
[ "def", "manage_action", "(", "self", ",", "stat_name", ",", "trigger", ",", "header", ",", "action_key", ")", ":", "# Here is a command line for the current trigger ?", "try", ":", "command", ",", "repeat", "=", "self", ".", "get_limit_action", "(", "trigger", ","...
Manage the action for the current stat.
[ "Manage", "the", "action", "for", "the", "current", "stat", "." ]
python
train
pyopenapi/pyswagger
pyswagger/scanner/v2_0/merge.py
https://github.com/pyopenapi/pyswagger/blob/333c4ca08e758cd2194943d9904a3eda3fe43977/pyswagger/scanner/v2_0/merge.py#L18-L42
def _merge(obj, app, creator, parser): """ resolve $ref, and inject/merge referenced object to self. This operation should be carried in a cascade manner. """ result = creator(NullContext()) result.merge(obj, parser) guard = CycleGuard() guard.update(obj) r = getattr(obj, '$ref') w...
[ "def", "_merge", "(", "obj", ",", "app", ",", "creator", ",", "parser", ")", ":", "result", "=", "creator", "(", "NullContext", "(", ")", ")", "result", ".", "merge", "(", "obj", ",", "parser", ")", "guard", "=", "CycleGuard", "(", ")", "guard", "....
resolve $ref, and inject/merge referenced object to self. This operation should be carried in a cascade manner.
[ "resolve", "$ref", "and", "inject", "/", "merge", "referenced", "object", "to", "self", ".", "This", "operation", "should", "be", "carried", "in", "a", "cascade", "manner", "." ]
python
train
galaxy-genome-annotation/python-apollo
apollo/users/__init__.py
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/users/__init__.py#L169-L203
def create_user(self, email, first_name, last_name, password, role="user", metadata={}): """ Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: ...
[ "def", "create_user", "(", "self", ",", "email", ",", "first_name", ",", "last_name", ",", "password", ",", "role", "=", "\"user\"", ",", "metadata", "=", "{", "}", ")", ":", "data", "=", "{", "'firstName'", ":", "first_name", ",", "'lastName'", ":", "...
Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: User's last name :type password: str :param password: User's password :type role: s...
[ "Create", "a", "new", "user" ]
python
train
reorx/torext
torext/handlers/base.py
https://github.com/reorx/torext/blob/84c4300ebc7fab0dbd11cf8b020bc7d4d1570171/torext/handlers/base.py#L291-L329
def finish(self): """Finishes this response, ending the HTTP request.""" if self._finished: raise RuntimeError("finish() called twice. May be caused " "by using async operations without the " "@asynchronous decorator.") i...
[ "def", "finish", "(", "self", ")", ":", "if", "self", ".", "_finished", ":", "raise", "RuntimeError", "(", "\"finish() called twice. May be caused \"", "\"by using async operations without the \"", "\"@asynchronous decorator.\"", ")", "if", "not", "hasattr", "(", "self",...
Finishes this response, ending the HTTP request.
[ "Finishes", "this", "response", "ending", "the", "HTTP", "request", "." ]
python
train
klahnakoski/mo-files
mo_files/__init__.py
https://github.com/klahnakoski/mo-files/blob/f6974a997cdc9fdabccb60c19edee13356a5787a/mo_files/__init__.py#L162-L176
def find(self, pattern): """ :param pattern: REGULAR EXPRESSION TO MATCH NAME (NOT INCLUDING PATH) :return: LIST OF File OBJECTS THAT HAVE MATCHING NAME """ output = [] def _find(dir): if re.match(pattern, dir._filename.split("/")[-1]): output...
[ "def", "find", "(", "self", ",", "pattern", ")", ":", "output", "=", "[", "]", "def", "_find", "(", "dir", ")", ":", "if", "re", ".", "match", "(", "pattern", ",", "dir", ".", "_filename", ".", "split", "(", "\"/\"", ")", "[", "-", "1", "]", ...
:param pattern: REGULAR EXPRESSION TO MATCH NAME (NOT INCLUDING PATH) :return: LIST OF File OBJECTS THAT HAVE MATCHING NAME
[ ":", "param", "pattern", ":", "REGULAR", "EXPRESSION", "TO", "MATCH", "NAME", "(", "NOT", "INCLUDING", "PATH", ")", ":", "return", ":", "LIST", "OF", "File", "OBJECTS", "THAT", "HAVE", "MATCHING", "NAME" ]
python
train
molmod/molmod
molmod/graphs.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/graphs.py#L1395-L1400
def iter_initial_relations(self, subject_graph): """Iterate over all valid initial relations for a match""" if self.pattern_graph.num_edges != subject_graph.num_edges: return # don't even try for pair in CustomPattern.iter_initial_relations(self, subject_graph): yield pai...
[ "def", "iter_initial_relations", "(", "self", ",", "subject_graph", ")", ":", "if", "self", ".", "pattern_graph", ".", "num_edges", "!=", "subject_graph", ".", "num_edges", ":", "return", "# don't even try", "for", "pair", "in", "CustomPattern", ".", "iter_initial...
Iterate over all valid initial relations for a match
[ "Iterate", "over", "all", "valid", "initial", "relations", "for", "a", "match" ]
python
train
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L217-L228
def run(self, args): """ Give the user with user_full_name the auth_role permissions on the remote project with project_name. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to give permissions, will be None i...
[ "def", "run", "(", "self", ",", "args", ")", ":", "email", "=", "args", ".", "email", "# email of person to give permissions, will be None if username is specified", "username", "=", "args", ".", "username", "# username of person to give permissions, will be None if email is sp...
Give the user with user_full_name the auth_role permissions on the remote project with project_name. :param args Namespace arguments parsed from the command line
[ "Give", "the", "user", "with", "user_full_name", "the", "auth_role", "permissions", "on", "the", "remote", "project", "with", "project_name", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
python
train
google/pyringe
pyringe/plugins/read_only.py
https://github.com/google/pyringe/blob/76dff5d1ac29cd5e7bf32677654a83291a15ad8a/pyringe/plugins/read_only.py#L52-L60
def Backtrace(self, to_string=False): """Get a backtrace of the current position.""" if self.inferior.is_running: res = self.inferior.Backtrace() if to_string: return res print res else: logging.error('Not attached to any process.')
[ "def", "Backtrace", "(", "self", ",", "to_string", "=", "False", ")", ":", "if", "self", ".", "inferior", ".", "is_running", ":", "res", "=", "self", ".", "inferior", ".", "Backtrace", "(", ")", "if", "to_string", ":", "return", "res", "print", "res", ...
Get a backtrace of the current position.
[ "Get", "a", "backtrace", "of", "the", "current", "position", "." ]
python
train
macbre/sql-metadata
sql_metadata.py
https://github.com/macbre/sql-metadata/blob/4b7b4ae0a961d568075aefe78535cf5aee74583c/sql_metadata.py#L30-L48
def preprocess_query(query): """ Perform initial query cleanup :type query str :rtype str """ # 1. remove aliases # FROM `dimension_wikis` `dw` # INNER JOIN `fact_wam_scores` `fwN` query = re.sub(r'(\s(FROM|JOIN)\s`[^`]+`)\s`[^`]+`', r'\1', query, flags=re.IGNORECASE) # 2. `dat...
[ "def", "preprocess_query", "(", "query", ")", ":", "# 1. remove aliases", "# FROM `dimension_wikis` `dw`", "# INNER JOIN `fact_wam_scores` `fwN`", "query", "=", "re", ".", "sub", "(", "r'(\\s(FROM|JOIN)\\s`[^`]+`)\\s`[^`]+`'", ",", "r'\\1'", ",", "query", ",", "flags", "=...
Perform initial query cleanup :type query str :rtype str
[ "Perform", "initial", "query", "cleanup" ]
python
train
phaethon/kamene
kamene/contrib/igmpv3.py
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/igmpv3.py#L123-L141
def float_encode(self, value): """Convert the integer value to its IGMPv3 encoded time value if needed. If value < 128, return the value specified. If >= 128, encode as a floating point value. Value can be 0 - 31744. """ if value < 128: code = value elif value > 31743: code = 25...
[ "def", "float_encode", "(", "self", ",", "value", ")", ":", "if", "value", "<", "128", ":", "code", "=", "value", "elif", "value", ">", "31743", ":", "code", "=", "255", "else", ":", "exp", "=", "0", "value", ">>=", "3", "while", "(", "value", ">...
Convert the integer value to its IGMPv3 encoded time value if needed. If value < 128, return the value specified. If >= 128, encode as a floating point value. Value can be 0 - 31744.
[ "Convert", "the", "integer", "value", "to", "its", "IGMPv3", "encoded", "time", "value", "if", "needed", ".", "If", "value", "<", "128", "return", "the", "value", "specified", ".", "If", ">", "=", "128", "encode", "as", "a", "floating", "point", "value",...
python
train
DocNow/twarc
twarc/client.py
https://github.com/DocNow/twarc/blob/47dd87d0c00592a4d583412c9d660ba574fc6f26/twarc/client.py#L254-L278
def follower_ids(self, user): """ Returns Twitter user id lists for the specified user's followers. A user can be a specific using their screen_name or user_id """ user = str(user) user = user.lstrip('@') url = 'https://api.twitter.com/1.1/followers/ids.json' ...
[ "def", "follower_ids", "(", "self", ",", "user", ")", ":", "user", "=", "str", "(", "user", ")", "user", "=", "user", ".", "lstrip", "(", "'@'", ")", "url", "=", "'https://api.twitter.com/1.1/followers/ids.json'", "if", "re", ".", "match", "(", "r'^\\d+$'"...
Returns Twitter user id lists for the specified user's followers. A user can be a specific using their screen_name or user_id
[ "Returns", "Twitter", "user", "id", "lists", "for", "the", "specified", "user", "s", "followers", ".", "A", "user", "can", "be", "a", "specific", "using", "their", "screen_name", "or", "user_id" ]
python
train
ic-labs/django-icekit
icekit/content_collections/abstract_models.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/icekit/content_collections/abstract_models.py#L159-L181
def get_response(self, request, parent, *args, **kwargs): """ Render this collected content to a response. :param request: the request :param parent: the parent collection :param args: :param kwargs: :return: """ context = { 'page': se...
[ "def", "get_response", "(", "self", ",", "request", ",", "parent", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "context", "=", "{", "'page'", ":", "self", ",", "}", "try", ":", "return", "TemplateResponse", "(", "request", ",", "self", ".", ...
Render this collected content to a response. :param request: the request :param parent: the parent collection :param args: :param kwargs: :return:
[ "Render", "this", "collected", "content", "to", "a", "response", "." ]
python
train
cuihantao/andes
andes/variables/call.py
https://github.com/cuihantao/andes/blob/7067898d4f26ce7534e968b8486c4aa8fe3a511a/andes/variables/call.py#L178-L188
def _compile_bus_injection(self): """Impose injections on buses""" string = '"""\n' for device, series in zip(self.devices, self.series): if series: string += 'system.' + device + '.gcall(system.dae)\n' string += '\n' string += 'system.dae.reset_small_...
[ "def", "_compile_bus_injection", "(", "self", ")", ":", "string", "=", "'\"\"\"\\n'", "for", "device", ",", "series", "in", "zip", "(", "self", ".", "devices", ",", "self", ".", "series", ")", ":", "if", "series", ":", "string", "+=", "'system.'", "+", ...
Impose injections on buses
[ "Impose", "injections", "on", "buses" ]
python
train
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L457-L463
def _is_excluded(filename, exclusions): """Return true if filename matches any of exclusions.""" for exclusion in exclusions: if fnmatch(filename, exclusion): return True return False
[ "def", "_is_excluded", "(", "filename", ",", "exclusions", ")", ":", "for", "exclusion", "in", "exclusions", ":", "if", "fnmatch", "(", "filename", ",", "exclusion", ")", ":", "return", "True", "return", "False" ]
Return true if filename matches any of exclusions.
[ "Return", "true", "if", "filename", "matches", "any", "of", "exclusions", "." ]
python
train
Azure/azure-multiapi-storage-python
azure/multiapi/storage/v2015_04_05/table/tableservice.py
https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/tableservice.py#L353-L383
def list_tables(self, num_results=None, marker=None, timeout=None): ''' Returns a generator to list the tables. The generator will lazily follow the continuation tokens returned by the service and stop when all tables have been returned or num_results is reached. If num_result...
[ "def", "list_tables", "(", "self", ",", "num_results", "=", "None", ",", "marker", "=", "None", ",", "timeout", "=", "None", ")", ":", "kwargs", "=", "{", "'max_results'", ":", "num_results", ",", "'marker'", ":", "marker", ",", "'timeout'", ":", "timeou...
Returns a generator to list the tables. The generator will lazily follow the continuation tokens returned by the service and stop when all tables have been returned or num_results is reached. If num_results is specified and the account has more than that number of tables, the generat...
[ "Returns", "a", "generator", "to", "list", "the", "tables", ".", "The", "generator", "will", "lazily", "follow", "the", "continuation", "tokens", "returned", "by", "the", "service", "and", "stop", "when", "all", "tables", "have", "been", "returned", "or", "n...
python
train
abe-winter/pg13-py
pg13/sqparse2.py
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/sqparse2.py#L332-L336
def p_assignlist(self,t): "assignlist : assignlist ',' assign \n | assign" if len(t)==4: t[0] = t[1] + [t[3]] elif len(t)==2: t[0] = [t[1]] else: raise NotImplementedError('unk_len', len(t)) # pragma: no cover
[ "def", "p_assignlist", "(", "self", ",", "t", ")", ":", "if", "len", "(", "t", ")", "==", "4", ":", "t", "[", "0", "]", "=", "t", "[", "1", "]", "+", "[", "t", "[", "3", "]", "]", "elif", "len", "(", "t", ")", "==", "2", ":", "t", "["...
assignlist : assignlist ',' assign \n | assign
[ "assignlist", ":", "assignlist", "assign", "\\", "n", "|", "assign" ]
python
train