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
fusionapp/fusion-util
fusion_util/enums.py
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/enums.py#L69-L79
def from_pairs(cls, doc, pairs): """ Construct an enumeration from an iterable of pairs. :param doc: See `Enum.__init__`. :type pairs: ``Iterable[Tuple[unicode, unicode]]`` :param pairs: Iterable to construct the enumeration from. :rtype: Enum """ values ...
[ "def", "from_pairs", "(", "cls", ",", "doc", ",", "pairs", ")", ":", "values", "=", "(", "EnumItem", "(", "value", ",", "desc", ")", "for", "value", ",", "desc", "in", "pairs", ")", "return", "cls", "(", "doc", "=", "doc", ",", "values", "=", "va...
Construct an enumeration from an iterable of pairs. :param doc: See `Enum.__init__`. :type pairs: ``Iterable[Tuple[unicode, unicode]]`` :param pairs: Iterable to construct the enumeration from. :rtype: Enum
[ "Construct", "an", "enumeration", "from", "an", "iterable", "of", "pairs", "." ]
python
train
zhmcclient/python-zhmcclient
zhmcclient/_exceptions.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient/_exceptions.py#L258-L270
def str_def(self): """ :term:`string`: The exception as a string in a Python definition-style format, e.g. for parsing by scripts: .. code-block:: text classname={}; read_timeout={}; read_retries={}; message={}; """ return "classname={!r}; read_timeout={!r};...
[ "def", "str_def", "(", "self", ")", ":", "return", "\"classname={!r}; read_timeout={!r}; read_retries={!r}; \"", "\"message={!r};\"", ".", "format", "(", "self", ".", "__class__", ".", "__name__", ",", "self", ".", "read_timeout", ",", "self", ".", "read_retries", "...
:term:`string`: The exception as a string in a Python definition-style format, e.g. for parsing by scripts: .. code-block:: text classname={}; read_timeout={}; read_retries={}; message={};
[ ":", "term", ":", "string", ":", "The", "exception", "as", "a", "string", "in", "a", "Python", "definition", "-", "style", "format", "e", ".", "g", ".", "for", "parsing", "by", "scripts", ":" ]
python
train
ajenhl/tacl
tacl/jitc.py
https://github.com/ajenhl/tacl/blob/b8a343248e77f1c07a5a4ac133a9ad6e0b4781c2/tacl/jitc.py#L96-L117
def _create_chord_chart(self, data, works, output_dir): """Generates and writes to a file in `output_dir` the data used to display a chord chart. :param data: data to derive the chord data from :type data: `pandas.DataFrame` :param works: works to display :type works: `l...
[ "def", "_create_chord_chart", "(", "self", ",", "data", ",", "works", ",", "output_dir", ")", ":", "matrix", "=", "[", "]", "chord_data", "=", "data", ".", "unstack", "(", "BASE_WORK", ")", "[", "SHARED", "]", "for", "index", ",", "row_data", "in", "ch...
Generates and writes to a file in `output_dir` the data used to display a chord chart. :param data: data to derive the chord data from :type data: `pandas.DataFrame` :param works: works to display :type works: `list` :param output_dir: directory to output data file to ...
[ "Generates", "and", "writes", "to", "a", "file", "in", "output_dir", "the", "data", "used", "to", "display", "a", "chord", "chart", "." ]
python
train
poppy-project/pypot
pypot/dynamixel/io/io.py
https://github.com/poppy-project/pypot/blob/d9c6551bbc87d45d9d1f0bc15e35b616d0002afd/pypot/dynamixel/io/io.py#L20-L28
def get_control_mode(self, ids): """ Gets the mode ('joint' or 'wheel') for the specified motors. """ to_get_ids = [id for id in ids if id not in self._known_mode] limits = self.get_angle_limit(to_get_ids, convert=False) modes = ['wheel' if limit == (0, 0) else 'joint' for limit in limit...
[ "def", "get_control_mode", "(", "self", ",", "ids", ")", ":", "to_get_ids", "=", "[", "id", "for", "id", "in", "ids", "if", "id", "not", "in", "self", ".", "_known_mode", "]", "limits", "=", "self", ".", "get_angle_limit", "(", "to_get_ids", ",", "conv...
Gets the mode ('joint' or 'wheel') for the specified motors.
[ "Gets", "the", "mode", "(", "joint", "or", "wheel", ")", "for", "the", "specified", "motors", "." ]
python
train
user-cont/conu
conu/apidefs/filesystem.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/apidefs/filesystem.py#L106-L119
def read_file(self, file_path): """ read file specified via 'file_path' and return its content - raises an ConuException if there is an issue accessing the file :param file_path: str, path to the file to read :return: str (not bytes), content of the file """ try:...
[ "def", "read_file", "(", "self", ",", "file_path", ")", ":", "try", ":", "with", "open", "(", "self", ".", "p", "(", "file_path", ")", ")", "as", "fd", ":", "return", "fd", ".", "read", "(", ")", "except", "IOError", "as", "ex", ":", "logger", "....
read file specified via 'file_path' and return its content - raises an ConuException if there is an issue accessing the file :param file_path: str, path to the file to read :return: str (not bytes), content of the file
[ "read", "file", "specified", "via", "file_path", "and", "return", "its", "content", "-", "raises", "an", "ConuException", "if", "there", "is", "an", "issue", "accessing", "the", "file" ]
python
train
jldantas/libmft
libmft/attribute.py
https://github.com/jldantas/libmft/blob/65a988605fe7663b788bd81dcb52c0a4eaad1549/libmft/attribute.py#L1547-L1568
def _from_binary_syn_link(cls, binary_stream): """See base class.""" ''' Offset to target name - 2 (relative to 16th byte) Length of target name - 2 Offset to print name - 2 (relative to 16th byte) Length of print name - 2 Symbolic link flags - 4 ''' offset_target_name, l...
[ "def", "_from_binary_syn_link", "(", "cls", ",", "binary_stream", ")", ":", "''' Offset to target name - 2 (relative to 16th byte)\n Length of target name - 2\n Offset to print name - 2 (relative to 16th byte)\n Length of print name - 2\n Symbolic link flags - 4\n '''"...
See base class.
[ "See", "base", "class", "." ]
python
train
pauleveritt/kaybee
kaybee/plugins/events.py
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/events.py#L144-L150
def call_env_updated(cls, kb_app, sphinx_app: Sphinx, sphinx_env: BuildEnvironment): """ On the env-updated event, do callbacks """ for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EU): callback(kb_app, sphinx_app, sphinx_env)
[ "def", "call_env_updated", "(", "cls", ",", "kb_app", ",", "sphinx_app", ":", "Sphinx", ",", "sphinx_env", ":", "BuildEnvironment", ")", ":", "for", "callback", "in", "EventAction", ".", "get_callbacks", "(", "kb_app", ",", "SphinxEvent", ".", "EU", ")", ":"...
On the env-updated event, do callbacks
[ "On", "the", "env", "-", "updated", "event", "do", "callbacks" ]
python
train
google/grr
grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L64-L96
def _CheckAccess(self, username, subject_id, approval_type): """Checks access to a given subject by a given user.""" precondition.AssertType(subject_id, Text) cache_key = (username, subject_id, approval_type) try: self.acl_cache.Get(cache_key) stats_collector_instance.Get().IncrementCounter...
[ "def", "_CheckAccess", "(", "self", ",", "username", ",", "subject_id", ",", "approval_type", ")", ":", "precondition", ".", "AssertType", "(", "subject_id", ",", "Text", ")", "cache_key", "=", "(", "username", ",", "subject_id", ",", "approval_type", ")", "...
Checks access to a given subject by a given user.
[ "Checks", "access", "to", "a", "given", "subject", "by", "a", "given", "user", "." ]
python
train
poldracklab/niworkflows
niworkflows/interfaces/segmentation.py
https://github.com/poldracklab/niworkflows/blob/254f4b4fcc5e6ecb29d2f4602a30786b913ecce5/niworkflows/interfaces/segmentation.py#L40-L58
def _post_run_hook(self, runtime): ''' generates a report showing nine slices, three per axis, of an arbitrary volume of `in_files`, with the resulting segmentation overlaid ''' self._anat_file = self.inputs.in_files[0] outputs = self.aggregate_outputs(runtime=runtime) se...
[ "def", "_post_run_hook", "(", "self", ",", "runtime", ")", ":", "self", ".", "_anat_file", "=", "self", ".", "inputs", ".", "in_files", "[", "0", "]", "outputs", "=", "self", ".", "aggregate_outputs", "(", "runtime", "=", "runtime", ")", "self", ".", "...
generates a report showing nine slices, three per axis, of an arbitrary volume of `in_files`, with the resulting segmentation overlaid
[ "generates", "a", "report", "showing", "nine", "slices", "three", "per", "axis", "of", "an", "arbitrary", "volume", "of", "in_files", "with", "the", "resulting", "segmentation", "overlaid" ]
python
train
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L122-L143
def find_ge(array, x): """ Find leftmost item greater than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_ge([0, 1, 2, 3], 1.0) 1 **中文文档** 寻找最小的大于等于x的数。 """ i = bisect.bisec...
[ "def", "find_ge", "(", "array", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_left", "(", "array", ",", "x", ")", "if", "i", "!=", "len", "(", "array", ")", ":", "return", "array", "[", "i", "]", "raise", "ValueError" ]
Find leftmost item greater than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_ge([0, 1, 2, 3], 1.0) 1 **中文文档** 寻找最小的大于等于x的数。
[ "Find", "leftmost", "item", "greater", "than", "or", "equal", "to", "x", "." ]
python
train
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L418-L437
def _list_audio_files(self, sub_dir=""): """ Parameters ---------- sub_dir : one of `needed_directories`, optional Default is "", which means it'll look through all of subdirs. Returns ------- audio_files : [str] A list whose elements are ...
[ "def", "_list_audio_files", "(", "self", ",", "sub_dir", "=", "\"\"", ")", ":", "audio_files", "=", "list", "(", ")", "for", "possibly_audio_file", "in", "os", ".", "listdir", "(", "\"{}/{}\"", ".", "format", "(", "self", ".", "src_dir", ",", "sub_dir", ...
Parameters ---------- sub_dir : one of `needed_directories`, optional Default is "", which means it'll look through all of subdirs. Returns ------- audio_files : [str] A list whose elements are basenames of the present audiofiles whose formats...
[ "Parameters", "----------", "sub_dir", ":", "one", "of", "needed_directories", "optional", "Default", "is", "which", "means", "it", "ll", "look", "through", "all", "of", "subdirs", "." ]
python
train
galactics/beyond
beyond/frames/iau1980.py
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L72-L76
def precesion(date): # pragma: no cover """Precession as a rotation matrix """ zeta, theta, z = np.deg2rad(_precesion(date)) return rot3(zeta) @ rot2(-theta) @ rot3(z)
[ "def", "precesion", "(", "date", ")", ":", "# pragma: no cover", "zeta", ",", "theta", ",", "z", "=", "np", ".", "deg2rad", "(", "_precesion", "(", "date", ")", ")", "return", "rot3", "(", "zeta", ")", "@", "rot2", "(", "-", "theta", ")", "@", "rot...
Precession as a rotation matrix
[ "Precession", "as", "a", "rotation", "matrix" ]
python
train
AndrewRPorter/yahoo-historical
yahoo_historical/fetch.py
https://github.com/AndrewRPorter/yahoo-historical/blob/7a501af77fec6aa69551edb0485b665ea9bb2727/yahoo_historical/fetch.py#L41-L50
def getData(self, events): """Returns a list of historical data from Yahoo Finance""" if self.interval not in ["1d", "1wk", "1mo"]: raise ValueError("Incorrect interval: valid intervals are 1d, 1wk, 1mo") url = self.api_url % (self.ticker, self.start, self.end, self.interval, events...
[ "def", "getData", "(", "self", ",", "events", ")", ":", "if", "self", ".", "interval", "not", "in", "[", "\"1d\"", ",", "\"1wk\"", ",", "\"1mo\"", "]", ":", "raise", "ValueError", "(", "\"Incorrect interval: valid intervals are 1d, 1wk, 1mo\"", ")", "url", "="...
Returns a list of historical data from Yahoo Finance
[ "Returns", "a", "list", "of", "historical", "data", "from", "Yahoo", "Finance" ]
python
train
teepark/greenhouse
greenhouse/scheduler.py
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L263-L300
def schedule(target=None, args=(), kwargs=None): """insert a greenlet into the scheduler If provided a function, it is wrapped in a new greenlet :param target: what to schedule :type target: function or greenlet :param args: arguments for the function (only used if ``target`` is a function...
[ "def", "schedule", "(", "target", "=", "None", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "if", "target", "is", "None", ":", "def", "decorator", "(", "target", ")", ":", "return", "schedule", "(", "target", ",", "args", "=", ...
insert a greenlet into the scheduler If provided a function, it is wrapped in a new greenlet :param target: what to schedule :type target: function or greenlet :param args: arguments for the function (only used if ``target`` is a function) :type args: tuple :param kwargs: keywo...
[ "insert", "a", "greenlet", "into", "the", "scheduler" ]
python
train
andreikop/qutepart
qutepart/lines.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/lines.py#L21-L29
def _atomicModification(func): """Decorator Make document modification atomic """ def wrapper(*args, **kwargs): self = args[0] with self._qpart: func(*args, **kwargs) return wrapper
[ "def", "_atomicModification", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", "=", "args", "[", "0", "]", "with", "self", ".", "_qpart", ":", "func", "(", "*", "args", ",", "*", "*", "kwargs",...
Decorator Make document modification atomic
[ "Decorator", "Make", "document", "modification", "atomic" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_notifications.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_notifications.py#L12-L23
def netconf_config_change_changed_by_server_or_user_server_server(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") netconf_config_change = ET.SubElement(config, "netconf-config-change", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications") chang...
[ "def", "netconf_config_change_changed_by_server_or_user_server_server", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "netconf_config_change", "=", "ET", ".", "SubElement", "(", "config", ",", "\"netco...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L140-L145
def create_fw_db(self, fw_id, fw_name, tenant_id): """Create FW dict. """ fw_dict = {'fw_id': fw_id, 'name': fw_name, 'tenant_id': tenant_id} # FW DB is already created by FW Mgr # self.add_fw_db(fw_id, fw_dict) self.update_fw_dict(fw_dict)
[ "def", "create_fw_db", "(", "self", ",", "fw_id", ",", "fw_name", ",", "tenant_id", ")", ":", "fw_dict", "=", "{", "'fw_id'", ":", "fw_id", ",", "'name'", ":", "fw_name", ",", "'tenant_id'", ":", "tenant_id", "}", "# FW DB is already created by FW Mgr", "# sel...
Create FW dict.
[ "Create", "FW", "dict", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L24181-L24192
def format_fat(self, quick): """Formats the medium as FAT. Generally only useful for floppy images as no partition table will be created. in quick of type bool Quick format it when set. """ if not isinstance(quick, bool): raise TypeError("quick can only...
[ "def", "format_fat", "(", "self", ",", "quick", ")", ":", "if", "not", "isinstance", "(", "quick", ",", "bool", ")", ":", "raise", "TypeError", "(", "\"quick can only be an instance of type bool\"", ")", "self", ".", "_call", "(", "\"formatFAT\"", ",", "in_p",...
Formats the medium as FAT. Generally only useful for floppy images as no partition table will be created. in quick of type bool Quick format it when set.
[ "Formats", "the", "medium", "as", "FAT", ".", "Generally", "only", "useful", "for", "floppy", "images", "as", "no", "partition", "table", "will", "be", "created", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/__init__.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/__init__.py#L45-L60
def Scanner(function, *args, **kw): """ Public interface factory function for creating different types of Scanners based on the different types of "functions" that may be supplied. TODO: Deprecate this some day. We've moved the functionality inside the Base class and really don't need this fa...
[ "def", "Scanner", "(", "function", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "SCons", ".", "Util", ".", "is_Dict", "(", "function", ")", ":", "return", "Selector", "(", "function", ",", "*", "args", ",", "*", "*", "kw", ")", "else", ...
Public interface factory function for creating different types of Scanners based on the different types of "functions" that may be supplied. TODO: Deprecate this some day. We've moved the functionality inside the Base class and really don't need this factory function any more. It was, however, u...
[ "Public", "interface", "factory", "function", "for", "creating", "different", "types", "of", "Scanners", "based", "on", "the", "different", "types", "of", "functions", "that", "may", "be", "supplied", "." ]
python
train
nwilming/ocupy
ocupy/parallel.py
https://github.com/nwilming/ocupy/blob/a0bd64f822576feaa502939d6bafd1183b237d16/ocupy/parallel.py#L61-L68
def xmlrpc_reschedule(self): """ Reschedule all running tasks. """ if not len(self.scheduled_tasks) == 0: self.reschedule = list(self.scheduled_tasks.items()) self.scheduled_tasks = {} return True
[ "def", "xmlrpc_reschedule", "(", "self", ")", ":", "if", "not", "len", "(", "self", ".", "scheduled_tasks", ")", "==", "0", ":", "self", ".", "reschedule", "=", "list", "(", "self", ".", "scheduled_tasks", ".", "items", "(", ")", ")", "self", ".", "s...
Reschedule all running tasks.
[ "Reschedule", "all", "running", "tasks", "." ]
python
train
alejandroautalan/pygubu
pygubu/builder/__init__.py
https://github.com/alejandroautalan/pygubu/blob/41c8fb37ef973736ec5d68cbe1cd4ecb78712e40/pygubu/builder/__init__.py#L238-L273
def create_variable(self, varname, vtype=None): """Create a tk variable. If the variable was created previously return that instance. """ var_types = ('string', 'int', 'boolean', 'double') vname = varname var = None type_from_name = 'string' # default type ...
[ "def", "create_variable", "(", "self", ",", "varname", ",", "vtype", "=", "None", ")", ":", "var_types", "=", "(", "'string'", ",", "'int'", ",", "'boolean'", ",", "'double'", ")", "vname", "=", "varname", "var", "=", "None", "type_from_name", "=", "'str...
Create a tk variable. If the variable was created previously return that instance.
[ "Create", "a", "tk", "variable", ".", "If", "the", "variable", "was", "created", "previously", "return", "that", "instance", "." ]
python
train
openstack/quark
quark/tools/billing.py
https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/tools/billing.py#L57-L118
def main(notify, hour, minute): """Runs billing report. Optionally sends notifications to billing""" # Read the config file and get the admin context config_opts = ['--config-file', '/etc/neutron/neutron.conf'] config.init(config_opts) # Have to load the billing module _after_ config is parsed so ...
[ "def", "main", "(", "notify", ",", "hour", ",", "minute", ")", ":", "# Read the config file and get the admin context", "config_opts", "=", "[", "'--config-file'", ",", "'/etc/neutron/neutron.conf'", "]", "config", ".", "init", "(", "config_opts", ")", "# Have to load...
Runs billing report. Optionally sends notifications to billing
[ "Runs", "billing", "report", ".", "Optionally", "sends", "notifications", "to", "billing" ]
python
valid
phoebe-project/phoebe2
phoebe/frontend/bundle.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L183-L315
def open(cls, filename): """Open a new bundle. Open a bundle from a JSON-formatted PHOEBE 2 file. This is a constructor so should be called as: >>> b = Bundle.open('test.phoebe') :parameter str filename: relative or full path to the file :return: instantiated :class:...
[ "def", "open", "(", "cls", ",", "filename", ")", ":", "filename", "=", "os", ".", "path", ".", "expanduser", "(", "filename", ")", "logger", ".", "debug", "(", "\"importing from {}\"", ".", "format", "(", "filename", ")", ")", "f", "=", "open", "(", ...
Open a new bundle. Open a bundle from a JSON-formatted PHOEBE 2 file. This is a constructor so should be called as: >>> b = Bundle.open('test.phoebe') :parameter str filename: relative or full path to the file :return: instantiated :class:`Bundle` object
[ "Open", "a", "new", "bundle", "." ]
python
train
matiasb/python-unrar
unrar/unrarlib.py
https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/unrarlib.py#L199-L205
def _c_func(func, restype, argtypes, errcheck=None): """Wrap c function setting prototype.""" func.restype = restype func.argtypes = argtypes if errcheck is not None: func.errcheck = errcheck return func
[ "def", "_c_func", "(", "func", ",", "restype", ",", "argtypes", ",", "errcheck", "=", "None", ")", ":", "func", ".", "restype", "=", "restype", "func", ".", "argtypes", "=", "argtypes", "if", "errcheck", "is", "not", "None", ":", "func", ".", "errcheck...
Wrap c function setting prototype.
[ "Wrap", "c", "function", "setting", "prototype", "." ]
python
valid
gem/oq-engine
openquake/hazardlib/gsim/abrahamson_2014.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/abrahamson_2014.py#L354-L373
def _get_intra_event_std(self, C, mag, sa1180, vs30, vs30measured, rrup): """ Returns Phi as described at pages 1046 and 1047 """ phi_al = self._get_phi_al_regional(C, mag, vs30measured, rrup) derAmp = self._get_derivative(C, sa1180, vs30) phi...
[ "def", "_get_intra_event_std", "(", "self", ",", "C", ",", "mag", ",", "sa1180", ",", "vs30", ",", "vs30measured", ",", "rrup", ")", ":", "phi_al", "=", "self", ".", "_get_phi_al_regional", "(", "C", ",", "mag", ",", "vs30measured", ",", "rrup", ")", "...
Returns Phi as described at pages 1046 and 1047
[ "Returns", "Phi", "as", "described", "at", "pages", "1046", "and", "1047" ]
python
train
fhcrc/taxtastic
taxtastic/taxonomy.py
https://github.com/fhcrc/taxtastic/blob/4e874b7f2cc146178828bfba386314f8c342722b/taxtastic/taxonomy.py#L784-L798
def nary_subtree(self, tax_id, n=2): """Return a list of species tax_ids under *tax_id* such that node under *tax_id* and above the species has two children. """ if tax_id is None: return None parent_id, rank = self._node(tax_id) if rank == 'species': ...
[ "def", "nary_subtree", "(", "self", ",", "tax_id", ",", "n", "=", "2", ")", ":", "if", "tax_id", "is", "None", ":", "return", "None", "parent_id", ",", "rank", "=", "self", ".", "_node", "(", "tax_id", ")", "if", "rank", "==", "'species'", ":", "re...
Return a list of species tax_ids under *tax_id* such that node under *tax_id* and above the species has two children.
[ "Return", "a", "list", "of", "species", "tax_ids", "under", "*", "tax_id", "*", "such", "that", "node", "under", "*", "tax_id", "*", "and", "above", "the", "species", "has", "two", "children", "." ]
python
train
bretth/djset
djset/commands.py
https://github.com/bretth/djset/blob/e04cbcadc311f6edec50a718415d0004aa304034/djset/commands.py#L16-L25
def _create_djset(args, cls): """ Return a DjSecret object """ name = args.get('--name') settings = args.get('--settings') if name: return cls(name=name) elif settings: return cls(name=settings) else: return cls()
[ "def", "_create_djset", "(", "args", ",", "cls", ")", ":", "name", "=", "args", ".", "get", "(", "'--name'", ")", "settings", "=", "args", ".", "get", "(", "'--settings'", ")", "if", "name", ":", "return", "cls", "(", "name", "=", "name", ")", "eli...
Return a DjSecret object
[ "Return", "a", "DjSecret", "object" ]
python
train
bitesofcode/projex
projex/text.py
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/text.py#L793-L810
def underscore(text, lower=True): """ Splits all the words from the inputted text into being separated by underscores :sa [[#joinWords]] :param text <str> :return <str> :usage |import projex.text |print projex.text.underscore('...
[ "def", "underscore", "(", "text", ",", "lower", "=", "True", ")", ":", "out", "=", "joinWords", "(", "text", ",", "'_'", ")", "if", "lower", ":", "return", "out", ".", "lower", "(", ")", "return", "out" ]
Splits all the words from the inputted text into being separated by underscores :sa [[#joinWords]] :param text <str> :return <str> :usage |import projex.text |print projex.text.underscore('TheQuick, Brown, Fox')
[ "Splits", "all", "the", "words", "from", "the", "inputted", "text", "into", "being", "separated", "by", "underscores", ":", "sa", "[[", "#joinWords", "]]", ":", "param", "text", "<str", ">", ":", "return", "<str", ">", ":", "usage", "|import", "projex", ...
python
train
fracpete/python-weka-wrapper3
python/weka/core/serialization.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/serialization.py#L68-L84
def read_all(filename): """ Reads the serialized objects from disk. Caller must wrap objects in appropriate Python wrapper classes. :param filename: the file with the serialized objects :type filename: str :return: the list of JB_OBjects :rtype: list """ array = javabridge.static_call( ...
[ "def", "read_all", "(", "filename", ")", ":", "array", "=", "javabridge", ".", "static_call", "(", "\"Lweka/core/SerializationHelper;\"", ",", "\"readAll\"", ",", "\"(Ljava/lang/String;)[Ljava/lang/Object;\"", ",", "filename", ")", "if", "array", "is", "None", ":", ...
Reads the serialized objects from disk. Caller must wrap objects in appropriate Python wrapper classes. :param filename: the file with the serialized objects :type filename: str :return: the list of JB_OBjects :rtype: list
[ "Reads", "the", "serialized", "objects", "from", "disk", ".", "Caller", "must", "wrap", "objects", "in", "appropriate", "Python", "wrapper", "classes", "." ]
python
train
coursera-dl/coursera-dl
coursera/api.py
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/api.py#L1526-L1561
def _extract_links_from_asset_tags_in_text(self, text): """ Scan the text and extract asset tags and links to corresponding files. @param text: Page text. @type text: str @return: @see CourseraOnDemand._extract_links_from_text """ # Extract asset tags fr...
[ "def", "_extract_links_from_asset_tags_in_text", "(", "self", ",", "text", ")", ":", "# Extract asset tags from instructions text", "asset_tags_map", "=", "self", ".", "_extract_asset_tags", "(", "text", ")", "ids", "=", "list", "(", "iterkeys", "(", "asset_tags_map", ...
Scan the text and extract asset tags and links to corresponding files. @param text: Page text. @type text: str @return: @see CourseraOnDemand._extract_links_from_text
[ "Scan", "the", "text", "and", "extract", "asset", "tags", "and", "links", "to", "corresponding", "files", "." ]
python
train
signaturit/python-sdk
signaturit_sdk/signaturit_client.py
https://github.com/signaturit/python-sdk/blob/2419c6d9675d901244f807ae360dc58aa46109a9/signaturit_sdk/signaturit_client.py#L377-L393
def count_SMS(self, conditions={}): """ Count all certified sms """ url = self.SMS_COUNT_URL + "?" for key, value in conditions.items(): if key is 'ids': value = ",".join(value) url += '&%s=%s' % (key, value) connection = Connect...
[ "def", "count_SMS", "(", "self", ",", "conditions", "=", "{", "}", ")", ":", "url", "=", "self", ".", "SMS_COUNT_URL", "+", "\"?\"", "for", "key", ",", "value", "in", "conditions", ".", "items", "(", ")", ":", "if", "key", "is", "'ids'", ":", "valu...
Count all certified sms
[ "Count", "all", "certified", "sms" ]
python
train
pytorch/ignite
ignite/contrib/handlers/base_logger.py
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/base_logger.py#L89-L108
def _setup_output_metrics(self, engine): """Helper method to setup metrics to log """ metrics = {} if self.metric_names is not None: for name in self.metric_names: if name not in engine.state.metrics: warnings.warn("Provided metric name '{}...
[ "def", "_setup_output_metrics", "(", "self", ",", "engine", ")", ":", "metrics", "=", "{", "}", "if", "self", ".", "metric_names", "is", "not", "None", ":", "for", "name", "in", "self", ".", "metric_names", ":", "if", "name", "not", "in", "engine", "."...
Helper method to setup metrics to log
[ "Helper", "method", "to", "setup", "metrics", "to", "log" ]
python
train
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L72-L95
def _set_description(self, schema): """Set description from schema. :type schema: Sequence[google.cloud.bigquery.schema.SchemaField] :param schema: A description of fields in the schema. """ if schema is None: self.description = None return self....
[ "def", "_set_description", "(", "self", ",", "schema", ")", ":", "if", "schema", "is", "None", ":", "self", ".", "description", "=", "None", "return", "self", ".", "description", "=", "tuple", "(", "[", "Column", "(", "name", "=", "field", ".", "name",...
Set description from schema. :type schema: Sequence[google.cloud.bigquery.schema.SchemaField] :param schema: A description of fields in the schema.
[ "Set", "description", "from", "schema", "." ]
python
train
ldomic/lintools
lintools/draw.py
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/draw.py#L29-L48
def draw_hydrogen_bonds(self,color="black"): """For each bond that has been determined to be important, a line gets drawn. """ self.draw_hbonds="" if self.hbonds!=None: for bond in self.hbonds.hbonds_for_drawing: x = str((self.molecule.x_dim-self.molecule.molsize1)/2) y = str((self.molecule.y_dim-sel...
[ "def", "draw_hydrogen_bonds", "(", "self", ",", "color", "=", "\"black\"", ")", ":", "self", ".", "draw_hbonds", "=", "\"\"", "if", "self", ".", "hbonds", "!=", "None", ":", "for", "bond", "in", "self", ".", "hbonds", ".", "hbonds_for_drawing", ":", "x",...
For each bond that has been determined to be important, a line gets drawn.
[ "For", "each", "bond", "that", "has", "been", "determined", "to", "be", "important", "a", "line", "gets", "drawn", "." ]
python
train
Hackerfleet/hfos
modules/navdata/hfos/navdata/sensors.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/modules/navdata/hfos/navdata/sensors.py#L290-L318
def navdatapush(self): """ Pushes the current :referenceframe: out to clients. :return: """ try: self.fireEvent(referenceframe({ 'data': self.referenceframe, 'ages': self.referenceages }), "navdata") self.intervalcount += 1 ...
[ "def", "navdatapush", "(", "self", ")", ":", "try", ":", "self", ".", "fireEvent", "(", "referenceframe", "(", "{", "'data'", ":", "self", ".", "referenceframe", ",", "'ages'", ":", "self", ".", "referenceages", "}", ")", ",", "\"navdata\"", ")", "self",...
Pushes the current :referenceframe: out to clients. :return:
[ "Pushes", "the", "current", ":", "referenceframe", ":", "out", "to", "clients", "." ]
python
train
GNS3/gns3-server
gns3server/compute/docker/docker_vm.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/docker/docker_vm.py#L669-L704
def _add_ubridge_connection(self, nio, adapter_number): """ Creates a connection in uBridge. :param nio: NIO instance or None if it's a dummy interface (if an interface is missing in ubridge you can't see it via ifconfig in the container) :param adapter_number: adapter number ""...
[ "def", "_add_ubridge_connection", "(", "self", ",", "nio", ",", "adapter_number", ")", ":", "try", ":", "adapter", "=", "self", ".", "_ethernet_adapters", "[", "adapter_number", "]", "except", "IndexError", ":", "raise", "DockerError", "(", "\"Adapter {adapter_num...
Creates a connection in uBridge. :param nio: NIO instance or None if it's a dummy interface (if an interface is missing in ubridge you can't see it via ifconfig in the container) :param adapter_number: adapter number
[ "Creates", "a", "connection", "in", "uBridge", "." ]
python
train
inasafe/inasafe
safe/gui/tools/geonode_uploader.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/geonode_uploader.py#L119-L129
def fill_layer_combo(self): """Fill layer combobox.""" project = QgsProject.instance() # MapLayers returns a QMap<QString id, QgsMapLayer layer> layers = list(project.mapLayers().values()) extensions = tuple(extension_siblings.keys()) for layer in layers: if ...
[ "def", "fill_layer_combo", "(", "self", ")", ":", "project", "=", "QgsProject", ".", "instance", "(", ")", "# MapLayers returns a QMap<QString id, QgsMapLayer layer>", "layers", "=", "list", "(", "project", ".", "mapLayers", "(", ")", ".", "values", "(", ")", ")...
Fill layer combobox.
[ "Fill", "layer", "combobox", "." ]
python
train
tensorflow/probability
tensorflow_probability/python/internal/special_math.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/special_math.py#L291-L380
def log_ndtr(x, series_order=3, name="log_ndtr"): """Log Normal distribution function. For details of the Normal distribution function see `ndtr`. This function calculates `(log o ndtr)(x)` by either calling `log(ndtr(x))` or using an asymptotic series. Specifically: - For `x > upper_segment`, use the appro...
[ "def", "log_ndtr", "(", "x", ",", "series_order", "=", "3", ",", "name", "=", "\"log_ndtr\"", ")", ":", "if", "not", "isinstance", "(", "series_order", ",", "int", ")", ":", "raise", "TypeError", "(", "\"series_order must be a Python integer.\"", ")", "if", ...
Log Normal distribution function. For details of the Normal distribution function see `ndtr`. This function calculates `(log o ndtr)(x)` by either calling `log(ndtr(x))` or using an asymptotic series. Specifically: - For `x > upper_segment`, use the approximation `-ndtr(-x)` based on `log(1-x) ~= -x, x <<...
[ "Log", "Normal", "distribution", "function", "." ]
python
test
amperser/proselint
app.py
https://github.com/amperser/proselint/blob/cb619ee4023cc7856f5fb96aec2a33a2c9f1a2e2/app.py#L34-L58
def check_auth(username, password): """Check if a username / password combination is valid.""" legal_hashes = [ "15a7fdade5fa58d38c6d400770e5c0e948fbc03ba365b704a6d205687738ae46", "057b24043181523e3c3717071953c575bd13862517a8ce228601582a9cbd9dae", "c8d79ae7d388b6da21cb982a819065b18941925...
[ "def", "check_auth", "(", "username", ",", "password", ")", ":", "legal_hashes", "=", "[", "\"15a7fdade5fa58d38c6d400770e5c0e948fbc03ba365b704a6d205687738ae46\"", ",", "\"057b24043181523e3c3717071953c575bd13862517a8ce228601582a9cbd9dae\"", ",", "\"c8d79ae7d388b6da21cb982a819065b1894192...
Check if a username / password combination is valid.
[ "Check", "if", "a", "username", "/", "password", "combination", "is", "valid", "." ]
python
train
Netflix-Skunkworks/cloudaux
cloudaux/aws/elbv2.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/aws/elbv2.py#L24-L33
def describe_listeners(load_balancer_arn=None, listener_arns=None, client=None): """ Permission: elasticloadbalancing:DescribeListeners """ kwargs = dict() if load_balancer_arn: kwargs.update(dict(LoadBalancerArn=load_balancer_arn)) if listener_arns: kwargs.update(dict(ListenerAr...
[ "def", "describe_listeners", "(", "load_balancer_arn", "=", "None", ",", "listener_arns", "=", "None", ",", "client", "=", "None", ")", ":", "kwargs", "=", "dict", "(", ")", "if", "load_balancer_arn", ":", "kwargs", ".", "update", "(", "dict", "(", "LoadBa...
Permission: elasticloadbalancing:DescribeListeners
[ "Permission", ":", "elasticloadbalancing", ":", "DescribeListeners" ]
python
valid
inasafe/inasafe
safe/impact_function/style.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/style.py#L99-L220
def generate_classified_legend( analysis, exposure, hazard, use_rounding, debug_mode): """Generate an ordered python structure with the classified symbology. :param analysis: The analysis layer. :type analysis: QgsVectorLayer :param exposure: The exposure layer....
[ "def", "generate_classified_legend", "(", "analysis", ",", "exposure", ",", "hazard", ",", "use_rounding", ",", "debug_mode", ")", ":", "# We need to read the analysis layer to get the number of features.", "analysis_row", "=", "next", "(", "analysis", ".", "getFeatures", ...
Generate an ordered python structure with the classified symbology. :param analysis: The analysis layer. :type analysis: QgsVectorLayer :param exposure: The exposure layer. :type exposure: QgsVectorLayer :param hazard: The hazard layer. :type hazard: QgsVectorLayer :param use_rounding: B...
[ "Generate", "an", "ordered", "python", "structure", "with", "the", "classified", "symbology", "." ]
python
train
lgpage/nbtutor
nbtutor/ipython/utils.py
https://github.com/lgpage/nbtutor/blob/07798a044cf6e1fd4eaac2afddeef3e13348dbcd/nbtutor/ipython/utils.py#L94-L104
def redirect_stdout(new_stdout): """Redirect the stdout Args: new_stdout (io.StringIO): New stdout to use instead """ old_stdout, sys.stdout = sys.stdout, new_stdout try: yield None finally: sys.stdout = old_stdout
[ "def", "redirect_stdout", "(", "new_stdout", ")", ":", "old_stdout", ",", "sys", ".", "stdout", "=", "sys", ".", "stdout", ",", "new_stdout", "try", ":", "yield", "None", "finally", ":", "sys", ".", "stdout", "=", "old_stdout" ]
Redirect the stdout Args: new_stdout (io.StringIO): New stdout to use instead
[ "Redirect", "the", "stdout" ]
python
valid
Bachmann1234/diff-cover
diff_cover/snippets.py
https://github.com/Bachmann1234/diff-cover/blob/901cb3fc986982961785e841658085ead453c6c9/diff_cover/snippets.py#L90-L105
def html(self): """ Return an HTML representation of the snippet. """ formatter = HtmlFormatter( cssclass=self.DIV_CSS_CLASS, linenos=True, linenostart=self._start_line, hl_lines=self._shift_lines( self._violation_lines, ...
[ "def", "html", "(", "self", ")", ":", "formatter", "=", "HtmlFormatter", "(", "cssclass", "=", "self", ".", "DIV_CSS_CLASS", ",", "linenos", "=", "True", ",", "linenostart", "=", "self", ".", "_start_line", ",", "hl_lines", "=", "self", ".", "_shift_lines"...
Return an HTML representation of the snippet.
[ "Return", "an", "HTML", "representation", "of", "the", "snippet", "." ]
python
train
Unidata/MetPy
metpy/cbook.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/cbook.py#L88-L102
def broadcast_indices(x, minv, ndim, axis): """Calculate index values to properly broadcast index array within data array. See usage in interp. """ ret = [] for dim in range(ndim): if dim == axis: ret.append(minv) else: broadcast_slice = [np.newaxis] * ndim ...
[ "def", "broadcast_indices", "(", "x", ",", "minv", ",", "ndim", ",", "axis", ")", ":", "ret", "=", "[", "]", "for", "dim", "in", "range", "(", "ndim", ")", ":", "if", "dim", "==", "axis", ":", "ret", ".", "append", "(", "minv", ")", "else", ":"...
Calculate index values to properly broadcast index array within data array. See usage in interp.
[ "Calculate", "index", "values", "to", "properly", "broadcast", "index", "array", "within", "data", "array", "." ]
python
train
OSSOS/MOP
src/ossos/canfar/cadc_certificates.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/canfar/cadc_certificates.py#L62-L75
def getUserPassword(host='www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'): """"Getting the username/password for host from .netrc filie """ if os.access(os.path.join(os.environ.get('HOME','/'),".netrc"),os.R_OK): auth=netrc.netrc().authenticators(host) else: auth=False if not auth: sys.st...
[ "def", "getUserPassword", "(", "host", "=", "'www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'", ")", ":", "if", "os", ".", "access", "(", "os", ".", "path", ".", "join", "(", "os", ".", "environ", ".", "get", "(", "'HOME'", ",", "'/'", ")", ",", "\".netrc\"", ")",...
Getting the username/password for host from .netrc filie
[ "Getting", "the", "username", "/", "password", "for", "host", "from", ".", "netrc", "filie" ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L14672-L14690
def get_guest_property_value(self, property_p): """Reads a value from the machine's guest property store. in property_p of type str The name of the property to read. return value of type str The value of the property. If the property does not exist then this ...
[ "def", "get_guest_property_value", "(", "self", ",", "property_p", ")", ":", "if", "not", "isinstance", "(", "property_p", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"property_p can only be an instance of type basestring\"", ")", "value", "=", "self", ...
Reads a value from the machine's guest property store. in property_p of type str The name of the property to read. return value of type str The value of the property. If the property does not exist then this will be empty. raises :class:`VBoxErrorInvalidVmS...
[ "Reads", "a", "value", "from", "the", "machine", "s", "guest", "property", "store", "." ]
python
train
rix0rrr/gcl
gcl/ast_util.py
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L171-L181
def find_inherited_key_completions(rootpath, root_env): """Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple. """ tup = inflate_context_tuple(rootpath, root_env) if is...
[ "def", "find_inherited_key_completions", "(", "rootpath", ",", "root_env", ")", ":", "tup", "=", "inflate_context_tuple", "(", "rootpath", ",", "root_env", ")", "if", "isinstance", "(", "tup", ",", "runtime", ".", "CompositeTuple", ")", ":", "keys", "=", "set"...
Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple.
[ "Return", "completion", "keys", "from", "INHERITED", "tuples", "." ]
python
train
wheeler-microfluidics/dmf-control-board-firmware
dmf_control_board_firmware/__init__.py
https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/dmf_control_board_firmware/__init__.py#L535-L562
def force(self, Ly=None): ''' Estimate the applied force (in Newtons) on a drop according to the electromechanical model [1]. Ly is the length of the actuated electrode along the y-axis (perpendicular to the direction of motion) in milimeters. By defa...
[ "def", "force", "(", "self", ",", "Ly", "=", "None", ")", ":", "if", "self", ".", "calibration", ".", "_c_drop", ":", "c_drop", "=", "self", ".", "calibration", ".", "c_drop", "(", "self", ".", "frequency", ")", "else", ":", "c_drop", "=", "self", ...
Estimate the applied force (in Newtons) on a drop according to the electromechanical model [1]. Ly is the length of the actuated electrode along the y-axis (perpendicular to the direction of motion) in milimeters. By default, use the square root of the actuated elect...
[ "Estimate", "the", "applied", "force", "(", "in", "Newtons", ")", "on", "a", "drop", "according", "to", "the", "electromechanical", "model", "[", "1", "]", "." ]
python
train
hydpy-dev/hydpy
hydpy/auxs/networktools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/auxs/networktools.py#L430-L460
def selection(self): """A complete |Selection| object of all "supplying" and "routing" elements and required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ...
[ "def", "selection", "(", "self", ")", ":", "return", "selectiontools", ".", "Selection", "(", "self", ".", "selection_name", ",", "self", ".", "nodes", ",", "self", ".", "elements", ")" ]
A complete |Selection| object of all "supplying" and "routing" elements and required nodes. >>> from hydpy import RiverBasinNumbers2Selection >>> rbns2s = RiverBasinNumbers2Selection( ... (111, 113, 1129, 11269, 1125, 11261, ... ...
[ "A", "complete", "|Selection|", "object", "of", "all", "supplying", "and", "routing", "elements", "and", "required", "nodes", "." ]
python
train
Pertino/pertino-sdk-python
pertinosdk/__init__.py
https://github.com/Pertino/pertino-sdk-python/blob/d7d75bd374b7f44967ae6f1626a6520507be3a54/pertinosdk/__init__.py#L75-L83
def deleteFrom(self, organization, devices): """ Deletes all devices in a list. :raises: HTTP errors """ for device in devices: url = self.BASE_URL+self.BASE_PATH+self.ORGS_PATH+"/"+ str(organization["id"]) + self.DEVICES_PATH+ "/" + str(device["id"]) + self.USER_QUER...
[ "def", "deleteFrom", "(", "self", ",", "organization", ",", "devices", ")", ":", "for", "device", "in", "devices", ":", "url", "=", "self", ".", "BASE_URL", "+", "self", ".", "BASE_PATH", "+", "self", ".", "ORGS_PATH", "+", "\"/\"", "+", "str", "(", ...
Deletes all devices in a list. :raises: HTTP errors
[ "Deletes", "all", "devices", "in", "a", "list", ".", ":", "raises", ":", "HTTP", "errors" ]
python
train
pavoni/pyvera
pyvera/__init__.py
https://github.com/pavoni/pyvera/blob/e05e3d13f76153444787d31948feb5419d77a8c8/pyvera/__init__.py#L445-L453
def vera_request(self, **kwargs): """Perfom a vera_request for this device.""" request_payload = { 'output_format': 'json', 'DeviceNum': self.device_id, } request_payload.update(kwargs) return self.vera_controller.data_request(request_payload)
[ "def", "vera_request", "(", "self", ",", "*", "*", "kwargs", ")", ":", "request_payload", "=", "{", "'output_format'", ":", "'json'", ",", "'DeviceNum'", ":", "self", ".", "device_id", ",", "}", "request_payload", ".", "update", "(", "kwargs", ")", "return...
Perfom a vera_request for this device.
[ "Perfom", "a", "vera_request", "for", "this", "device", "." ]
python
train
sys-git/certifiable
certifiable/utils.py
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/utils.py#L68-L91
def certify_required(value, required=False): """ Certify that a value is present if required. :param object value: The value that is to be certified. :param bool required: Is the value required? :raises CertifierValueError: Required value is `None`. """ # Certify ou...
[ "def", "certify_required", "(", "value", ",", "required", "=", "False", ")", ":", "# Certify our kwargs:", "if", "not", "isinstance", "(", "required", ",", "bool", ")", ":", "raise", "CertifierParamError", "(", "'required'", ",", "required", ",", ")", "if", ...
Certify that a value is present if required. :param object value: The value that is to be certified. :param bool required: Is the value required? :raises CertifierValueError: Required value is `None`.
[ "Certify", "that", "a", "value", "is", "present", "if", "required", "." ]
python
train
cloudmesh/cloudmesh-common
cloudmesh/common/console.py
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/console.py#L251-L264
def cprint(color, prefix, message): """ prints a message in a given color :param color: the color as defined in the theme :param prefix: the prefix (a string) :param message: the message :return: """ message = message or "" prefix = prefix or "" ...
[ "def", "cprint", "(", "color", ",", "prefix", ",", "message", ")", ":", "message", "=", "message", "or", "\"\"", "prefix", "=", "prefix", "or", "\"\"", "print", "(", "(", "Console", ".", "theme", "[", "color", "]", "+", "prefix", "+", "message", "+",...
prints a message in a given color :param color: the color as defined in the theme :param prefix: the prefix (a string) :param message: the message :return:
[ "prints", "a", "message", "in", "a", "given", "color", ":", "param", "color", ":", "the", "color", "as", "defined", "in", "the", "theme", ":", "param", "prefix", ":", "the", "prefix", "(", "a", "string", ")", ":", "param", "message", ":", "the", "mes...
python
train
wglass/lighthouse
lighthouse/sockutils.py
https://github.com/wglass/lighthouse/blob/f4ce6550895acc31e433ede0c05d366718a3ffe5/lighthouse/sockutils.py#L5-L31
def get_response(sock, buffer_size=4096): """ Helper method for retrieving a response from a given socket. Returns two values in a tuple, the first is the reponse line and the second is any extra data after the newline. """ response = "" extra = "" while True: try: ...
[ "def", "get_response", "(", "sock", ",", "buffer_size", "=", "4096", ")", ":", "response", "=", "\"\"", "extra", "=", "\"\"", "while", "True", ":", "try", ":", "chunk", "=", "sock", ".", "recv", "(", "buffer_size", ")", "if", "chunk", ":", "response", ...
Helper method for retrieving a response from a given socket. Returns two values in a tuple, the first is the reponse line and the second is any extra data after the newline.
[ "Helper", "method", "for", "retrieving", "a", "response", "from", "a", "given", "socket", "." ]
python
train
brbsix/subsystem
subsystem/subsystem.py
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L276-L289
def multithreader(args, paths): """Execute multiple processes at once.""" def shellprocess(path): """Return a ready-to-use subprocess.""" import subprocess return subprocess.Popen(args + [path], stderr=subprocess.DEVNULL, s...
[ "def", "multithreader", "(", "args", ",", "paths", ")", ":", "def", "shellprocess", "(", "path", ")", ":", "\"\"\"Return a ready-to-use subprocess.\"\"\"", "import", "subprocess", "return", "subprocess", ".", "Popen", "(", "args", "+", "[", "path", "]", ",", "...
Execute multiple processes at once.
[ "Execute", "multiple", "processes", "at", "once", "." ]
python
train
saltstack/salt
salt/states/keystone_endpoint.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_endpoint.py#L80-L143
def present(name, service_name, auth=None, **kwargs): ''' Ensure an endpoint exists and is up-to-date name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint enabled Boolean to cont...
[ "def", "present", "(", "name", ",", "service_name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "...
Ensure an endpoint exists and is up-to-date name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint enabled Boolean to control if endpoint is enabled
[ "Ensure", "an", "endpoint", "exists", "and", "is", "up", "-", "to", "-", "date" ]
python
train
chinapnr/fishbase
fishbase/fish_logger.py
https://github.com/chinapnr/fishbase/blob/23c5147a6bc0d8ed36409e55352ffb2c5b0edc82/fishbase/fish_logger.py#L41-L54
def emit(self, record): """ Emit a record. Always check time """ try: if self.check_base_filename(record): self.build_base_filename() FileHandler.emit(self, record) except (KeyboardInterrupt, SystemExit): raise ...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "try", ":", "if", "self", ".", "check_base_filename", "(", "record", ")", ":", "self", ".", "build_base_filename", "(", ")", "FileHandler", ".", "emit", "(", "self", ",", "record", ")", "except", "("...
Emit a record. Always check time
[ "Emit", "a", "record", "." ]
python
train
ArabellaTech/django-basic-cms
basic_cms/managers.py
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/managers.py#L273-L280
def sanitize(self, content): """Sanitize a string in order to avoid possible XSS using ``html5lib``.""" import html5lib from html5lib import sanitizer p = html5lib.HTMLParser(tokenizer=sanitizer.HTMLSanitizer) dom_tree = p.parseFragment(content) return dom_tree.te...
[ "def", "sanitize", "(", "self", ",", "content", ")", ":", "import", "html5lib", "from", "html5lib", "import", "sanitizer", "p", "=", "html5lib", ".", "HTMLParser", "(", "tokenizer", "=", "sanitizer", ".", "HTMLSanitizer", ")", "dom_tree", "=", "p", ".", "p...
Sanitize a string in order to avoid possible XSS using ``html5lib``.
[ "Sanitize", "a", "string", "in", "order", "to", "avoid", "possible", "XSS", "using", "html5lib", "." ]
python
train
google/grr
grr/client/grr_response_client/fleetspeak_client.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/fleetspeak_client.py#L122-L129
def _ForemanOp(self): """Sends Foreman checks periodically.""" period = config.CONFIG["Client.foreman_check_frequency"] self._threads["Worker"].SendReply( rdf_protodict.DataBlob(), session_id=rdfvalue.FlowSessionID(flow_name="Foreman"), require_fastpoll=False) time.sleep(period)
[ "def", "_ForemanOp", "(", "self", ")", ":", "period", "=", "config", ".", "CONFIG", "[", "\"Client.foreman_check_frequency\"", "]", "self", ".", "_threads", "[", "\"Worker\"", "]", ".", "SendReply", "(", "rdf_protodict", ".", "DataBlob", "(", ")", ",", "sess...
Sends Foreman checks periodically.
[ "Sends", "Foreman", "checks", "periodically", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py#L236-L248
def init_heartbeat(self): """start the heart beating""" # heartbeat doesn't share context, because it mustn't be blocked # by the GIL, which is accessed by libzmq when freeing zero-copy messages hb_ctx = zmq.Context() self.heartbeat = Heartbeat(hb_ctx, (self.ip, self.hb_port)) ...
[ "def", "init_heartbeat", "(", "self", ")", ":", "# heartbeat doesn't share context, because it mustn't be blocked", "# by the GIL, which is accessed by libzmq when freeing zero-copy messages", "hb_ctx", "=", "zmq", ".", "Context", "(", ")", "self", ".", "heartbeat", "=", "Heart...
start the heart beating
[ "start", "the", "heart", "beating" ]
python
test
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py#L106-L146
def make_multisig_segwit_info( m, pks ): """ Make either a p2sh-p2wpkh or p2sh-p2wsh redeem script and p2sh address. Return {'address': p2sh address, 'redeem_script': **the witness script**, 'private_keys': privkeys, 'segwit': True} * privkeys and redeem_script will be hex-encoded """ pubs ...
[ "def", "make_multisig_segwit_info", "(", "m", ",", "pks", ")", ":", "pubs", "=", "[", "]", "privkeys", "=", "[", "]", "for", "pk", "in", "pks", ":", "priv", "=", "BitcoinPrivateKey", "(", "pk", ",", "compressed", "=", "True", ")", "priv_hex", "=", "p...
Make either a p2sh-p2wpkh or p2sh-p2wsh redeem script and p2sh address. Return {'address': p2sh address, 'redeem_script': **the witness script**, 'private_keys': privkeys, 'segwit': True} * privkeys and redeem_script will be hex-encoded
[ "Make", "either", "a", "p2sh", "-", "p2wpkh", "or", "p2sh", "-", "p2wsh", "redeem", "script", "and", "p2sh", "address", "." ]
python
train
cjdrake/pyeda
pyeda/parsing/boolexpr.py
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/parsing/boolexpr.py#L473-L480
def _xorterm(lexer): """Return an xor term expresssion.""" prodterm = _prodterm(lexer) xorterm_prime = _xorterm_prime(lexer) if xorterm_prime is None: return prodterm else: return ('xor', prodterm, xorterm_prime)
[ "def", "_xorterm", "(", "lexer", ")", ":", "prodterm", "=", "_prodterm", "(", "lexer", ")", "xorterm_prime", "=", "_xorterm_prime", "(", "lexer", ")", "if", "xorterm_prime", "is", "None", ":", "return", "prodterm", "else", ":", "return", "(", "'xor'", ",",...
Return an xor term expresssion.
[ "Return", "an", "xor", "term", "expresssion", "." ]
python
train
edeposit/edeposit.amqp.pdfgen
src/edeposit/amqp/pdfgen/translator.py
https://github.com/edeposit/edeposit.amqp.pdfgen/blob/1022d6d01196f4928d664a71e49273c2d8c67e63/src/edeposit/amqp/pdfgen/translator.py#L49-L79
def gen_pdf(rst_content, style_text, header=None, footer=FOOTER): """ Create PDF file from `rst_content` using `style_text` as style. Optinally, add `header` or `footer`. Args: rst_content (str): Content of the PDF file in restructured text markup. style_text (str): Style for the :mod:...
[ "def", "gen_pdf", "(", "rst_content", ",", "style_text", ",", "header", "=", "None", ",", "footer", "=", "FOOTER", ")", ":", "out_file_obj", "=", "StringIO", "(", ")", "with", "NamedTemporaryFile", "(", ")", "as", "f", ":", "f", ".", "write", "(", "sty...
Create PDF file from `rst_content` using `style_text` as style. Optinally, add `header` or `footer`. Args: rst_content (str): Content of the PDF file in restructured text markup. style_text (str): Style for the :mod:`rst2pdf` module. header (str, default None): Header which will be ren...
[ "Create", "PDF", "file", "from", "rst_content", "using", "style_text", "as", "style", "." ]
python
train
neuroticnerd/armory
armory/utils/__init__.py
https://github.com/neuroticnerd/armory/blob/d37c5ca1dbdd60dddb968e35f0bbe4bc1299dca1/armory/utils/__init__.py#L14-L48
def env(key, default=_NOT_PROVIDED, cast=str, force=False, **kwargs): """ Retrieve environment variables and specify default and options. :param key: (required) environment variable name to retrieve :param default: value to use if the environment var doesn't exist :param cast: values always come in...
[ "def", "env", "(", "key", ",", "default", "=", "_NOT_PROVIDED", ",", "cast", "=", "str", ",", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "boolmap", "=", "kwargs", ".", "get", "(", "'boolmap'", ",", "None", ")", "sticky", "=", "kwargs...
Retrieve environment variables and specify default and options. :param key: (required) environment variable name to retrieve :param default: value to use if the environment var doesn't exist :param cast: values always come in as strings, cast to this type if needed :param force: force casting of value ...
[ "Retrieve", "environment", "variables", "and", "specify", "default", "and", "options", "." ]
python
train
toomore/goristock
grs/twseno.py
https://github.com/toomore/goristock/blob/e61f57f11a626cfbc4afbf66337fd9d1c51e3e71/grs/twseno.py#L72-L85
def search(self,q): """ Search. """ import re pattern = re.compile("%s" % q) result = {} for i in self.allstockno: b = re.search(pattern, self.allstockno[i]) try: b.group() result[i] = self.allstockno[i] except: pass return result
[ "def", "search", "(", "self", ",", "q", ")", ":", "import", "re", "pattern", "=", "re", ".", "compile", "(", "\"%s\"", "%", "q", ")", "result", "=", "{", "}", "for", "i", "in", "self", ".", "allstockno", ":", "b", "=", "re", ".", "search", "(",...
Search.
[ "Search", "." ]
python
train
PyCQA/astroid
astroid/scoped_nodes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/scoped_nodes.py#L1614-L1666
def infer_call_result(self, caller=None, context=None): """Infer what the function returns when called. :returns: What the function returns. :rtype: iterable(NodeNG or Uninferable) or None """ if self.is_generator(): if isinstance(self, AsyncFunctionDef): ...
[ "def", "infer_call_result", "(", "self", ",", "caller", "=", "None", ",", "context", "=", "None", ")", ":", "if", "self", ".", "is_generator", "(", ")", ":", "if", "isinstance", "(", "self", ",", "AsyncFunctionDef", ")", ":", "generator_cls", "=", "bases...
Infer what the function returns when called. :returns: What the function returns. :rtype: iterable(NodeNG or Uninferable) or None
[ "Infer", "what", "the", "function", "returns", "when", "called", "." ]
python
train
openstack/quark
quark/plugin_modules/ip_addresses.py
https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/plugin_modules/ip_addresses.py#L437-L460
def get_port_for_ip_address(context, ip_id, id, fields=None): """Retrieve a port. : param context: neutron api request context : param id: UUID representing the port to fetch. : param fields: a list of strings that are valid keys in a port dictionary as listed in the RESOURCE_ATTRIBUTE_MAP ...
[ "def", "get_port_for_ip_address", "(", "context", ",", "ip_id", ",", "id", ",", "fields", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"get_port %s for tenant %s fields %s\"", "%", "(", "id", ",", "context", ".", "tenant_id", ",", "fields", ")", ")", ...
Retrieve a port. : param context: neutron api request context : param id: UUID representing the port to fetch. : param fields: a list of strings that are valid keys in a port dictionary as listed in the RESOURCE_ATTRIBUTE_MAP object in neutron/api/v2/attributes.py. Only these fields ...
[ "Retrieve", "a", "port", "." ]
python
valid
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_classifier.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_classifier.py#L19-L62
def convert(model, feature_names, target): """Convert a boosted tree model to protobuf format. Parameters ---------- decision_tree : GradientBoostingClassifier A trained scikit-learn tree model. feature_names: [str] Name of the input columns. target: str Name of the ou...
[ "def", "convert", "(", "model", ",", "feature_names", ",", "target", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "_sklearn_util", ".", "check_expected_type...
Convert a boosted tree model to protobuf format. Parameters ---------- decision_tree : GradientBoostingClassifier A trained scikit-learn tree model. feature_names: [str] Name of the input columns. target: str Name of the output column. Returns ------- model_sp...
[ "Convert", "a", "boosted", "tree", "model", "to", "protobuf", "format", "." ]
python
train
NuGrid/NuGridPy
scripts/nugrid_set/nugrid_set.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/scripts/nugrid_set/nugrid_set.py#L1240-L1374
def set_plot_surface_abu(self,fig=2,species=['Sr-88','Ba-136'],decay=False,number_frac=False,xaxis='cycles',age_years=False,ratio=False,sumiso=False,eps=False,samefigure=False,samefigureall=False,withkip=False,sparsity=200,linestyle=['--'],marker=['o'],color=['r'],label=[],markevery=100,t0_model=-1,savefig=''): ''...
[ "def", "set_plot_surface_abu", "(", "self", ",", "fig", "=", "2", ",", "species", "=", "[", "'Sr-88'", ",", "'Ba-136'", "]", ",", "decay", "=", "False", ",", "number_frac", "=", "False", ",", "xaxis", "=", "'cycles'", ",", "age_years", "=", "False", ",...
Simply plots surface abundance versus model number or time
[ "Simply", "plots", "surface", "abundance", "versus", "model", "number", "or", "time" ]
python
train
openstack/python-monascaclient
monascaclient/v2_0/notifications.py
https://github.com/openstack/python-monascaclient/blob/03b07534145928eb2debad938da033c232dda105/monascaclient/v2_0/notifications.py#L29-L37
def get(self, **kwargs): """Get the details for a specific notification.""" # NOTE(trebskit) should actually be find_one, but # monasca does not support expected response format url = '%s/%s' % (self.base_url, kwargs['notification_id']) resp = self.client.list(path=url) ...
[ "def", "get", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# NOTE(trebskit) should actually be find_one, but", "# monasca does not support expected response format", "url", "=", "'%s/%s'", "%", "(", "self", ".", "base_url", ",", "kwargs", "[", "'notification_id'", ...
Get the details for a specific notification.
[ "Get", "the", "details", "for", "a", "specific", "notification", "." ]
python
train
wavycloud/pyboto3
pyboto3/rds.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L5435-L5539
def describe_reserved_db_instances(ReservedDBInstanceId=None, ReservedDBInstancesOfferingId=None, DBInstanceClass=None, Duration=None, ProductDescription=None, OfferingType=None, MultiAZ=None, Filters=None, MaxRecords=None, Marker=None): """ Returns information about reserved DB instances for this account, or a...
[ "def", "describe_reserved_db_instances", "(", "ReservedDBInstanceId", "=", "None", ",", "ReservedDBInstancesOfferingId", "=", "None", ",", "DBInstanceClass", "=", "None", ",", "Duration", "=", "None", ",", "ProductDescription", "=", "None", ",", "OfferingType", "=", ...
Returns information about reserved DB instances for this account, or about a specified reserved DB instance. See also: AWS API Documentation Examples This example lists information for all reserved DB instances for the specified DB instance class, duration, product, offering type, and availability zone...
[ "Returns", "information", "about", "reserved", "DB", "instances", "for", "this", "account", "or", "about", "a", "specified", "reserved", "DB", "instance", ".", "See", "also", ":", "AWS", "API", "Documentation", "Examples", "This", "example", "lists", "informatio...
python
train
shichao-an/115wangpan
u115/utils.py
https://github.com/shichao-an/115wangpan/blob/e7cc935313f675e886bceca831fcffcdedf1e880/u115/utils.py#L25-L30
def get_timestamp(length): """Get a timestamp of `length` in string""" s = '%.6f' % time.time() whole, frac = map(int, s.split('.')) res = '%d%d' % (whole, frac) return res[:length]
[ "def", "get_timestamp", "(", "length", ")", ":", "s", "=", "'%.6f'", "%", "time", ".", "time", "(", ")", "whole", ",", "frac", "=", "map", "(", "int", ",", "s", ".", "split", "(", "'.'", ")", ")", "res", "=", "'%d%d'", "%", "(", "whole", ",", ...
Get a timestamp of `length` in string
[ "Get", "a", "timestamp", "of", "length", "in", "string" ]
python
train
inveniosoftware-contrib/json-merger
json_merger/merger.py
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/merger.py#L135-L224
def merge(self): """Populates result members. Performs the merge algorithm using the specified config and fills in the members that provide stats about the merging procedure. Attributes: merged_root: The result of the merge. aligned_root, aligned_head, aligned_...
[ "def", "merge", "(", "self", ")", ":", "self", ".", "merged_root", "=", "self", ".", "_recursive_merge", "(", "self", ".", "root", ",", "self", ".", "head", ",", "self", ".", "update", ")", "if", "self", ".", "conflicts", ":", "raise", "MergeError", ...
Populates result members. Performs the merge algorithm using the specified config and fills in the members that provide stats about the merging procedure. Attributes: merged_root: The result of the merge. aligned_root, aligned_head, aligned_update: Copies of root, head...
[ "Populates", "result", "members", "." ]
python
train
gwastro/pycbc
pycbc/inference/sampler/base.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/sampler/base.py#L204-L242
def create_new_output_file(sampler, filename, force=False, injection_file=None, **kwargs): """Creates a new output file. If the output file already exists, an ``OSError`` will be raised. This can be overridden by setting ``force`` to ``True``. Parameters ---------- s...
[ "def", "create_new_output_file", "(", "sampler", ",", "filename", ",", "force", "=", "False", ",", "injection_file", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "if", "force", ":", ...
Creates a new output file. If the output file already exists, an ``OSError`` will be raised. This can be overridden by setting ``force`` to ``True``. Parameters ---------- sampler : sampler instance Sampler filename : str Name of the file to create. force : bool, optional ...
[ "Creates", "a", "new", "output", "file", "." ]
python
train
optimizely/python-sdk
optimizely/optimizely.py
https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/optimizely.py#L610-L634
def get_forced_variation(self, experiment_key, user_id): """ Gets the forced variation for a given user and experiment. Args: experiment_key: A string key identifying the experiment. user_id: The user ID. Returns: The forced variation key. None if no forced variation key. """ if...
[ "def", "get_forced_variation", "(", "self", ",", "experiment_key", ",", "user_id", ")", ":", "if", "not", "self", ".", "is_valid", ":", "self", ".", "logger", ".", "error", "(", "enums", ".", "Errors", ".", "INVALID_DATAFILE", ".", "format", "(", "'get_for...
Gets the forced variation for a given user and experiment. Args: experiment_key: A string key identifying the experiment. user_id: The user ID. Returns: The forced variation key. None if no forced variation key.
[ "Gets", "the", "forced", "variation", "for", "a", "given", "user", "and", "experiment", "." ]
python
train
senaite/senaite.core
bika/lims/utils/__init__.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/utils/__init__.py#L71-L83
def t(i18n_msg): """Safely translate and convert to UTF8, any zope i18n msgid returned from a bikaMessageFactory _ """ text = to_unicode(i18n_msg) try: request = api.get_request() domain = getattr(i18n_msg, "domain", "senaite.core") text = translate(text, domain=domain, conte...
[ "def", "t", "(", "i18n_msg", ")", ":", "text", "=", "to_unicode", "(", "i18n_msg", ")", "try", ":", "request", "=", "api", ".", "get_request", "(", ")", "domain", "=", "getattr", "(", "i18n_msg", ",", "\"domain\"", ",", "\"senaite.core\"", ")", "text", ...
Safely translate and convert to UTF8, any zope i18n msgid returned from a bikaMessageFactory _
[ "Safely", "translate", "and", "convert", "to", "UTF8", "any", "zope", "i18n", "msgid", "returned", "from", "a", "bikaMessageFactory", "_" ]
python
train
umich-brcf-bioinf/Connor
connor/consam/readers.py
https://github.com/umich-brcf-bioinf/Connor/blob/b20e9f36e9730c29eaa27ea5fa8b0151e58d2f13/connor/consam/readers.py#L112-L124
def paired_reader_from_bamfile(args, log, usage_logger, annotated_writer): '''Given a BAM file, return a generator that yields filtered, paired reads''' total_aligns = pysamwrapper.total_align_count(args.input_bam) ...
[ "def", "paired_reader_from_bamfile", "(", "args", ",", "log", ",", "usage_logger", ",", "annotated_writer", ")", ":", "total_aligns", "=", "pysamwrapper", ".", "total_align_count", "(", "args", ".", "input_bam", ")", "bamfile_generator", "=", "_bamfile_generator", "...
Given a BAM file, return a generator that yields filtered, paired reads
[ "Given", "a", "BAM", "file", "return", "a", "generator", "that", "yields", "filtered", "paired", "reads" ]
python
train
raamana/mrivis
mrivis/base.py
https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L558-L567
def _create_imshow_objects(self): """Turns off all the x and y axes in each Axis""" # uniform values for initial image can cause weird behaviour with normalization # as imshow.set_data() does not automatically update the normalization!! # using random data is a better choice ...
[ "def", "_create_imshow_objects", "(", "self", ")", ":", "# uniform values for initial image can cause weird behaviour with normalization", "# as imshow.set_data() does not automatically update the normalization!!", "# using random data is a better choice", "random_image", "=", "np", "....
Turns off all the x and y axes in each Axis
[ "Turns", "off", "all", "the", "x", "and", "y", "axes", "in", "each", "Axis" ]
python
train
willthames/ansible-inventory-grapher
lib/ansibleinventorygrapher/inventory.py
https://github.com/willthames/ansible-inventory-grapher/blob/018908594776486a317ef9ed9293a9ef391fe3e9/lib/ansibleinventorygrapher/inventory.py#L121-L135
def _plugins_inventory(self, entities): import os from ansible.plugins.loader import vars_loader from ansible.utils.vars import combine_vars ''' merges all entities by inventory source ''' data = {} for inventory_dir in self.variable_manager._inventory._sources: ...
[ "def", "_plugins_inventory", "(", "self", ",", "entities", ")", ":", "import", "os", "from", "ansible", ".", "plugins", ".", "loader", "import", "vars_loader", "from", "ansible", ".", "utils", ".", "vars", "import", "combine_vars", "data", "=", "{", "}", "...
merges all entities by inventory source
[ "merges", "all", "entities", "by", "inventory", "source" ]
python
train
ptmcg/littletable
littletable.py
https://github.com/ptmcg/littletable/blob/8352f7716e458e55a6997372dadf92e179d19f98/littletable.py#L1087-L1097
def pivot(self, attrlist): """Pivots the data using the given attributes, returning a L{PivotTable}. @param attrlist: list of attributes to be used to construct the pivot table @type attrlist: list of strings, or string of space-delimited attribute names """ if isinstance...
[ "def", "pivot", "(", "self", ",", "attrlist", ")", ":", "if", "isinstance", "(", "attrlist", ",", "basestring", ")", ":", "attrlist", "=", "attrlist", ".", "split", "(", ")", "if", "all", "(", "a", "in", "self", ".", "_indexes", "for", "a", "in", "...
Pivots the data using the given attributes, returning a L{PivotTable}. @param attrlist: list of attributes to be used to construct the pivot table @type attrlist: list of strings, or string of space-delimited attribute names
[ "Pivots", "the", "data", "using", "the", "given", "attributes", "returning", "a", "L", "{", "PivotTable", "}", "." ]
python
train
apache/airflow
airflow/contrib/hooks/gcp_function_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_function_hook.py#L109-L127
def update_function(self, name, body, update_mask): """ Updates Cloud Functions according to the specified update mask. :param name: The name of the function. :type name: str :param body: The body required by the cloud function patch API. :type body: dict :param ...
[ "def", "update_function", "(", "self", ",", "name", ",", "body", ",", "update_mask", ")", ":", "response", "=", "self", ".", "get_conn", "(", ")", ".", "projects", "(", ")", ".", "locations", "(", ")", ".", "functions", "(", ")", ".", "patch", "(", ...
Updates Cloud Functions according to the specified update mask. :param name: The name of the function. :type name: str :param body: The body required by the cloud function patch API. :type body: dict :param update_mask: The update mask - array of fields that should be patched. ...
[ "Updates", "Cloud", "Functions", "according", "to", "the", "specified", "update", "mask", "." ]
python
test
peri-source/peri
peri/states.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/states.py#L273-L288
def _grad_one_param(self, funct, p, dl=2e-5, rts=False, nout=1, **kwargs): """ Gradient of `func` wrt a single parameter `p`. (see _graddoc) """ vals = self.get_values(p) f0 = funct(**kwargs) self.update(p, vals+dl) f1 = funct(**kwargs) if rts: ...
[ "def", "_grad_one_param", "(", "self", ",", "funct", ",", "p", ",", "dl", "=", "2e-5", ",", "rts", "=", "False", ",", "nout", "=", "1", ",", "*", "*", "kwargs", ")", ":", "vals", "=", "self", ".", "get_values", "(", "p", ")", "f0", "=", "funct"...
Gradient of `func` wrt a single parameter `p`. (see _graddoc)
[ "Gradient", "of", "func", "wrt", "a", "single", "parameter", "p", ".", "(", "see", "_graddoc", ")" ]
python
valid
zetaops/zengine
zengine/lib/translation.py
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/translation.py#L328-L361
def _wrap_locale_formatter(fn, locale_type): """Wrap a Babel data formatting function to automatically format for currently installed locale.""" def wrapped_locale_formatter(*args, **kwargs): """A Babel formatting function, wrapped to automatically use the currently installed language. ...
[ "def", "_wrap_locale_formatter", "(", "fn", ",", "locale_type", ")", ":", "def", "wrapped_locale_formatter", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"A Babel formatting function, wrapped to automatically use the\n currently installed language.\n\n ...
Wrap a Babel data formatting function to automatically format for currently installed locale.
[ "Wrap", "a", "Babel", "data", "formatting", "function", "to", "automatically", "format", "for", "currently", "installed", "locale", "." ]
python
train
glitchassassin/lackey
lackey/SettingsDebug.py
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/SettingsDebug.py#L23-L33
def user(self, message): """ Creates a user log (if user logging is turned on) Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT Note: Does *not* use Java string formatting like Sikuli. Format your message with Python ``basestri...
[ "def", "user", "(", "self", ",", "message", ")", ":", "if", "Settings", ".", "UserLogs", ":", "self", ".", "_write_log", "(", "Settings", ".", "UserLogPrefix", ",", "Settings", ".", "UserLogTime", ",", "message", ")" ]
Creates a user log (if user logging is turned on) Uses the log path defined by ``Debug.setUserLogFile()``. If no log file is defined, sends to STDOUT Note: Does *not* use Java string formatting like Sikuli. Format your message with Python ``basestring.format()`` instead.
[ "Creates", "a", "user", "log", "(", "if", "user", "logging", "is", "turned", "on", ")" ]
python
train
binux/pyspider
pyspider/scheduler/task_queue.py
https://github.com/binux/pyspider/blob/3fccfabe2b057b7a56d4a4c79dc0dd6cd2239fe9/pyspider/scheduler/task_queue.py#L190-L225
def put(self, taskid, priority=0, exetime=0): """ Put a task into task queue when use heap sort, if we put tasks(with the same priority and exetime=0) into queue, the queue is not a strict FIFO queue, but more like a FILO stack. It is very possible that when there are co...
[ "def", "put", "(", "self", ",", "taskid", ",", "priority", "=", "0", ",", "exetime", "=", "0", ")", ":", "now", "=", "time", ".", "time", "(", ")", "task", "=", "InQueueTask", "(", "taskid", ",", "priority", ",", "exetime", ")", "self", ".", "mut...
Put a task into task queue when use heap sort, if we put tasks(with the same priority and exetime=0) into queue, the queue is not a strict FIFO queue, but more like a FILO stack. It is very possible that when there are continuous big flow, the speed of select is slower than req...
[ "Put", "a", "task", "into", "task", "queue", "when", "use", "heap", "sort", "if", "we", "put", "tasks", "(", "with", "the", "same", "priority", "and", "exetime", "=", "0", ")", "into", "queue", "the", "queue", "is", "not", "a", "strict", "FIFO", "que...
python
train
zalando/patroni
patroni/dcs/__init__.py
https://github.com/zalando/patroni/blob/f6d29081c90af52064b981cdd877a07338d86038/patroni/dcs/__init__.py#L376-L388
def from_node(index, value): """ >>> h = TimelineHistory.from_node(1, 2) >>> h.lines [] """ try: lines = json.loads(value) except (TypeError, ValueError): lines = None if not isinstance(lines, list): lines = [] r...
[ "def", "from_node", "(", "index", ",", "value", ")", ":", "try", ":", "lines", "=", "json", ".", "loads", "(", "value", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "lines", "=", "None", "if", "not", "isinstance", "(", "lines", ",", ...
>>> h = TimelineHistory.from_node(1, 2) >>> h.lines []
[ ">>>", "h", "=", "TimelineHistory", ".", "from_node", "(", "1", "2", ")", ">>>", "h", ".", "lines", "[]" ]
python
train
a1ezzz/wasp-general
wasp_general/crypto/hmac.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/crypto/hmac.py#L69-L80
def hash(self, key, message=None): """ Return digest of the given message and key :param key: secret HMAC key :param message: code (message) to authenticate :return: bytes """ hmac_obj = hmac.HMAC(key, self.__digest_generator, backend=default_backend()) if message is not None: hmac_obj.update(message...
[ "def", "hash", "(", "self", ",", "key", ",", "message", "=", "None", ")", ":", "hmac_obj", "=", "hmac", ".", "HMAC", "(", "key", ",", "self", ".", "__digest_generator", ",", "backend", "=", "default_backend", "(", ")", ")", "if", "message", "is", "no...
Return digest of the given message and key :param key: secret HMAC key :param message: code (message) to authenticate :return: bytes
[ "Return", "digest", "of", "the", "given", "message", "and", "key" ]
python
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/generators.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L301-L325
def match_rank (self, ps): """ Returns true if the generator can be run with the specified properties. """ # See if generator's requirements are satisfied by # 'properties'. Treat a feature name in requirements # (i.e. grist-only element), as matching any value of th...
[ "def", "match_rank", "(", "self", ",", "ps", ")", ":", "# See if generator's requirements are satisfied by", "# 'properties'. Treat a feature name in requirements", "# (i.e. grist-only element), as matching any value of the", "# feature.", "assert", "isinstance", "(", "ps", ",", "...
Returns true if the generator can be run with the specified properties.
[ "Returns", "true", "if", "the", "generator", "can", "be", "run", "with", "the", "specified", "properties", "." ]
python
train
PyCQA/astroid
astroid/node_classes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L4183-L4201
def block_range(self, lineno): """Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at the given line number. ...
[ "def", "block_range", "(", "self", ",", "lineno", ")", ":", "child", "=", "self", ".", "body", "[", "0", "]", "# py2.5 try: except: finally:", "if", "(", "isinstance", "(", "child", ",", "TryExcept", ")", "and", "child", ".", "fromlineno", "==", "self", ...
Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at the given line number. :rtype: tuple(int, int)
[ "Get", "a", "range", "from", "the", "given", "line", "number", "to", "where", "this", "node", "ends", "." ]
python
train
openstack/python-monascaclient
monascaclient/v2_0/shell.py
https://github.com/openstack/python-monascaclient/blob/03b07534145928eb2debad938da033c232dda105/monascaclient/v2_0/shell.py#L788-L812
def do_alarm_definition_create(mc, args): '''Create an alarm definition.''' fields = {} fields['name'] = args.name if args.description: fields['description'] = args.description fields['expression'] = args.expression if args.alarm_actions: fields['alarm_actions'] = args.alarm_acti...
[ "def", "do_alarm_definition_create", "(", "mc", ",", "args", ")", ":", "fields", "=", "{", "}", "fields", "[", "'name'", "]", "=", "args", ".", "name", "if", "args", ".", "description", ":", "fields", "[", "'description'", "]", "=", "args", ".", "descr...
Create an alarm definition.
[ "Create", "an", "alarm", "definition", "." ]
python
train
chrislit/abydos
abydos/stats/_confusion_table.py
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L1263-L1302
def mcc(self): r"""Return Matthews correlation coefficient (MCC). The Matthews correlation coefficient is defined in :cite:`Matthews:1975` as: :math:`\frac{(tp \cdot tn) - (fp \cdot fn)} {\sqrt{(tp + fp)(tp + fn)(tn + fp)(tn + fn)}}` This is equivalent to the geometric ...
[ "def", "mcc", "(", "self", ")", ":", "if", "(", "(", "(", "self", ".", "_tp", "+", "self", ".", "_fp", ")", "*", "(", "self", ".", "_tp", "+", "self", ".", "_fn", ")", "*", "(", "self", ".", "_tn", "+", "self", ".", "_fp", ")", "*", "(", ...
r"""Return Matthews correlation coefficient (MCC). The Matthews correlation coefficient is defined in :cite:`Matthews:1975` as: :math:`\frac{(tp \cdot tn) - (fp \cdot fn)} {\sqrt{(tp + fp)(tp + fn)(tn + fp)(tn + fn)}}` This is equivalent to the geometric mean of informedness an...
[ "r", "Return", "Matthews", "correlation", "coefficient", "(", "MCC", ")", "." ]
python
valid
opencobra/cobrapy
cobra/sampling/hr_sampler.py
https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/sampling/hr_sampler.py#L369-L383
def _bounds_dist(self, p): """Get the lower and upper bound distances. Negative is bad.""" prob = self.problem lb_dist = (p - prob.variable_bounds[0, ]).min() ub_dist = (prob.variable_bounds[1, ] - p).min() if prob.bounds.shape[0] > 0: const = prob.inequalities.dot(...
[ "def", "_bounds_dist", "(", "self", ",", "p", ")", ":", "prob", "=", "self", ".", "problem", "lb_dist", "=", "(", "p", "-", "prob", ".", "variable_bounds", "[", "0", ",", "]", ")", ".", "min", "(", ")", "ub_dist", "=", "(", "prob", ".", "variable...
Get the lower and upper bound distances. Negative is bad.
[ "Get", "the", "lower", "and", "upper", "bound", "distances", ".", "Negative", "is", "bad", "." ]
python
valid
diging/tethne
tethne/classes/graphcollection.py
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/classes/graphcollection.py#L213-L235
def edges(self, data=False, native=True): """ Returns a list of all edges in the :class:`.GraphCollection`\. Parameters ---------- data : bool (default: False) If True, returns a list of 3-tuples containing source and target node labels, and attributes. ...
[ "def", "edges", "(", "self", ",", "data", "=", "False", ",", "native", "=", "True", ")", ":", "edges", "=", "self", ".", "master_graph", ".", "edges", "(", "data", "=", "data", ")", "if", "native", ":", "if", "data", ":", "edges", "=", "[", "(", ...
Returns a list of all edges in the :class:`.GraphCollection`\. Parameters ---------- data : bool (default: False) If True, returns a list of 3-tuples containing source and target node labels, and attributes. Returns ------- edges : list
[ "Returns", "a", "list", "of", "all", "edges", "in", "the", ":", "class", ":", ".", "GraphCollection", "\\", "." ]
python
train
sprockets/sprockets.mixins.metrics
sprockets/mixins/metrics/statsd.py
https://github.com/sprockets/sprockets.mixins.metrics/blob/0b17d5f0c09a2be9db779e17e6789d3d5ff9a0d0/sprockets/mixins/metrics/statsd.py#L51-L66
def execution_timer(self, *path): """ Record the time it takes to perform an arbitrary code block. :param path: elements of the metric path to record This method returns a context manager that records the amount of time spent inside of the context and submits a timing metric ...
[ "def", "execution_timer", "(", "self", ",", "*", "path", ")", ":", "start", "=", "time", ".", "time", "(", ")", "try", ":", "yield", "finally", ":", "self", ".", "record_timing", "(", "max", "(", "start", ",", "time", ".", "time", "(", ")", ")", ...
Record the time it takes to perform an arbitrary code block. :param path: elements of the metric path to record This method returns a context manager that records the amount of time spent inside of the context and submits a timing metric to the specified `path` using (:meth:`record_tim...
[ "Record", "the", "time", "it", "takes", "to", "perform", "an", "arbitrary", "code", "block", "." ]
python
train
gwpy/gwpy
gwpy/frequencyseries/frequencyseries.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/frequencyseries/frequencyseries.py#L133-L163
def read(cls, source, *args, **kwargs): """Read data into a `FrequencySeries` Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats. Parameters ---------- ...
[ "def", "read", "(", "cls", ",", "source", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "io_registry", ".", "read", "(", "cls", ",", "source", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Read data into a `FrequencySeries` Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats. Parameters ---------- source : `str`, `list` Source of data...
[ "Read", "data", "into", "a", "FrequencySeries" ]
python
train
martinpitt/python-dbusmock
dbusmock/mockobject.py
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/mockobject.py#L165-L192
def Set(self, interface_name, property_name, value, *args, **kwargs): '''Standard D-Bus API for setting a property value''' self.log('Set %s.%s%s' % (interface_name, property_name, self.format_args((value,)))) try: ...
[ "def", "Set", "(", "self", ",", "interface_name", ",", "property_name", ",", "value", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", "(", "'Set %s.%s%s'", "%", "(", "interface_name", ",", "property_name", ",", "self", ".", "fo...
Standard D-Bus API for setting a property value
[ "Standard", "D", "-", "Bus", "API", "for", "setting", "a", "property", "value" ]
python
train
tensorflow/hub
tensorflow_hub/resolver.py
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L83-L86
def create_local_module_dir(cache_dir, module_name): """Creates and returns the name of directory where to cache a module.""" tf_v1.gfile.MakeDirs(cache_dir) return os.path.join(cache_dir, module_name)
[ "def", "create_local_module_dir", "(", "cache_dir", ",", "module_name", ")", ":", "tf_v1", ".", "gfile", ".", "MakeDirs", "(", "cache_dir", ")", "return", "os", ".", "path", ".", "join", "(", "cache_dir", ",", "module_name", ")" ]
Creates and returns the name of directory where to cache a module.
[ "Creates", "and", "returns", "the", "name", "of", "directory", "where", "to", "cache", "a", "module", "." ]
python
train
bramwelt/field
field/__init__.py
https://github.com/bramwelt/field/blob/05f38170d080fb48e76aa984bf4aa6b3d05ea6dc/field/__init__.py#L49-L71
def column_converter(string): """ Converts column arguments to integers. - Accepts columns in form of INT, or the range INT-INT. - Returns a list of one or more integers. """ column = string.strip(',') if '-' in column: column_range = map(int, column.split('-')) # For decrea...
[ "def", "column_converter", "(", "string", ")", ":", "column", "=", "string", ".", "strip", "(", "','", ")", "if", "'-'", "in", "column", ":", "column_range", "=", "map", "(", "int", ",", "column", ".", "split", "(", "'-'", ")", ")", "# For decreasing r...
Converts column arguments to integers. - Accepts columns in form of INT, or the range INT-INT. - Returns a list of one or more integers.
[ "Converts", "column", "arguments", "to", "integers", "." ]
python
train
alex-kostirin/pyatomac
atomac/AXClasses.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L656-L671
def waitForFocusToMatchCriteria(self, timeout=10, **kwargs): """Convenience method to wait for focused element to change (to element matching kwargs criteria). Returns: Element or None """ def _matchFocused(retelem, **kwargs): return retelem if retelem._match(**kwa...
[ "def", "waitForFocusToMatchCriteria", "(", "self", ",", "timeout", "=", "10", ",", "*", "*", "kwargs", ")", ":", "def", "_matchFocused", "(", "retelem", ",", "*", "*", "kwargs", ")", ":", "return", "retelem", "if", "retelem", ".", "_match", "(", "*", "...
Convenience method to wait for focused element to change (to element matching kwargs criteria). Returns: Element or None
[ "Convenience", "method", "to", "wait", "for", "focused", "element", "to", "change", "(", "to", "element", "matching", "kwargs", "criteria", ")", "." ]
python
valid
yyuu/botornado
botornado/s3/bucket.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/botornado/s3/bucket.py#L175-L213
def delete_key(self, key_name, headers=None, version_id=None, mfa_token=None, callback=None): """ Deletes a key from the bucket. If a version_id is provided, only that version of the key will be deleted. :type key_name: string :param key_name: The key...
[ "def", "delete_key", "(", "self", ",", "key_name", ",", "headers", "=", "None", ",", "version_id", "=", "None", ",", "mfa_token", "=", "None", ",", "callback", "=", "None", ")", ":", "provider", "=", "self", ".", "connection", ".", "provider", "if", "v...
Deletes a key from the bucket. If a version_id is provided, only that version of the key will be deleted. :type key_name: string :param key_name: The key name to delete :type version_id: string :param version_id: The version ID (optional) :type mfa_tok...
[ "Deletes", "a", "key", "from", "the", "bucket", ".", "If", "a", "version_id", "is", "provided", "only", "that", "version", "of", "the", "key", "will", "be", "deleted", ".", ":", "type", "key_name", ":", "string", ":", "param", "key_name", ":", "The", "...
python
train