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
taskcluster/taskcluster-client.py
taskcluster/client.py
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/client.py#L255-L281
def _makeApiCall(self, entry, *args, **kwargs): """ This function is used to dispatch calls to other functions for a given API Reference entry""" x = self._processArgs(entry, *args, **kwargs) routeParams, payload, query, paginationHandler, paginationLimit = x route = self._subAr...
[ "def", "_makeApiCall", "(", "self", ",", "entry", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "x", "=", "self", ".", "_processArgs", "(", "entry", ",", "*", "args", ",", "*", "*", "kwargs", ")", "routeParams", ",", "payload", ",", "query",...
This function is used to dispatch calls to other functions for a given API Reference entry
[ "This", "function", "is", "used", "to", "dispatch", "calls", "to", "other", "functions", "for", "a", "given", "API", "Reference", "entry" ]
python
train
chemlab/chemlab
chemlab/libs/chemspipy.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/libs/chemspipy.py#L183-L190
def image(self): """ Return string containing PNG binary image data of 2D structure image """ if self._image is None: apiurl = 'http://www.chemspider.com/Search.asmx/GetCompoundThumbnail?id=%s&token=%s' % (self.csid,TOKEN) response = urlopen(apiurl) tree = ET.parse(re...
[ "def", "image", "(", "self", ")", ":", "if", "self", ".", "_image", "is", "None", ":", "apiurl", "=", "'http://www.chemspider.com/Search.asmx/GetCompoundThumbnail?id=%s&token=%s'", "%", "(", "self", ".", "csid", ",", "TOKEN", ")", "response", "=", "urlopen", "("...
Return string containing PNG binary image data of 2D structure image
[ "Return", "string", "containing", "PNG", "binary", "image", "data", "of", "2D", "structure", "image" ]
python
train
MAVENSDC/cdflib
cdflib/cdfwrite.py
https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfwrite.py#L1295-L1310
def _get_recrange(self, f, VXRoffset): ''' Finds the first and last record numbers pointed by the VXR Assumes the VXRs are in order ''' f.seek(VXRoffset+20) # Num entries numEntries = int.from_bytes(f.read(4), 'big', signed=True) # used entries use...
[ "def", "_get_recrange", "(", "self", ",", "f", ",", "VXRoffset", ")", ":", "f", ".", "seek", "(", "VXRoffset", "+", "20", ")", "# Num entries", "numEntries", "=", "int", ".", "from_bytes", "(", "f", ".", "read", "(", "4", ")", ",", "'big'", ",", "s...
Finds the first and last record numbers pointed by the VXR Assumes the VXRs are in order
[ "Finds", "the", "first", "and", "last", "record", "numbers", "pointed", "by", "the", "VXR", "Assumes", "the", "VXRs", "are", "in", "order" ]
python
train
sampsyo/confuse
confuse.py
https://github.com/sampsyo/confuse/blob/9ff0992e30470f6822824711950e6dd906e253fb/confuse.py#L915-L922
def _add_user_source(self): """Add the configuration options from the YAML file in the user's configuration directory (given by `config_dir`) if it exists. """ filename = self.user_config_path() if os.path.isfile(filename): self.add(ConfigSource(load_yaml(file...
[ "def", "_add_user_source", "(", "self", ")", ":", "filename", "=", "self", ".", "user_config_path", "(", ")", "if", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "self", ".", "add", "(", "ConfigSource", "(", "load_yaml", "(", "filename", ...
Add the configuration options from the YAML file in the user's configuration directory (given by `config_dir`) if it exists.
[ "Add", "the", "configuration", "options", "from", "the", "YAML", "file", "in", "the", "user", "s", "configuration", "directory", "(", "given", "by", "config_dir", ")", "if", "it", "exists", "." ]
python
train
tgbugs/pyontutils
ilxutils/ilxutils/simple_scicrunch_client.py
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/simple_scicrunch_client.py#L152-L160
def get_data_from_ilx(self, ilx_id): ''' Gets full meta data (expect their annotations and relationships) from is ILX ID ''' ilx_id = self.fix_ilx(ilx_id) url_base = self.base_path + "ilx/search/identifier/{identifier}?key={APIKEY}" url = url_base.format(identifier=ilx_id, APIKEY=self.AP...
[ "def", "get_data_from_ilx", "(", "self", ",", "ilx_id", ")", ":", "ilx_id", "=", "self", ".", "fix_ilx", "(", "ilx_id", ")", "url_base", "=", "self", ".", "base_path", "+", "\"ilx/search/identifier/{identifier}?key={APIKEY}\"", "url", "=", "url_base", ".", "form...
Gets full meta data (expect their annotations and relationships) from is ILX ID
[ "Gets", "full", "meta", "data", "(", "expect", "their", "annotations", "and", "relationships", ")", "from", "is", "ILX", "ID" ]
python
train
polyaxon/polyaxon
polyaxon/signals/deletion.py
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/signals/deletion.py#L56-L77
def experiment_group_pre_delete(sender, **kwargs): """Delete all group outputs.""" instance = kwargs['instance'] if instance.is_selection: return # Delete outputs and logs celery_app.send_task( SchedulerCeleryTasks.STORES_SCHEDULE_OUTPUTS_DELETION, kwargs={ 'per...
[ "def", "experiment_group_pre_delete", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "if", "instance", ".", "is_selection", ":", "return", "# Delete outputs and logs", "celery_app", ".", "send_task", "(", "Sc...
Delete all group outputs.
[ "Delete", "all", "group", "outputs", "." ]
python
train
SmokinCaterpillar/pypet
pypet/storageservice.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L696-L700
def _overview_group(self): """Direct link to the overview group""" if self._overview_group_ is None: self._overview_group_ = self._all_create_or_get_groups('overview')[0] return self._overview_group_
[ "def", "_overview_group", "(", "self", ")", ":", "if", "self", ".", "_overview_group_", "is", "None", ":", "self", ".", "_overview_group_", "=", "self", ".", "_all_create_or_get_groups", "(", "'overview'", ")", "[", "0", "]", "return", "self", ".", "_overvie...
Direct link to the overview group
[ "Direct", "link", "to", "the", "overview", "group" ]
python
test
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_nameserver.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_nameserver.py#L87-L101
def get_nameserver_detail_output_show_nameserver_nameserver_fc4s(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_nameserver_detail = ET.Element("get_nameserver_detail") config = get_nameserver_detail output = ET.SubElement(get_nameserver_deta...
[ "def", "get_nameserver_detail_output_show_nameserver_nameserver_fc4s", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_nameserver_detail", "=", "ET", ".", "Element", "(", "\"get_nameserver_detail\"", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
log2timeline/dfdatetime
dfdatetime/interface.py
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L389-L503
def _CopyTimeFromString(self, time_string): """Copies a time from a string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The seconds fraction a...
[ "def", "_CopyTimeFromString", "(", "self", ",", "time_string", ")", ":", "time_string_length", "=", "len", "(", "time_string", ")", "# The time string should at least contain 'hh:mm:ss'.", "if", "time_string_length", "<", "8", ":", "raise", "ValueError", "(", "'Time str...
Copies a time from a string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The seconds fraction and time zone offset are optional. Re...
[ "Copies", "a", "time", "from", "a", "string", "." ]
python
train
ev3dev/ev3dev-lang-python
ev3dev2/led.py
https://github.com/ev3dev/ev3dev-lang-python/blob/afc98d35004b533dc161a01f7c966e78607d7c1e/ev3dev2/led.py#L140-L145
def brightness(self): """ Sets the brightness level. Possible values are from 0 to `max_brightness`. """ self._brightness, value = self.get_attr_int(self._brightness, 'brightness') return value
[ "def", "brightness", "(", "self", ")", ":", "self", ".", "_brightness", ",", "value", "=", "self", ".", "get_attr_int", "(", "self", ".", "_brightness", ",", "'brightness'", ")", "return", "value" ]
Sets the brightness level. Possible values are from 0 to `max_brightness`.
[ "Sets", "the", "brightness", "level", ".", "Possible", "values", "are", "from", "0", "to", "max_brightness", "." ]
python
train
zero-os/0-core
client/py-client/zeroos/core0/client/client.py
https://github.com/zero-os/0-core/blob/69f6ce845ab8b8ad805a79a415227e7ac566c218/client/py-client/zeroos/core0/client/client.py#L516-L529
def move(self, path, destination): """ Move a path to destination :param path: source :param destination: destination :return: """ args = { 'path': path, 'destination': destination, } return self._client.json('filesystem.m...
[ "def", "move", "(", "self", ",", "path", ",", "destination", ")", ":", "args", "=", "{", "'path'", ":", "path", ",", "'destination'", ":", "destination", ",", "}", "return", "self", ".", "_client", ".", "json", "(", "'filesystem.move'", ",", "args", ")...
Move a path to destination :param path: source :param destination: destination :return:
[ "Move", "a", "path", "to", "destination" ]
python
train
TUT-ARG/sed_eval
evaluators/sound_event_eval.py
https://github.com/TUT-ARG/sed_eval/blob/0cb1b6d11ceec4fe500cc9b31079c9d8666ed6eb/evaluators/sound_event_eval.py#L94-L144
def main(argv): """Main """ parameters = process_arguments(argv) file_list = sed_eval.io.load_file_pair_list(parameters['file_list']) path = os.path.dirname(parameters['file_list']) data = [] all_data = dcase_util.containers.MetaDataContainer() for file_pair in file_list: refer...
[ "def", "main", "(", "argv", ")", ":", "parameters", "=", "process_arguments", "(", "argv", ")", "file_list", "=", "sed_eval", ".", "io", ".", "load_file_pair_list", "(", "parameters", "[", "'file_list'", "]", ")", "path", "=", "os", ".", "path", ".", "di...
Main
[ "Main" ]
python
train
nerdvegas/rez
src/rez/package_search.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_search.py#L359-L374
def format_search_results(self, search_results): """Format search results. Args: search_results (list of `ResourceSearchResult`): Search to format. Returns: List of 2-tuple: Text and color to print in. """ formatted_lines = [] for search_result ...
[ "def", "format_search_results", "(", "self", ",", "search_results", ")", ":", "formatted_lines", "=", "[", "]", "for", "search_result", "in", "search_results", ":", "lines", "=", "self", ".", "_format_search_result", "(", "search_result", ")", "formatted_lines", "...
Format search results. Args: search_results (list of `ResourceSearchResult`): Search to format. Returns: List of 2-tuple: Text and color to print in.
[ "Format", "search", "results", "." ]
python
train
andreafioraldi/angrdbg
angrdbg/page_7.py
https://github.com/andreafioraldi/angrdbg/blob/939b20fb9b341aee695d2db12142b1eddc5b555a/angrdbg/page_7.py#L92-L115
def load_slice(self, state, start, end): """ Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object) """ items = [] if sta...
[ "def", "load_slice", "(", "self", ",", "state", ",", "start", ",", "end", ")", ":", "items", "=", "[", "]", "if", "start", ">", "self", ".", "_page_addr", "+", "self", ".", "_page_size", "or", "end", "<", "self", ".", "_page_addr", ":", "l", ".", ...
Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object)
[ "Return", "the", "memory", "objects", "overlapping", "with", "the", "provided", "slice", ".", ":", "param", "start", ":", "the", "start", "address", ":", "param", "end", ":", "the", "end", "address", "(", "non", "-", "inclusive", ")", ":", "returns", ":"...
python
train
saltstack/salt
salt/utils/jinja.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L92-L98
def check_cache(self, template): ''' Cache a file only once ''' if template not in self.cached: self.cache_file(template) self.cached.append(template)
[ "def", "check_cache", "(", "self", ",", "template", ")", ":", "if", "template", "not", "in", "self", ".", "cached", ":", "self", ".", "cache_file", "(", "template", ")", "self", ".", "cached", ".", "append", "(", "template", ")" ]
Cache a file only once
[ "Cache", "a", "file", "only", "once" ]
python
train
pantsbuild/pants
src/python/pants/reporting/reporting_server.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/reporting/reporting_server.py#L82-L88
def _handle_runs(self, relpath, params): """Show a listing of all pants runs since the last clean-all.""" runs_by_day = self._partition_runs_by_day() args = self._default_template_args('run_list.html') args['runs_by_day'] = runs_by_day content = self._renderer.render_name('base.html', args).encode("...
[ "def", "_handle_runs", "(", "self", ",", "relpath", ",", "params", ")", ":", "runs_by_day", "=", "self", ".", "_partition_runs_by_day", "(", ")", "args", "=", "self", ".", "_default_template_args", "(", "'run_list.html'", ")", "args", "[", "'runs_by_day'", "]"...
Show a listing of all pants runs since the last clean-all.
[ "Show", "a", "listing", "of", "all", "pants", "runs", "since", "the", "last", "clean", "-", "all", "." ]
python
train
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/filters/aleph_filter.py
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/filters/aleph_filter.py#L20-L41
def name_to_vector(name): """ Convert `name` to the ASCII vector. Example: >>> name_to_vector("ing. Franta Putšálek") ['putsalek', 'franta', 'ing'] Args: name (str): Name which will be vectorized. Returns: list: Vector created from name. """ if not isinstan...
[ "def", "name_to_vector", "(", "name", ")", ":", "if", "not", "isinstance", "(", "name", ",", "unicode", ")", ":", "name", "=", "name", ".", "decode", "(", "\"utf-8\"", ")", "name", "=", "name", ".", "lower", "(", ")", "name", "=", "unicodedata", ".",...
Convert `name` to the ASCII vector. Example: >>> name_to_vector("ing. Franta Putšálek") ['putsalek', 'franta', 'ing'] Args: name (str): Name which will be vectorized. Returns: list: Vector created from name.
[ "Convert", "name", "to", "the", "ASCII", "vector", "." ]
python
train
apache/incubator-mxnet
example/ssd/dataset/pycocotools/coco.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/ssd/dataset/pycocotools/coco.py#L152-L172
def getCatIds(self, catNms=[], supNms=[], catIds=[]): """ filtering parameters. default skips that filter. :param catNms (str array) : get cats for given cat names :param supNms (str array) : get cats for given supercategory names :param catIds (int array) : get cats for given...
[ "def", "getCatIds", "(", "self", ",", "catNms", "=", "[", "]", ",", "supNms", "=", "[", "]", ",", "catIds", "=", "[", "]", ")", ":", "catNms", "=", "catNms", "if", "type", "(", "catNms", ")", "==", "list", "else", "[", "catNms", "]", "supNms", ...
filtering parameters. default skips that filter. :param catNms (str array) : get cats for given cat names :param supNms (str array) : get cats for given supercategory names :param catIds (int array) : get cats for given cat ids :return: ids (int array) : integer array of cat ids
[ "filtering", "parameters", ".", "default", "skips", "that", "filter", ".", ":", "param", "catNms", "(", "str", "array", ")", ":", "get", "cats", "for", "given", "cat", "names", ":", "param", "supNms", "(", "str", "array", ")", ":", "get", "cats", "for"...
python
train
angr/angr
angr/state_plugins/javavm_memory.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_memory.py#L198-L252
def load_array_elements(self, array, start_idx, no_of_elements): """ Loads either a single element or a range of elements from the array. :param array: Reference to the array. :param start_idx: Starting index for the load. :param no_of_elements: Number of elemen...
[ "def", "load_array_elements", "(", "self", ",", "array", ",", "start_idx", ",", "no_of_elements", ")", ":", "# concretize start index", "concrete_start_idxes", "=", "self", ".", "concretize_load_idx", "(", "start_idx", ")", "if", "len", "(", "concrete_start_idxes", ...
Loads either a single element or a range of elements from the array. :param array: Reference to the array. :param start_idx: Starting index for the load. :param no_of_elements: Number of elements to load.
[ "Loads", "either", "a", "single", "element", "or", "a", "range", "of", "elements", "from", "the", "array", "." ]
python
train
cenkalti/kuyruk
kuyruk/worker.py
https://github.com/cenkalti/kuyruk/blob/c99d66be9d8fb077610f2fa883d5a1d268b42f04/kuyruk/worker.py#L81-L115
def run(self) -> None: """Runs the worker and consumes messages from RabbitMQ. Returns only after `shutdown()` is called. """ if self._logging_level: logging.basicConfig( level=getattr(logging, self._logging_level.upper()), format="%(levelname...
[ "def", "run", "(", "self", ")", "->", "None", ":", "if", "self", ".", "_logging_level", ":", "logging", ".", "basicConfig", "(", "level", "=", "getattr", "(", "logging", ",", "self", ".", "_logging_level", ".", "upper", "(", ")", ")", ",", "format", ...
Runs the worker and consumes messages from RabbitMQ. Returns only after `shutdown()` is called.
[ "Runs", "the", "worker", "and", "consumes", "messages", "from", "RabbitMQ", ".", "Returns", "only", "after", "shutdown", "()", "is", "called", "." ]
python
train
brechtm/rinohtype
src/rinoh/backend/pdf/xobject/purepng.py
https://github.com/brechtm/rinohtype/blob/40a63c4e5ad7550f62b6860f1812cb67cafb9dc7/src/rinoh/backend/pdf/xobject/purepng.py#L582-L604
def __undo_filter_paeth(self, scanline): """Undo Paeth filter.""" ai = -self.fu previous = self.prev for i in range(len(scanline)): x = scanline[i] if ai < 0: pr = previous[i] # a = c = 0 else: a = scanline[ai] # resul...
[ "def", "__undo_filter_paeth", "(", "self", ",", "scanline", ")", ":", "ai", "=", "-", "self", ".", "fu", "previous", "=", "self", ".", "prev", "for", "i", "in", "range", "(", "len", "(", "scanline", ")", ")", ":", "x", "=", "scanline", "[", "i", ...
Undo Paeth filter.
[ "Undo", "Paeth", "filter", "." ]
python
train
square/pylink
pylink/__main__.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L570-L603
def main(args=None): """Main command-line interface entrypoint. Runs the given subcommand or argument that were specified. If not given a ``args`` parameter, assumes the arguments are passed on the command-line. Args: args (list): list of command-line arguments Returns: Zero on succe...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "parser", "=", "create_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", "args", ")", "if", ...
Main command-line interface entrypoint. Runs the given subcommand or argument that were specified. If not given a ``args`` parameter, assumes the arguments are passed on the command-line. Args: args (list): list of command-line arguments Returns: Zero on success, non-zero otherwise.
[ "Main", "command", "-", "line", "interface", "entrypoint", "." ]
python
train
aegirhall/console-menu
consolemenu/menu_component.py
https://github.com/aegirhall/console-menu/blob/1a28959d6f1dd6ac79c87b11efd8529d05532422/consolemenu/menu_component.py#L308-L317
def show_item_top_border(self, item_text, flag): """ Sets a flag that will show a top border for an item with the specified text. :param item_text: the text property of the item :param flag: boolean specifying if the border should be shown. """ if flag: self._...
[ "def", "show_item_top_border", "(", "self", ",", "item_text", ",", "flag", ")", ":", "if", "flag", ":", "self", ".", "__top_border_dict", "[", "item_text", "]", "=", "True", "else", ":", "self", ".", "__top_border_dict", ".", "pop", "(", "item_text", ",", ...
Sets a flag that will show a top border for an item with the specified text. :param item_text: the text property of the item :param flag: boolean specifying if the border should be shown.
[ "Sets", "a", "flag", "that", "will", "show", "a", "top", "border", "for", "an", "item", "with", "the", "specified", "text", ".", ":", "param", "item_text", ":", "the", "text", "property", "of", "the", "item", ":", "param", "flag", ":", "boolean", "spec...
python
train
buckket/twtxt
twtxt/config.py
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L63-L93
def create_config(cls, cfgfile, nick, twtfile, twturl, disclose_identity, add_news): """Create a new config file at the default location. :param str cfgfile: path to the config file :param str nick: nickname to use for own tweets :param str twtfile: path to the local twtxt file ...
[ "def", "create_config", "(", "cls", ",", "cfgfile", ",", "nick", ",", "twtfile", ",", "twturl", ",", "disclose_identity", ",", "add_news", ")", ":", "cfgfile_dir", "=", "os", ".", "path", ".", "dirname", "(", "cfgfile", ")", "if", "not", "os", ".", "pa...
Create a new config file at the default location. :param str cfgfile: path to the config file :param str nick: nickname to use for own tweets :param str twtfile: path to the local twtxt file :param str twturl: URL to the remote twtxt file :param bool disclose_identity: if true t...
[ "Create", "a", "new", "config", "file", "at", "the", "default", "location", "." ]
python
valid
tjvr/kurt
kurt/__init__.py
https://github.com/tjvr/kurt/blob/fcccd80cae11dc233f6dd02b40ec9a388c62f259/kurt/__init__.py#L2445-L2454
def load(cls, path): """Load Waveform from file.""" assert os.path.exists(path), "No such file: %r" % path (folder, filename) = os.path.split(path) (name, extension) = os.path.splitext(filename) wave = Waveform(None) wave._path = path return wave
[ "def", "load", "(", "cls", ",", "path", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "path", ")", ",", "\"No such file: %r\"", "%", "path", "(", "folder", ",", "filename", ")", "=", "os", ".", "path", ".", "split", "(", "path", ")", ...
Load Waveform from file.
[ "Load", "Waveform", "from", "file", "." ]
python
train
biocommons/eutils
eutils/client.py
https://github.com/biocommons/eutils/blob/0ec7444fd520d2af56114122442ff8f60952db0b/eutils/client.py#L52-L68
def einfo(self, db=None): """query the einfo endpoint :param db: string (optional) :rtype: EInfo or EInfoDB object If db is None, the reply is a list of databases, which is returned in an EInfo object (which has a databases() method). If db is not None, the reply is in...
[ "def", "einfo", "(", "self", ",", "db", "=", "None", ")", ":", "if", "db", "is", "None", ":", "return", "EInfoResult", "(", "self", ".", "_qs", ".", "einfo", "(", ")", ")", ".", "dblist", "return", "EInfoResult", "(", "self", ".", "_qs", ".", "ei...
query the einfo endpoint :param db: string (optional) :rtype: EInfo or EInfoDB object If db is None, the reply is a list of databases, which is returned in an EInfo object (which has a databases() method). If db is not None, the reply is information about the specified ...
[ "query", "the", "einfo", "endpoint" ]
python
train
9b/google-alerts
google_alerts/__init__.py
https://github.com/9b/google-alerts/blob/69a502cbcccf1bcafe963ed40d286441b0117e04/google_alerts/__init__.py#L382-L403
def delete(self, monitor_id): """Delete a monitor by ID.""" if not self._state: raise InvalidState("State was not properly obtained from the app") monitors = self.list() # Get the latest set of monitors bit = None for monitor in monitors: if monitor_id !=...
[ "def", "delete", "(", "self", ",", "monitor_id", ")", ":", "if", "not", "self", ".", "_state", ":", "raise", "InvalidState", "(", "\"State was not properly obtained from the app\"", ")", "monitors", "=", "self", ".", "list", "(", ")", "# Get the latest set of moni...
Delete a monitor by ID.
[ "Delete", "a", "monitor", "by", "ID", "." ]
python
train
mitsei/dlkit
dlkit/json_/authorization/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/objects.py#L370-L383
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidRelationshipForm._init_map(self, record_types=record_types) self._my_map['assignedVaultIds'] = [str(kwargs['vault_id'])] self._my_map['functionId'] = str(kwargs['function_id']) self._my_m...
[ "def", "_init_map", "(", "self", ",", "record_types", "=", "None", ",", "*", "*", "kwargs", ")", ":", "osid_objects", ".", "OsidRelationshipForm", ".", "_init_map", "(", "self", ",", "record_types", "=", "record_types", ")", "self", ".", "_my_map", "[", "'...
Initialize form map
[ "Initialize", "form", "map" ]
python
train
gijzelaerr/python-snap7
snap7/util.py
https://github.com/gijzelaerr/python-snap7/blob/a6db134c7a3a2ef187b9eca04669221d6fc634c3/snap7/util.py#L355-L361
def get_bytearray(self): """ return bytearray from self or DB parent """ if isinstance(self._bytearray, DB): return self._bytearray._bytearray return self._bytearray
[ "def", "get_bytearray", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_bytearray", ",", "DB", ")", ":", "return", "self", ".", "_bytearray", ".", "_bytearray", "return", "self", ".", "_bytearray" ]
return bytearray from self or DB parent
[ "return", "bytearray", "from", "self", "or", "DB", "parent" ]
python
train
kieferk/dfply
dfply/reshape.py
https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L143-L201
def spread(df, key, values, convert=False): """ Transforms a "long" DataFrame into a "wide" format using a key and value column. If you have a mixed datatype column in your long-format DataFrame then the default behavior is for the spread columns to be of type `object`, or string. If you want t...
[ "def", "spread", "(", "df", ",", "key", ",", "values", ",", "convert", "=", "False", ")", ":", "# Taken mostly from dplython package", "columns", "=", "df", ".", "columns", ".", "tolist", "(", ")", "id_cols", "=", "[", "col", "for", "col", "in", "columns...
Transforms a "long" DataFrame into a "wide" format using a key and value column. If you have a mixed datatype column in your long-format DataFrame then the default behavior is for the spread columns to be of type `object`, or string. If you want to try to convert dtypes when spreading, you can set ...
[ "Transforms", "a", "long", "DataFrame", "into", "a", "wide", "format", "using", "a", "key", "and", "value", "column", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L577-L600
def path_shift(self, count=1): ''' Shift some levels of PATH_INFO into SCRIPT_NAME and return the moved part. count defaults to 1''' #/a/b/ /c/d --> 'a','b' 'c','d' if count == 0: return '' pathlist = self.path.strip('/').split('/') scriptlist = self.environ.get('S...
[ "def", "path_shift", "(", "self", ",", "count", "=", "1", ")", ":", "#/a/b/ /c/d --> 'a','b' 'c','d'", "if", "count", "==", "0", ":", "return", "''", "pathlist", "=", "self", ".", "path", ".", "strip", "(", "'/'", ")", ".", "split", "(", "'/'", ")",...
Shift some levels of PATH_INFO into SCRIPT_NAME and return the moved part. count defaults to 1
[ "Shift", "some", "levels", "of", "PATH_INFO", "into", "SCRIPT_NAME", "and", "return", "the", "moved", "part", ".", "count", "defaults", "to", "1" ]
python
train
mallamanis/experimenter
experimenter/data.py
https://github.com/mallamanis/experimenter/blob/2ed5ce85084cc47251ccba3aae0cb3431fbe4259/experimenter/data.py#L13-L32
def experiment_data(self, commit=None, must_contain_results=False): """ :param commit: the commit that all the experiments should have happened or None to include all :type commit: str :param must_contain_results: include only tags that contain results :type must_contain_results:...
[ "def", "experiment_data", "(", "self", ",", "commit", "=", "None", ",", "must_contain_results", "=", "False", ")", ":", "results", "=", "{", "}", "for", "tag", "in", "self", ".", "__repository", ".", "tags", ":", "if", "not", "tag", ".", "name", ".", ...
:param commit: the commit that all the experiments should have happened or None to include all :type commit: str :param must_contain_results: include only tags that contain results :type must_contain_results: bool :return: all the experiment data :rtype: dict
[ ":", "param", "commit", ":", "the", "commit", "that", "all", "the", "experiments", "should", "have", "happened", "or", "None", "to", "include", "all", ":", "type", "commit", ":", "str", ":", "param", "must_contain_results", ":", "include", "only", "tags", ...
python
valid
thebigmunch/gmusicapi-wrapper
gmusicapi_wrapper/mobileclient.py
https://github.com/thebigmunch/gmusicapi-wrapper/blob/8708683cd33955def1378fc28319ef37805b851d/gmusicapi_wrapper/mobileclient.py#L88-L123
def get_google_songs(self, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False): """Create song list from user's Google Music library. Parameters: include_filters (list): A list of ``(field, pattern)`` tuples. Fields are any valid Google Music metadata field available to the M...
[ "def", "get_google_songs", "(", "self", ",", "include_filters", "=", "None", ",", "exclude_filters", "=", "None", ",", "all_includes", "=", "False", ",", "all_excludes", "=", "False", ")", ":", "logger", ".", "info", "(", "\"Loading Google Music songs...\"", ")"...
Create song list from user's Google Music library. Parameters: include_filters (list): A list of ``(field, pattern)`` tuples. Fields are any valid Google Music metadata field available to the Mobileclient client. Patterns are Python regex patterns. Google Music songs are filtered out if the given meta...
[ "Create", "song", "list", "from", "user", "s", "Google", "Music", "library", "." ]
python
valid
ray-project/ray
python/ray/experimental/async_plasma.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L152-L160
def set_result(self, result): """Complete all tasks. """ for future in self.traverse(): # All cancelled futures should have callbacks to removed itself # from this linked list. However, these callbacks are scheduled in # an event loop, so we could still find them in o...
[ "def", "set_result", "(", "self", ",", "result", ")", ":", "for", "future", "in", "self", ".", "traverse", "(", ")", ":", "# All cancelled futures should have callbacks to removed itself", "# from this linked list. However, these callbacks are scheduled in", "# an event loop, s...
Complete all tasks.
[ "Complete", "all", "tasks", "." ]
python
train
globality-corp/microcosm-flask
microcosm_flask/conventions/relation.py
https://github.com/globality-corp/microcosm-flask/blob/c2eaf57f03e7d041eea343751a4a90fcc80df418/microcosm_flask/conventions/relation.py#L98-L135
def configure_replacefor(self, ns, definition): """ Register a replace-for relation endpoint. For typical usage, this relation is not strictly required; once an object exists and has its own ID, it is better to operate on it directly via dedicated CRUD routes. However, in some c...
[ "def", "configure_replacefor", "(", "self", ",", "ns", ",", "definition", ")", ":", "@", "self", ".", "add_route", "(", "ns", ".", "relation_path", ",", "Operation", ".", "ReplaceFor", ",", "ns", ")", "@", "request", "(", "definition", ".", "request_schema...
Register a replace-for relation endpoint. For typical usage, this relation is not strictly required; once an object exists and has its own ID, it is better to operate on it directly via dedicated CRUD routes. However, in some cases, the composite key of (subject_id, object_id) is required to lo...
[ "Register", "a", "replace", "-", "for", "relation", "endpoint", "." ]
python
train
AnnAnnFryingPan/data_hub_call
build/lib/data_hub_call/dataHubCallTriangulum.py
https://github.com/AnnAnnFryingPan/data_hub_call/blob/907a481bb2adfff86d311bdf5a4fa352fd7e90be/build/lib/data_hub_call/dataHubCallTriangulum.py#L63-L134
def call_api_fetch(self, params, get_latest_only=True): """ GET https: // myserver / piwebapi / assetdatabases / D0NxzXSxtlKkGzAhZfHOB - KAQLhZ5wrU - UyRDQnzB_zGVAUEhMQUZTMDRcTlVHUkVFTg HTTP / 1.1 Host: myserver Accept: application / json""" output_format = 'application/json' ...
[ "def", "call_api_fetch", "(", "self", ",", "params", ",", "get_latest_only", "=", "True", ")", ":", "output_format", "=", "'application/json'", "url_string", "=", "self", ".", "request_info", ".", "url_string", "(", ")", "# passing the username and required output for...
GET https: // myserver / piwebapi / assetdatabases / D0NxzXSxtlKkGzAhZfHOB - KAQLhZ5wrU - UyRDQnzB_zGVAUEhMQUZTMDRcTlVHUkVFTg HTTP / 1.1 Host: myserver Accept: application / json
[ "GET", "https", ":", "//", "myserver", "/", "piwebapi", "/", "assetdatabases", "/", "D0NxzXSxtlKkGzAhZfHOB", "-", "KAQLhZ5wrU", "-", "UyRDQnzB_zGVAUEhMQUZTMDRcTlVHUkVFTg", "HTTP", "/", "1", ".", "1", "Host", ":", "myserver", "Accept", ":", "application", "/", "j...
python
train
potash/drain
drain/data.py
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L399-L413
def select_regexes(strings, regexes): """ select subset of strings matching a regex treats strings as a set """ strings = set(strings) select = set() if isinstance(strings, collections.Iterable): for r in regexes: s = set(filter(re.compile('^' + r + '$').search, strings))...
[ "def", "select_regexes", "(", "strings", ",", "regexes", ")", ":", "strings", "=", "set", "(", "strings", ")", "select", "=", "set", "(", ")", "if", "isinstance", "(", "strings", ",", "collections", ".", "Iterable", ")", ":", "for", "r", "in", "regexes...
select subset of strings matching a regex treats strings as a set
[ "select", "subset", "of", "strings", "matching", "a", "regex", "treats", "strings", "as", "a", "set" ]
python
train
chrisrink10/basilisp
src/basilisp/lang/compiler/generator.py
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L1232-L1261
def __if_body_to_py_ast( ctx: GeneratorContext, node: Node, result_name: str ) -> GeneratedPyAST: """Generate custom `if` nodes to handle `recur` bodies. Recur nodes can appear in the then and else expressions of `if` forms. Recur nodes generate Python `continue` statements, which we would otherwise ...
[ "def", "__if_body_to_py_ast", "(", "ctx", ":", "GeneratorContext", ",", "node", ":", "Node", ",", "result_name", ":", "str", ")", "->", "GeneratedPyAST", ":", "if", "node", ".", "op", "==", "NodeOp", ".", "RECUR", "and", "ctx", ".", "recur_point", ".", "...
Generate custom `if` nodes to handle `recur` bodies. Recur nodes can appear in the then and else expressions of `if` forms. Recur nodes generate Python `continue` statements, which we would otherwise attempt to insert directly into an expression. Python will complain if it finds a statement in an expre...
[ "Generate", "custom", "if", "nodes", "to", "handle", "recur", "bodies", "." ]
python
test
shendo/websnort
websnort/ids/snort.py
https://github.com/shendo/websnort/blob/19495e8834a111e889ba28efad8cd90cf55eb661/websnort/ids/snort.py#L80-L91
def parse_version(output): """ Parses the supplied output and returns the version string. :param output: A string containing the output of running snort. :returns: Version string for the version of snort run. None if not found. """ for x in output.splitlines(): match = VERSION_PATTERN.m...
[ "def", "parse_version", "(", "output", ")", ":", "for", "x", "in", "output", ".", "splitlines", "(", ")", ":", "match", "=", "VERSION_PATTERN", ".", "match", "(", "x", ")", "if", "match", ":", "return", "match", ".", "group", "(", "'version'", ")", "...
Parses the supplied output and returns the version string. :param output: A string containing the output of running snort. :returns: Version string for the version of snort run. None if not found.
[ "Parses", "the", "supplied", "output", "and", "returns", "the", "version", "string", "." ]
python
train
Robpol86/etaprogress
etaprogress/components/base_progress_bar.py
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/base_progress_bar.py#L40-L61
def numerator(self, value): """Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator.""" # If ETA is every iteration, don't do anything fancy. if self.eta_every <= 1: self._eta.numerator = value self._eta_string = self._generate_e...
[ "def", "numerator", "(", "self", ",", "value", ")", ":", "# If ETA is every iteration, don't do anything fancy.", "if", "self", ".", "eta_every", "<=", "1", ":", "self", ".", "_eta", ".", "numerator", "=", "value", "self", ".", "_eta_string", "=", "self", ".",...
Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator.
[ "Sets", "a", "new", "numerator", "and", "generates", "the", "ETA", ".", "Must", "be", "greater", "than", "or", "equal", "to", "previous", "numerator", "." ]
python
train
tensorflow/hub
tensorflow_hub/native_module.py
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L472-L561
def create_apply_graph(self, signature, input_tensors, name): """See `ModuleImpl.create_apply_graph`.""" signature_def = self._meta_graph.signature_def.get(signature) meta_graph = meta_graph_pb2.MetaGraphDef() meta_graph.CopyFrom(self._meta_graph) apply_graph = tf_v1.get_default_graph() infeed_m...
[ "def", "create_apply_graph", "(", "self", ",", "signature", ",", "input_tensors", ",", "name", ")", ":", "signature_def", "=", "self", ".", "_meta_graph", ".", "signature_def", ".", "get", "(", "signature", ")", "meta_graph", "=", "meta_graph_pb2", ".", "MetaG...
See `ModuleImpl.create_apply_graph`.
[ "See", "ModuleImpl", ".", "create_apply_graph", "." ]
python
train
CalebBell/fluids
fluids/optional/pychebfun.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/optional/pychebfun.py#L395-L401
def restrict(self,subinterval): """ Return a Polyfun that matches self on subinterval. """ if (subinterval[0] < self._domain[0]) or (subinterval[1] > self._domain[1]): raise ValueError("Can only restrict to subinterval") return self.from_function(self, subinterval)
[ "def", "restrict", "(", "self", ",", "subinterval", ")", ":", "if", "(", "subinterval", "[", "0", "]", "<", "self", ".", "_domain", "[", "0", "]", ")", "or", "(", "subinterval", "[", "1", "]", ">", "self", ".", "_domain", "[", "1", "]", ")", ":...
Return a Polyfun that matches self on subinterval.
[ "Return", "a", "Polyfun", "that", "matches", "self", "on", "subinterval", "." ]
python
train
OnroerendErfgoed/oe_utils
oe_utils/search/__init__.py
https://github.com/OnroerendErfgoed/oe_utils/blob/7b2014bda8ac6bb71b7138eaa06ac17ef3ff4a6d/oe_utils/search/__init__.py#L42-L58
def parse_filter_params(query_params, filterable): """ Parse query_params to a filter params dict. Merge multiple values for one key to a list. Filter out keys that aren't filterable. :param query_params: query params :param filterable: list of filterable keys :return: dict of filter values ...
[ "def", "parse_filter_params", "(", "query_params", ",", "filterable", ")", ":", "if", "query_params", "is", "not", "None", ":", "filter_params", "=", "{", "}", "for", "fq", "in", "query_params", ".", "mixed", "(", ")", ":", "if", "fq", "in", "filterable", ...
Parse query_params to a filter params dict. Merge multiple values for one key to a list. Filter out keys that aren't filterable. :param query_params: query params :param filterable: list of filterable keys :return: dict of filter values
[ "Parse", "query_params", "to", "a", "filter", "params", "dict", ".", "Merge", "multiple", "values", "for", "one", "key", "to", "a", "list", ".", "Filter", "out", "keys", "that", "aren", "t", "filterable", "." ]
python
train
posativ/isso
isso/migrate.py
https://github.com/posativ/isso/blob/78997f491044b7d694ac7170edc32030544095b7/isso/migrate.py#L296-L306
def migrate(self): """Process the input file and fill the DB.""" with io.open(self.json_file, 'rt', encoding='utf8') as fh: threads = json.load(fh) progress = Progress(len(threads)) for i, thread in enumerate(threads): progress.update(i, str(i)) self....
[ "def", "migrate", "(", "self", ")", ":", "with", "io", ".", "open", "(", "self", ".", "json_file", ",", "'rt'", ",", "encoding", "=", "'utf8'", ")", "as", "fh", ":", "threads", "=", "json", ".", "load", "(", "fh", ")", "progress", "=", "Progress", ...
Process the input file and fill the DB.
[ "Process", "the", "input", "file", "and", "fill", "the", "DB", "." ]
python
train
mezz64/pyHik
pyhik/hikvision.py
https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L220-L223
def add_update_callback(self, callback, sensor): """Register as callback for when a matching device sensor changes.""" self._updateCallbacks.append([callback, sensor]) _LOGGING.debug('Added update callback to %s on %s', callback, sensor)
[ "def", "add_update_callback", "(", "self", ",", "callback", ",", "sensor", ")", ":", "self", ".", "_updateCallbacks", ".", "append", "(", "[", "callback", ",", "sensor", "]", ")", "_LOGGING", ".", "debug", "(", "'Added update callback to %s on %s'", ",", "call...
Register as callback for when a matching device sensor changes.
[ "Register", "as", "callback", "for", "when", "a", "matching", "device", "sensor", "changes", "." ]
python
train
OCR-D/core
ocrd/ocrd/workspace_backup.py
https://github.com/OCR-D/core/blob/57e68c578526cb955fd2e368207f5386c459d91d/ocrd/ocrd/workspace_backup.py#L70-L88
def add(self): """ Create a backup in <self.backup_directory> """ log = getLogger('ocrd.workspace_backup.add') mets_str = self.workspace.mets.to_xml() chksum = _chksum(mets_str) backups = self.list() if backups and backups[0].chksum == chksum: ...
[ "def", "add", "(", "self", ")", ":", "log", "=", "getLogger", "(", "'ocrd.workspace_backup.add'", ")", "mets_str", "=", "self", ".", "workspace", ".", "mets", ".", "to_xml", "(", ")", "chksum", "=", "_chksum", "(", "mets_str", ")", "backups", "=", "self"...
Create a backup in <self.backup_directory>
[ "Create", "a", "backup", "in", "<self", ".", "backup_directory", ">" ]
python
train
worldcompany/djangoembed
oembed/sites.py
https://github.com/worldcompany/djangoembed/blob/f3f2be283441d91d1f89db780444dc75f7b51902/oembed/sites.py#L106-L114
def provider_for_url(self, url): """ Find the right provider for a URL """ for provider, regex in self.get_registry().items(): if re.match(regex, url) is not None: return provider raise OEmbedMissingEndpoint('No endpoint matches URL: %s' % url...
[ "def", "provider_for_url", "(", "self", ",", "url", ")", ":", "for", "provider", ",", "regex", "in", "self", ".", "get_registry", "(", ")", ".", "items", "(", ")", ":", "if", "re", ".", "match", "(", "regex", ",", "url", ")", "is", "not", "None", ...
Find the right provider for a URL
[ "Find", "the", "right", "provider", "for", "a", "URL" ]
python
valid
fredrike/pypoint
pypoint/__init__.py
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L106-L109
def _request_devices(self, url, _type): """Request list of devices.""" res = self._request(url) return res.get(_type) if res else {}
[ "def", "_request_devices", "(", "self", ",", "url", ",", "_type", ")", ":", "res", "=", "self", ".", "_request", "(", "url", ")", "return", "res", ".", "get", "(", "_type", ")", "if", "res", "else", "{", "}" ]
Request list of devices.
[ "Request", "list", "of", "devices", "." ]
python
train
gem/oq-engine
openquake/commands/show.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/show.py#L53-L109
def show(what='contents', calc_id=-1, extra=()): """ Show the content of a datastore (by default the last one). """ datadir = datastore.get_datadir() if what == 'all': # show all if not os.path.exists(datadir): return rows = [] for calc_id in datastore.get_calc_i...
[ "def", "show", "(", "what", "=", "'contents'", ",", "calc_id", "=", "-", "1", ",", "extra", "=", "(", ")", ")", ":", "datadir", "=", "datastore", ".", "get_datadir", "(", ")", "if", "what", "==", "'all'", ":", "# show all", "if", "not", "os", ".", ...
Show the content of a datastore (by default the last one).
[ "Show", "the", "content", "of", "a", "datastore", "(", "by", "default", "the", "last", "one", ")", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/jid.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/jid.py#L156-L186
def __from_unicode(cls, data, check = True): """Return jid tuple from an Unicode string. :Parameters: - `data`: the JID string - `check`: when `False` then the JID is not checked for specification compliance. :Return: (localpart, domainpart, resourcepart) ...
[ "def", "__from_unicode", "(", "cls", ",", "data", ",", "check", "=", "True", ")", ":", "parts1", "=", "data", ".", "split", "(", "u\"/\"", ",", "1", ")", "parts2", "=", "parts1", "[", "0", "]", ".", "split", "(", "u\"@\"", ",", "1", ")", "if", ...
Return jid tuple from an Unicode string. :Parameters: - `data`: the JID string - `check`: when `False` then the JID is not checked for specification compliance. :Return: (localpart, domainpart, resourcepart) tuple
[ "Return", "jid", "tuple", "from", "an", "Unicode", "string", "." ]
python
valid
edx/edx-val
edxval/utils.py
https://github.com/edx/edx-val/blob/30df48061e77641edb5272895b7c7f7f25eb7aa7/edxval/utils.py#L189-L200
def create_file_in_fs(file_data, file_name, file_system, static_dir): """ Writes file in specific file system. Arguments: file_data (str): Data to store into the file. file_name (str): File name of the file to be created. file_system (OSFS): Import file system. static_dir (s...
[ "def", "create_file_in_fs", "(", "file_data", ",", "file_name", ",", "file_system", ",", "static_dir", ")", ":", "with", "file_system", ".", "open", "(", "combine", "(", "static_dir", ",", "file_name", ")", ",", "'wb'", ")", "as", "f", ":", "f", ".", "wr...
Writes file in specific file system. Arguments: file_data (str): Data to store into the file. file_name (str): File name of the file to be created. file_system (OSFS): Import file system. static_dir (str): The Directory to retrieve transcript file.
[ "Writes", "file", "in", "specific", "file", "system", "." ]
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py#L144-L158
def help_content(self): """Return the content of help for this step wizard. We only needs to re-implement this method in each wizard step. :returns: A message object contains help. :rtype: m.Message """ message = m.Message() message.add(m.Paragraph(tr( ...
[ "def", "help_content", "(", "self", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "message", ".", "add", "(", "m", ".", "Paragraph", "(", "tr", "(", "'In this wizard step: {step_name}, You can choose a exposure '", "'layer from the list of layers that have ...
Return the content of help for this step wizard. We only needs to re-implement this method in each wizard step. :returns: A message object contains help. :rtype: m.Message
[ "Return", "the", "content", "of", "help", "for", "this", "step", "wizard", "." ]
python
train
frictionlessdata/datapackage-py
datapackage/resource.py
https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/resource.py#L222-L229
def raw_read(self): """https://github.com/frictionlessdata/datapackage-py#resource """ contents = b'' with self.raw_iter() as filelike: for chunk in filelike: contents += chunk return contents
[ "def", "raw_read", "(", "self", ")", ":", "contents", "=", "b''", "with", "self", ".", "raw_iter", "(", ")", "as", "filelike", ":", "for", "chunk", "in", "filelike", ":", "contents", "+=", "chunk", "return", "contents" ]
https://github.com/frictionlessdata/datapackage-py#resource
[ "https", ":", "//", "github", ".", "com", "/", "frictionlessdata", "/", "datapackage", "-", "py#resource" ]
python
valid
spacetelescope/synphot_refactor
synphot/models.py
https://github.com/spacetelescope/synphot_refactor/blob/9c064f3cff0c41dd8acadc0f67c6350931275b9f/synphot/models.py#L252-L268
def evaluate(self, x, *args): """One dimensional constant flux model function. Parameters ---------- x : number or ndarray Wavelengths in Angstrom. Returns ------- y : number or ndarray Flux in PHOTLAM. """ a = (self.ampl...
[ "def", "evaluate", "(", "self", ",", "x", ",", "*", "args", ")", ":", "a", "=", "(", "self", ".", "amplitude", "*", "np", ".", "ones_like", "(", "x", ")", ")", "*", "self", ".", "_flux_unit", "y", "=", "units", ".", "convert_flux", "(", "x", ",...
One dimensional constant flux model function. Parameters ---------- x : number or ndarray Wavelengths in Angstrom. Returns ------- y : number or ndarray Flux in PHOTLAM.
[ "One", "dimensional", "constant", "flux", "model", "function", "." ]
python
train
ladybug-tools/ladybug
ladybug/location.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/location.py#L40-L59
def from_json(cls, data): """Create a location from a dictionary. Args: data: { "city": "-", "latitude": 0, "longitude": 0, "time_zone": 0, "elevation": 0} """ optional_keys = ('city', 'state', 'country', 'latitude'...
[ "def", "from_json", "(", "cls", ",", "data", ")", ":", "optional_keys", "=", "(", "'city'", ",", "'state'", ",", "'country'", ",", "'latitude'", ",", "'longitude'", ",", "'time_zone'", ",", "'elevation'", ",", "'station_id'", ",", "'source'", ")", "for", "...
Create a location from a dictionary. Args: data: { "city": "-", "latitude": 0, "longitude": 0, "time_zone": 0, "elevation": 0}
[ "Create", "a", "location", "from", "a", "dictionary", "." ]
python
train
pantsbuild/pex
pex/variables.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/variables.py#L123-L129
def patch(self, **kw): """Update the environment for the duration of a context.""" old_environ = self._environ self._environ = self._environ.copy() self._environ.update(kw) yield self._environ = old_environ
[ "def", "patch", "(", "self", ",", "*", "*", "kw", ")", ":", "old_environ", "=", "self", ".", "_environ", "self", ".", "_environ", "=", "self", ".", "_environ", ".", "copy", "(", ")", "self", ".", "_environ", ".", "update", "(", "kw", ")", "yield", ...
Update the environment for the duration of a context.
[ "Update", "the", "environment", "for", "the", "duration", "of", "a", "context", "." ]
python
train
RJT1990/pyflux
pyflux/ssm/dar.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/ssm/dar.py#L84-L97
def _create_latent_variables(self): """ Creates model latent variables Returns ---------- None (changes model attributes) """ self.latent_variables.add_z('Sigma^2 irregular', fam.Flat(transform='exp'), fam.Normal(0,3)) self.latent_variables.add_z('Constant', fa...
[ "def", "_create_latent_variables", "(", "self", ")", ":", "self", ".", "latent_variables", ".", "add_z", "(", "'Sigma^2 irregular'", ",", "fam", ".", "Flat", "(", "transform", "=", "'exp'", ")", ",", "fam", ".", "Normal", "(", "0", ",", "3", ")", ")", ...
Creates model latent variables Returns ---------- None (changes model attributes)
[ "Creates", "model", "latent", "variables" ]
python
train
HumanCellAtlas/cloud-blobstore
cloud_blobstore/__init__.py
https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/__init__.py#L232-L245
def get_user_metadata( self, bucket: str, key: str ) -> typing.Dict[str, str]: """ Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or suffixes for the metadata keys, they should be stripped befo...
[ "def", "get_user_metadata", "(", "self", ",", "bucket", ":", "str", ",", "key", ":", "str", ")", "->", "typing", ".", "Dict", "[", "str", ",", "str", "]", ":", "raise", "NotImplementedError", "(", ")" ]
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or suffixes for the metadata keys, they should be stripped before being returned. :param bucket: the bucket the object resides in. :param key: the key of the object for which metadata is...
[ "Retrieves", "the", "user", "metadata", "for", "a", "given", "object", "in", "a", "given", "bucket", ".", "If", "the", "platform", "has", "any", "mandatory", "prefixes", "or", "suffixes", "for", "the", "metadata", "keys", "they", "should", "be", "stripped", ...
python
train
orbingol/NURBS-Python
geomdl/linalg.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L565-L595
def convex_hull(points): """ Returns points on convex hull in counterclockwise order according to Graham's scan algorithm. Reference: https://gist.github.com/arthur-e/5cf52962341310f438e96c1f3c3398b8 .. note:: This implementation only works in 2-dimensional space. :param points: list of 2-dimensional...
[ "def", "convex_hull", "(", "points", ")", ":", "turn_left", ",", "turn_right", ",", "turn_none", "=", "(", "1", ",", "-", "1", ",", "0", ")", "def", "cmp", "(", "a", ",", "b", ")", ":", "return", "(", "a", ">", "b", ")", "-", "(", "a", "<", ...
Returns points on convex hull in counterclockwise order according to Graham's scan algorithm. Reference: https://gist.github.com/arthur-e/5cf52962341310f438e96c1f3c3398b8 .. note:: This implementation only works in 2-dimensional space. :param points: list of 2-dimensional points :type points: list, t...
[ "Returns", "points", "on", "convex", "hull", "in", "counterclockwise", "order", "according", "to", "Graham", "s", "scan", "algorithm", "." ]
python
train
jtmoulia/switchboard-python
aplus/__init__.py
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/aplus/__init__.py#L47-L66
def reject(self, reason): """ Reject this promise for a given reason. """ assert self._state==self.PENDING self._state=self.REJECTED; self.reason = reason for errback in self._errbacks: try: errback(reason) except Exception...
[ "def", "reject", "(", "self", ",", "reason", ")", ":", "assert", "self", ".", "_state", "==", "self", ".", "PENDING", "self", ".", "_state", "=", "self", ".", "REJECTED", "self", ".", "reason", "=", "reason", "for", "errback", "in", "self", ".", "_er...
Reject this promise for a given reason.
[ "Reject", "this", "promise", "for", "a", "given", "reason", "." ]
python
train
MaxHalford/prince
prince/mfa.py
https://github.com/MaxHalford/prince/blob/714c9cdfc4d9f8823eabf550a23ad01fe87c50d7/prince/mfa.py#L158-L190
def partial_row_coordinates(self, X): """Returns the row coordinates for each group.""" utils.validation.check_is_fitted(self, 's_') # Check input if self.check_input: utils.check_array(X, dtype=[str, np.number]) # Prepare input X = self._prepare_input(X) ...
[ "def", "partial_row_coordinates", "(", "self", ",", "X", ")", ":", "utils", ".", "validation", ".", "check_is_fitted", "(", "self", ",", "'s_'", ")", "# Check input", "if", "self", ".", "check_input", ":", "utils", ".", "check_array", "(", "X", ",", "dtype...
Returns the row coordinates for each group.
[ "Returns", "the", "row", "coordinates", "for", "each", "group", "." ]
python
train
riga/law
law/workflow/local.py
https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/local.py#L29-L38
def complete(self): """ When *local_workflow_require_branches* of the task was set to *True*, returns whether the :py:meth:`run` method has been called before. Otherwise, the call is forwarded to the super class. """ if self.task.local_workflow_require_branches: ...
[ "def", "complete", "(", "self", ")", ":", "if", "self", ".", "task", ".", "local_workflow_require_branches", ":", "return", "self", ".", "_has_run", "else", ":", "return", "super", "(", "LocalWorkflowProxy", ",", "self", ")", ".", "complete", "(", ")" ]
When *local_workflow_require_branches* of the task was set to *True*, returns whether the :py:meth:`run` method has been called before. Otherwise, the call is forwarded to the super class.
[ "When", "*", "local_workflow_require_branches", "*", "of", "the", "task", "was", "set", "to", "*", "True", "*", "returns", "whether", "the", ":", "py", ":", "meth", ":", "run", "method", "has", "been", "called", "before", ".", "Otherwise", "the", "call", ...
python
train
saltstack/salt
salt/client/ssh/wrapper/state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L170-L177
def _parse_mods(mods): ''' Parse modules. ''' if isinstance(mods, six.string_types): mods = [item.strip() for item in mods.split(',') if item.strip()] return mods
[ "def", "_parse_mods", "(", "mods", ")", ":", "if", "isinstance", "(", "mods", ",", "six", ".", "string_types", ")", ":", "mods", "=", "[", "item", ".", "strip", "(", ")", "for", "item", "in", "mods", ".", "split", "(", "','", ")", "if", "item", "...
Parse modules.
[ "Parse", "modules", "." ]
python
train
brentp/cruzdb
cruzdb/intersecter.py
https://github.com/brentp/cruzdb/blob/9068d46e25952f4a929dde0242beb31fa4c7e89a/cruzdb/intersecter.py#L269-L284
def distance(f1, f2): """\ Distance between 2 features. The integer result is always positive or zero. If the features overlap or touch, it is zero. >>> from intersecter import Feature, distance >>> distance(Feature(1, 2), Feature(12, 13)) 10 >>> distance(Feature(1, 2), Feature(2, 3)) 0 ...
[ "def", "distance", "(", "f1", ",", "f2", ")", ":", "if", "f1", ".", "end", "<", "f2", ".", "start", ":", "return", "f2", ".", "start", "-", "f1", ".", "end", "if", "f2", ".", "end", "<", "f1", ".", "start", ":", "return", "f1", ".", "start", ...
\ Distance between 2 features. The integer result is always positive or zero. If the features overlap or touch, it is zero. >>> from intersecter import Feature, distance >>> distance(Feature(1, 2), Feature(12, 13)) 10 >>> distance(Feature(1, 2), Feature(2, 3)) 0 >>> distance(Feature(1, 1...
[ "\\", "Distance", "between", "2", "features", ".", "The", "integer", "result", "is", "always", "positive", "or", "zero", ".", "If", "the", "features", "overlap", "or", "touch", "it", "is", "zero", ".", ">>>", "from", "intersecter", "import", "Feature", "di...
python
train
ponty/pyscreenshot
pyscreenshot/plugins/gtkpixbuf.py
https://github.com/ponty/pyscreenshot/blob/51010195cbb5361dcd4b414ff132b87244c9e1cb/pyscreenshot/plugins/gtkpixbuf.py#L30-L56
def grab_to_file(self, filename, bbox=None): """http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html. only "jpeg" or "png" """ w = self.gtk.gdk.get_default_root_window() # Capture the whole screen. if bbox is None: sz = w.get_size() pb = self.gtk.g...
[ "def", "grab_to_file", "(", "self", ",", "filename", ",", "bbox", "=", "None", ")", ":", "w", "=", "self", ".", "gtk", ".", "gdk", ".", "get_default_root_window", "(", ")", "# Capture the whole screen.", "if", "bbox", "is", "None", ":", "sz", "=", ...
http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html. only "jpeg" or "png"
[ "http", ":", "//", "www", ".", "pygtk", ".", "org", "/", "docs", "/", "pygtk", "/", "class", "-", "gdkpixbuf", ".", "html", "." ]
python
valid
networks-lab/metaknowledge
metaknowledge/citation.py
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/citation.py#L263-L311
def isJournal(self, dbname = abrevDBname, manualDB = manualDBname, returnDict ='both', checkIfExcluded = False): """Returns `True` if the `Citation`'s `journal` field is a journal abbreviation from the WOS listing found at [http://images.webofknowledge.com/WOK46/help/WOS/A_abrvjt.html](http://images.webofknowle...
[ "def", "isJournal", "(", "self", ",", "dbname", "=", "abrevDBname", ",", "manualDB", "=", "manualDBname", ",", "returnDict", "=", "'both'", ",", "checkIfExcluded", "=", "False", ")", ":", "global", "abbrevDict", "if", "abbrevDict", "is", "None", ":", "abbrev...
Returns `True` if the `Citation`'s `journal` field is a journal abbreviation from the WOS listing found at [http://images.webofknowledge.com/WOK46/help/WOS/A_abrvjt.html](http://images.webofknowledge.com/WOK46/help/WOS/A_abrvjt.html), i.e. checks if the citation is citing a journal. **Note**: Requires the [j9A...
[ "Returns", "True", "if", "the", "Citation", "s", "journal", "field", "is", "a", "journal", "abbreviation", "from", "the", "WOS", "listing", "found", "at", "[", "http", ":", "//", "images", ".", "webofknowledge", ".", "com", "/", "WOK46", "/", "help", "/"...
python
train
grahambell/pymoc
lib/pymoc/util/tool.py
https://github.com/grahambell/pymoc/blob/0e2e57ce07ff3de6ac024627c1fb6ad30c2fde48/lib/pymoc/util/tool.py#L353-L400
def plot(self): """Show the running MOC on an all-sky map. This command requires that the Healpy and matplotlib libraries be available. It plots the running MOC, which should be normalized to a lower order first if it would generate an excessively large pixel array. ::...
[ "def", "plot", "(", "self", ")", ":", "if", "self", ".", "moc", "is", "None", ":", "raise", "CommandError", "(", "'No MOC information present for plotting'", ")", "from", ".", "plot", "import", "plot_moc", "order", "=", "self", ".", "moc", ".", "order", "a...
Show the running MOC on an all-sky map. This command requires that the Healpy and matplotlib libraries be available. It plots the running MOC, which should be normalized to a lower order first if it would generate an excessively large pixel array. :: pymoctool a.m...
[ "Show", "the", "running", "MOC", "on", "an", "all", "-", "sky", "map", "." ]
python
train
openstack/networking-hyperv
networking_hyperv/neutron/trunk_driver.py
https://github.com/openstack/networking-hyperv/blob/7a89306ab0586c95b99debb44d898f70834508b9/networking_hyperv/neutron/trunk_driver.py#L61-L85
def handle_subports(self, subports, event_type): """Subport data model change from the server.""" LOG.debug("Subports event received: %(event_type)s. " "Subports: %(subports)s", {'event_type': event_type, 'subports': subports}) # update the cache. if...
[ "def", "handle_subports", "(", "self", ",", "subports", ",", "event_type", ")", ":", "LOG", ".", "debug", "(", "\"Subports event received: %(event_type)s. \"", "\"Subports: %(subports)s\"", ",", "{", "'event_type'", ":", "event_type", ",", "'subports'", ":", "subports...
Subport data model change from the server.
[ "Subport", "data", "model", "change", "from", "the", "server", "." ]
python
train
aio-libs/aiohttp
aiohttp/client.py
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L1035-L1119
def request( method: str, url: StrOrURL, *, params: Optional[Mapping[str, str]]=None, data: Any=None, json: Any=None, headers: LooseHeaders=None, skip_auto_headers: Optional[Iterable[str]]=None, auth: Optional[BasicAuth]=None, allow_redirects: bool...
[ "def", "request", "(", "method", ":", "str", ",", "url", ":", "StrOrURL", ",", "*", ",", "params", ":", "Optional", "[", "Mapping", "[", "str", ",", "str", "]", "]", "=", "None", ",", "data", ":", "Any", "=", "None", ",", "json", ":", "Any", "=...
Constructs and sends a request. Returns response object. method - HTTP method url - request url params - (optional) Dictionary or bytes to be sent in the query string of the new request data - (optional) Dictionary, bytes, or file-like object to send in the body of the request json - (op...
[ "Constructs", "and", "sends", "a", "request", ".", "Returns", "response", "object", ".", "method", "-", "HTTP", "method", "url", "-", "request", "url", "params", "-", "(", "optional", ")", "Dictionary", "or", "bytes", "to", "be", "sent", "in", "the", "qu...
python
train
cackharot/suds-py3
suds/xsd/schema.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/xsd/schema.py#L99-L118
def autoblend(self): """ Ensure that all schemas within the collection import each other which has a blending effect. @return: self @rtype: L{SchemaCollection} """ namespaces = self.namespaces.keys() for s in self.children: for ns in namespaces...
[ "def", "autoblend", "(", "self", ")", ":", "namespaces", "=", "self", ".", "namespaces", ".", "keys", "(", ")", "for", "s", "in", "self", ".", "children", ":", "for", "ns", "in", "namespaces", ":", "tns", "=", "s", ".", "root", ".", "get", "(", "...
Ensure that all schemas within the collection import each other which has a blending effect. @return: self @rtype: L{SchemaCollection}
[ "Ensure", "that", "all", "schemas", "within", "the", "collection", "import", "each", "other", "which", "has", "a", "blending", "effect", "." ]
python
train
thefactory/marathon-python
marathon/client.py
https://github.com/thefactory/marathon-python/blob/592b253aa8edf2475c97ca438ad7b6936652caf2/marathon/client.py#L67-L74
def _parse_response(response, clazz, is_list=False, resource_name=None): """Parse a Marathon response into an object or list of objects.""" target = response.json()[ resource_name] if resource_name else response.json() if is_list: return [clazz.from_json(resource) for res...
[ "def", "_parse_response", "(", "response", ",", "clazz", ",", "is_list", "=", "False", ",", "resource_name", "=", "None", ")", ":", "target", "=", "response", ".", "json", "(", ")", "[", "resource_name", "]", "if", "resource_name", "else", "response", ".",...
Parse a Marathon response into an object or list of objects.
[ "Parse", "a", "Marathon", "response", "into", "an", "object", "or", "list", "of", "objects", "." ]
python
train
political-memory/django-representatives
representatives/migrations/0016_chamber_migrate_data.py
https://github.com/political-memory/django-representatives/blob/811c90d0250149e913e6196f0ab11c97d396be39/representatives/migrations/0016_chamber_migrate_data.py#L9-L36
def calculate_hash(obj): """ Computes fingerprint for an object, this code is duplicated from representatives.models.HashableModel because we don't have access to model methods in a migration scenario. """ hashable_fields = { 'Chamber': ['name', 'country', 'abbreviation'], 'Cons...
[ "def", "calculate_hash", "(", "obj", ")", ":", "hashable_fields", "=", "{", "'Chamber'", ":", "[", "'name'", ",", "'country'", ",", "'abbreviation'", "]", ",", "'Constituency'", ":", "[", "'name'", "]", ",", "'Group'", ":", "[", "'name'", ",", "'abbreviati...
Computes fingerprint for an object, this code is duplicated from representatives.models.HashableModel because we don't have access to model methods in a migration scenario.
[ "Computes", "fingerprint", "for", "an", "object", "this", "code", "is", "duplicated", "from", "representatives", ".", "models", ".", "HashableModel", "because", "we", "don", "t", "have", "access", "to", "model", "methods", "in", "a", "migration", "scenario", "...
python
train
proycon/clam
clam/common/data.py
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1800-L1822
def xml(self, indent = ""): """Produce Template XML""" xml = indent + "<OutputTemplate id=\"" + self.id + "\" format=\"" + self.formatclass.__name__ + "\"" + " label=\"" + self.label + "\"" if self.formatclass.mimetype: xml +=" mimetype=\""+self.formatclass.mimetype+"\"" if s...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<OutputTemplate id=\\\"\"", "+", "self", ".", "id", "+", "\"\\\" format=\\\"\"", "+", "self", ".", "formatclass", ".", "__name__", "+", "\"\\\"\"", "+", "\" labe...
Produce Template XML
[ "Produce", "Template", "XML" ]
python
train
SteveMcGrath/pySecurityCenter
securitycenter/sc4.py
https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/securitycenter/sc4.py#L866-L904
def asset_create_combo(self, name, combo, tag='', description=''): '''asset_create_combo name, combination, tag, description Creates a new combination asset list. Operands can be either asset list IDs or be a nested combination asset list. UN-DOCUMENTED CALL: This function is not consi...
[ "def", "asset_create_combo", "(", "self", ",", "name", ",", "combo", ",", "tag", "=", "''", ",", "description", "=", "''", ")", ":", "return", "self", ".", "raw_query", "(", "'asset'", ",", "'add'", ",", "data", "=", "{", "'name'", ":", "name", ",", ...
asset_create_combo name, combination, tag, description Creates a new combination asset list. Operands can be either asset list IDs or be a nested combination asset list. UN-DOCUMENTED CALL: This function is not considered stable. AND = intersection OR = union operand =...
[ "asset_create_combo", "name", "combination", "tag", "description", "Creates", "a", "new", "combination", "asset", "list", ".", "Operands", "can", "be", "either", "asset", "list", "IDs", "or", "be", "a", "nested", "combination", "asset", "list", "." ]
python
train
Azure/msrestazure-for-python
msrestazure/azure_active_directory.py
https://github.com/Azure/msrestazure-for-python/blob/5f99262305692525d03ca87d2c5356b05c5aa874/msrestazure/azure_active_directory.py#L159-L174
def _convert_token(self, token): """Convert token fields from camel case. :param dict token: An authentication token. :rtype: dict """ # Beware that ADAL returns a pointer to its own dict, do # NOT change it in place token = token.copy() # If it's from A...
[ "def", "_convert_token", "(", "self", ",", "token", ")", ":", "# Beware that ADAL returns a pointer to its own dict, do", "# NOT change it in place", "token", "=", "token", ".", "copy", "(", ")", "# If it's from ADAL, expiresOn will be in ISO form.", "# Bring it back to float, us...
Convert token fields from camel case. :param dict token: An authentication token. :rtype: dict
[ "Convert", "token", "fields", "from", "camel", "case", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/build/build_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/build/build_client.py#L49-L70
def get_artifact(self, project, build_id, artifact_name): """GetArtifact. Gets a specific artifact for a build. :param str project: Project ID or project name :param int build_id: The ID of the build. :param str artifact_name: The name of the artifact. :rtype: :class:`<Bu...
[ "def", "get_artifact", "(", "self", ",", "project", ",", "build_id", ",", "artifact_name", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'", "]", "=", "self", ".", "_serialize", ".", "ur...
GetArtifact. Gets a specific artifact for a build. :param str project: Project ID or project name :param int build_id: The ID of the build. :param str artifact_name: The name of the artifact. :rtype: :class:`<BuildArtifact> <azure.devops.v5_0.build.models.BuildArtifact>`
[ "GetArtifact", ".", "Gets", "a", "specific", "artifact", "for", "a", "build", ".", ":", "param", "str", "project", ":", "Project", "ID", "or", "project", "name", ":", "param", "int", "build_id", ":", "The", "ID", "of", "the", "build", ".", ":", "param"...
python
train
fermiPy/fermipy
fermipy/utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1239-L1302
def merge_dict(d0, d1, add_new_keys=False, append_arrays=False): """Recursively merge the contents of python dictionary d0 with the contents of another python dictionary, d1. Parameters ---------- d0 : dict The input dictionary. d1 : dict Dictionary to be merged with the input di...
[ "def", "merge_dict", "(", "d0", ",", "d1", ",", "add_new_keys", "=", "False", ",", "append_arrays", "=", "False", ")", ":", "if", "d1", "is", "None", ":", "return", "d0", "elif", "d0", "is", "None", ":", "return", "d1", "elif", "d0", "is", "None", ...
Recursively merge the contents of python dictionary d0 with the contents of another python dictionary, d1. Parameters ---------- d0 : dict The input dictionary. d1 : dict Dictionary to be merged with the input dictionary. add_new_keys : str Do not skip keys that only exis...
[ "Recursively", "merge", "the", "contents", "of", "python", "dictionary", "d0", "with", "the", "contents", "of", "another", "python", "dictionary", "d1", "." ]
python
train
MacHu-GWU/constant2-project
constant2/_constant2.py
https://github.com/MacHu-GWU/constant2-project/blob/ccf7e14b0e23f9f4bfd13a3e2ce4a1142e570d4f/constant2/_constant2.py#L282-L300
def get_first(self, attr, value, e=0.000001, sort_by="__name__", reverse=False): """Get the first nested Constant class that met ``klass.attr == value``. :param attr: attribute name. :param value: value. :param e: used for float value comparison. :param sort_by...
[ "def", "get_first", "(", "self", ",", "attr", ",", "value", ",", "e", "=", "0.000001", ",", "sort_by", "=", "\"__name__\"", ",", "reverse", "=", "False", ")", ":", "for", "_", ",", "klass", "in", "self", ".", "subclasses", "(", "sort_by", ",", "rever...
Get the first nested Constant class that met ``klass.attr == value``. :param attr: attribute name. :param value: value. :param e: used for float value comparison. :param sort_by: nested class is ordered by <sort_by> attribute. .. versionchanged:: 0.0.5
[ "Get", "the", "first", "nested", "Constant", "class", "that", "met", "klass", ".", "attr", "==", "value", "." ]
python
train
kudos/passwords
passwords/pbkdf2.py
https://github.com/kudos/passwords/blob/3f404cea6b841f405d720ebeda9ef8b9c58dfef5/passwords/pbkdf2.py#L90-L119
def pbkdf2_bin(data, salt, iterations=1000, keylen=24, hashfunc=None): """Returns a binary digest for the PBKDF2 hash algorithm of `data` with the given `salt`. It iterates `iterations` time and produces a key of `keylen` bytes. By default SHA-1 is used as hash function, a different hashlib `hashfunc`...
[ "def", "pbkdf2_bin", "(", "data", ",", "salt", ",", "iterations", "=", "1000", ",", "keylen", "=", "24", ",", "hashfunc", "=", "None", ")", ":", "hashfunc", "=", "hashfunc", "or", "hashlib", ".", "sha1", "mac", "=", "hmac", ".", "new", "(", "bytes_",...
Returns a binary digest for the PBKDF2 hash algorithm of `data` with the given `salt`. It iterates `iterations` time and produces a key of `keylen` bytes. By default SHA-1 is used as hash function, a different hashlib `hashfunc` can be provided.
[ "Returns", "a", "binary", "digest", "for", "the", "PBKDF2", "hash", "algorithm", "of", "data", "with", "the", "given", "salt", ".", "It", "iterates", "iterations", "time", "and", "produces", "a", "key", "of", "keylen", "bytes", ".", "By", "default", "SHA",...
python
train
PyHDI/Pyverilog
pyverilog/vparser/parser.py
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L1438-L1442
def p_delays_floatnumber(self, p): 'delays : DELAY floatnumber' p[0] = DelayStatement(FloatConst( p[2], lineno=p.lineno(1)), lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
[ "def", "p_delays_floatnumber", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "DelayStatement", "(", "FloatConst", "(", "p", "[", "2", "]", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ")", ",", "lineno", "=", "p", ".", "li...
delays : DELAY floatnumber
[ "delays", ":", "DELAY", "floatnumber" ]
python
train
softlayer/softlayer-python
SoftLayer/CLI/call_api.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/call_api.py#L16-L53
def _build_filters(_filters): """Builds filters using the filter options passed into the CLI. This only supports the equals keyword at the moment. """ root = utils.NestedDict({}) for _filter in _filters: operation = None for operation, token in SPLIT_TOKENS: # split "som...
[ "def", "_build_filters", "(", "_filters", ")", ":", "root", "=", "utils", ".", "NestedDict", "(", "{", "}", ")", "for", "_filter", "in", "_filters", ":", "operation", "=", "None", "for", "operation", ",", "token", "in", "SPLIT_TOKENS", ":", "# split \"some...
Builds filters using the filter options passed into the CLI. This only supports the equals keyword at the moment.
[ "Builds", "filters", "using", "the", "filter", "options", "passed", "into", "the", "CLI", "." ]
python
train
PMEAL/OpenPNM
openpnm/models/misc/misc.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/models/misc/misc.py#L292-L341
def generic_distribution(target, seeds, func): r""" Accepts an 'rv_frozen' object from the Scipy.stats submodule and returns values from the distribution for the given seeds This uses the ``ppf`` method of the stats object Parameters ---------- target : OpenPNM Object The object wh...
[ "def", "generic_distribution", "(", "target", ",", "seeds", ",", "func", ")", ":", "seeds", "=", "target", "[", "seeds", "]", "value", "=", "func", ".", "ppf", "(", "seeds", ")", "return", "value" ]
r""" Accepts an 'rv_frozen' object from the Scipy.stats submodule and returns values from the distribution for the given seeds This uses the ``ppf`` method of the stats object Parameters ---------- target : OpenPNM Object The object which this model is associated with. This controls th...
[ "r", "Accepts", "an", "rv_frozen", "object", "from", "the", "Scipy", ".", "stats", "submodule", "and", "returns", "values", "from", "the", "distribution", "for", "the", "given", "seeds" ]
python
train
empirical-org/Quill-NLP-Tools-and-Datasets
utils/qfragment/examples/porcupine/app.py
https://github.com/empirical-org/Quill-NLP-Tools-and-Datasets/blob/f2ff579ddf3a556d9cdc47c5f702422fa06863d9/utils/qfragment/examples/porcupine/app.py#L59-L102
def get_submissions(): """API endpoint to get submissions in JSON format""" print(request.args.to_dict()) print(request.args.get('search[value]')) print(request.args.get('draw', 1)) # submissions = session.query(Submission).all() if request.args.get('correct_filter', 'all') == 'all': co...
[ "def", "get_submissions", "(", ")", ":", "print", "(", "request", ".", "args", ".", "to_dict", "(", ")", ")", "print", "(", "request", ".", "args", ".", "get", "(", "'search[value]'", ")", ")", "print", "(", "request", ".", "args", ".", "get", "(", ...
API endpoint to get submissions in JSON format
[ "API", "endpoint", "to", "get", "submissions", "in", "JSON", "format" ]
python
train
OCHA-DAP/hdx-python-country
src/hdx/location/country.py
https://github.com/OCHA-DAP/hdx-python-country/blob/e86a0b5f182a5d010c4cd7faa36a213cfbcc01f6/src/hdx/location/country.py#L409-L446
def simplify_countryname(cls, country): # type: (str) -> (str, List[str]) """Simplifies country name by removing descriptive text eg. DEMOCRATIC, REPUBLIC OF etc. Args: country (str): Country name to simplify Returns: Tuple[str, List[str]]: Uppercase simplified ...
[ "def", "simplify_countryname", "(", "cls", ",", "country", ")", ":", "# type: (str) -> (str, List[str])", "countryupper", "=", "country", ".", "upper", "(", ")", "words", "=", "get_words_in_sentence", "(", "countryupper", ")", "index", "=", "countryupper", ".", "f...
Simplifies country name by removing descriptive text eg. DEMOCRATIC, REPUBLIC OF etc. Args: country (str): Country name to simplify Returns: Tuple[str, List[str]]: Uppercase simplified country name and list of removed words
[ "Simplifies", "country", "name", "by", "removing", "descriptive", "text", "eg", ".", "DEMOCRATIC", "REPUBLIC", "OF", "etc", "." ]
python
train
iotile/coretools
iotilecore/iotile/core/utilities/kvstore_json.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/kvstore_json.py#L48-L58
def _load_file(self): """Load all entries from json backing file """ if not os.path.exists(self.file): return {} with open(self.file, "r") as infile: data = json.load(infile) return data
[ "def", "_load_file", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "file", ")", ":", "return", "{", "}", "with", "open", "(", "self", ".", "file", ",", "\"r\"", ")", "as", "infile", ":", "data", "=", "j...
Load all entries from json backing file
[ "Load", "all", "entries", "from", "json", "backing", "file" ]
python
train
drericstrong/pyedna
pyedna/ezdna.py
https://github.com/drericstrong/pyedna/blob/b8f8f52def4f26bb4f3a993ce3400769518385f6/pyedna/ezdna.py#L729-L741
def SelectPoint(): """ Opens an eDNA point picker, where the user can select a single tag. :return: selected tag name """ # Define all required variables in the correct ctypes format pszPoint = create_string_buffer(20) nPoint = c_ushort(20) # Opens the point picker dna_dll...
[ "def", "SelectPoint", "(", ")", ":", "# Define all required variables in the correct ctypes format\r", "pszPoint", "=", "create_string_buffer", "(", "20", ")", "nPoint", "=", "c_ushort", "(", "20", ")", "# Opens the point picker\r", "dna_dll", ".", "DnaSelectPoint", "(", ...
Opens an eDNA point picker, where the user can select a single tag. :return: selected tag name
[ "Opens", "an", "eDNA", "point", "picker", "where", "the", "user", "can", "select", "a", "single", "tag", ".", ":", "return", ":", "selected", "tag", "name" ]
python
train
BYU-PCCL/holodeck
holodeck/environments.py
https://github.com/BYU-PCCL/holodeck/blob/01acd4013f5acbd9f61fbc9caaafe19975e8b121/holodeck/environments.py#L262-L273
def spawn_agent(self, agent_definition, location): """Queues a spawn agent command. It will be applied when `tick` or `step` is called next. The agent won't be able to be used until the next frame. Args: agent_definition (:obj:`AgentDefinition`): The definition of the agent to spawn...
[ "def", "spawn_agent", "(", "self", ",", "agent_definition", ",", "location", ")", ":", "self", ".", "_should_write_to_command_buffer", "=", "True", "self", ".", "_add_agents", "(", "agent_definition", ")", "command_to_send", "=", "SpawnAgentCommand", "(", "location"...
Queues a spawn agent command. It will be applied when `tick` or `step` is called next. The agent won't be able to be used until the next frame. Args: agent_definition (:obj:`AgentDefinition`): The definition of the agent to spawn. location (np.ndarray or list): The position to s...
[ "Queues", "a", "spawn", "agent", "command", ".", "It", "will", "be", "applied", "when", "tick", "or", "step", "is", "called", "next", ".", "The", "agent", "won", "t", "be", "able", "to", "be", "used", "until", "the", "next", "frame", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/image_transformer.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer.py#L565-L579
def imagetransformerpp_base_5l_8h_big_uncond_dr00_dan_g_bs1(): """For 256x256.""" hparams = imagetransformerpp_base_10l_8h_big_uncond_dr03_dan_g() # TODO(trandustin): I forgot to set this in the runs! Maybe it's not used in # image transformer training implementation? # hparams.img_len = 256 hparams.max_len...
[ "def", "imagetransformerpp_base_5l_8h_big_uncond_dr00_dan_g_bs1", "(", ")", ":", "hparams", "=", "imagetransformerpp_base_10l_8h_big_uncond_dr03_dan_g", "(", ")", "# TODO(trandustin): I forgot to set this in the runs! Maybe it's not used in", "# image transformer training implementation?", "...
For 256x256.
[ "For", "256x256", "." ]
python
train
edeposit/marcxml2mods
src/marcxml2mods/mods_postprocessor/monograph.py
https://github.com/edeposit/marcxml2mods/blob/7b44157e859b4d2a372f79598ddbf77e43d39812/src/marcxml2mods/mods_postprocessor/monograph.py#L318-L344
def fix_missing_lang_tags(marc_xml, dom): """ If the lang tags are missing, add them to the MODS. Lang tags are parsed from `marc_xml`. """ def get_lang_tag(lang): lang_str = '\n <mods:language>\n' lang_str += ' <mods:languageTerm authority="iso639-2b" type="code">' lang_...
[ "def", "fix_missing_lang_tags", "(", "marc_xml", ",", "dom", ")", ":", "def", "get_lang_tag", "(", "lang", ")", ":", "lang_str", "=", "'\\n <mods:language>\\n'", "lang_str", "+=", "' <mods:languageTerm authority=\"iso639-2b\" type=\"code\">'", "lang_str", "+=", "lang"...
If the lang tags are missing, add them to the MODS. Lang tags are parsed from `marc_xml`.
[ "If", "the", "lang", "tags", "are", "missing", "add", "them", "to", "the", "MODS", ".", "Lang", "tags", "are", "parsed", "from", "marc_xml", "." ]
python
train
mkouhei/tonicdnscli
src/tonicdnscli/connect.py
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/connect.py#L135-L207
def response(uri, method, res, token='', keyword='', content='', raw_flag=False): """Response of tonicdns_client request Arguments: uri: TonicDNS API URI method: TonicDNS API request method res: Response of against request to TonicDNS API token: Toni...
[ "def", "response", "(", "uri", ",", "method", ",", "res", ",", "token", "=", "''", ",", "keyword", "=", "''", ",", "content", "=", "''", ",", "raw_flag", "=", "False", ")", ":", "if", "method", "==", "'GET'", "or", "(", "method", "==", "'PUT'", "...
Response of tonicdns_client request Arguments: uri: TonicDNS API URI method: TonicDNS API request method res: Response of against request to TonicDNS API token: TonicDNS API token keyword: Processing keyword content: JSON data raw_flag: True...
[ "Response", "of", "tonicdns_client", "request" ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py#L560-L569
def set_mode_manual(self): '''enter MANUAL mode''' if self.mavlink10(): self.mav.command_long_send(self.target_system, self.target_component, mavlink.MAV_CMD_DO_SET_MODE, 0, mavlink.MAV_MODE_MANUAL_ARMED, ...
[ "def", "set_mode_manual", "(", "self", ")", ":", "if", "self", ".", "mavlink10", "(", ")", ":", "self", ".", "mav", ".", "command_long_send", "(", "self", ".", "target_system", ",", "self", ".", "target_component", ",", "mavlink", ".", "MAV_CMD_DO_SET_MODE",...
enter MANUAL mode
[ "enter", "MANUAL", "mode" ]
python
train
ibis-project/ibis
ibis/bigquery/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/bigquery/client.py#L303-L356
def parse_project_and_dataset( project: str, dataset: Optional[str] = None ) -> Tuple[str, str, Optional[str]]: """Compute the billing project, data project, and dataset if available. This function figure out the project id under which queries will run versus the project of where the data live as well ...
[ "def", "parse_project_and_dataset", "(", "project", ":", "str", ",", "dataset", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Tuple", "[", "str", ",", "str", ",", "Optional", "[", "str", "]", "]", ":", "try", ":", "data_project", ",", "d...
Compute the billing project, data project, and dataset if available. This function figure out the project id under which queries will run versus the project of where the data live as well as what dataset to use. Parameters ---------- project : str A project name dataset : Optional[str]...
[ "Compute", "the", "billing", "project", "data", "project", "and", "dataset", "if", "available", "." ]
python
train
noirbizarre/minibench
minibench/benchmark.py
https://github.com/noirbizarre/minibench/blob/a1ac66dc075181c62bb3c0d3a26beb5c46d5f4ab/minibench/benchmark.py#L55-L59
def label(self): '''A human readable label''' if self.__doc__ and self.__doc__.strip(): return self.__doc__.strip().splitlines()[0] return humanize(self.__class__.__name__)
[ "def", "label", "(", "self", ")", ":", "if", "self", ".", "__doc__", "and", "self", ".", "__doc__", ".", "strip", "(", ")", ":", "return", "self", ".", "__doc__", ".", "strip", "(", ")", ".", "splitlines", "(", ")", "[", "0", "]", "return", "huma...
A human readable label
[ "A", "human", "readable", "label" ]
python
train
kiwiz/gkeepapi
gkeepapi/__init__.py
https://github.com/kiwiz/gkeepapi/blob/78aaae8b988b1cf616e3973f7f15d4c6d5e996cc/gkeepapi/__init__.py#L523-L540
def resume(self, email, master_token, state=None, sync=True): """Authenticate to Google with the provided master token & sync. Args: email (str): The account to use. master_token (str): The master token. state (dict): Serialized state to load. Raises: ...
[ "def", "resume", "(", "self", ",", "email", ",", "master_token", ",", "state", "=", "None", ",", "sync", "=", "True", ")", ":", "auth", "=", "APIAuth", "(", "self", ".", "OAUTH_SCOPES", ")", "ret", "=", "auth", ".", "load", "(", "email", ",", "mast...
Authenticate to Google with the provided master token & sync. Args: email (str): The account to use. master_token (str): The master token. state (dict): Serialized state to load. Raises: LoginException: If there was a problem logging in.
[ "Authenticate", "to", "Google", "with", "the", "provided", "master", "token", "&", "sync", "." ]
python
train
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L163-L215
def chosen_view_factory(chooser_cls): """ Returns a ChosenView class that extends specified chooser class. :param chooser_cls: the class to extend. :rtype: class. """ class ChosenView(chooser_cls): #noinspection PyUnusedLocal def get(self, request, *args, **kwargs): ...
[ "def", "chosen_view_factory", "(", "chooser_cls", ")", ":", "class", "ChosenView", "(", "chooser_cls", ")", ":", "#noinspection PyUnusedLocal", "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n ...
Returns a ChosenView class that extends specified chooser class. :param chooser_cls: the class to extend. :rtype: class.
[ "Returns", "a", "ChosenView", "class", "that", "extends", "specified", "chooser", "class", "." ]
python
train
Avsecz/kopt
kopt/hyopt.py
https://github.com/Avsecz/kopt/blob/fe4f929c8938590845306a759547daa5ba8bd7a9/kopt/hyopt.py#L171-L177
def count_by_state_unsynced(self, arg): """Extends the original object in order to inject checking for stalled jobs and killing them if they are running for too long """ if self.kill_timeout is not None: self.delete_running(self.kill_timeout) return super(KMongoTrials...
[ "def", "count_by_state_unsynced", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "kill_timeout", "is", "not", "None", ":", "self", ".", "delete_running", "(", "self", ".", "kill_timeout", ")", "return", "super", "(", "KMongoTrials", ",", "self", ")"...
Extends the original object in order to inject checking for stalled jobs and killing them if they are running for too long
[ "Extends", "the", "original", "object", "in", "order", "to", "inject", "checking", "for", "stalled", "jobs", "and", "killing", "them", "if", "they", "are", "running", "for", "too", "long" ]
python
train
proycon/pynlpl
pynlpl/formats/folia.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1766-L1768
def findreplaceables(Class, parent, set=None,**kwargs): """Internal method to find replaceable elements. Auxiliary function used by :meth:`AbstractElement.replace`. Can be overriden for more fine-grained control.""" return list(parent.select(Class,set,False))
[ "def", "findreplaceables", "(", "Class", ",", "parent", ",", "set", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "list", "(", "parent", ".", "select", "(", "Class", ",", "set", ",", "False", ")", ")" ]
Internal method to find replaceable elements. Auxiliary function used by :meth:`AbstractElement.replace`. Can be overriden for more fine-grained control.
[ "Internal", "method", "to", "find", "replaceable", "elements", ".", "Auxiliary", "function", "used", "by", ":", "meth", ":", "AbstractElement", ".", "replace", ".", "Can", "be", "overriden", "for", "more", "fine", "-", "grained", "control", "." ]
python
train
minio/minio-py
minio/parsers.py
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/parsers.py#L427-L442
def parse_multi_object_delete_response(data): """Parser for Multi-Object Delete API response. :param data: XML response body content from service. :return: Returns list of error objects for each delete object that had an error. """ root = S3Element.fromstring('MultiObjectDeleteResult', data) ...
[ "def", "parse_multi_object_delete_response", "(", "data", ")", ":", "root", "=", "S3Element", ".", "fromstring", "(", "'MultiObjectDeleteResult'", ",", "data", ")", "return", "[", "MultiDeleteError", "(", "errtag", ".", "get_child_text", "(", "'Key'", ")", ",", ...
Parser for Multi-Object Delete API response. :param data: XML response body content from service. :return: Returns list of error objects for each delete object that had an error.
[ "Parser", "for", "Multi", "-", "Object", "Delete", "API", "response", "." ]
python
train
dancsalo/TensorBase
tensorbase/base.py
https://github.com/dancsalo/TensorBase/blob/3d42a326452bd03427034916ff2fb90730020204/tensorbase/base.py#L618-L662
def deconvnet(self, filter_sizes, output_channels, strides=None, padding=None, activation_fn=None, b_value=None, s_value=None, bn=None, trainable=True): ''' Shortcut for creating a 2D Deconvolutional Neural Network in one line Stacks multiple deconv2d layers, with arguments for...
[ "def", "deconvnet", "(", "self", ",", "filter_sizes", ",", "output_channels", ",", "strides", "=", "None", ",", "padding", "=", "None", ",", "activation_fn", "=", "None", ",", "b_value", "=", "None", ",", "s_value", "=", "None", ",", "bn", "=", "None", ...
Shortcut for creating a 2D Deconvolutional Neural Network in one line Stacks multiple deconv2d layers, with arguments for each layer defined in a list. If an argument is left as None, then the conv2d defaults are kept :param filter_sizes: int. assumes square filter :param output_channels...
[ "Shortcut", "for", "creating", "a", "2D", "Deconvolutional", "Neural", "Network", "in", "one", "line", "Stacks", "multiple", "deconv2d", "layers", "with", "arguments", "for", "each", "layer", "defined", "in", "a", "list", ".", "If", "an", "argument", "is", "...
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L11765-L11810
def spkcvo(target, et, outref, refloc, abcorr, obssta, obsepc, obsctr, obsref): """ Return the state of a specified target relative to an "observer," where the observer has constant velocity in a specified reference frame. The observer's state is provided by the calling program rather than by loade...
[ "def", "spkcvo", "(", "target", ",", "et", ",", "outref", ",", "refloc", ",", "abcorr", ",", "obssta", ",", "obsepc", ",", "obsctr", ",", "obsref", ")", ":", "target", "=", "stypes", ".", "stringToCharP", "(", "target", ")", "et", "=", "ctypes", ".",...
Return the state of a specified target relative to an "observer," where the observer has constant velocity in a specified reference frame. The observer's state is provided by the calling program rather than by loaded SPK files. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcvo_c.html ...
[ "Return", "the", "state", "of", "a", "specified", "target", "relative", "to", "an", "observer", "where", "the", "observer", "has", "constant", "velocity", "in", "a", "specified", "reference", "frame", ".", "The", "observer", "s", "state", "is", "provided", "...
python
train