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
MolSSI-BSE/basis_set_exchange
basis_set_exchange/cli/bse_handlers.py
https://github.com/MolSSI-BSE/basis_set_exchange/blob/e79110aaeb65f392ed5032420322dee3336948f7/basis_set_exchange/cli/bse_handlers.py#L40-L49
def _bse_cli_list_ref_formats(args): '''Handles the list-ref-formats subcommand''' all_refformats = api.get_reference_formats() if args.no_description: liststr = all_refformats.keys() else: liststr = format_columns(all_refformats.items()) return '\n'.join(liststr)
[ "def", "_bse_cli_list_ref_formats", "(", "args", ")", ":", "all_refformats", "=", "api", ".", "get_reference_formats", "(", ")", "if", "args", ".", "no_description", ":", "liststr", "=", "all_refformats", ".", "keys", "(", ")", "else", ":", "liststr", "=", "...
Handles the list-ref-formats subcommand
[ "Handles", "the", "list", "-", "ref", "-", "formats", "subcommand" ]
python
train
OSSOS/MOP
src/ossos/core/ossos/astrom.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/astrom.py#L345-L373
def _write_observation_headers(self, observations): """ See src/pipematt/step1matt-c """ for observation in observations: header = observation.header def get_header_vals(header_list): header_vals = [] for key in header_list: ...
[ "def", "_write_observation_headers", "(", "self", ",", "observations", ")", ":", "for", "observation", "in", "observations", ":", "header", "=", "observation", ".", "header", "def", "get_header_vals", "(", "header_list", ")", ":", "header_vals", "=", "[", "]", ...
See src/pipematt/step1matt-c
[ "See", "src", "/", "pipematt", "/", "step1matt", "-", "c" ]
python
train
mottosso/be
be/vendor/requests/sessions.py
https://github.com/mottosso/be/blob/0f3d4f3597c71223f616d78c6d9b2c8dffcd8a71/be/vendor/requests/sessions.py#L42-L72
def merge_setting(request_setting, session_setting, dict_class=OrderedDict): """ Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` ...
[ "def", "merge_setting", "(", "request_setting", ",", "session_setting", ",", "dict_class", "=", "OrderedDict", ")", ":", "if", "session_setting", "is", "None", ":", "return", "request_setting", "if", "request_setting", "is", "None", ":", "return", "session_setting",...
Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class`
[ "Determines", "appropriate", "setting", "for", "a", "given", "request", "taking", "into", "account", "the", "explicit", "setting", "on", "that", "request", "and", "the", "setting", "in", "the", "session", ".", "If", "a", "setting", "is", "a", "dictionary", "...
python
train
eventable/vobject
docs/build/lib/vobject/icalendar.py
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L802-L822
def transformToNative(obj): """ Turn obj.value into a list of dates, datetimes, or (datetime, timedelta) tuples. """ if obj.isNative: return obj obj.isNative = True if obj.value == '': obj.value = [] return obj tzinfo = ...
[ "def", "transformToNative", "(", "obj", ")", ":", "if", "obj", ".", "isNative", ":", "return", "obj", "obj", ".", "isNative", "=", "True", "if", "obj", ".", "value", "==", "''", ":", "obj", ".", "value", "=", "[", "]", "return", "obj", "tzinfo", "=...
Turn obj.value into a list of dates, datetimes, or (datetime, timedelta) tuples.
[ "Turn", "obj", ".", "value", "into", "a", "list", "of", "dates", "datetimes", "or", "(", "datetime", "timedelta", ")", "tuples", "." ]
python
train
datosgobar/pydatajson
pydatajson/indicators.py
https://github.com/datosgobar/pydatajson/blob/3141082ffbaa295e2deaf6ffbbc5a59f5859960e/pydatajson/indicators.py#L509-L562
def _count_fields_recursive(dataset, fields): """Cuenta la información de campos optativos/recomendados/requeridos desde 'fields', y cuenta la ocurrencia de los mismos en 'dataset'. Args: dataset (dict): diccionario con claves a ser verificadas. fields (dict): diccionario con los campos a v...
[ "def", "_count_fields_recursive", "(", "dataset", ",", "fields", ")", ":", "key_count", "=", "{", "'recomendado'", ":", "0", ",", "'optativo'", ":", "0", ",", "'requerido'", ":", "0", ",", "'total_optativo'", ":", "0", ",", "'total_recomendado'", ":", "0", ...
Cuenta la información de campos optativos/recomendados/requeridos desde 'fields', y cuenta la ocurrencia de los mismos en 'dataset'. Args: dataset (dict): diccionario con claves a ser verificadas. fields (dict): diccionario con los campos a verificar en dataset como claves, y 'optat...
[ "Cuenta", "la", "información", "de", "campos", "optativos", "/", "recomendados", "/", "requeridos", "desde", "fields", "y", "cuenta", "la", "ocurrencia", "de", "los", "mismos", "en", "dataset", "." ]
python
train
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/output_writers.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/output_writers.py#L504-L509
def _get_tmp_account_id(cls, writer_spec): """Returns the account id to use with tmp bucket.""" # pick tmp id iff tmp bucket is set explicitly if cls.TMP_BUCKET_NAME_PARAM in writer_spec: return writer_spec.get(cls._TMP_ACCOUNT_ID_PARAM, None) return cls._get_account_id(writer_spec)
[ "def", "_get_tmp_account_id", "(", "cls", ",", "writer_spec", ")", ":", "# pick tmp id iff tmp bucket is set explicitly", "if", "cls", ".", "TMP_BUCKET_NAME_PARAM", "in", "writer_spec", ":", "return", "writer_spec", ".", "get", "(", "cls", ".", "_TMP_ACCOUNT_ID_PARAM", ...
Returns the account id to use with tmp bucket.
[ "Returns", "the", "account", "id", "to", "use", "with", "tmp", "bucket", "." ]
python
train
greenelab/django-genes
genes/api.py
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/api.py#L202-L214
def post_list(self, request, **kwargs): """ (Copied from implementation in https://github.com/greenelab/adage-server/blob/master/adage/analyze/api.py) Handle an incoming POST as a GET to work around URI length limitations """ # The convert_post_to_VERB() technique is bor...
[ "def", "post_list", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "# The convert_post_to_VERB() technique is borrowed from", "# resources.py in tastypie source. This helps us to convert the POST", "# to a GET in the proper way internally.", "request", ".", "method...
(Copied from implementation in https://github.com/greenelab/adage-server/blob/master/adage/analyze/api.py) Handle an incoming POST as a GET to work around URI length limitations
[ "(", "Copied", "from", "implementation", "in", "https", ":", "//", "github", ".", "com", "/", "greenelab", "/", "adage", "-", "server", "/", "blob", "/", "master", "/", "adage", "/", "analyze", "/", "api", ".", "py", ")" ]
python
train
aarongarrett/inspyred
inspyred/swarm/topologies.py
https://github.com/aarongarrett/inspyred/blob/d5976ab503cc9d51c6f586cbb7bb601a38c01128/inspyred/swarm/topologies.py#L69-L101
def ring_topology(random, population, args): """Returns the neighbors using a ring topology. This function sets all particles in a specified sized neighborhood as neighbors for a given particle. This is known as a ring topology. The resulting list of lists of neighbors is returned. .. Arg...
[ "def", "ring_topology", "(", "random", ",", "population", ",", "args", ")", ":", "neighborhood_size", "=", "args", ".", "setdefault", "(", "'neighborhood_size'", ",", "3", ")", "half_hood", "=", "neighborhood_size", "//", "2", "neighbor_index_start", "=", "[", ...
Returns the neighbors using a ring topology. This function sets all particles in a specified sized neighborhood as neighbors for a given particle. This is known as a ring topology. The resulting list of lists of neighbors is returned. .. Arguments: random -- the random number generator...
[ "Returns", "the", "neighbors", "using", "a", "ring", "topology", ".", "This", "function", "sets", "all", "particles", "in", "a", "specified", "sized", "neighborhood", "as", "neighbors", "for", "a", "given", "particle", ".", "This", "is", "known", "as", "a", ...
python
train
mar10/wsgidav
wsgidav/server/server_cli.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/server/server_cli.py#L715-L730
def _run_wsgiref(app, config, mode): """Run WsgiDAV using wsgiref.simple_server, on Python 2.5+.""" # http://www.python.org/doc/2.5.2/lib/module-wsgiref.html from wsgiref.simple_server import make_server, software_version version = "WsgiDAV/{} {}".format(__version__, software_version) _logger.info(...
[ "def", "_run_wsgiref", "(", "app", ",", "config", ",", "mode", ")", ":", "# http://www.python.org/doc/2.5.2/lib/module-wsgiref.html", "from", "wsgiref", ".", "simple_server", "import", "make_server", ",", "software_version", "version", "=", "\"WsgiDAV/{} {}\"", ".", "fo...
Run WsgiDAV using wsgiref.simple_server, on Python 2.5+.
[ "Run", "WsgiDAV", "using", "wsgiref", ".", "simple_server", "on", "Python", "2", ".", "5", "+", "." ]
python
valid
hazelcast/hazelcast-python-client
hazelcast/proxy/queue.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/proxy/queue.py#L199-L208
def put(self, item): """ Adds the specified element into this queue. If there is no space, it waits until necessary space becomes available. :param item: (object), the specified item. """ check_not_none(item, "Value can't be None") element_data = self._to_data(it...
[ "def", "put", "(", "self", ",", "item", ")", ":", "check_not_none", "(", "item", ",", "\"Value can't be None\"", ")", "element_data", "=", "self", ".", "_to_data", "(", "item", ")", "return", "self", ".", "_encode_invoke", "(", "queue_put_codec", ",", "value...
Adds the specified element into this queue. If there is no space, it waits until necessary space becomes available. :param item: (object), the specified item.
[ "Adds", "the", "specified", "element", "into", "this", "queue", ".", "If", "there", "is", "no", "space", "it", "waits", "until", "necessary", "space", "becomes", "available", "." ]
python
train
ddorn/GUI
GUI/vracabulous.py
https://github.com/ddorn/GUI/blob/e1fcb5286d24e0995f280d5180222e51895c368c/GUI/vracabulous.py#L251-L265
def update_on_event(self, e): """Process a single event.""" if e.type == QUIT: self.running = False elif e.type == KEYDOWN: if e.key == K_ESCAPE: self.running = False elif e.key == K_F4 and e.mod & KMOD_ALT: # Alt+F4 --> quits ...
[ "def", "update_on_event", "(", "self", ",", "e", ")", ":", "if", "e", ".", "type", "==", "QUIT", ":", "self", ".", "running", "=", "False", "elif", "e", ".", "type", "==", "KEYDOWN", ":", "if", "e", ".", "key", "==", "K_ESCAPE", ":", "self", ".",...
Process a single event.
[ "Process", "a", "single", "event", "." ]
python
train
quodlibet/mutagen
mutagen/apev2.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/apev2.py#L427-L485
def save(self, filething=None): """Save changes to a file. If no filename is given, the one most recently loaded is used. Tags are always written at the end of the file, and include a header and a footer. """ fileobj = filething.fileobj data = _APEv2Data(fileo...
[ "def", "save", "(", "self", ",", "filething", "=", "None", ")", ":", "fileobj", "=", "filething", ".", "fileobj", "data", "=", "_APEv2Data", "(", "fileobj", ")", "if", "data", ".", "is_at_start", ":", "delete_bytes", "(", "fileobj", ",", "data", ".", "...
Save changes to a file. If no filename is given, the one most recently loaded is used. Tags are always written at the end of the file, and include a header and a footer.
[ "Save", "changes", "to", "a", "file", "." ]
python
train
cs50/check50
check50/api.py
https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L67-L86
def hash(file): """ Hashes file using SHA-256. :param file: name of file to be hashed :type file: str :rtype: str :raises check50.Failure: if ``file`` does not exist """ exists(file) log(_("hashing {}...").format(file)) # https://stackoverflow.com/a/22058673 with open(fil...
[ "def", "hash", "(", "file", ")", ":", "exists", "(", "file", ")", "log", "(", "_", "(", "\"hashing {}...\"", ")", ".", "format", "(", "file", ")", ")", "# https://stackoverflow.com/a/22058673", "with", "open", "(", "file", ",", "\"rb\"", ")", "as", "f", ...
Hashes file using SHA-256. :param file: name of file to be hashed :type file: str :rtype: str :raises check50.Failure: if ``file`` does not exist
[ "Hashes", "file", "using", "SHA", "-", "256", "." ]
python
train
fossasia/knittingpattern
knittingpattern/Loader.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Loader.py#L198-L211
def url(self, url, encoding="UTF-8"): """load and process the content behind a url :return: the processed result of the :paramref:`url's <url>` content :param str url: the url to retrieve the content from :param str encoding: the encoding of the retrieved content. The default ...
[ "def", "url", "(", "self", ",", "url", ",", "encoding", "=", "\"UTF-8\"", ")", ":", "import", "urllib", ".", "request", "with", "urllib", ".", "request", ".", "urlopen", "(", "url", ")", "as", "file", ":", "webpage_content", "=", "file", ".", "read", ...
load and process the content behind a url :return: the processed result of the :paramref:`url's <url>` content :param str url: the url to retrieve the content from :param str encoding: the encoding of the retrieved content. The default encoding is UTF-8.
[ "load", "and", "process", "the", "content", "behind", "a", "url" ]
python
valid
jonathf/chaospy
chaospy/distributions/sampler/generator.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/distributions/sampler/generator.py#L76-L139
def generate_samples(order, domain=1, rule="R", antithetic=None): """ Sample generator. Args: order (int): Sample order. Determines the number of samples to create. domain (Dist, int, numpy.ndarray): Defines the space where the samples are generated. If integer is ...
[ "def", "generate_samples", "(", "order", ",", "domain", "=", "1", ",", "rule", "=", "\"R\"", ",", "antithetic", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "logger", ".", "debug", "(", "\"generating random sampl...
Sample generator. Args: order (int): Sample order. Determines the number of samples to create. domain (Dist, int, numpy.ndarray): Defines the space where the samples are generated. If integer is provided, the space ``[0, 1]^domain`` will be used. If array-like ...
[ "Sample", "generator", "." ]
python
train
google/tangent
tangent/transformers.py
https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/transformers.py#L81-L96
def append(self, node): """Append a statement to the current statement. Note that multiple calls to append will result in the last statement to be appended to end up at the bottom. Args: node: The statement to append. Raises: ValueError: If the given node is not a statement. """ ...
[ "def", "append", "(", "self", ",", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "grammar", ".", "STATEMENTS", ")", ":", "raise", "ValueError", "self", ".", "to_append", "[", "-", "1", "]", ".", "append", "(", "node", ")" ]
Append a statement to the current statement. Note that multiple calls to append will result in the last statement to be appended to end up at the bottom. Args: node: The statement to append. Raises: ValueError: If the given node is not a statement.
[ "Append", "a", "statement", "to", "the", "current", "statement", "." ]
python
train
MagicStack/asyncpg
asyncpg/prepared_stmt.py
https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/prepared_stmt.py#L95-L108
def cursor(self, *args, prefetch=None, timeout=None) -> cursor.CursorFactory: """Return a *cursor factory* for the prepared statement. :param args: Query arguments. :param int prefetch: The number of rows the *cursor iterator* will prefetch (defaults ...
[ "def", "cursor", "(", "self", ",", "*", "args", ",", "prefetch", "=", "None", ",", "timeout", "=", "None", ")", "->", "cursor", ".", "CursorFactory", ":", "return", "cursor", ".", "CursorFactory", "(", "self", ".", "_connection", ",", "self", ".", "_qu...
Return a *cursor factory* for the prepared statement. :param args: Query arguments. :param int prefetch: The number of rows the *cursor iterator* will prefetch (defaults to ``50``.) :param float timeout: Optional timeout in seconds. :return: A :class:`~curs...
[ "Return", "a", "*", "cursor", "factory", "*", "for", "the", "prepared", "statement", "." ]
python
train
wonambi-python/wonambi
wonambi/attr/anat.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/anat.py#L295-L318
def read_label(self, hemi, parc_type='aparc'): """Read the labels (annotations) for each hemisphere. Parameters ---------- hemi : str 'lh' or 'rh' parc_type : str 'aparc', 'aparc.a2009s', 'BA', 'BA.thresh', or 'aparc.DKTatlas40' 'aparc.DKTatla...
[ "def", "read_label", "(", "self", ",", "hemi", ",", "parc_type", "=", "'aparc'", ")", ":", "parc_file", "=", "self", ".", "dir", "/", "'label'", "/", "(", "hemi", "+", "'.'", "+", "parc_type", "+", "'.annot'", ")", "vert_val", ",", "region_color", ",",...
Read the labels (annotations) for each hemisphere. Parameters ---------- hemi : str 'lh' or 'rh' parc_type : str 'aparc', 'aparc.a2009s', 'BA', 'BA.thresh', or 'aparc.DKTatlas40' 'aparc.DKTatlas40' is only for recent freesurfer versions Retur...
[ "Read", "the", "labels", "(", "annotations", ")", "for", "each", "hemisphere", "." ]
python
train
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/time_utils.py
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/time_utils.py#L16-L24
def SecondsToZuluTS(secs=None): """Returns Zulu TS from unix time seconds. If secs is not provided will convert the current time. """ if not secs: secs = int(time.time()) return(datetime.utcfromtimestamp(secs).strftime("%Y-%m-%dT%H:%M:%SZ"))
[ "def", "SecondsToZuluTS", "(", "secs", "=", "None", ")", ":", "if", "not", "secs", ":", "secs", "=", "int", "(", "time", ".", "time", "(", ")", ")", "return", "(", "datetime", ".", "utcfromtimestamp", "(", "secs", ")", ".", "strftime", "(", "\"%Y-%m-...
Returns Zulu TS from unix time seconds. If secs is not provided will convert the current time.
[ "Returns", "Zulu", "TS", "from", "unix", "time", "seconds", "." ]
python
train
pecan/pecan
pecan/secure.py
https://github.com/pecan/pecan/blob/833d0653fa0e6bbfb52545b091c30182105f4a82/pecan/secure.py#L205-L217
def handle_security(controller, im_self=None): """ Checks the security of a controller. """ if controller._pecan.get('secured', False): check_permissions = controller._pecan['check_permissions'] if isinstance(check_permissions, six.string_types): check_permissions = getattr( ...
[ "def", "handle_security", "(", "controller", ",", "im_self", "=", "None", ")", ":", "if", "controller", ".", "_pecan", ".", "get", "(", "'secured'", ",", "False", ")", ":", "check_permissions", "=", "controller", ".", "_pecan", "[", "'check_permissions'", "]...
Checks the security of a controller.
[ "Checks", "the", "security", "of", "a", "controller", "." ]
python
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L183-L188
def extract_all(self, directory=".", members=None): """Extract all member from the archive to the specified working directory. """ if self.handle: self.handle.extractall(path=directory, members=members)
[ "def", "extract_all", "(", "self", ",", "directory", "=", "\".\"", ",", "members", "=", "None", ")", ":", "if", "self", ".", "handle", ":", "self", ".", "handle", ".", "extractall", "(", "path", "=", "directory", ",", "members", "=", "members", ")" ]
Extract all member from the archive to the specified working directory.
[ "Extract", "all", "member", "from", "the", "archive", "to", "the", "specified", "working", "directory", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17r_2_00/cluster/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_2_00/cluster/__init__.py#L317-L338
def _set_designated_forwarder_hold_time(self, v, load=False): """ Setter method for designated_forwarder_hold_time, mapped from YANG variable /cluster/designated_forwarder_hold_time (uint16) If this variable is read-only (config: false) in the source YANG file, then _set_designated_forwarder_hold_time i...
[ "def", "_set_designated_forwarder_hold_time", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", ...
Setter method for designated_forwarder_hold_time, mapped from YANG variable /cluster/designated_forwarder_hold_time (uint16) If this variable is read-only (config: false) in the source YANG file, then _set_designated_forwarder_hold_time is considered as a private method. Backends looking to populate this va...
[ "Setter", "method", "for", "designated_forwarder_hold_time", "mapped", "from", "YANG", "variable", "/", "cluster", "/", "designated_forwarder_hold_time", "(", "uint16", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "...
python
train
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewprofile.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewprofile.py#L442-L490
def fromXml( xprofile ): """ Restores the profile information from XML. :param xprofile | <xml.etree.ElementTree.Element> :return <XViewProfile> """ # determine the proper version if xprofile.tag != 'profile': retur...
[ "def", "fromXml", "(", "xprofile", ")", ":", "# determine the proper version\r", "if", "xprofile", ".", "tag", "!=", "'profile'", ":", "return", "XViewProfile", "(", ")", "version", "=", "int", "(", "xprofile", ".", "get", "(", "'version'", ",", "'1'", ")", ...
Restores the profile information from XML. :param xprofile | <xml.etree.ElementTree.Element> :return <XViewProfile>
[ "Restores", "the", "profile", "information", "from", "XML", ".", ":", "param", "xprofile", "|", "<xml", ".", "etree", ".", "ElementTree", ".", "Element", ">", ":", "return", "<XViewProfile", ">" ]
python
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L150-L154
def annotate_gemini(data, retriever=None): """Annotate with population calls if have data installed. """ r = dd.get_variation_resources(data) return all([r.get(k) and objectstore.file_exists_or_remote(r[k]) for k in ["exac", "gnomad_exome"]])
[ "def", "annotate_gemini", "(", "data", ",", "retriever", "=", "None", ")", ":", "r", "=", "dd", ".", "get_variation_resources", "(", "data", ")", "return", "all", "(", "[", "r", ".", "get", "(", "k", ")", "and", "objectstore", ".", "file_exists_or_remote...
Annotate with population calls if have data installed.
[ "Annotate", "with", "population", "calls", "if", "have", "data", "installed", "." ]
python
train
jorbas/GADDAG
gaddag/gaddag.py
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L186-L203
def add_word(self, word): """ Add a word to the GADDAG. Args: word: A word to be added to the GADDAG. """ word = word.lower() if not (word.isascii() and word.isalpha()): raise ValueError("Invalid character in word '{}'".format(word)) wor...
[ "def", "add_word", "(", "self", ",", "word", ")", ":", "word", "=", "word", ".", "lower", "(", ")", "if", "not", "(", "word", ".", "isascii", "(", ")", "and", "word", ".", "isalpha", "(", ")", ")", ":", "raise", "ValueError", "(", "\"Invalid charac...
Add a word to the GADDAG. Args: word: A word to be added to the GADDAG.
[ "Add", "a", "word", "to", "the", "GADDAG", "." ]
python
train
DEIB-GECO/PyGMQL
gmql/RemoteConnection/RemoteManager.py
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/RemoteConnection/RemoteManager.py#L611-L622
def trace_job(self, jobId): """ Get information about the specified remote job :param jobId: the job identifier :return: a dictionary with the information """ header = self.__check_authentication() status_url = self.address + "/jobs/" + jobId + "/trace" status_re...
[ "def", "trace_job", "(", "self", ",", "jobId", ")", ":", "header", "=", "self", ".", "__check_authentication", "(", ")", "status_url", "=", "self", ".", "address", "+", "\"/jobs/\"", "+", "jobId", "+", "\"/trace\"", "status_resp", "=", "requests", ".", "ge...
Get information about the specified remote job :param jobId: the job identifier :return: a dictionary with the information
[ "Get", "information", "about", "the", "specified", "remote", "job" ]
python
train
martinpitt/python-dbusmock
dbusmock/templates/logind.py
https://github.com/martinpitt/python-dbusmock/blob/26f65f78bc0ed347233f699a8d6ee0e6880e7eb0/dbusmock/templates/logind.py#L117-L145
def AddSeat(self, seat): '''Convenience method to add a seat. Return the object path of the new seat. ''' seat_path = '/org/freedesktop/login1/seat/' + seat if seat_path in mockobject.objects: raise dbus.exceptions.DBusException('Seat %s already exists' % seat, ...
[ "def", "AddSeat", "(", "self", ",", "seat", ")", ":", "seat_path", "=", "'/org/freedesktop/login1/seat/'", "+", "seat", "if", "seat_path", "in", "mockobject", ".", "objects", ":", "raise", "dbus", ".", "exceptions", ".", "DBusException", "(", "'Seat %s already e...
Convenience method to add a seat. Return the object path of the new seat.
[ "Convenience", "method", "to", "add", "a", "seat", "." ]
python
train
dbarsam/python-vsgen
vsgen/solution.py
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/solution.py#L37-L47
def _import(self, datadict): """ Internal method to import instance variables data from a dictionary :param dict datadict: The dictionary containing variables values. """ self.GUID = datadict.get("GUID", uuid.uuid1()) self.FileName = datadict.get("FileName", "") ...
[ "def", "_import", "(", "self", ",", "datadict", ")", ":", "self", ".", "GUID", "=", "datadict", ".", "get", "(", "\"GUID\"", ",", "uuid", ".", "uuid1", "(", ")", ")", "self", ".", "FileName", "=", "datadict", ".", "get", "(", "\"FileName\"", ",", "...
Internal method to import instance variables data from a dictionary :param dict datadict: The dictionary containing variables values.
[ "Internal", "method", "to", "import", "instance", "variables", "data", "from", "a", "dictionary" ]
python
train
opendatateam/udata
udata/commands/images.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/commands/images.py#L30-L72
def render(): '''Force (re)rendering stored images''' from udata.core.organization.models import Organization from udata.core.post.models import Post from udata.core.reuse.models import Reuse from udata.core.user.models import User header('Rendering images') count = Counter() total = C...
[ "def", "render", "(", ")", ":", "from", "udata", ".", "core", ".", "organization", ".", "models", "import", "Organization", "from", "udata", ".", "core", ".", "post", ".", "models", "import", "Post", "from", "udata", ".", "core", ".", "reuse", ".", "mo...
Force (re)rendering stored images
[ "Force", "(", "re", ")", "rendering", "stored", "images" ]
python
train
AirtestProject/Poco
poco/pocofw.py
https://github.com/AirtestProject/Poco/blob/2c559a586adf3fd11ee81cabc446d4d3f6f2d119/poco/pocofw.py#L162-L199
def freeze(this): """ Snapshot current **hierarchy** and cache it into a new poco instance. This new poco instance is a copy from current poco instance (``self``). The hierarchy of the new poco instance is fixed and immutable. It will be super fast when calling ``dump`` function from fro...
[ "def", "freeze", "(", "this", ")", ":", "class", "FrozenPoco", "(", "Poco", ")", ":", "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "hierarchy_dict", "=", "this", ".", "agent", ".", "hierarchy", ".", "dump", "(", ")", "hierarchy"...
Snapshot current **hierarchy** and cache it into a new poco instance. This new poco instance is a copy from current poco instance (``self``). The hierarchy of the new poco instance is fixed and immutable. It will be super fast when calling ``dump`` function from frozen poco. See the example below. ...
[ "Snapshot", "current", "**", "hierarchy", "**", "and", "cache", "it", "into", "a", "new", "poco", "instance", ".", "This", "new", "poco", "instance", "is", "a", "copy", "from", "current", "poco", "instance", "(", "self", ")", ".", "The", "hierarchy", "of...
python
train
pypa/setuptools
setuptools/__init__.py
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/__init__.py#L203-L212
def _find_all_simple(path): """ Find all files under 'path' """ results = ( os.path.join(base, file) for base, dirs, files in os.walk(path, followlinks=True) for file in files ) return filter(os.path.isfile, results)
[ "def", "_find_all_simple", "(", "path", ")", ":", "results", "=", "(", "os", ".", "path", ".", "join", "(", "base", ",", "file", ")", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "path", ",", "followlinks", "=", "True", ...
Find all files under 'path'
[ "Find", "all", "files", "under", "path" ]
python
train
chemlab/chemlab
chemlab/graphics/transformations.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/graphics/transformations.py#L1039-L1087
def superimposition_matrix(v0, v1, scale=False, usesvd=True): """Return matrix to transform given 3D point set into second point set. v0 and v1 are shape (3, \*) or (4, \*) arrays of at least 3 points. The parameters scale and usesvd are explained in the more general affine_matrix_from_points function...
[ "def", "superimposition_matrix", "(", "v0", ",", "v1", ",", "scale", "=", "False", ",", "usesvd", "=", "True", ")", ":", "v0", "=", "numpy", ".", "array", "(", "v0", ",", "dtype", "=", "numpy", ".", "float64", ",", "copy", "=", "False", ")", "[", ...
Return matrix to transform given 3D point set into second point set. v0 and v1 are shape (3, \*) or (4, \*) arrays of at least 3 points. The parameters scale and usesvd are explained in the more general affine_matrix_from_points function. The returned matrix is a similarity or Eucledian transformatio...
[ "Return", "matrix", "to", "transform", "given", "3D", "point", "set", "into", "second", "point", "set", "." ]
python
train
common-workflow-language/cwltool
cwltool/executors.py
https://github.com/common-workflow-language/cwltool/blob/cb81b22abc52838823da9945f04d06739ab32fda/cwltool/executors.py#L252-L305
def run_job(self, job, # type: Union[JobBase, WorkflowJob, None] runtime_context # type: RuntimeContext ): # type: (...) -> None """ Execute a single Job in a seperate thread. """ if job is not None: with self.pending_jobs_lock: ...
[ "def", "run_job", "(", "self", ",", "job", ",", "# type: Union[JobBase, WorkflowJob, None]", "runtime_context", "# type: RuntimeContext", ")", ":", "# type: (...) -> None", "if", "job", "is", "not", "None", ":", "with", "self", ".", "pending_jobs_lock", ":", "self", ...
Execute a single Job in a seperate thread.
[ "Execute", "a", "single", "Job", "in", "a", "seperate", "thread", "." ]
python
train
TeamHG-Memex/eli5
eli5/transform.py
https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/transform.py#L7-L34
def transform_feature_names(transformer, in_names=None): """Get feature names for transformer output as a function of input names. Used by :func:`explain_weights` when applied to a scikit-learn Pipeline, this ``singledispatch`` should be registered with custom name transformations for each class of tra...
[ "def", "transform_feature_names", "(", "transformer", ",", "in_names", "=", "None", ")", ":", "if", "hasattr", "(", "transformer", ",", "'get_feature_names'", ")", ":", "return", "transformer", ".", "get_feature_names", "(", ")", "raise", "NotImplementedError", "(...
Get feature names for transformer output as a function of input names. Used by :func:`explain_weights` when applied to a scikit-learn Pipeline, this ``singledispatch`` should be registered with custom name transformations for each class of transformer. If there is no ``singledispatch`` handler reg...
[ "Get", "feature", "names", "for", "transformer", "output", "as", "a", "function", "of", "input", "names", "." ]
python
train
ejeschke/ginga
ginga/rv/Control.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L939-L945
def zoom_1_to_1(self): """Zoom the view to a 1 to 1 pixel ratio (100 %%). """ viewer = self.getfocus_viewer() if hasattr(viewer, 'scale_to'): viewer.scale_to(1.0, 1.0) return True
[ "def", "zoom_1_to_1", "(", "self", ")", ":", "viewer", "=", "self", ".", "getfocus_viewer", "(", ")", "if", "hasattr", "(", "viewer", ",", "'scale_to'", ")", ":", "viewer", ".", "scale_to", "(", "1.0", ",", "1.0", ")", "return", "True" ]
Zoom the view to a 1 to 1 pixel ratio (100 %%).
[ "Zoom", "the", "view", "to", "a", "1", "to", "1", "pixel", "ratio", "(", "100", "%%", ")", "." ]
python
train
zengbin93/zb
zb/crawlers/xinshipu.py
https://github.com/zengbin93/zb/blob/ccdb384a0b5801b459933220efcb71972c2b89a7/zb/crawlers/xinshipu.py#L86-L100
def get_all_classify(): """获取全部菜谱分类""" url = "https://www.xinshipu.com/%E8%8F%9C%E8%B0%B1%E5%A4%A7%E5%85%A8.html" response = requests.get(url, headers=get_header()) html = BeautifulSoup(response.text, "lxml") all_a = html.find("div", {'class': "detail-cate-list clearfix mt20"}).find_all('a') cl...
[ "def", "get_all_classify", "(", ")", ":", "url", "=", "\"https://www.xinshipu.com/%E8%8F%9C%E8%B0%B1%E5%A4%A7%E5%85%A8.html\"", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "get_header", "(", ")", ")", "html", "=", "BeautifulSoup", "(", ...
获取全部菜谱分类
[ "获取全部菜谱分类" ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/shellapp.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/shellapp.py#L231-L244
def init_code(self): """run the pre-flight code, specified via exec_lines""" self._run_startup_files() self._run_exec_lines() self._run_exec_files() self._run_cmd_line_code() self._run_module() # flush output, so itwon't be attached to the first cell ...
[ "def", "init_code", "(", "self", ")", ":", "self", ".", "_run_startup_files", "(", ")", "self", ".", "_run_exec_lines", "(", ")", "self", ".", "_run_exec_files", "(", ")", "self", ".", "_run_cmd_line_code", "(", ")", "self", ".", "_run_module", "(", ")", ...
run the pre-flight code, specified via exec_lines
[ "run", "the", "pre", "-", "flight", "code", "specified", "via", "exec_lines" ]
python
test
SHTOOLS/SHTOOLS
pyshtools/shclasses/shwindow.py
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/shclasses/shwindow.py#L714-L864
def plot_windows(self, nwin, lmax=None, maxcolumns=3, tick_interval=[60, 45], minor_tick_interval=None, xlabel='Longitude', ylabel='Latitude', axes_labelsize=None, tick_labelsize=None, title_labelsize=None, grid=False, show=True, title=...
[ "def", "plot_windows", "(", "self", ",", "nwin", ",", "lmax", "=", "None", ",", "maxcolumns", "=", "3", ",", "tick_interval", "=", "[", "60", ",", "45", "]", ",", "minor_tick_interval", "=", "None", ",", "xlabel", "=", "'Longitude'", ",", "ylabel", "="...
Plot the best-concentrated localization windows. Usage ----- x.plot_windows(nwin, [lmax, maxcolumns, tick_interval, minor_tick_interval, xlabel, ylabel, grid, show, title, axes_labelsize, tick_labelsize, t...
[ "Plot", "the", "best", "-", "concentrated", "localization", "windows", "." ]
python
train
apache/incubator-mxnet
python/mxnet/image/image.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/image/image.py#L1290-L1300
def hard_reset(self): """Resets the iterator and ignore roll over data""" if self.seq is not None and self.shuffle: random.shuffle(self.seq) if self.imgrec is not None: self.imgrec.reset() self.cur = 0 self._allow_read = True self._cache_data = Non...
[ "def", "hard_reset", "(", "self", ")", ":", "if", "self", ".", "seq", "is", "not", "None", "and", "self", ".", "shuffle", ":", "random", ".", "shuffle", "(", "self", ".", "seq", ")", "if", "self", ".", "imgrec", "is", "not", "None", ":", "self", ...
Resets the iterator and ignore roll over data
[ "Resets", "the", "iterator", "and", "ignore", "roll", "over", "data" ]
python
train
dokterbob/django-multilingual-model
multilingual_model/forms.py
https://github.com/dokterbob/django-multilingual-model/blob/2479b2c3d6f7b697e95aa1e082c8bc8699f1f638/multilingual_model/forms.py#L19-L58
def clean(self): """ Make sure there is at least a translation has been filled in. If a default language has been specified, make sure that it exists amongst translations. """ # First make sure the super's clean method is called upon. super(TranslationFormSet, se...
[ "def", "clean", "(", "self", ")", ":", "# First make sure the super's clean method is called upon.", "super", "(", "TranslationFormSet", ",", "self", ")", ".", "clean", "(", ")", "if", "settings", ".", "HIDE_LANGUAGE", ":", "return", "if", "len", "(", "self", "....
Make sure there is at least a translation has been filled in. If a default language has been specified, make sure that it exists amongst translations.
[ "Make", "sure", "there", "is", "at", "least", "a", "translation", "has", "been", "filled", "in", ".", "If", "a", "default", "language", "has", "been", "specified", "make", "sure", "that", "it", "exists", "amongst", "translations", "." ]
python
train
PmagPy/PmagPy
pmagpy/ipmag.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/ipmag.py#L6155-L6301
def azdip_magic(orient_file='orient.txt', samp_file="samples.txt", samp_con="1", Z=1, method_codes='FS-FD', location_name='unknown', append=False, output_dir='.', input_dir='.', data_model=3): """ takes space delimited AzDip file and converts to MagIC formatted tables Parameters __________ orie...
[ "def", "azdip_magic", "(", "orient_file", "=", "'orient.txt'", ",", "samp_file", "=", "\"samples.txt\"", ",", "samp_con", "=", "\"1\"", ",", "Z", "=", "1", ",", "method_codes", "=", "'FS-FD'", ",", "location_name", "=", "'unknown'", ",", "append", "=", "Fals...
takes space delimited AzDip file and converts to MagIC formatted tables Parameters __________ orient_file : name of azdip formatted input file samp_file : name of samples.txt formatted output file samp_con : integer of sample orientation convention [1] XXXXY: where XXXX is ...
[ "takes", "space", "delimited", "AzDip", "file", "and", "converts", "to", "MagIC", "formatted", "tables" ]
python
train
neovim/pynvim
pynvim/api/buffer.py
https://github.com/neovim/pynvim/blob/5e577188e6d7133f597ad0ce60dc6a4b1314064a/pynvim/api/buffer.py#L86-L90
def append(self, lines, index=-1): """Append a string or list of lines to the buffer.""" if isinstance(lines, (basestring, bytes)): lines = [lines] return self.request('nvim_buf_set_lines', index, index, True, lines)
[ "def", "append", "(", "self", ",", "lines", ",", "index", "=", "-", "1", ")", ":", "if", "isinstance", "(", "lines", ",", "(", "basestring", ",", "bytes", ")", ")", ":", "lines", "=", "[", "lines", "]", "return", "self", ".", "request", "(", "'nv...
Append a string or list of lines to the buffer.
[ "Append", "a", "string", "or", "list", "of", "lines", "to", "the", "buffer", "." ]
python
train
blockstack/blockstack-core
blockstack/lib/client.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/client.py#L240-L254
def json_is_exception(resp): """ Is the given response object an exception traceback? Return True if so Return False if not """ if not json_is_error(resp): return False if 'traceback' not in resp.keys() or 'error' not in resp.keys(): return False return True
[ "def", "json_is_exception", "(", "resp", ")", ":", "if", "not", "json_is_error", "(", "resp", ")", ":", "return", "False", "if", "'traceback'", "not", "in", "resp", ".", "keys", "(", ")", "or", "'error'", "not", "in", "resp", ".", "keys", "(", ")", "...
Is the given response object an exception traceback? Return True if so Return False if not
[ "Is", "the", "given", "response", "object", "an", "exception", "traceback?" ]
python
train
jupyterhub/nbgitpuller
nbgitpuller/pull.py
https://github.com/jupyterhub/nbgitpuller/blob/30df8d548078c58665ce0ae920308f991122abe3/nbgitpuller/pull.py#L133-L146
def find_upstream_changed(self, kind): """ Return list of files that have been changed upstream belonging to a particular kind of change """ output = subprocess.check_output([ 'git', 'log', '{}..origin/{}'.format(self.branch_name, self.branch_name), '--oneline', '...
[ "def", "find_upstream_changed", "(", "self", ",", "kind", ")", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "'git'", ",", "'log'", ",", "'{}..origin/{}'", ".", "format", "(", "self", ".", "branch_name", ",", "self", ".", "branch_name", ...
Return list of files that have been changed upstream belonging to a particular kind of change
[ "Return", "list", "of", "files", "that", "have", "been", "changed", "upstream", "belonging", "to", "a", "particular", "kind", "of", "change" ]
python
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L770-L835
def _read_hdr_file(ktlx_file): """Reads header of one KTLX file. Parameters ---------- ktlx_file : Path name of one of the ktlx files inside the directory (absolute path) Returns ------- dict dict with information about the file Notes ----- p.3: says long, but ...
[ "def", "_read_hdr_file", "(", "ktlx_file", ")", ":", "with", "ktlx_file", ".", "open", "(", "'rb'", ")", "as", "f", ":", "hdr", "=", "{", "}", "assert", "f", ".", "tell", "(", ")", "==", "0", "hdr", "[", "'file_guid'", "]", "=", "hexlify", "(", "...
Reads header of one KTLX file. Parameters ---------- ktlx_file : Path name of one of the ktlx files inside the directory (absolute path) Returns ------- dict dict with information about the file Notes ----- p.3: says long, but python-long requires 8 bytes, so we us...
[ "Reads", "header", "of", "one", "KTLX", "file", "." ]
python
train
Clinical-Genomics/scout
scout/parse/omim.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/omim.py#L43-L166
def parse_genemap2(lines): """Parse the omim source file called genemap2.txt Explanation of Phenotype field: Brackets, "[ ]", indicate "nondiseases," mainly genetic variations that lead to apparently abnormal laboratory test values. Braces, "{ }", indicate mutations that contribute to suscept...
[ "def", "parse_genemap2", "(", "lines", ")", ":", "LOG", ".", "info", "(", "\"Parsing the omim genemap2\"", ")", "header", "=", "[", "]", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "line", "=", "line", ".", "rstrip", "(", ")", ...
Parse the omim source file called genemap2.txt Explanation of Phenotype field: Brackets, "[ ]", indicate "nondiseases," mainly genetic variations that lead to apparently abnormal laboratory test values. Braces, "{ }", indicate mutations that contribute to susceptibility to multifactorial dis...
[ "Parse", "the", "omim", "source", "file", "called", "genemap2", ".", "txt", "Explanation", "of", "Phenotype", "field", ":", "Brackets", "[", "]", "indicate", "nondiseases", "mainly", "genetic", "variations", "that", "lead", "to", "apparently", "abnormal", "labor...
python
test
pvlib/pvlib-python
pvlib/clearsky.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/clearsky.py#L491-L499
def _calc_b(w, aod700): """Calculate the b coefficient.""" b1 = 0.00925*aod700**2 + 0.0148*aod700 - 0.0172 b0 = -0.7565*aod700**2 + 0.5057*aod700 + 0.4557 b = b1 * np.log(w) + b0 return b
[ "def", "_calc_b", "(", "w", ",", "aod700", ")", ":", "b1", "=", "0.00925", "*", "aod700", "**", "2", "+", "0.0148", "*", "aod700", "-", "0.0172", "b0", "=", "-", "0.7565", "*", "aod700", "**", "2", "+", "0.5057", "*", "aod700", "+", "0.4557", "b"...
Calculate the b coefficient.
[ "Calculate", "the", "b", "coefficient", "." ]
python
train
mar10/wsgidav
wsgidav/dc/simple_dc.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dc/simple_dc.py#L109-L117
def require_authentication(self, realm, environ): """Return True if this realm requires authentication (grant anonymous access otherwise).""" realm_entry = self._get_realm_entry(realm) if realm_entry is None: _logger.error( 'Missing configuration simple_dc.user_mappin...
[ "def", "require_authentication", "(", "self", ",", "realm", ",", "environ", ")", ":", "realm_entry", "=", "self", ".", "_get_realm_entry", "(", "realm", ")", "if", "realm_entry", "is", "None", ":", "_logger", ".", "error", "(", "'Missing configuration simple_dc....
Return True if this realm requires authentication (grant anonymous access otherwise).
[ "Return", "True", "if", "this", "realm", "requires", "authentication", "(", "grant", "anonymous", "access", "otherwise", ")", "." ]
python
valid
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/fluxion_node.py
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L419-L431
def _forward_mode(self, *args): """Forward mode differentiation for a constant""" # Evaluate inner function self.f X: np.ndarray dX: np.ndarray X, dX = self.f._forward_mode(*args) # Alias the power to p for legibility p: float = self.p # The function value...
[ "def", "_forward_mode", "(", "self", ",", "*", "args", ")", ":", "# Evaluate inner function self.f", "X", ":", "np", ".", "ndarray", "dX", ":", "np", ".", "ndarray", "X", ",", "dX", "=", "self", ".", "f", ".", "_forward_mode", "(", "*", "args", ")", ...
Forward mode differentiation for a constant
[ "Forward", "mode", "differentiation", "for", "a", "constant" ]
python
train
zeroSteiner/AdvancedHTTPServer
advancedhttpserver.py
https://github.com/zeroSteiner/AdvancedHTTPServer/blob/8c53cf7e1ddbf7ae9f573c82c5fe5f6992db7b5a/advancedhttpserver.py#L1521-L1536
def close(self): """ Close the web socket connection and stop processing results. If the connection is still open, a WebSocket close message will be sent to the peer. """ if not self.connected: return self.connected = False if self.handler.wfile.closed: return if select.select([], [self.handler....
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "return", "self", ".", "connected", "=", "False", "if", "self", ".", "handler", ".", "wfile", ".", "closed", ":", "return", "if", "select", ".", "select", "(", "[", ...
Close the web socket connection and stop processing results. If the connection is still open, a WebSocket close message will be sent to the peer.
[ "Close", "the", "web", "socket", "connection", "and", "stop", "processing", "results", ".", "If", "the", "connection", "is", "still", "open", "a", "WebSocket", "close", "message", "will", "be", "sent", "to", "the", "peer", "." ]
python
train
azraq27/neural
neural/general.py
https://github.com/azraq27/neural/blob/fe91bfeecbf73ad99708cf5dca66cb61fcd529f5/neural/general.py#L24-L30
def voxel_loop(self): '''iterator that loops through each voxel and yields the coords and time series as a tuple''' # Prob not the most efficient, but the best I can do for now: for x in xrange(len(self.data)): for y in xrange(len(self.data[x])): for z in xrange(len(s...
[ "def", "voxel_loop", "(", "self", ")", ":", "# Prob not the most efficient, but the best I can do for now:", "for", "x", "in", "xrange", "(", "len", "(", "self", ".", "data", ")", ")", ":", "for", "y", "in", "xrange", "(", "len", "(", "self", ".", "data", ...
iterator that loops through each voxel and yields the coords and time series as a tuple
[ "iterator", "that", "loops", "through", "each", "voxel", "and", "yields", "the", "coords", "and", "time", "series", "as", "a", "tuple" ]
python
train
crs4/hl7apy
hl7apy/__init__.py
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/__init__.py#L239-L281
def load_reference(name, element_type, version): """ Look for an element of the given type, name and version and return its reference structure :type element_type: ``str`` :param element_type: the element type to look for (e.g. 'Segment') :type name: ``str`` :param name: the element name to loo...
[ "def", "load_reference", "(", "name", ",", "element_type", ",", "version", ")", ":", "lib", "=", "load_library", "(", "version", ")", "ref", "=", "lib", ".", "get", "(", "name", ",", "element_type", ")", "return", "ref" ]
Look for an element of the given type, name and version and return its reference structure :type element_type: ``str`` :param element_type: the element type to look for (e.g. 'Segment') :type name: ``str`` :param name: the element name to look for (e.g. 'MSH') :type version: ``str`` :param vers...
[ "Look", "for", "an", "element", "of", "the", "given", "type", "name", "and", "version", "and", "return", "its", "reference", "structure" ]
python
train
ourway/auth
auth/CAS/authorization.py
https://github.com/ourway/auth/blob/f0d9676854dcec494add4fa086a9b2a3e4d8cea5/auth/CAS/authorization.py#L62-L66
def get_role_members(self, role): """get permissions of a user""" targetRoleDb = AuthGroup.objects(creator=self.client, role=role) members = AuthMembership.objects(groups__in=targetRoleDb).only('user') return json.loads(members.to_json())
[ "def", "get_role_members", "(", "self", ",", "role", ")", ":", "targetRoleDb", "=", "AuthGroup", ".", "objects", "(", "creator", "=", "self", ".", "client", ",", "role", "=", "role", ")", "members", "=", "AuthMembership", ".", "objects", "(", "groups__in",...
get permissions of a user
[ "get", "permissions", "of", "a", "user" ]
python
train
linkedin/luminol
src/luminol/algorithms/anomaly_detector_algorithms/default_detector.py
https://github.com/linkedin/luminol/blob/42e4ab969b774ff98f902d064cb041556017f635/src/luminol/algorithms/anomaly_detector_algorithms/default_detector.py#L35-L49
def _set_scores(self): """ Set anomaly scores using a weighted sum. """ anom_scores_ema = self.exp_avg_detector.run() anom_scores_deri = self.derivative_detector.run() anom_scores = {} for timestamp in anom_scores_ema.timestamps: # Compute a weighted a...
[ "def", "_set_scores", "(", "self", ")", ":", "anom_scores_ema", "=", "self", ".", "exp_avg_detector", ".", "run", "(", ")", "anom_scores_deri", "=", "self", ".", "derivative_detector", ".", "run", "(", ")", "anom_scores", "=", "{", "}", "for", "timestamp", ...
Set anomaly scores using a weighted sum.
[ "Set", "anomaly", "scores", "using", "a", "weighted", "sum", "." ]
python
train
juju/charm-helpers
charmhelpers/contrib/openstack/audits/openstack_security_guide.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/audits/openstack_security_guide.py#L220-L237
def validate_file_permissions(config): """Verify that permissions on configuration files are secure enough.""" files = config.get('files', {}) for file_name, options in files.items(): for key in options.keys(): if key not in ["owner", "group", "mode"]: raise RuntimeError(...
[ "def", "validate_file_permissions", "(", "config", ")", ":", "files", "=", "config", ".", "get", "(", "'files'", ",", "{", "}", ")", "for", "file_name", ",", "options", "in", "files", ".", "items", "(", ")", ":", "for", "key", "in", "options", ".", "...
Verify that permissions on configuration files are secure enough.
[ "Verify", "that", "permissions", "on", "configuration", "files", "are", "secure", "enough", "." ]
python
train
pyviz/holoviews
holoviews/core/dimension.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/dimension.py#L1206-L1284
def options(self, *args, **kwargs): """Applies simplified option definition returning a new object. Applies options on an object or nested group of objects in a flat format returning a new object with the options applied. If the options are to be set directly on the object a sim...
[ "def", "options", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "backend", "=", "kwargs", ".", "get", "(", "'backend'", ",", "None", ")", "clone", "=", "kwargs", ".", "pop", "(", "'clone'", ",", "True", ")", "if", "len", "(", ...
Applies simplified option definition returning a new object. Applies options on an object or nested group of objects in a flat format returning a new object with the options applied. If the options are to be set directly on the object a simple format may be used, e.g.: obj....
[ "Applies", "simplified", "option", "definition", "returning", "a", "new", "object", "." ]
python
train
spyder-ide/spyder
spyder/plugins/editor/panels/debugger.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L51-L66
def _draw_breakpoint_icon(self, top, painter, icon_name): """Draw the given breakpoint pixmap. Args: top (int): top of the line to draw the breakpoint icon. painter (QPainter) icon_name (srt): key of icon to draw (see: self.icons) """ rect = QRect(0, ...
[ "def", "_draw_breakpoint_icon", "(", "self", ",", "top", ",", "painter", ",", "icon_name", ")", ":", "rect", "=", "QRect", "(", "0", ",", "top", ",", "self", ".", "sizeHint", "(", ")", ".", "width", "(", ")", ",", "self", ".", "sizeHint", "(", ")",...
Draw the given breakpoint pixmap. Args: top (int): top of the line to draw the breakpoint icon. painter (QPainter) icon_name (srt): key of icon to draw (see: self.icons)
[ "Draw", "the", "given", "breakpoint", "pixmap", "." ]
python
train
jtmoulia/switchboard-python
examples/lamsonworker.py
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/examples/lamsonworker.py#L37-L44
def received_new(self, msg): """ As new messages arrive, deliver them to the lamson relay. """ logger.info("Receiving msg, delivering to Lamson...") logger.debug("Relaying msg to lamson: From: %s, To: %s", msg['From'], msg['To']) self._relay.deliver(m...
[ "def", "received_new", "(", "self", ",", "msg", ")", ":", "logger", ".", "info", "(", "\"Receiving msg, delivering to Lamson...\"", ")", "logger", ".", "debug", "(", "\"Relaying msg to lamson: From: %s, To: %s\"", ",", "msg", "[", "'From'", "]", ",", "msg", "[", ...
As new messages arrive, deliver them to the lamson relay.
[ "As", "new", "messages", "arrive", "deliver", "them", "to", "the", "lamson", "relay", "." ]
python
train
slickqa/python-client
slickqa/connection.py
https://github.com/slickqa/python-client/blob/1d36b4977cd4140d7d24917cab2b3f82b60739c2/slickqa/connection.py#L321-L348
def upload_local_file(self, local_file_path, file_obj=None): """Create a Stored File and upload it's data. This is a one part do it all type method. Here is what it does: 1. "Discover" information about the file (mime-type, size) 2. Create the stored file object in slick ...
[ "def", "upload_local_file", "(", "self", ",", "local_file_path", ",", "file_obj", "=", "None", ")", ":", "if", "file_obj", "is", "None", "and", "not", "os", ".", "path", ".", "exists", "(", "local_file_path", ")", ":", "return", "storedfile", "=", "StoredF...
Create a Stored File and upload it's data. This is a one part do it all type method. Here is what it does: 1. "Discover" information about the file (mime-type, size) 2. Create the stored file object in slick 3. Upload (chunked) all the data in the local file 4. ...
[ "Create", "a", "Stored", "File", "and", "upload", "it", "s", "data", ".", "This", "is", "a", "one", "part", "do", "it", "all", "type", "method", ".", "Here", "is", "what", "it", "does", ":", "1", ".", "Discover", "information", "about", "the", "file"...
python
train
ehansis/ozelot
ozelot/client.py
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/client.py#L102-L115
def store_password(params, password): """Store the password for a database connection using :mod:`keyring` Use the ``user`` field as the user name and ``<host>:<driver>`` as service name. Args: params (dict): database configuration, as defined in :mod:`ozelot.config` pa...
[ "def", "store_password", "(", "params", ",", "password", ")", ":", "user_name", "=", "params", "[", "'user'", "]", "service_name", "=", "params", "[", "'host'", "]", "+", "':'", "+", "params", "[", "'driver'", "]", "keyring", ".", "set_password", "(", "s...
Store the password for a database connection using :mod:`keyring` Use the ``user`` field as the user name and ``<host>:<driver>`` as service name. Args: params (dict): database configuration, as defined in :mod:`ozelot.config` password (str): password to store
[ "Store", "the", "password", "for", "a", "database", "connection", "using", ":", "mod", ":", "keyring" ]
python
train
yeraydiazdiaz/lunr.py
lunr/pipeline.py
https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/pipeline.py#L43-L56
def load(cls, serialised): """Loads a previously serialised pipeline.""" pipeline = cls() for fn_name in serialised: try: fn = cls.registered_functions[fn_name] except KeyError: raise BaseLunrException( "Cannot load unre...
[ "def", "load", "(", "cls", ",", "serialised", ")", ":", "pipeline", "=", "cls", "(", ")", "for", "fn_name", "in", "serialised", ":", "try", ":", "fn", "=", "cls", ".", "registered_functions", "[", "fn_name", "]", "except", "KeyError", ":", "raise", "Ba...
Loads a previously serialised pipeline.
[ "Loads", "a", "previously", "serialised", "pipeline", "." ]
python
train
iamteem/redisco
redisco/containers.py
https://github.com/iamteem/redisco/blob/a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91/redisco/containers.py#L457-L464
def lt(self, v, limit=None, offset=None): """Returns the list of the members of the set that have scores less than v. """ if limit is not None and offset is None: offset = 0 return self.zrangebyscore(self._min_score, "(%f" % v, start=offset, num=limit)
[ "def", "lt", "(", "self", ",", "v", ",", "limit", "=", "None", ",", "offset", "=", "None", ")", ":", "if", "limit", "is", "not", "None", "and", "offset", "is", "None", ":", "offset", "=", "0", "return", "self", ".", "zrangebyscore", "(", "self", ...
Returns the list of the members of the set that have scores less than v.
[ "Returns", "the", "list", "of", "the", "members", "of", "the", "set", "that", "have", "scores", "less", "than", "v", "." ]
python
train
dantezhu/haven
haven/gevent_impl.py
https://github.com/dantezhu/haven/blob/7bf7edab07fa2ade7644a548d6ab9d89cf3d259d/haven/gevent_impl.py#L88-L112
def set(self, interval, callback, repeat=False, force=True): """ 添加timer """ if self.timer: if force: # 如果已经存在,那么先要把现在的清空 self.clear() else: # 已经存在的话,就返回了 return def callback_wrapper(): ...
[ "def", "set", "(", "self", ",", "interval", ",", "callback", ",", "repeat", "=", "False", ",", "force", "=", "True", ")", ":", "if", "self", ".", "timer", ":", "if", "force", ":", "# 如果已经存在,那么先要把现在的清空", "self", ".", "clear", "(", ")", "else", ":", ...
添加timer
[ "添加timer" ]
python
train
reanahub/reana-commons
reana_commons/utils.py
https://github.com/reanahub/reana-commons/blob/abf31d9f495e0d93171c43fc4a414cd292091b11/reana_commons/utils.py#L210-L216
def render_cvmfs_sc(cvmfs_volume): """Render REANA_CVMFS_SC_TEMPLATE.""" name = CVMFS_REPOSITORIES[cvmfs_volume] rendered_template = dict(REANA_CVMFS_SC_TEMPLATE) rendered_template['metadata']['name'] = "csi-cvmfs-{}".format(name) rendered_template['parameters']['repository'] = cvmfs_volume retu...
[ "def", "render_cvmfs_sc", "(", "cvmfs_volume", ")", ":", "name", "=", "CVMFS_REPOSITORIES", "[", "cvmfs_volume", "]", "rendered_template", "=", "dict", "(", "REANA_CVMFS_SC_TEMPLATE", ")", "rendered_template", "[", "'metadata'", "]", "[", "'name'", "]", "=", "\"cs...
Render REANA_CVMFS_SC_TEMPLATE.
[ "Render", "REANA_CVMFS_SC_TEMPLATE", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/gui/lang/i18n.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/gui/lang/i18n.py#L23-L29
def get_path(language): ''' Returns the full path to the language file ''' filename = language.lower() + '.json' lang_file_path = os.path.join(_DEFAULT_DIR, filename) if not os.path.exists(lang_file_path): raise IOError('Could not find {} language file'.format(language)) return lang_file_path
[ "def", "get_path", "(", "language", ")", ":", "filename", "=", "language", ".", "lower", "(", ")", "+", "'.json'", "lang_file_path", "=", "os", ".", "path", ".", "join", "(", "_DEFAULT_DIR", ",", "filename", ")", "if", "not", "os", ".", "path", ".", ...
Returns the full path to the language file
[ "Returns", "the", "full", "path", "to", "the", "language", "file" ]
python
train
aodag/WebDispatch
webdispatch/uritemplate.py
https://github.com/aodag/WebDispatch/blob/55f8658a2b4100498e098a80303a346c3940f1bc/webdispatch/uritemplate.py#L93-L97
def new_named_args(self, cur_named_args: Dict[str, Any]) -> Dict[str, Any]: """ create new named args updating current name args""" named_args = cur_named_args.copy() named_args.update(self.matchdict) return named_args
[ "def", "new_named_args", "(", "self", ",", "cur_named_args", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "named_args", "=", "cur_named_args", ".", "copy", "(", ")", "named_args", ".", "update", "(", ...
create new named args updating current name args
[ "create", "new", "named", "args", "updating", "current", "name", "args" ]
python
train
CI-WATER/gsshapy
gsshapy/orm/gag.py
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L150-L186
def _createGsshaPyObjects(self, eventChunk): """ Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method """ ## TODO: Add Support for RADAR file format type values # Create GSSHAPY PrecipEvent event = PrecipEvent(description=eventChunk['description'], ...
[ "def", "_createGsshaPyObjects", "(", "self", ",", "eventChunk", ")", ":", "## TODO: Add Support for RADAR file format type values", "# Create GSSHAPY PrecipEvent", "event", "=", "PrecipEvent", "(", "description", "=", "eventChunk", "[", "'description'", "]", ",", "nrGag", ...
Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method
[ "Create", "GSSHAPY", "PrecipEvent", "PrecipValue", "and", "PrecipGage", "Objects", "Method" ]
python
train
uw-it-aca/uw-restclients-sws
uw_sws/department.py
https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/department.py#L14-L22
def get_departments_by_college(college): """ Returns a list of restclients.Department models, for the passed College model. """ url = "{}?{}".format( dept_search_url_prefix, urlencode({"college_abbreviation": college.label})) return _json_to_departments(get_resource(url), college...
[ "def", "get_departments_by_college", "(", "college", ")", ":", "url", "=", "\"{}?{}\"", ".", "format", "(", "dept_search_url_prefix", ",", "urlencode", "(", "{", "\"college_abbreviation\"", ":", "college", ".", "label", "}", ")", ")", "return", "_json_to_departmen...
Returns a list of restclients.Department models, for the passed College model.
[ "Returns", "a", "list", "of", "restclients", ".", "Department", "models", "for", "the", "passed", "College", "model", "." ]
python
train
Workiva/furious
example/complex_workflow.py
https://github.com/Workiva/furious/blob/c29823ec8b98549e7439d7273aa064d1e5830632/example/complex_workflow.py#L76-L91
def state_machine_success(): """A positive result! Iterate!""" from furious.async import Async from furious.context import get_current_async result = get_current_async().result if result == 'ALPHA': logging.info('Inserting continuation for state %s.', result) return Async(target=c...
[ "def", "state_machine_success", "(", ")", ":", "from", "furious", ".", "async", "import", "Async", "from", "furious", ".", "context", "import", "get_current_async", "result", "=", "get_current_async", "(", ")", ".", "result", "if", "result", "==", "'ALPHA'", "...
A positive result! Iterate!
[ "A", "positive", "result!", "Iterate!" ]
python
train
JoeVirtual/KonFoo
konfoo/core.py
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/core.py#L1046-L1055
def insert(self, index, item): """ Inserts the *item* before the *index* into the `Sequence`. :param int index: `Sequence` index. :param item: any :class:`Structure`, :class:`Sequence`, :class:`Array` or :class:`Field` instance. """ if not is_any(item): r...
[ "def", "insert", "(", "self", ",", "index", ",", "item", ")", ":", "if", "not", "is_any", "(", "item", ")", ":", "raise", "MemberTypeError", "(", "self", ",", "item", ",", "member", "=", "len", "(", "self", ")", ")", "self", ".", "_data", ".", "i...
Inserts the *item* before the *index* into the `Sequence`. :param int index: `Sequence` index. :param item: any :class:`Structure`, :class:`Sequence`, :class:`Array` or :class:`Field` instance.
[ "Inserts", "the", "*", "item", "*", "before", "the", "*", "index", "*", "into", "the", "Sequence", "." ]
python
train
base4sistemas/pyescpos
escpos/conn/serial.py
https://github.com/base4sistemas/pyescpos/blob/621bd00f1499aff700f37d8d36d04e0d761708f1/escpos/conn/serial.py#L349-L382
def as_from(value): """ Constructs an instance of :class:`SerialSettings` from a string representation, that looks like ``/dev/ttyS0:9600,8,1,N,RTSCTS``, describing, in order, the serial port name, baud rate, byte size, stop bits, parity and flow control protocol. Valid ...
[ "def", "as_from", "(", "value", ")", ":", "keys", "=", "[", "'port'", ",", "'baudrate'", ",", "'databits'", ",", "'stopbits'", ",", "'parity'", ",", "'protocol'", "]", "values", "=", "value", ".", "replace", "(", "','", ",", "':'", ")", ".", "split", ...
Constructs an instance of :class:`SerialSettings` from a string representation, that looks like ``/dev/ttyS0:9600,8,1,N,RTSCTS``, describing, in order, the serial port name, baud rate, byte size, stop bits, parity and flow control protocol. Valid string representations are (in cases whe...
[ "Constructs", "an", "instance", "of", ":", "class", ":", "SerialSettings", "from", "a", "string", "representation", "that", "looks", "like", "/", "dev", "/", "ttyS0", ":", "9600", "8", "1", "N", "RTSCTS", "describing", "in", "order", "the", "serial", "port...
python
train
DataDog/integrations-core
openstack_controller/datadog_checks/openstack_controller/openstack_controller.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/openstack_controller.py#L601-L669
def init_api(self, instance_config, custom_tags): """ Guarantees a valid auth scope for this instance, and returns it Communicates with the identity server and initializes a new scope when one is absent, or has been forcibly removed due to token expiry """ custom_tags = ...
[ "def", "init_api", "(", "self", ",", "instance_config", ",", "custom_tags", ")", ":", "custom_tags", "=", "custom_tags", "or", "[", "]", "keystone_server_url", "=", "instance_config", ".", "get", "(", "\"keystone_server_url\"", ")", "proxy_config", "=", "self", ...
Guarantees a valid auth scope for this instance, and returns it Communicates with the identity server and initializes a new scope when one is absent, or has been forcibly removed due to token expiry
[ "Guarantees", "a", "valid", "auth", "scope", "for", "this", "instance", "and", "returns", "it" ]
python
train
PyGithub/PyGithub
github/AuthenticatedUser.py
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/AuthenticatedUser.py#L383-L393
def add_to_following(self, following): """ :calls: `PUT /user/following/:user <http://developer.github.com/v3/users/followers>`_ :param following: :class:`github.NamedUser.NamedUser` :rtype: None """ assert isinstance(following, github.NamedUser.NamedUser), following ...
[ "def", "add_to_following", "(", "self", ",", "following", ")", ":", "assert", "isinstance", "(", "following", ",", "github", ".", "NamedUser", ".", "NamedUser", ")", ",", "following", "headers", ",", "data", "=", "self", ".", "_requester", ".", "requestJsonA...
:calls: `PUT /user/following/:user <http://developer.github.com/v3/users/followers>`_ :param following: :class:`github.NamedUser.NamedUser` :rtype: None
[ ":", "calls", ":", "PUT", "/", "user", "/", "following", "/", ":", "user", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "users", "/", "followers", ">", "_", ":", "param", "following", ":", ":", "class", ":", "github",...
python
train
getpelican/pelican-plugins
render_math/math.py
https://github.com/getpelican/pelican-plugins/blob/cfc7a3f224f1743063b034561f89a6a712d13587/render_math/math.py#L319-L330
def rst_add_mathjax(content): """Adds mathjax script for reStructuredText""" # .rst is the only valid extension for reStructuredText files _, ext = os.path.splitext(os.path.basename(content.source_path)) if ext != '.rst': return # If math class is present in text, add the javascript # ...
[ "def", "rst_add_mathjax", "(", "content", ")", ":", "# .rst is the only valid extension for reStructuredText files", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "content", ".", "source_path", ")", ")", ...
Adds mathjax script for reStructuredText
[ "Adds", "mathjax", "script", "for", "reStructuredText" ]
python
train
ace0/pyrelic
pyrelic/ecqv.py
https://github.com/ace0/pyrelic/blob/f23d4e6586674675f72304d5938548267d6413bf/pyrelic/ecqv.py#L48-L81
def validate(idText, alpha, r, cert, caPubkey): """ A server can validate an implicit certificate response using identity string @idText, private value @alpha (used to generate cert request), and the certificate response @r (private key component) and implicit @cert. @raises Exception if the cer...
[ "def", "validate", "(", "idText", ",", "alpha", ",", "r", ",", "cert", ",", "caPubkey", ")", ":", "# Verify parameter types", "assertScalarType", "(", "alpha", ")", "assertScalarType", "(", "r", ")", "assertType", "(", "cert", ",", "ec1Element", ")", "assert...
A server can validate an implicit certificate response using identity string @idText, private value @alpha (used to generate cert request), and the certificate response @r (private key component) and implicit @cert. @raises Exception if the certificate response is invalid. @returns (privkey, pubkey)
[ "A", "server", "can", "validate", "an", "implicit", "certificate", "response", "using", "identity", "string" ]
python
train
Iotic-Labs/py-IoticAgent
src/IoticAgent/Core/Client.py
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/Client.py#L1225-L1235
def __fire_callback(self, type_, *args, **kwargs): """Returns True if at least one callback was called""" called = False plain_submit = self.__threadpool.submit with self.__callbacks: submit = self.__crud_threadpool.submit if type_ in _CB_CRUD_TYPES else plain_submit ...
[ "def", "__fire_callback", "(", "self", ",", "type_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "called", "=", "False", "plain_submit", "=", "self", ".", "__threadpool", ".", "submit", "with", "self", ".", "__callbacks", ":", "submit", "=", "...
Returns True if at least one callback was called
[ "Returns", "True", "if", "at", "least", "one", "callback", "was", "called" ]
python
train
DataONEorg/d1_python
lib_client/src/d1_client/cnclient.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_client/src/d1_client/cnclient.py#L622-L640
def listSubjectsResponse( self, query, status=None, start=None, count=None, vendorSpecific=None ): """CNIdentity.listSubjects(session, query, status, start, count) → SubjectList https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNIdentity.listSubjects. ...
[ "def", "listSubjectsResponse", "(", "self", ",", "query", ",", "status", "=", "None", ",", "start", "=", "None", ",", "count", "=", "None", ",", "vendorSpecific", "=", "None", ")", ":", "url_query", "=", "{", "'status'", ":", "status", ",", "'start'", ...
CNIdentity.listSubjects(session, query, status, start, count) → SubjectList https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNIdentity.listSubjects. Args: query: status: start: count: vendorSpecific: Retu...
[ "CNIdentity", ".", "listSubjects", "(", "session", "query", "status", "start", "count", ")", "→", "SubjectList", "https", ":", "//", "releases", ".", "dataone", ".", "org", "/", "online", "/", "api", "-", "documentation", "-", "v2", ".", "0", ".", "1", ...
python
train
d0c-s4vage/pfp
pfp/interp.py
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L340-L351
def get_var(self, name, recurse=True): """Return the first var of name ``name`` in the current scope stack (remember, vars are the ones that parse the input stream) :name: The name of the id :recurse: Whether parent scopes should also be searched (defaults to True) :retu...
[ "def", "get_var", "(", "self", ",", "name", ",", "recurse", "=", "True", ")", ":", "self", ".", "_dlog", "(", "\"getting var '{}'\"", ".", "format", "(", "name", ")", ")", "return", "self", ".", "_search", "(", "\"vars\"", ",", "name", ",", "recurse", ...
Return the first var of name ``name`` in the current scope stack (remember, vars are the ones that parse the input stream) :name: The name of the id :recurse: Whether parent scopes should also be searched (defaults to True) :returns: TODO
[ "Return", "the", "first", "var", "of", "name", "name", "in", "the", "current", "scope", "stack", "(", "remember", "vars", "are", "the", "ones", "that", "parse", "the", "input", "stream", ")" ]
python
train
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L773-L837
def create_devices(self, thing_names, config_file, region=None, cert_dir=None, append=False, account_id=None, policy_name='ggd-discovery-policy', profile_name=None): """ Using the `thing_names` values, creates Things in AWS IoT, attaches and download...
[ "def", "create_devices", "(", "self", ",", "thing_names", ",", "config_file", ",", "region", "=", "None", ",", "cert_dir", "=", "None", ",", "append", "=", "False", ",", "account_id", "=", "None", ",", "policy_name", "=", "'ggd-discovery-policy'", ",", "prof...
Using the `thing_names` values, creates Things in AWS IoT, attaches and downloads new keys & certs to the certificate directory, then records the created information in the local config file for inclusion in the Greengrass Group as Greengrass Devices. :param thing_names: the thing name ...
[ "Using", "the", "thing_names", "values", "creates", "Things", "in", "AWS", "IoT", "attaches", "and", "downloads", "new", "keys", "&", "certs", "to", "the", "certificate", "directory", "then", "records", "the", "created", "information", "in", "the", "local", "c...
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/extensions_v1beta1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/extensions_v1beta1_api.py#L1243-L1272
def delete_collection_namespaced_network_policy(self, namespace, **kwargs): # noqa: E501 """delete_collection_namespaced_network_policy # noqa: E501 delete collection of NetworkPolicy # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP r...
[ "def", "delete_collection_namespaced_network_policy", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return...
delete_collection_namespaced_network_policy # noqa: E501 delete collection of NetworkPolicy # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_network_poli...
[ "delete_collection_namespaced_network_policy", "#", "noqa", ":", "E501" ]
python
train
datacamp/antlr-ast
antlr_ast/ast.py
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L629-L632
def visitTerminal(self, ctx): """Converts case insensitive keywords and identifiers to lowercase""" text = ctx.getText() return Terminal.from_text(text, ctx)
[ "def", "visitTerminal", "(", "self", ",", "ctx", ")", ":", "text", "=", "ctx", ".", "getText", "(", ")", "return", "Terminal", ".", "from_text", "(", "text", ",", "ctx", ")" ]
Converts case insensitive keywords and identifiers to lowercase
[ "Converts", "case", "insensitive", "keywords", "and", "identifiers", "to", "lowercase" ]
python
train
gmr/tinman
tinman/application.py
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L216-L219
def _prepare_transforms(self): """Prepare the list of transforming objects""" for offset, value in enumerate(self._config.get(config.TRANSFORMS, [])): self._config[config.TRANSFORMS][offset] = self._import_class(value)
[ "def", "_prepare_transforms", "(", "self", ")", ":", "for", "offset", ",", "value", "in", "enumerate", "(", "self", ".", "_config", ".", "get", "(", "config", ".", "TRANSFORMS", ",", "[", "]", ")", ")", ":", "self", ".", "_config", "[", "config", "."...
Prepare the list of transforming objects
[ "Prepare", "the", "list", "of", "transforming", "objects" ]
python
train
matthew-brett/delocate
delocate/delocating.py
https://github.com/matthew-brett/delocate/blob/ed48de15fce31c3f52f1a9f32cae1b02fc55aa60/delocate/delocating.py#L508-L552
def bads_report(bads, path_prefix=None): """ Return a nice report of bad architectures in `bads` Parameters ---------- bads : set set of length 2 or 3 tuples. A length 2 tuple is of form ``(depending_lib, missing_archs)`` meaning that an arch in `require_archs` was missing from ...
[ "def", "bads_report", "(", "bads", ",", "path_prefix", "=", "None", ")", ":", "path_processor", "=", "(", "(", "lambda", "x", ":", "x", ")", "if", "path_prefix", "is", "None", "else", "get_rp_stripper", "(", "path_prefix", ")", ")", "reports", "=", "[", ...
Return a nice report of bad architectures in `bads` Parameters ---------- bads : set set of length 2 or 3 tuples. A length 2 tuple is of form ``(depending_lib, missing_archs)`` meaning that an arch in `require_archs` was missing from ``depending_lib``. A length 3 tuple is o...
[ "Return", "a", "nice", "report", "of", "bad", "architectures", "in", "bads" ]
python
train
GreatFruitOmsk/tailhead
tailhead/__init__.py
https://github.com/GreatFruitOmsk/tailhead/blob/a3b1324a39935f8ffcfda59328a9a458672889d9/tailhead/__init__.py#L143-L196
def seek_previous_line(self): """ Seek previous line relative to the current file position. :return: Position of the line or -1 if previous line was not found. """ where = self.file.tell() offset = 0 while True: if offset == where: br...
[ "def", "seek_previous_line", "(", "self", ")", ":", "where", "=", "self", ".", "file", ".", "tell", "(", ")", "offset", "=", "0", "while", "True", ":", "if", "offset", "==", "where", ":", "break", "read_size", "=", "self", ".", "read_size", "if", "se...
Seek previous line relative to the current file position. :return: Position of the line or -1 if previous line was not found.
[ "Seek", "previous", "line", "relative", "to", "the", "current", "file", "position", "." ]
python
test
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L822-L825
def community_post_create(self, data, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/posts#create-post" api_path = "/api/v2/community/posts.json" return self.call(api_path, method="POST", data=data, **kwargs)
[ "def", "community_post_create", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/community/posts.json\"", "return", "self", ".", "call", "(", "api_path", ",", "method", "=", "\"POST\"", ",", "data", "=", "data", ",", ...
https://developer.zendesk.com/rest_api/docs/help_center/posts#create-post
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "help_center", "/", "posts#create", "-", "post" ]
python
train
molmod/molmod
molmod/unit_cells.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/unit_cells.py#L203-L218
def alignment_a(self): """Computes the rotation matrix that aligns the unit cell with the Cartesian axes, starting with cell vector a. * a parallel to x * b in xy-plane with b_y positive * c with c_z positive """ from molmod.transformations import Rot...
[ "def", "alignment_a", "(", "self", ")", ":", "from", "molmod", ".", "transformations", "import", "Rotation", "new_x", "=", "self", ".", "matrix", "[", ":", ",", "0", "]", ".", "copy", "(", ")", "new_x", "/=", "np", ".", "linalg", ".", "norm", "(", ...
Computes the rotation matrix that aligns the unit cell with the Cartesian axes, starting with cell vector a. * a parallel to x * b in xy-plane with b_y positive * c with c_z positive
[ "Computes", "the", "rotation", "matrix", "that", "aligns", "the", "unit", "cell", "with", "the", "Cartesian", "axes", "starting", "with", "cell", "vector", "a", "." ]
python
train
hatemile/hatemile-for-python
hatemile/implementation/assoc.py
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/assoc.py#L136-L158
def _validate_header(self, hed): """ Validate the list that represents the table header. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return: True if the table header is valid or False if the tabl...
[ "def", "_validate_header", "(", "self", ",", "hed", ")", ":", "# pylint: disable=no-self-use", "if", "not", "bool", "(", "hed", ")", ":", "return", "False", "length", "=", "-", "1", "for", "row", "in", "hed", ":", "if", "not", "bool", "(", "row", ")", ...
Validate the list that represents the table header. :param hed: The list that represents the table header. :type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement)) :return: True if the table header is valid or False if the table header is not valid. :rtyp...
[ "Validate", "the", "list", "that", "represents", "the", "table", "header", "." ]
python
train
mattupstate/cubric
cubric/tasks.py
https://github.com/mattupstate/cubric/blob/a648ce00e4467cd14d71e754240ef6c1f87a34b5/cubric/tasks.py#L11-L17
def create_server(initialize=True): """Create a server""" with provider() as p: host_string = p.create_server() if initialize: env.host_string = host_string initialize_server()
[ "def", "create_server", "(", "initialize", "=", "True", ")", ":", "with", "provider", "(", ")", "as", "p", ":", "host_string", "=", "p", ".", "create_server", "(", ")", "if", "initialize", ":", "env", ".", "host_string", "=", "host_string", "initialize_ser...
Create a server
[ "Create", "a", "server" ]
python
train
dswah/pyGAM
pygam/pygam.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/pygam.py#L2686-L2718
def predict(self, X, exposure=None): """ preduct expected value of target given model and input X often this is done via expected value of GAM given input X Parameters --------- X : array-like of shape (n_samples, m_features), default: None containing the inp...
[ "def", "predict", "(", "self", ",", "X", ",", "exposure", "=", "None", ")", ":", "if", "not", "self", ".", "_is_fitted", ":", "raise", "AttributeError", "(", "'GAM has not been fitted. Call fit first.'", ")", "X", "=", "check_X", "(", "X", ",", "n_feats", ...
preduct expected value of target given model and input X often this is done via expected value of GAM given input X Parameters --------- X : array-like of shape (n_samples, m_features), default: None containing the input dataset exposure : array-like shape (n_sample...
[ "preduct", "expected", "value", "of", "target", "given", "model", "and", "input", "X", "often", "this", "is", "done", "via", "expected", "value", "of", "GAM", "given", "input", "X" ]
python
train
saltstack/salt
salt/states/pip_state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L964-L1019
def removed(name, requirements=None, bin_env=None, log=None, proxy=None, timeout=None, user=None, cwd=None, use_vt=False): ''' Make sure that a package is not installed. name The name of the package to u...
[ "def", "removed", "(", "name", ",", "requirements", "=", "None", ",", "bin_env", "=", "None", ",", "log", "=", "None", ",", "proxy", "=", "None", ",", "timeout", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "use_vt", "=", ...
Make sure that a package is not installed. name The name of the package to uninstall user The user under which to run pip bin_env : None the pip executable or virtualenenv to use use_vt Use VT terminal emulation (see output while installing)
[ "Make", "sure", "that", "a", "package", "is", "not", "installed", "." ]
python
train
dgraph-io/pydgraph
pydgraph/client_stub.py
https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L58-L62
def commit_or_abort(self, ctx, timeout=None, metadata=None, credentials=None): """Runs commit or abort operation.""" return self.stub.CommitOrAbort(ctx, timeout=timeout, metadata=metadata, credentials=credentials)
[ "def", "commit_or_abort", "(", "self", ",", "ctx", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ",", "credentials", "=", "None", ")", ":", "return", "self", ".", "stub", ".", "CommitOrAbort", "(", "ctx", ",", "timeout", "=", "timeout", ",...
Runs commit or abort operation.
[ "Runs", "commit", "or", "abort", "operation", "." ]
python
train
thoth-station/solver
thoth/solver/compile.py
https://github.com/thoth-station/solver/blob/de9bd6e744cb4d5f70320ba77d6875ccb8b876c4/thoth/solver/compile.py#L30-L52
def pip_compile(*packages: str): """Run pip-compile to pin down packages, also resolve their transitive dependencies.""" result = None packages = "\n".join(packages) with tempfile.TemporaryDirectory() as tmp_dirname, cwd(tmp_dirname): with open("requirements.in", "w") as requirements_file: ...
[ "def", "pip_compile", "(", "*", "packages", ":", "str", ")", ":", "result", "=", "None", "packages", "=", "\"\\n\"", ".", "join", "(", "packages", ")", "with", "tempfile", ".", "TemporaryDirectory", "(", ")", "as", "tmp_dirname", ",", "cwd", "(", "tmp_di...
Run pip-compile to pin down packages, also resolve their transitive dependencies.
[ "Run", "pip", "-", "compile", "to", "pin", "down", "packages", "also", "resolve", "their", "transitive", "dependencies", "." ]
python
train
pytroll/satpy
satpy/readers/hrpt.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/hrpt.py#L66-L82
def time_seconds(tc_array, year): """Return the time object from the timecodes """ tc_array = np.array(tc_array, copy=True) word = tc_array[:, 0] day = word >> 1 word = tc_array[:, 1].astype(np.uint64) msecs = ((127) & word) * 1024 word = tc_array[:, 2] msecs += word & 1023 msecs...
[ "def", "time_seconds", "(", "tc_array", ",", "year", ")", ":", "tc_array", "=", "np", ".", "array", "(", "tc_array", ",", "copy", "=", "True", ")", "word", "=", "tc_array", "[", ":", ",", "0", "]", "day", "=", "word", ">>", "1", "word", "=", "tc_...
Return the time object from the timecodes
[ "Return", "the", "time", "object", "from", "the", "timecodes" ]
python
train
saltstack/salt
salt/modules/boto3_sns.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L350-L383
def unsubscribe(SubscriptionArn, region=None, key=None, keyid=None, profile=None): ''' Unsubscribe a specific SubscriptionArn of a topic. CLI Example: .. code-block:: bash salt myminion boto3_sns.unsubscribe my_subscription_arn region=us-east-1 ''' if not SubscriptionArn.startswith('a...
[ "def", "unsubscribe", "(", "SubscriptionArn", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "if", "not", "SubscriptionArn", ".", "startswith", "(", "'arn:aws:sns:'", ")", ":", "# Gr...
Unsubscribe a specific SubscriptionArn of a topic. CLI Example: .. code-block:: bash salt myminion boto3_sns.unsubscribe my_subscription_arn region=us-east-1
[ "Unsubscribe", "a", "specific", "SubscriptionArn", "of", "a", "topic", "." ]
python
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L770-L797
def make_box_pixel_mask_from_col_row(column, row, default=0, value=1): '''Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list. Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of r...
[ "def", "make_box_pixel_mask_from_col_row", "(", "column", ",", "row", ",", "default", "=", "0", ",", "value", "=", "1", ")", ":", "# FE columns and rows start from 1\r", "col_array", "=", "np", ".", "array", "(", "column", ")", "-", "1", "row_array", "=", "n...
Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list. Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of row values. default : int Value of pixels that are not selected by...
[ "Generate", "box", "shaped", "mask", "from", "column", "and", "row", "lists", ".", "Takes", "the", "minimum", "and", "maximum", "value", "from", "each", "list", ".", "Parameters", "----------", "column", ":", "iterable", "int", "List", "of", "colums", "value...
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_heliplane.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_heliplane.py#L102-L130
def update_channels(self): '''update which channels provide input''' self.interlock_channel = -1 self.override_channel = -1 self.zero_I_channel = -1 self.no_vtol_channel = -1 # output channels self.rsc_out_channel = 9 self.fwd_thr_channel = 10 fo...
[ "def", "update_channels", "(", "self", ")", ":", "self", ".", "interlock_channel", "=", "-", "1", "self", ".", "override_channel", "=", "-", "1", "self", ".", "zero_I_channel", "=", "-", "1", "self", ".", "no_vtol_channel", "=", "-", "1", "# output channel...
update which channels provide input
[ "update", "which", "channels", "provide", "input" ]
python
train
OpenTreeOfLife/peyotl
peyotl/amendments/amendments_shard.py
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/amendments/amendments_shard.py#L161-L177
def _mint_new_ott_ids(self, how_many=1): """ ASSUMES the caller holds the _doc_counter_lock ! Checks the current int value of the next ottid, reserves a block of {how_many} ids, advances the counter to the next available value, stores the counter in a file in case the server is restarted...
[ "def", "_mint_new_ott_ids", "(", "self", ",", "how_many", "=", "1", ")", ":", "first_minted_id", "=", "self", ".", "_next_ott_id", "self", ".", "_next_ott_id", "=", "first_minted_id", "+", "how_many", "content", "=", "u'{\"next_ott_id\": %d}\\n'", "%", "self", "...
ASSUMES the caller holds the _doc_counter_lock ! Checks the current int value of the next ottid, reserves a block of {how_many} ids, advances the counter to the next available value, stores the counter in a file in case the server is restarted. Checks out master branch as a side effect.
[ "ASSUMES", "the", "caller", "holds", "the", "_doc_counter_lock", "!", "Checks", "the", "current", "int", "value", "of", "the", "next", "ottid", "reserves", "a", "block", "of", "{", "how_many", "}", "ids", "advances", "the", "counter", "to", "the", "next", ...
python
train
square/pylink
pylink/__main__.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L172-L184
def run(self, args): """Erases the device connected to the J-Link. Args: self (EraseCommand): the ``EraseCommand`` instance args (Namespace): the arguments passed on the command-line Returns: ``None`` """ jlink = self.create_jlink(args) era...
[ "def", "run", "(", "self", ",", "args", ")", ":", "jlink", "=", "self", ".", "create_jlink", "(", "args", ")", "erased", "=", "jlink", ".", "erase", "(", ")", "print", "(", "'Bytes Erased: %d'", "%", "erased", ")" ]
Erases the device connected to the J-Link. Args: self (EraseCommand): the ``EraseCommand`` instance args (Namespace): the arguments passed on the command-line Returns: ``None``
[ "Erases", "the", "device", "connected", "to", "the", "J", "-", "Link", "." ]
python
train
honzajavorek/redis-collections
redis_collections/lists.py
https://github.com/honzajavorek/redis-collections/blob/07ca8efe88fb128f7dc7319dfa6a26cd39b3776b/redis_collections/lists.py#L739-L744
def append(self, value): """Add *value* to the right side of the collection.""" def append_trans(pipe): self._append_helper(value, pipe) self._transaction(append_trans)
[ "def", "append", "(", "self", ",", "value", ")", ":", "def", "append_trans", "(", "pipe", ")", ":", "self", ".", "_append_helper", "(", "value", ",", "pipe", ")", "self", ".", "_transaction", "(", "append_trans", ")" ]
Add *value* to the right side of the collection.
[ "Add", "*", "value", "*", "to", "the", "right", "side", "of", "the", "collection", "." ]
python
train
Qiskit/qiskit-api-py
IBMQuantumExperience/IBMQuantumExperience.py
https://github.com/Qiskit/qiskit-api-py/blob/2ab240110fb7e653254e44c4833f3643e8ae7f0f/IBMQuantumExperience/IBMQuantumExperience.py#L22-L34
def get_job_url(config, hub, group, project): """ Util method to get job url """ if ((config is not None) and ('hub' in config) and (hub is None)): hub = config["hub"] if ((config is not None) and ('group' in config) and (group is None)): group = config["group"] if ((config is no...
[ "def", "get_job_url", "(", "config", ",", "hub", ",", "group", ",", "project", ")", ":", "if", "(", "(", "config", "is", "not", "None", ")", "and", "(", "'hub'", "in", "config", ")", "and", "(", "hub", "is", "None", ")", ")", ":", "hub", "=", "...
Util method to get job url
[ "Util", "method", "to", "get", "job", "url" ]
python
train