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
pylover/khayyam
khayyam/jalali_date.py
https://github.com/pylover/khayyam/blob/7e3a30bb941f8dc8bad8bf9d3be2336fed04bb57/khayyam/jalali_date.py#L257-L283
def timetuple(self): """ It's equivalent to: >>> time.struct_time((d.year, d.month, d.day, d.hour, d.minute, d.second, d.weekday(), dayofyear, [-1|1|0])) # doctest: +SKIP time.struct_time(tm_year=2015, tm_mon=7, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=209, ...
[ "def", "timetuple", "(", "self", ")", ":", "return", "time", ".", "struct_time", "(", "(", "self", ".", "year", ",", "self", ".", "month", ",", "self", ".", "day", ",", "0", ",", "0", ",", "0", ",", "self", ".", "weekday", "(", ")", ",", "self"...
It's equivalent to: >>> time.struct_time((d.year, d.month, d.day, d.hour, d.minute, d.second, d.weekday(), dayofyear, [-1|1|0])) # doctest: +SKIP time.struct_time(tm_year=2015, tm_mon=7, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=209, tm_isdst=-1) The tm_isdst flag ...
[ "It", "s", "equivalent", "to", ":" ]
python
train
twilio/twilio-python
twilio/rest/api/v2010/account/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/__init__.py#L618-L627
def validation_requests(self): """ Access the validation_requests :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList """ if self._validation_requests is None: ...
[ "def", "validation_requests", "(", "self", ")", ":", "if", "self", ".", "_validation_requests", "is", "None", ":", "self", ".", "_validation_requests", "=", "ValidationRequestList", "(", "self", ".", "_version", ",", "account_sid", "=", "self", ".", "_solution",...
Access the validation_requests :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList
[ "Access", "the", "validation_requests" ]
python
train
akfullfo/taskforce
taskforce/watch_files.py
https://github.com/akfullfo/taskforce/blob/bc6dd744bd33546447d085dbd18a350532220193/taskforce/watch_files.py#L254-L266
def _self_pipe(self): """ This sets up a self-pipe so we can hand back an fd to the caller allowing the object to manage event triggers. The ends of the pipe are set non-blocking so it doesn't really matter if a bunch of events fill the pipe buffer. """ import fcntl ...
[ "def", "_self_pipe", "(", "self", ")", ":", "import", "fcntl", "self", ".", "_poll_fd", ",", "self", ".", "_poll_send", "=", "os", ".", "pipe", "(", ")", "for", "fd", "in", "[", "self", ".", "_poll_fd", ",", "self", ".", "_poll_send", "]", ":", "fl...
This sets up a self-pipe so we can hand back an fd to the caller allowing the object to manage event triggers. The ends of the pipe are set non-blocking so it doesn't really matter if a bunch of events fill the pipe buffer.
[ "This", "sets", "up", "a", "self", "-", "pipe", "so", "we", "can", "hand", "back", "an", "fd", "to", "the", "caller", "allowing", "the", "object", "to", "manage", "event", "triggers", ".", "The", "ends", "of", "the", "pipe", "are", "set", "non", "-",...
python
train
rigetti/pyquil
pyquil/api/_base_connection.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_base_connection.py#L311-L320
def _run_and_measure(self, quil_program, qubits, trials, random_seed) -> np.ndarray: """ Run a Forest ``run_and_measure`` job. Users should use :py:func:`WavefunctionSimulator.run_and_measure` instead of calling this directly. """ payload = run_and_measure_payload(quil_p...
[ "def", "_run_and_measure", "(", "self", ",", "quil_program", ",", "qubits", ",", "trials", ",", "random_seed", ")", "->", "np", ".", "ndarray", ":", "payload", "=", "run_and_measure_payload", "(", "quil_program", ",", "qubits", ",", "trials", ",", "random_seed...
Run a Forest ``run_and_measure`` job. Users should use :py:func:`WavefunctionSimulator.run_and_measure` instead of calling this directly.
[ "Run", "a", "Forest", "run_and_measure", "job", "." ]
python
train
zengbin93/zb
zb/tools/file.py
https://github.com/zengbin93/zb/blob/ccdb384a0b5801b459933220efcb71972c2b89a7/zb/tools/file.py#L209-L212
def empty_file(file, mode="w", encoding='utf-8'): """empty file""" with open(file, mode, encoding=encoding) as f: f.truncate()
[ "def", "empty_file", "(", "file", ",", "mode", "=", "\"w\"", ",", "encoding", "=", "'utf-8'", ")", ":", "with", "open", "(", "file", ",", "mode", ",", "encoding", "=", "encoding", ")", "as", "f", ":", "f", ".", "truncate", "(", ")" ]
empty file
[ "empty", "file" ]
python
train
fracpete/python-weka-wrapper3
python/weka/flow/transformer.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/flow/transformer.py#L600-L610
def do_execute(self): """ The actual execution of the actor. :return: None if successful, otherwise error message :rtype: str """ expr = str(self.resolve_option("expression")) expr = expr.replace("{X}", str(self.input.payload)) self._output.append(Token(e...
[ "def", "do_execute", "(", "self", ")", ":", "expr", "=", "str", "(", "self", ".", "resolve_option", "(", "\"expression\"", ")", ")", "expr", "=", "expr", ".", "replace", "(", "\"{X}\"", ",", "str", "(", "self", ".", "input", ".", "payload", ")", ")",...
The actual execution of the actor. :return: None if successful, otherwise error message :rtype: str
[ "The", "actual", "execution", "of", "the", "actor", "." ]
python
train
BD2KGenomics/protect
src/protect/mutation_calling/muse.py
https://github.com/BD2KGenomics/protect/blob/06310682c50dcf8917b912c8e551299ff7ee41ce/src/protect/mutation_calling/muse.py#L104-L142
def run_muse_perchrom(job, tumor_bam, normal_bam, univ_options, muse_options, chrom): """ Run MuSE call on a single chromosome in the input bams. :param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq :param dict normal_bam: Dict of bam and bai for normal DNA-Seq :param dict univ_options: Dic...
[ "def", "run_muse_perchrom", "(", "job", ",", "tumor_bam", ",", "normal_bam", ",", "univ_options", ",", "muse_options", ",", "chrom", ")", ":", "work_dir", "=", "os", ".", "getcwd", "(", ")", "input_files", "=", "{", "'tumor.bam'", ":", "tumor_bam", "[", "'...
Run MuSE call on a single chromosome in the input bams. :param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq :param dict normal_bam: Dict of bam and bai for normal DNA-Seq :param dict univ_options: Dict of universal options used by almost all tools :param dict muse_options: Options specific to ...
[ "Run", "MuSE", "call", "on", "a", "single", "chromosome", "in", "the", "input", "bams", "." ]
python
train
LionelAuroux/pyrser
pyrser/parsing/base.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/base.py#L234-L248
def eval_hook(self, name: str, ctx: list) -> Node: """Evaluate the hook by its name""" if name not in self.__class__._hooks: # TODO: don't always throw error, could have return True by default self.diagnostic.notify( error.Severity.ERROR, "Unknown ...
[ "def", "eval_hook", "(", "self", ",", "name", ":", "str", ",", "ctx", ":", "list", ")", "->", "Node", ":", "if", "name", "not", "in", "self", ".", "__class__", ".", "_hooks", ":", "# TODO: don't always throw error, could have return True by default", "self", "...
Evaluate the hook by its name
[ "Evaluate", "the", "hook", "by", "its", "name" ]
python
test
novopl/peltak
src/peltak/core/shell.py
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/shell.py#L67-L73
def cprint(msg, *args, **kw): # type: (str, *Any, **Any) -> None """ Print colored message to stdout. """ if len(args) or len(kw): msg = msg.format(*args, **kw) print(fmt('{}<0>'.format(msg)))
[ "def", "cprint", "(", "msg", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "# type: (str, *Any, **Any) -> None", "if", "len", "(", "args", ")", "or", "len", "(", "kw", ")", ":", "msg", "=", "msg", ".", "format", "(", "*", "args", ",", "*", "*"...
Print colored message to stdout.
[ "Print", "colored", "message", "to", "stdout", "." ]
python
train
3DLIRIOUS/MeshLabXML
meshlabxml/create.py
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L167-L193
def sphere_cap(script, angle=1.0, subdivisions=3, color=None): """# angle = Angle of the cone subtending the cap. It must be <180 less than 180 # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitt...
[ "def", "sphere_cap", "(", "script", ",", "angle", "=", "1.0", ",", "subdivisions", "=", "3", ",", "color", "=", "None", ")", ":", "filter_xml", "=", "''", ".", "join", "(", "[", "' <filter name=\"Sphere Cap\">\\n'", ",", "' <Param name=\"angle\" '", ",", ...
# angle = Angle of the cone subtending the cap. It must be <180 less than 180 # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitted values are in the range 0 (an icosahedron) to 8 (a 1.3 MegaTris ...
[ "#", "angle", "=", "Angle", "of", "the", "cone", "subtending", "the", "cap", ".", "It", "must", "be", "<180", "less", "than", "180", "#", "subdivisions", "=", "Subdivision", "level", ";", "Number", "of", "the", "recursive", "subdivision", "of", "the", "#...
python
test
michaelhelmick/lassie
lassie/core.py
https://github.com/michaelhelmick/lassie/blob/b929f78d7e545cff5fb42eb5edfcaf396456f1ee/lassie/core.py#L343-L368
def _filter_link_tag_data(self, source, soup, data, url): """This method filters the web page content for link tags that match patterns given in the ``FILTER_MAPS`` :param source: The key of the meta dictionary in ``FILTER_MAPS['link']`` :type source: string :param soup: BeautifulSoup i...
[ "def", "_filter_link_tag_data", "(", "self", ",", "source", ",", "soup", ",", "data", ",", "url", ")", ":", "link", "=", "FILTER_MAPS", "[", "'link'", "]", "[", "source", "]", "html", "=", "soup", ".", "find_all", "(", "'link'", ",", "{", "link", "["...
This method filters the web page content for link tags that match patterns given in the ``FILTER_MAPS`` :param source: The key of the meta dictionary in ``FILTER_MAPS['link']`` :type source: string :param soup: BeautifulSoup instance to find meta tags :type soup: instance :param...
[ "This", "method", "filters", "the", "web", "page", "content", "for", "link", "tags", "that", "match", "patterns", "given", "in", "the", "FILTER_MAPS" ]
python
train
pantsbuild/pants
src/python/pants/backend/jvm/tasks/classpath_products.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/classpath_products.py#L268-L281
def get_product_target_mappings_for_targets(self, targets, respect_excludes=True): """Gets the classpath products-target associations for the given targets. Product-target tuples are returned in order, optionally respecting target excludes. :param targets: The targets to lookup classpath products for. ...
[ "def", "get_product_target_mappings_for_targets", "(", "self", ",", "targets", ",", "respect_excludes", "=", "True", ")", ":", "classpath_target_tuples", "=", "self", ".", "_classpaths", ".", "get_product_target_mappings_for_targets", "(", "targets", ")", "if", "respect...
Gets the classpath products-target associations for the given targets. Product-target tuples are returned in order, optionally respecting target excludes. :param targets: The targets to lookup classpath products for. :param bool respect_excludes: `True` to respect excludes; `False` to ignore them. :re...
[ "Gets", "the", "classpath", "products", "-", "target", "associations", "for", "the", "given", "targets", "." ]
python
train
gtaylor/python-route53
route53/connection.py
https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/connection.py#L230-L276
def _list_resource_record_sets_by_zone_id(self, id, rrset_type=None, identifier=None, name=None, page_chunks=100): """ Lists a hosted zone's resource record sets by Zone ID, if you already know it. ...
[ "def", "_list_resource_record_sets_by_zone_id", "(", "self", ",", "id", ",", "rrset_type", "=", "None", ",", "identifier", "=", "None", ",", "name", "=", "None", ",", "page_chunks", "=", "100", ")", ":", "params", "=", "{", "'name'", ":", "name", ",", "'...
Lists a hosted zone's resource record sets by Zone ID, if you already know it. .. tip:: For most cases, we recommend going through a :py:class:`HostedZone <route53.hosted_zone.HostedZone>` instance's :py:meth:`HostedZone.record_sets <route53.hosted_zone.HostedZone.re...
[ "Lists", "a", "hosted", "zone", "s", "resource", "record", "sets", "by", "Zone", "ID", "if", "you", "already", "know", "it", "." ]
python
test
ryanvarley/ExoData
exodata/database.py
https://github.com/ryanvarley/ExoData/blob/e0d3652117214d2377a707d6778f93b7eb201a41/exodata/database.py#L101-L138
def _loadDatabase(self, databaseLocation, stream=False): """ Loads the database from a given file path in the class :param databaseLocation: the location on disk or the stream object :param stream: if true treats the databaseLocation as a stream object """ # Initialise Database...
[ "def", "_loadDatabase", "(", "self", ",", "databaseLocation", ",", "stream", "=", "False", ")", ":", "# Initialise Database", "self", ".", "systems", "=", "[", "]", "self", ".", "binaries", "=", "[", "]", "self", ".", "stars", "=", "[", "]", "self", "....
Loads the database from a given file path in the class :param databaseLocation: the location on disk or the stream object :param stream: if true treats the databaseLocation as a stream object
[ "Loads", "the", "database", "from", "a", "given", "file", "path", "in", "the", "class" ]
python
train
pyca/pynacl
src/nacl/bindings/crypto_aead.py
https://github.com/pyca/pynacl/blob/0df0c2c7693fa5d316846111ce510702756f5feb/src/nacl/bindings/crypto_aead.py#L209-L276
def crypto_aead_chacha20poly1305_encrypt(message, aad, nonce, key): """ Encrypt the given ``message`` using the "legacy" construction described in draft-agl-tls-chacha20poly1305. :param message: :type message: bytes :param aad: :type aad: bytes :param nonce: :type nonce: bytes :...
[ "def", "crypto_aead_chacha20poly1305_encrypt", "(", "message", ",", "aad", ",", "nonce", ",", "key", ")", ":", "ensure", "(", "isinstance", "(", "message", ",", "bytes", ")", ",", "'Input message type must be bytes'", ",", "raising", "=", "exc", ".", "TypeError"...
Encrypt the given ``message`` using the "legacy" construction described in draft-agl-tls-chacha20poly1305. :param message: :type message: bytes :param aad: :type aad: bytes :param nonce: :type nonce: bytes :param key: :type key: bytes :return: authenticated ciphertext :rtype...
[ "Encrypt", "the", "given", "message", "using", "the", "legacy", "construction", "described", "in", "draft", "-", "agl", "-", "tls", "-", "chacha20poly1305", "." ]
python
train
Riparo/nougat
nougat/asgi.py
https://github.com/Riparo/nougat/blob/8453bc37e0b782f296952f0a418532ebbbcd74f3/nougat/asgi.py#L165-L186
async def send_http_response(writer, http_code: int, headers: List[Tuple[str, str]], content: bytes, http_status: str= None ) -> None: """ generate http response paylo...
[ "async", "def", "send_http_response", "(", "writer", ",", "http_code", ":", "int", ",", "headers", ":", "List", "[", "Tuple", "[", "str", ",", "str", "]", "]", ",", "content", ":", "bytes", ",", "http_status", ":", "str", "=", "None", ")", "->", "Non...
generate http response payload and send to writer
[ "generate", "http", "response", "payload", "and", "send", "to", "writer" ]
python
train
hufman/flask_rdf
flask_rdf/format.py
https://github.com/hufman/flask_rdf/blob/9bf86023288171eb0665c15fb28070250f80310c/flask_rdf/format.py#L53-L60
def get_default_mimetype(self): """ Returns the default mimetype """ mimetype = self.default_mimetype if mimetype is None: # class inherits from module default mimetype = DEFAULT_MIMETYPE if mimetype is None: # module is set to None? mimetype = 'application/rdf+xml' return mimetype
[ "def", "get_default_mimetype", "(", "self", ")", ":", "mimetype", "=", "self", ".", "default_mimetype", "if", "mimetype", "is", "None", ":", "# class inherits from module default", "mimetype", "=", "DEFAULT_MIMETYPE", "if", "mimetype", "is", "None", ":", "# module i...
Returns the default mimetype
[ "Returns", "the", "default", "mimetype" ]
python
train
ewels/MultiQC
multiqc/modules/macs2/macs2.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/macs2/macs2.py#L75-L99
def macs_general_stats(self): """ Add columns to General Statistics table """ headers = OrderedDict() headers['d'] = { 'title': 'Fragment Length', 'min': 0, 'format': '{:,.0f}' } headers['treatment_redundant_rate'] = { 'title': 'Tre...
[ "def", "macs_general_stats", "(", "self", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "'d'", "]", "=", "{", "'title'", ":", "'Fragment Length'", ",", "'min'", ":", "0", ",", "'format'", ":", "'{:,.0f}'", "}", "headers", "[", "'trea...
Add columns to General Statistics table
[ "Add", "columns", "to", "General", "Statistics", "table" ]
python
train
jwhitlock/drf-cached-instances
drf_cached_instances/cache.py
https://github.com/jwhitlock/drf-cached-instances/blob/ec4e8a6e1e83eeea6ec0b924b2eaa40a38d5963a/drf_cached_instances/cache.py#L238-L242
def field_date_to_json(self, day): """Convert a date to a date triple.""" if isinstance(day, six.string_types): day = parse_date(day) return [day.year, day.month, day.day] if day else None
[ "def", "field_date_to_json", "(", "self", ",", "day", ")", ":", "if", "isinstance", "(", "day", ",", "six", ".", "string_types", ")", ":", "day", "=", "parse_date", "(", "day", ")", "return", "[", "day", ".", "year", ",", "day", ".", "month", ",", ...
Convert a date to a date triple.
[ "Convert", "a", "date", "to", "a", "date", "triple", "." ]
python
train
KennethWilke/PingdomLib
pingdomlib/check.py
https://github.com/KennethWilke/PingdomLib/blob/3ed1e481f9c9d16b032558d62fb05c2166e162ed/pingdomlib/check.py#L740-L746
def publishPublicReport(self): """Activate public report for this check. Returns status message""" response = self.pingdom.request('PUT', 'reports.public/%s' % self.id) return response.json()['message']
[ "def", "publishPublicReport", "(", "self", ")", ":", "response", "=", "self", ".", "pingdom", ".", "request", "(", "'PUT'", ",", "'reports.public/%s'", "%", "self", ".", "id", ")", "return", "response", ".", "json", "(", ")", "[", "'message'", "]" ]
Activate public report for this check. Returns status message
[ "Activate", "public", "report", "for", "this", "check", "." ]
python
train
clalancette/pycdlib
pycdlib/udf.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/udf.py#L3124-L3140
def file_identifier(self): # type: () -> bytes ''' A method to get the name of this UDF File Entry as a byte string. Parameters: None. Returns: The UDF File Entry as a byte string. ''' if not self._initialized: raise pycdlibexception...
[ "def", "file_identifier", "(", "self", ")", ":", "# type: () -> bytes", "if", "not", "self", ".", "_initialized", ":", "raise", "pycdlibexception", ".", "PyCdlibInternalError", "(", "'UDF File Entry not initialized'", ")", "if", "self", ".", "file_ident", "is", "Non...
A method to get the name of this UDF File Entry as a byte string. Parameters: None. Returns: The UDF File Entry as a byte string.
[ "A", "method", "to", "get", "the", "name", "of", "this", "UDF", "File", "Entry", "as", "a", "byte", "string", "." ]
python
train
knipknap/SpiffWorkflow
SpiffWorkflow/workflow.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/workflow.py#L185-L194
def get_tasks(self, state=Task.ANY_MASK): """ Returns a list of Task objects with the given state. :type state: integer :param state: A bitmask of states. :rtype: list[Task] :returns: A list of tasks. """ return [t for t in Task.Iterator(self.task_tree,...
[ "def", "get_tasks", "(", "self", ",", "state", "=", "Task", ".", "ANY_MASK", ")", ":", "return", "[", "t", "for", "t", "in", "Task", ".", "Iterator", "(", "self", ".", "task_tree", ",", "state", ")", "]" ]
Returns a list of Task objects with the given state. :type state: integer :param state: A bitmask of states. :rtype: list[Task] :returns: A list of tasks.
[ "Returns", "a", "list", "of", "Task", "objects", "with", "the", "given", "state", "." ]
python
valid
adafruit/Adafruit_CircuitPython_NeoPixel
neopixel.py
https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/blob/c0ed34813a608b64ed044826553918ddbad12f0c/neopixel.py#L107-L112
def deinit(self): """Blank out the NeoPixels and release the pin.""" for i in range(len(self.buf)): self.buf[i] = 0 neopixel_write(self.pin, self.buf) self.pin.deinit()
[ "def", "deinit", "(", "self", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "buf", ")", ")", ":", "self", ".", "buf", "[", "i", "]", "=", "0", "neopixel_write", "(", "self", ".", "pin", ",", "self", ".", "buf", ")", "self...
Blank out the NeoPixels and release the pin.
[ "Blank", "out", "the", "NeoPixels", "and", "release", "the", "pin", "." ]
python
train
droope/droopescan
dscan/common/output.py
https://github.com/droope/droopescan/blob/424c48a0f9d12b4536dbef5a786f0fbd4ce9519a/dscan/common/output.py#L109-L126
def warn(self, msg, whitespace_strp=True): """ For things that have gone seriously wrong but don't merit a program halt. Outputs to stderr, so JsonOutput does not need to override. @param msg: warning to output. @param whitespace_strp: whether to strip whitespace. ...
[ "def", "warn", "(", "self", ",", "msg", ",", "whitespace_strp", "=", "True", ")", ":", "if", "self", ".", "errors_display", ":", "if", "whitespace_strp", ":", "msg", "=", "strip_whitespace", "(", "msg", ")", "if", "not", "self", ".", "log_to_file", ":", ...
For things that have gone seriously wrong but don't merit a program halt. Outputs to stderr, so JsonOutput does not need to override. @param msg: warning to output. @param whitespace_strp: whether to strip whitespace.
[ "For", "things", "that", "have", "gone", "seriously", "wrong", "but", "don", "t", "merit", "a", "program", "halt", ".", "Outputs", "to", "stderr", "so", "JsonOutput", "does", "not", "need", "to", "override", "." ]
python
train
chaoss/grimoirelab-perceval
perceval/backends/core/gitlab.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L431-L445
def merges(self, from_date=None): """Get the merge requests from pagination""" payload = { 'state': 'all', 'order_by': 'updated_at', 'sort': 'asc', 'view': 'simple', 'per_page': PER_PAGE } if from_date: payload['up...
[ "def", "merges", "(", "self", ",", "from_date", "=", "None", ")", ":", "payload", "=", "{", "'state'", ":", "'all'", ",", "'order_by'", ":", "'updated_at'", ",", "'sort'", ":", "'asc'", ",", "'view'", ":", "'simple'", ",", "'per_page'", ":", "PER_PAGE", ...
Get the merge requests from pagination
[ "Get", "the", "merge", "requests", "from", "pagination" ]
python
test
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L651-L669
def _ConvertInteger(value): """Convert an integer. Args: value: A scalar value to convert. Returns: The integer value. Raises: ParseError: If an integer couldn't be consumed. """ if isinstance(value, float) and not value.is_integer(): raise ParseError('Couldn\'t parse integer: {0}.'.forma...
[ "def", "_ConvertInteger", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "float", ")", "and", "not", "value", ".", "is_integer", "(", ")", ":", "raise", "ParseError", "(", "'Couldn\\'t parse integer: {0}.'", ".", "format", "(", "value", ")", ...
Convert an integer. Args: value: A scalar value to convert. Returns: The integer value. Raises: ParseError: If an integer couldn't be consumed.
[ "Convert", "an", "integer", "." ]
python
train
PierreRaybaut/formlayout
formlayout.py
https://github.com/PierreRaybaut/formlayout/blob/832a0ef7a5c1c4a3205ffd94ccd41d7c833cb6f0/formlayout.py#L1168-L1187
def get(self): """Return form result""" # It is import to avoid accessing Qt C++ object as it has probably # already been destroyed, due to the Qt.WA_DeleteOnClose attribute if self.outfile: if self.result in ['list', 'dict', 'OrderedDict']: fd = open(self.out...
[ "def", "get", "(", "self", ")", ":", "# It is import to avoid accessing Qt C++ object as it has probably", "# already been destroyed, due to the Qt.WA_DeleteOnClose attribute", "if", "self", ".", "outfile", ":", "if", "self", ".", "result", "in", "[", "'list'", ",", "'dict'...
Return form result
[ "Return", "form", "result" ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_widget.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_widget.py#L65-L70
def hideEvent(self, event): """ Reimplemented to disconnect signal handlers and event filter. """ super(CompletionWidget, self).hideEvent(event) self._text_edit.cursorPositionChanged.disconnect(self._update_current) self._text_edit.removeEventFilter(self)
[ "def", "hideEvent", "(", "self", ",", "event", ")", ":", "super", "(", "CompletionWidget", ",", "self", ")", ".", "hideEvent", "(", "event", ")", "self", ".", "_text_edit", ".", "cursorPositionChanged", ".", "disconnect", "(", "self", ".", "_update_current",...
Reimplemented to disconnect signal handlers and event filter.
[ "Reimplemented", "to", "disconnect", "signal", "handlers", "and", "event", "filter", "." ]
python
test
vpelletier/pprofile
zpprofile.py
https://github.com/vpelletier/pprofile/blob/51a36896727565faf23e5abccc9204e5f935fe1e/zpprofile.py#L407-L486
def _iterOutFiles(self): """ Yields path, data, mimetype for each file involved on or produced by profiling. """ out = StringIO() self.callgrind(out, relative_path=True) yield ( 'cachegrind.out.pprofile', out.getvalue(), 'applic...
[ "def", "_iterOutFiles", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "self", ".", "callgrind", "(", "out", ",", "relative_path", "=", "True", ")", "yield", "(", "'cachegrind.out.pprofile'", ",", "out", ".", "getvalue", "(", ")", ",", "'applic...
Yields path, data, mimetype for each file involved on or produced by profiling.
[ "Yields", "path", "data", "mimetype", "for", "each", "file", "involved", "on", "or", "produced", "by", "profiling", "." ]
python
train
DataONEorg/d1_python
gmn/src/d1_gmn/app/did.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/gmn/src/d1_gmn/app/did.py#L195-L197
def is_local_replica(pid): """Includes unprocessed replication requests.""" return d1_gmn.app.models.LocalReplica.objects.filter(pid__did=pid).exists()
[ "def", "is_local_replica", "(", "pid", ")", ":", "return", "d1_gmn", ".", "app", ".", "models", ".", "LocalReplica", ".", "objects", ".", "filter", "(", "pid__did", "=", "pid", ")", ".", "exists", "(", ")" ]
Includes unprocessed replication requests.
[ "Includes", "unprocessed", "replication", "requests", "." ]
python
train
coghost/izen
izen/schedule.py
https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/schedule.py#L66-L90
def run_continuously(self, interval=1): """Continuously run, while executing pending jobs at each elapsed time interval. @return cease_continuous_run: threading.Event which can be set to cease continuous run. Please note that it is *intended behavior that run_continuously() ...
[ "def", "run_continuously", "(", "self", ",", "interval", "=", "1", ")", ":", "cease_continuous_run", "=", "threading", ".", "Event", "(", ")", "class", "ScheduleThread", "(", "threading", ".", "Thread", ")", ":", "@", "classmethod", "def", "run", "(", "cls...
Continuously run, while executing pending jobs at each elapsed time interval. @return cease_continuous_run: threading.Event which can be set to cease continuous run. Please note that it is *intended behavior that run_continuously() does not run missed jobs*. For example, if you...
[ "Continuously", "run", "while", "executing", "pending", "jobs", "at", "each", "elapsed", "time", "interval", "." ]
python
train
jazzband/django-authority
authority/permissions.py
https://github.com/jazzband/django-authority/blob/58e08483cdd91a6a69e8019dd2a2edf68531ae97/authority/permissions.py#L99-L107
def _prime_user_perm_caches(self): """ Prime both the user and group caches and put them on the ``self.user``. In addition add a cache filled flag on ``self.user``. """ perm_cache, group_perm_cache = self._get_user_cached_perms() self.user._authority_perm_cache = perm_cac...
[ "def", "_prime_user_perm_caches", "(", "self", ")", ":", "perm_cache", ",", "group_perm_cache", "=", "self", ".", "_get_user_cached_perms", "(", ")", "self", ".", "user", ".", "_authority_perm_cache", "=", "perm_cache", "self", ".", "user", ".", "_authority_group_...
Prime both the user and group caches and put them on the ``self.user``. In addition add a cache filled flag on ``self.user``.
[ "Prime", "both", "the", "user", "and", "group", "caches", "and", "put", "them", "on", "the", "self", ".", "user", ".", "In", "addition", "add", "a", "cache", "filled", "flag", "on", "self", ".", "user", "." ]
python
train
BetterWorks/django-anonymizer
anonymizer/replacers.py
https://github.com/BetterWorks/django-anonymizer/blob/2d25bb6e8b5e4230c58031c4b6d10cc536669b3e/anonymizer/replacers.py#L95-L99
def first_name(anon, obj, field, val): """ Returns a random first name """ return anon.faker.first_name(field=field)
[ "def", "first_name", "(", "anon", ",", "obj", ",", "field", ",", "val", ")", ":", "return", "anon", ".", "faker", ".", "first_name", "(", "field", "=", "field", ")" ]
Returns a random first name
[ "Returns", "a", "random", "first", "name" ]
python
train
GibbsConsulting/django-plotly-dash
django_plotly_dash/dash_wrapper.py
https://github.com/GibbsConsulting/django-plotly-dash/blob/773ed081fc2ea3cc7607590322a14686a7a79bc5/django_plotly_dash/dash_wrapper.py#L407-L412
def layout(self, value): 'Overloaded layout function to fix component names as needed' if self._adjust_id: self._fix_component_id(value) return Dash.layout.fset(self, value)
[ "def", "layout", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_adjust_id", ":", "self", ".", "_fix_component_id", "(", "value", ")", "return", "Dash", ".", "layout", ".", "fset", "(", "self", ",", "value", ")" ]
Overloaded layout function to fix component names as needed
[ "Overloaded", "layout", "function", "to", "fix", "component", "names", "as", "needed" ]
python
train
openvax/varcode
varcode/effects/effect_collection.py
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L249-L270
def top_expression_effect(self, expression_levels): """ Return effect whose transcript has the highest expression level. If none of the effects are expressed or have associated transcripts, then return None. In case of ties, add lexicographical sorting by effect priority and tran...
[ "def", "top_expression_effect", "(", "self", ",", "expression_levels", ")", ":", "effect_expression_dict", "=", "self", ".", "effect_expression", "(", "expression_levels", ")", "if", "len", "(", "effect_expression_dict", ")", "==", "0", ":", "return", "None", "def...
Return effect whose transcript has the highest expression level. If none of the effects are expressed or have associated transcripts, then return None. In case of ties, add lexicographical sorting by effect priority and transcript length.
[ "Return", "effect", "whose", "transcript", "has", "the", "highest", "expression", "level", ".", "If", "none", "of", "the", "effects", "are", "expressed", "or", "have", "associated", "transcripts", "then", "return", "None", ".", "In", "case", "of", "ties", "a...
python
train
EpistasisLab/tpot
tpot/base.py
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L621-L780
def fit(self, features, target, sample_weight=None, groups=None): """Fit an optimized machine learning pipeline. Uses genetic programming to optimize a machine learning pipeline that maximizes score on the provided features and target. Performs internal k-fold cross-validaton to avoid o...
[ "def", "fit", "(", "self", ",", "features", ",", "target", ",", "sample_weight", "=", "None", ",", "groups", "=", "None", ")", ":", "self", ".", "_fit_init", "(", ")", "features", ",", "target", "=", "self", ".", "_check_dataset", "(", "features", ",",...
Fit an optimized machine learning pipeline. Uses genetic programming to optimize a machine learning pipeline that maximizes score on the provided features and target. Performs internal k-fold cross-validaton to avoid overfitting on the provided data. The best pipeline is then trained on...
[ "Fit", "an", "optimized", "machine", "learning", "pipeline", "." ]
python
train
googleapis/google-auth-library-python
google/auth/compute_engine/credentials.py
https://github.com/googleapis/google-auth-library-python/blob/2c6ad78917e936f38f87c946209c8031166dc96e/google/auth/compute_engine/credentials.py#L83-L102
def refresh(self, request): """Refresh the access token and scopes. Args: request (google.auth.transport.Request): The object used to make HTTP requests. Raises: google.auth.exceptions.RefreshError: If the Compute Engine metadata service ...
[ "def", "refresh", "(", "self", ",", "request", ")", ":", "try", ":", "self", ".", "_retrieve_info", "(", "request", ")", "self", ".", "token", ",", "self", ".", "expiry", "=", "_metadata", ".", "get_service_account_token", "(", "request", ",", "service_acc...
Refresh the access token and scopes. Args: request (google.auth.transport.Request): The object used to make HTTP requests. Raises: google.auth.exceptions.RefreshError: If the Compute Engine metadata service can't be reached if if the instance has...
[ "Refresh", "the", "access", "token", "and", "scopes", "." ]
python
train
googlefonts/fontmake
Lib/fontmake/font_project.py
https://github.com/googlefonts/fontmake/blob/b611baf49929575c2a30fd18662055365219ce2d/Lib/fontmake/font_project.py#L220-L240
def _deep_copy_contours(self, ufo, parent, component, transformation): """Copy contours from component to parent, including nested components.""" for nested in component.components: self._deep_copy_contours( ufo, parent, ufo[nested.baseGlyph],...
[ "def", "_deep_copy_contours", "(", "self", ",", "ufo", ",", "parent", ",", "component", ",", "transformation", ")", ":", "for", "nested", "in", "component", ".", "components", ":", "self", ".", "_deep_copy_contours", "(", "ufo", ",", "parent", ",", "ufo", ...
Copy contours from component to parent, including nested components.
[ "Copy", "contours", "from", "component", "to", "parent", "including", "nested", "components", "." ]
python
train
stephan-mclean/KickassTorrentsAPI
kat.py
https://github.com/stephan-mclean/KickassTorrentsAPI/blob/4d867a090c06ce95b9ed996b48092cb5bfe28bbd/kat.py#L197-L200
def _categorize(self, category): """Remove torrents with unwanted category from self.torrents""" self.torrents = [result for result in self.torrents if result.category == category]
[ "def", "_categorize", "(", "self", ",", "category", ")", ":", "self", ".", "torrents", "=", "[", "result", "for", "result", "in", "self", ".", "torrents", "if", "result", ".", "category", "==", "category", "]" ]
Remove torrents with unwanted category from self.torrents
[ "Remove", "torrents", "with", "unwanted", "category", "from", "self", ".", "torrents" ]
python
train
astropy/photutils
photutils/isophote/harmonics.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/harmonics.py#L56-L92
def fit_first_and_second_harmonics(phi, intensities): """ Fit the first and second harmonic function values to a set of (angle, intensity) pairs. This function is used to compute corrections for ellipse fitting: .. math:: f(phi) = y0 + a1*\\sin(phi) + b1*\\cos(phi) + a2*\\sin(2*phi) + ...
[ "def", "fit_first_and_second_harmonics", "(", "phi", ",", "intensities", ")", ":", "a1", "=", "b1", "=", "a2", "=", "b2", "=", "1.", "def", "optimize_func", "(", "x", ")", ":", "return", "first_and_second_harmonic_function", "(", "phi", ",", "np", ".", "ar...
Fit the first and second harmonic function values to a set of (angle, intensity) pairs. This function is used to compute corrections for ellipse fitting: .. math:: f(phi) = y0 + a1*\\sin(phi) + b1*\\cos(phi) + a2*\\sin(2*phi) + b2*\\cos(2*phi) Parameters ---------- p...
[ "Fit", "the", "first", "and", "second", "harmonic", "function", "values", "to", "a", "set", "of", "(", "angle", "intensity", ")", "pairs", "." ]
python
train
ldiary/marigoso
marigoso/abstract.py
https://github.com/ldiary/marigoso/blob/886dd4356f83dd3ea6867df6243ba336119011f1/marigoso/abstract.py#L71-L80
def trim_start(self, string, start, end=None): """ Removes the starting substring. :param string: The entire string. :param start: The starting substring to be removed. :param end: An optional point in the string, defaults to the strings ending :return: A substring cons...
[ "def", "trim_start", "(", "self", ",", "string", ",", "start", ",", "end", "=", "None", ")", ":", "extract", "=", "string", "[", "string", ".", "find", "(", "start", ")", "+", "len", "(", "start", ")", ":", "end", "]", "return", "extract", ".", "...
Removes the starting substring. :param string: The entire string. :param start: The starting substring to be removed. :param end: An optional point in the string, defaults to the strings ending :return: A substring consists of the subsequent substring after the ...
[ "Removes", "the", "starting", "substring", ".", ":", "param", "string", ":", "The", "entire", "string", ".", ":", "param", "start", ":", "The", "starting", "substring", "to", "be", "removed", ".", ":", "param", "end", ":", "An", "optional", "point", "in"...
python
train
pytroll/satpy
satpy/writers/cf_writer.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/writers/cf_writer.py#L98-L105
def get_extra_ds(dataset): """Get the extra datasets associated to *dataset*.""" ds_collection = {} for ds in dataset.attrs.get('ancillary_variables', []): ds_collection.update(get_extra_ds(ds)) ds_collection[dataset.attrs['name']] = dataset return ds_collection
[ "def", "get_extra_ds", "(", "dataset", ")", ":", "ds_collection", "=", "{", "}", "for", "ds", "in", "dataset", ".", "attrs", ".", "get", "(", "'ancillary_variables'", ",", "[", "]", ")", ":", "ds_collection", ".", "update", "(", "get_extra_ds", "(", "ds"...
Get the extra datasets associated to *dataset*.
[ "Get", "the", "extra", "datasets", "associated", "to", "*", "dataset", "*", "." ]
python
train
pydata/xarray
xarray/core/coordinates.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/coordinates.py#L296-L330
def remap_label_indexers(obj, indexers=None, method=None, tolerance=None, **indexers_kwargs): """ Remap **indexers from obj.coords. If indexer is an instance of DataArray and it has coordinate, then this coordinate will be attached to pos_indexers. Returns ------- p...
[ "def", "remap_label_indexers", "(", "obj", ",", "indexers", "=", "None", ",", "method", "=", "None", ",", "tolerance", "=", "None", ",", "*", "*", "indexers_kwargs", ")", ":", "from", ".", "dataarray", "import", "DataArray", "indexers", "=", "either_dict_or_...
Remap **indexers from obj.coords. If indexer is an instance of DataArray and it has coordinate, then this coordinate will be attached to pos_indexers. Returns ------- pos_indexers: Same type of indexers. np.ndarray or Variable or DataArra new_indexes: mapping of new dimensional-coordina...
[ "Remap", "**", "indexers", "from", "obj", ".", "coords", ".", "If", "indexer", "is", "an", "instance", "of", "DataArray", "and", "it", "has", "coordinate", "then", "this", "coordinate", "will", "be", "attached", "to", "pos_indexers", "." ]
python
train
tango-controls/pytango
tango/databaseds/database.py
https://github.com/tango-controls/pytango/blob/9cf78c517c9cdc1081ff6d080a9646a740cc1d36/tango/databaseds/database.py#L652-L677
def DbDeleteDeviceAttribute(self, argin): """ Delete device attribute properties from database :param argin: Str[0] = Device name Str[1] = Attribute name :type: tango.DevVarStringArray :return: :rtype: tango.DevVoid """ self._log.debug("In DbDeleteDeviceAttribut...
[ "def", "DbDeleteDeviceAttribute", "(", "self", ",", "argin", ")", ":", "self", ".", "_log", ".", "debug", "(", "\"In DbDeleteDeviceAttribute()\"", ")", "if", "len", "(", "argin", ")", "<", "2", ":", "self", ".", "warn_stream", "(", "\"DataBase::db_delete_devic...
Delete device attribute properties from database :param argin: Str[0] = Device name Str[1] = Attribute name :type: tango.DevVarStringArray :return: :rtype: tango.DevVoid
[ "Delete", "device", "attribute", "properties", "from", "database" ]
python
train
nfcpy/nfcpy
src/nfc/clf/rcs956.py
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/rcs956.py#L210-L229
def sense_tta(self, target): """Activate the RF field and probe for a Type A Target. The RC-S956 can discover all Type A Targets (Type 1 Tag, Type 2 Tag, and Type 4A Tag) at 106 kbps. Due to firmware restrictions it is not possible to read a Type 1 Tag with dynamic memory layout...
[ "def", "sense_tta", "(", "self", ",", "target", ")", ":", "target", "=", "super", "(", "Device", ",", "self", ")", ".", "sense_tta", "(", "target", ")", "if", "target", "and", "target", ".", "rid_res", ":", "# This is a TT1 tag. Unfortunately we can only read ...
Activate the RF field and probe for a Type A Target. The RC-S956 can discover all Type A Targets (Type 1 Tag, Type 2 Tag, and Type 4A Tag) at 106 kbps. Due to firmware restrictions it is not possible to read a Type 1 Tag with dynamic memory layout (more than 128 byte memory).
[ "Activate", "the", "RF", "field", "and", "probe", "for", "a", "Type", "A", "Target", "." ]
python
train
welbornprod/colr
colr/progress_frames.py
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/progress_frames.py#L599-L606
def with_wrapper(self, wrapper=None, name=None): """ Copy this BarSet, and return a new BarSet with the specified name and wrapper. If no name is given, `{self.name}_custom_wrapper` is used. If no wrapper is given, the new BarSet will have no wrapper. """ name...
[ "def", "with_wrapper", "(", "self", ",", "wrapper", "=", "None", ",", "name", "=", "None", ")", ":", "name", "=", "name", "or", "'{}_custom_wrapper'", ".", "format", "(", "self", ".", "name", ")", "return", "self", ".", "__class__", "(", "self", ".", ...
Copy this BarSet, and return a new BarSet with the specified name and wrapper. If no name is given, `{self.name}_custom_wrapper` is used. If no wrapper is given, the new BarSet will have no wrapper.
[ "Copy", "this", "BarSet", "and", "return", "a", "new", "BarSet", "with", "the", "specified", "name", "and", "wrapper", ".", "If", "no", "name", "is", "given", "{", "self", ".", "name", "}", "_custom_wrapper", "is", "used", ".", "If", "no", "wrapper", "...
python
train
mabuchilab/QNET
src/qnet/algebra/_rules.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/_rules.py#L1006-L1113
def _algebraic_rules_circuit(): """Set the default algebraic rules for the operations defined in this module""" A_CPermutation = wc("A", head=CPermutation) B_CPermutation = wc("B", head=CPermutation) C_CPermutation = wc("C", head=CPermutation) D_CPermutation = wc("D", head=CPermutation) A_C...
[ "def", "_algebraic_rules_circuit", "(", ")", ":", "A_CPermutation", "=", "wc", "(", "\"A\"", ",", "head", "=", "CPermutation", ")", "B_CPermutation", "=", "wc", "(", "\"B\"", ",", "head", "=", "CPermutation", ")", "C_CPermutation", "=", "wc", "(", "\"C\"", ...
Set the default algebraic rules for the operations defined in this module
[ "Set", "the", "default", "algebraic", "rules", "for", "the", "operations", "defined", "in", "this", "module" ]
python
train
zeromake/aiko
aiko/request.py
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/request.py#L500-L510
def host(self) -> str: """ 获取 host + port, 如果开启 proxy 开关。使用 X-Forwarded-Host 头 """ host = cast(Optional[str], None) if self.proxy and 'X-Forwarded-Host' in self._headers: xhost = cast(Optional[str], self.get('X-Forwarded-Host')) if xhost is not None: ...
[ "def", "host", "(", "self", ")", "->", "str", ":", "host", "=", "cast", "(", "Optional", "[", "str", "]", ",", "None", ")", "if", "self", ".", "proxy", "and", "'X-Forwarded-Host'", "in", "self", ".", "_headers", ":", "xhost", "=", "cast", "(", "Opt...
获取 host + port, 如果开启 proxy 开关。使用 X-Forwarded-Host 头
[ "获取", "host", "+", "port", "如果开启", "proxy", "开关。使用", "X", "-", "Forwarded", "-", "Host", "头" ]
python
train
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L482-L511
def combine_variant_files(orig_files, out_file, ref_file, config, quiet_out=True, region=None): """Combine VCF files from the same sample into a single output file. Handles cases where we split files into SNPs/Indels for processing then need to merge back into a final file. ""...
[ "def", "combine_variant_files", "(", "orig_files", ",", "out_file", ",", "ref_file", ",", "config", ",", "quiet_out", "=", "True", ",", "region", "=", "None", ")", ":", "in_pipeline", "=", "False", "if", "isinstance", "(", "orig_files", ",", "dict", ")", "...
Combine VCF files from the same sample into a single output file. Handles cases where we split files into SNPs/Indels for processing then need to merge back into a final file.
[ "Combine", "VCF", "files", "from", "the", "same", "sample", "into", "a", "single", "output", "file", "." ]
python
train
blockstack/blockstack-core
blockstack/blockstackd.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/blockstackd.py#L1269-L1297
def rpc_get_namespace_cost( self, namespace_id, **con_info ): """ Return the cost of a given namespace, including fees. Returns {'amount': ..., 'units': ...} """ if not check_namespace(namespace_id): return {'error': 'Invalid namespace', 'http_status': 400} d...
[ "def", "rpc_get_namespace_cost", "(", "self", ",", "namespace_id", ",", "*", "*", "con_info", ")", ":", "if", "not", "check_namespace", "(", "namespace_id", ")", ":", "return", "{", "'error'", ":", "'Invalid namespace'", ",", "'http_status'", ":", "400", "}", ...
Return the cost of a given namespace, including fees. Returns {'amount': ..., 'units': ...}
[ "Return", "the", "cost", "of", "a", "given", "namespace", "including", "fees", ".", "Returns", "{", "amount", ":", "...", "units", ":", "...", "}" ]
python
train
widdowquinn/pyani
pyani/tetra.py
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/pyani/tetra.py#L118-L149
def calculate_correlations(tetra_z): """Returns dataframe of Pearson correlation coefficients. - tetra_z - dictionary of Z-scores, keyed by sequence ID Calculates Pearson correlation coefficient from Z scores for each tetranucleotide. This is done longhand here, which is fast enough, but for robus...
[ "def", "calculate_correlations", "(", "tetra_z", ")", ":", "orgs", "=", "sorted", "(", "tetra_z", ".", "keys", "(", ")", ")", "correlations", "=", "pd", ".", "DataFrame", "(", "index", "=", "orgs", ",", "columns", "=", "orgs", ",", "dtype", "=", "float...
Returns dataframe of Pearson correlation coefficients. - tetra_z - dictionary of Z-scores, keyed by sequence ID Calculates Pearson correlation coefficient from Z scores for each tetranucleotide. This is done longhand here, which is fast enough, but for robustness we might want to do something else... ...
[ "Returns", "dataframe", "of", "Pearson", "correlation", "coefficients", "." ]
python
train
kurtbrose/pyjks
jks/jks.py
https://github.com/kurtbrose/pyjks/blob/1cbe7f060e2ad076b6462f3273f11d635771ea3d/jks/jks.py#L383-L419
def new(cls, store_type, store_entries): """ Helper function to create a new KeyStore. :param string store_type: What kind of keystore the store should be. Valid options are jks or jceks. :param list store_entries: Existing entries that should be added to the keystor...
[ "def", "new", "(", "cls", ",", "store_type", ",", "store_entries", ")", ":", "if", "store_type", "not", "in", "[", "'jks'", ",", "'jceks'", "]", ":", "raise", "UnsupportedKeystoreTypeException", "(", "\"The Keystore Type '%s' is not supported\"", "%", "store_type", ...
Helper function to create a new KeyStore. :param string store_type: What kind of keystore the store should be. Valid options are jks or jceks. :param list store_entries: Existing entries that should be added to the keystore. :returns: A loaded :class:`KeyStore` instance, ...
[ "Helper", "function", "to", "create", "a", "new", "KeyStore", "." ]
python
train
JensRantil/rewind
rewind/server/eventstores.py
https://github.com/JensRantil/rewind/blob/7f645d20186c1db55cfe53a0310c9fd6292f91ea/rewind/server/eventstores.py#L95-L106
def _read_keyvals(filename): """Read the key/values if the file exists. returns -- a dictionary with key/values, or empty dictionary if the file does not exist. """ assert isinstance(filename, str) if os.path.exists(filename): return _KeyValuePers...
[ "def", "_read_keyvals", "(", "filename", ")", ":", "assert", "isinstance", "(", "filename", ",", "str", ")", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "return", "_KeyValuePersister", ".", "_actually_populate_keyvals", "(", "filename", ...
Read the key/values if the file exists. returns -- a dictionary with key/values, or empty dictionary if the file does not exist.
[ "Read", "the", "key", "/", "values", "if", "the", "file", "exists", "." ]
python
train
mthornhill/django-postal
src/postal/resource.py
https://github.com/mthornhill/django-postal/blob/21d65e09b45f0515cde6166345f46c3f506dd08f/src/postal/resource.py#L446-L454
def form_validation_response(self, e): """ Method to return form validation error information. You will probably want to override this in your own `Resource` subclass. """ resp = rc.BAD_REQUEST resp.write(' '+str(e.form.errors)) return resp
[ "def", "form_validation_response", "(", "self", ",", "e", ")", ":", "resp", "=", "rc", ".", "BAD_REQUEST", "resp", ".", "write", "(", "' '", "+", "str", "(", "e", ".", "form", ".", "errors", ")", ")", "return", "resp" ]
Method to return form validation error information. You will probably want to override this in your own `Resource` subclass.
[ "Method", "to", "return", "form", "validation", "error", "information", ".", "You", "will", "probably", "want", "to", "override", "this", "in", "your", "own", "Resource", "subclass", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/keras/initializers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/keras/initializers.py#L32-L60
def _compute_fans(shape): """Computes the number of input and output units for a weight shape. Args: shape: Integer shape tuple or TF tensor shape. Returns: A tuple of scalars (fan_in, fan_out). """ if len(shape) < 1: # Just to avoid errors for constants. fan_in = fan_out = 1 elif len(shape) ...
[ "def", "_compute_fans", "(", "shape", ")", ":", "if", "len", "(", "shape", ")", "<", "1", ":", "# Just to avoid errors for constants.", "fan_in", "=", "fan_out", "=", "1", "elif", "len", "(", "shape", ")", "==", "1", ":", "fan_in", "=", "fan_out", "=", ...
Computes the number of input and output units for a weight shape. Args: shape: Integer shape tuple or TF tensor shape. Returns: A tuple of scalars (fan_in, fan_out).
[ "Computes", "the", "number", "of", "input", "and", "output", "units", "for", "a", "weight", "shape", "." ]
python
train
danpoland/pyramid-restful-framework
pyramid_restful/routers.py
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/routers.py#L205-L217
def get_method_map(self, viewset, method_map): """ Given a viewset, and a mapping of http methods to actions, return a new mapping which only includes any mappings that are actually implemented by the viewset. """ bound_methods = {} for method, action in method_map.item...
[ "def", "get_method_map", "(", "self", ",", "viewset", ",", "method_map", ")", ":", "bound_methods", "=", "{", "}", "for", "method", ",", "action", "in", "method_map", ".", "items", "(", ")", ":", "if", "hasattr", "(", "viewset", ",", "action", ")", ":"...
Given a viewset, and a mapping of http methods to actions, return a new mapping which only includes any mappings that are actually implemented by the viewset.
[ "Given", "a", "viewset", "and", "a", "mapping", "of", "http", "methods", "to", "actions", "return", "a", "new", "mapping", "which", "only", "includes", "any", "mappings", "that", "are", "actually", "implemented", "by", "the", "viewset", "." ]
python
train
niklasf/python-chess
chess/__init__.py
https://github.com/niklasf/python-chess/blob/d91f986ca3e046b300a0d7d9ee2a13b07610fe1a/chess/__init__.py#L815-L822
def remove_piece_at(self, square: Square) -> Optional[Piece]: """ Removes the piece from the given square. Returns the :class:`~chess.Piece` or ``None`` if the square was already empty. """ color = bool(self.occupied_co[WHITE] & BB_SQUARES[square]) piece_type = self._remo...
[ "def", "remove_piece_at", "(", "self", ",", "square", ":", "Square", ")", "->", "Optional", "[", "Piece", "]", ":", "color", "=", "bool", "(", "self", ".", "occupied_co", "[", "WHITE", "]", "&", "BB_SQUARES", "[", "square", "]", ")", "piece_type", "=",...
Removes the piece from the given square. Returns the :class:`~chess.Piece` or ``None`` if the square was already empty.
[ "Removes", "the", "piece", "from", "the", "given", "square", ".", "Returns", "the", ":", "class", ":", "~chess", ".", "Piece", "or", "None", "if", "the", "square", "was", "already", "empty", "." ]
python
train
jbloomlab/phydms
phydmslib/models.py
https://github.com/jbloomlab/phydms/blob/9cdebc10bafbe543c552d79486c7f950780ed3c0/phydmslib/models.py#L1407-L1421
def _update_dPrxy(self): """Update `dPrxy`, accounting for dependence of `Prxy` on `omega2`.""" super(ExpCM_empirical_phi_divpressure, self)._update_dPrxy() if 'omega2' in self.freeparams: with scipy.errstate(divide='raise', under='raise', over='raise', in...
[ "def", "_update_dPrxy", "(", "self", ")", ":", "super", "(", "ExpCM_empirical_phi_divpressure", ",", "self", ")", ".", "_update_dPrxy", "(", ")", "if", "'omega2'", "in", "self", ".", "freeparams", ":", "with", "scipy", ".", "errstate", "(", "divide", "=", ...
Update `dPrxy`, accounting for dependence of `Prxy` on `omega2`.
[ "Update", "dPrxy", "accounting", "for", "dependence", "of", "Prxy", "on", "omega2", "." ]
python
train
manns/pyspread
pyspread/src/lib/vlc.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L6153-L6172
def libvlc_audio_output_device_get(mp): '''Get the current audio output device identifier. This complements L{libvlc_audio_output_device_set}(). @warning: The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare...
[ "def", "libvlc_audio_output_device_get", "(", "mp", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_audio_output_device_get'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_audio_output_device_get'", ",", "(", "(", "1", ",", ")", ",", ")", "...
Get the current audio output device identifier. This complements L{libvlc_audio_output_device_set}(). @warning: The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare this value against the known device identifier...
[ "Get", "the", "current", "audio", "output", "device", "identifier", ".", "This", "complements", "L", "{", "libvlc_audio_output_device_set", "}", "()", "." ]
python
train
gwpy/gwpy
gwpy/timeseries/io/losc.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/io/losc.py#L274-L285
def _gwf_channel(path, series_class=TimeSeries, verbose=False): """Find the right channel name for a LOSC GWF file """ channels = list(io_gwf.iter_channel_names(file_path(path))) if issubclass(series_class, StateVector): regex = DQMASK_CHANNEL_REGEX else: regex = STRAIN_CHANNEL_REGEX...
[ "def", "_gwf_channel", "(", "path", ",", "series_class", "=", "TimeSeries", ",", "verbose", "=", "False", ")", ":", "channels", "=", "list", "(", "io_gwf", ".", "iter_channel_names", "(", "file_path", "(", "path", ")", ")", ")", "if", "issubclass", "(", ...
Find the right channel name for a LOSC GWF file
[ "Find", "the", "right", "channel", "name", "for", "a", "LOSC", "GWF", "file" ]
python
train
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L5023-L5101
def _get_cluster_dict(cluster_name, cluster_ref): ''' Returns a cluster dict representation from a vim.ClusterComputeResource object. cluster_name Name of the cluster cluster_ref Reference to the cluster ''' log.trace('Building a dictionary representation of cluster \'%s\'...
[ "def", "_get_cluster_dict", "(", "cluster_name", ",", "cluster_ref", ")", ":", "log", ".", "trace", "(", "'Building a dictionary representation of cluster \\'%s\\''", ",", "cluster_name", ")", "props", "=", "salt", ".", "utils", ".", "vmware", ".", "get_properties_of_...
Returns a cluster dict representation from a vim.ClusterComputeResource object. cluster_name Name of the cluster cluster_ref Reference to the cluster
[ "Returns", "a", "cluster", "dict", "representation", "from", "a", "vim", ".", "ClusterComputeResource", "object", "." ]
python
train
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1053-L1055
def delete_lbaas_l7rule(self, l7rule, l7policy): """Deletes the specified L7 rule.""" return self.delete(self.lbaas_l7rule_path % (l7policy, l7rule))
[ "def", "delete_lbaas_l7rule", "(", "self", ",", "l7rule", ",", "l7policy", ")", ":", "return", "self", ".", "delete", "(", "self", ".", "lbaas_l7rule_path", "%", "(", "l7policy", ",", "l7rule", ")", ")" ]
Deletes the specified L7 rule.
[ "Deletes", "the", "specified", "L7", "rule", "." ]
python
train
ynop/audiomate
audiomate/encoding/base.py
https://github.com/ynop/audiomate/blob/61727920b23a708293c3d526fa3000d4de9c6c21/audiomate/encoding/base.py#L15-L35
def encode_corpus(self, corpus, output_path): """ Encode all utterances of the given corpus and store them in a :class:`audiomate.container.Container`. Args: corpus (Corpus): The corpus to process. output_path (str): The path to store the container with the encoded data....
[ "def", "encode_corpus", "(", "self", ",", "corpus", ",", "output_path", ")", ":", "out_container", "=", "containers", ".", "Container", "(", "output_path", ")", "out_container", ".", "open", "(", ")", "for", "utterance", "in", "corpus", ".", "utterances", "....
Encode all utterances of the given corpus and store them in a :class:`audiomate.container.Container`. Args: corpus (Corpus): The corpus to process. output_path (str): The path to store the container with the encoded data. Returns: Container: The container with the e...
[ "Encode", "all", "utterances", "of", "the", "given", "corpus", "and", "store", "them", "in", "a", ":", "class", ":", "audiomate", ".", "container", ".", "Container", "." ]
python
train
cytoscape/py2cytoscape
py2cytoscape/data/base_view.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/base_view.py#L41-L57
def set_value(self, visual_property, value): """Set a single Visual Property Value :param visual_property: Visual Property ID :param value: New value for the VP :return: None """ if visual_property is None or value is None: raise ValueError('Both VP and value...
[ "def", "set_value", "(", "self", ",", "visual_property", ",", "value", ")", ":", "if", "visual_property", "is", "None", "or", "value", "is", "None", ":", "raise", "ValueError", "(", "'Both VP and value are required.'", ")", "new_value", "=", "[", "{", "'visual...
Set a single Visual Property Value :param visual_property: Visual Property ID :param value: New value for the VP :return: None
[ "Set", "a", "single", "Visual", "Property", "Value" ]
python
train
DataDog/integrations-core
openstack_controller/datadog_checks/openstack_controller/api.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openstack_controller/datadog_checks/openstack_controller/api.py#L296-L331
def _make_request(self, url, headers, params=None): """ Generic request handler for OpenStack API requests Raises specialized Exceptions for commonly encountered error codes """ self.logger.debug("Request URL, Headers and Params: %s, %s, %s", url, headers, params) # Chec...
[ "def", "_make_request", "(", "self", ",", "url", ",", "headers", ",", "params", "=", "None", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Request URL, Headers and Params: %s, %s, %s\"", ",", "url", ",", "headers", ",", "params", ")", "# Checking if r...
Generic request handler for OpenStack API requests Raises specialized Exceptions for commonly encountered error codes
[ "Generic", "request", "handler", "for", "OpenStack", "API", "requests", "Raises", "specialized", "Exceptions", "for", "commonly", "encountered", "error", "codes" ]
python
train
GPflow/GPflow
gpflow/training/monitor.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/monitor.py#L550-L565
def _growing_step_sequence(interval_growth, max_interval, init_interval, start_level=None): """ Returns an iterator that constructs a sequence of trigger levels with growing intervals. The interval is growing exponentially until it reaches the maximum value. Then the interval stays the s...
[ "def", "_growing_step_sequence", "(", "interval_growth", ",", "max_interval", ",", "init_interval", ",", "start_level", "=", "None", ")", ":", "interval", "=", "init_interval", "next_level", "=", "start_level", "or", "init_interval", "while", "True", ":", "yield", ...
Returns an iterator that constructs a sequence of trigger levels with growing intervals. The interval is growing exponentially until it reaches the maximum value. Then the interval stays the same and the sequence becomes linear. An optional starting level `start_level` defaults to the initial i...
[ "Returns", "an", "iterator", "that", "constructs", "a", "sequence", "of", "trigger", "levels", "with", "growing", "intervals", ".", "The", "interval", "is", "growing", "exponentially", "until", "it", "reaches", "the", "maximum", "value", ".", "Then", "the", "i...
python
train
majerteam/deform_extensions
deform_extensions/__init__.py
https://github.com/majerteam/deform_extensions/blob/fdad612e4889a40f1944611264b943866a3cb96e/deform_extensions/__init__.py#L359-L375
def childgroup(self, field): """ Return a list of fields stored by row regarding the configured grid :param field: The original field this widget is attached to """ grid = getattr(self, "grid", None) named_grid = getattr(self, "named_grid", None) if grid is not ...
[ "def", "childgroup", "(", "self", ",", "field", ")", ":", "grid", "=", "getattr", "(", "self", ",", "\"grid\"", ",", "None", ")", "named_grid", "=", "getattr", "(", "self", ",", "\"named_grid\"", ",", "None", ")", "if", "grid", "is", "not", "None", "...
Return a list of fields stored by row regarding the configured grid :param field: The original field this widget is attached to
[ "Return", "a", "list", "of", "fields", "stored", "by", "row", "regarding", "the", "configured", "grid" ]
python
train
secdev/scapy
scapy/utils.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1835-L1861
def whois(ip_address): """Whois client for Python""" whois_ip = str(ip_address) try: query = socket.gethostbyname(whois_ip) except Exception: query = whois_ip s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("whois.ripe.net", 43)) s.send(query.encode("utf8") +...
[ "def", "whois", "(", "ip_address", ")", ":", "whois_ip", "=", "str", "(", "ip_address", ")", "try", ":", "query", "=", "socket", ".", "gethostbyname", "(", "whois_ip", ")", "except", "Exception", ":", "query", "=", "whois_ip", "s", "=", "socket", ".", ...
Whois client for Python
[ "Whois", "client", "for", "Python" ]
python
train
google/grumpy
third_party/stdlib/rfc822.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L290-L297
def getheader(self, name, default=None): """Get the header value for a name. This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. ...
[ "def", "getheader", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "return", "self", ".", "dict", ".", "get", "(", "name", ".", "lower", "(", ")", ",", "default", ")" ]
Get the header value for a name. This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header.
[ "Get", "the", "header", "value", "for", "a", "name", "." ]
python
valid
CivicSpleen/ambry
ambry/bundle/process.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/process.py#L258-L260
def start(self, phase, stage, **kwargs): """Start a new routine, stage or phase""" return ProgressSection(self, self._session, phase, stage, self._logger, **kwargs)
[ "def", "start", "(", "self", ",", "phase", ",", "stage", ",", "*", "*", "kwargs", ")", ":", "return", "ProgressSection", "(", "self", ",", "self", ".", "_session", ",", "phase", ",", "stage", ",", "self", ".", "_logger", ",", "*", "*", "kwargs", ")...
Start a new routine, stage or phase
[ "Start", "a", "new", "routine", "stage", "or", "phase" ]
python
train
dereneaton/ipyrad
ipyrad/analysis/tetrad.py
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L445-L512
def _store_N_samples(self, ncpus): """ Find all quartets of samples and store in a large array Create a chunk size for sampling from the array of quartets. This should be relatively large so that we don't spend a lot of time doing I/O, but small enough that jobs finish often f...
[ "def", "_store_N_samples", "(", "self", ",", "ncpus", ")", ":", "breaks", "=", "2", "if", "self", ".", "params", ".", "nquartets", "<", "5000", ":", "breaks", "=", "1", "if", "self", ".", "params", ".", "nquartets", ">", "100000", ":", "breaks", "=",...
Find all quartets of samples and store in a large array Create a chunk size for sampling from the array of quartets. This should be relatively large so that we don't spend a lot of time doing I/O, but small enough that jobs finish often for checkpointing.
[ "Find", "all", "quartets", "of", "samples", "and", "store", "in", "a", "large", "array", "Create", "a", "chunk", "size", "for", "sampling", "from", "the", "array", "of", "quartets", ".", "This", "should", "be", "relatively", "large", "so", "that", "we", ...
python
valid
Workiva/furious
furious/job_utils.py
https://github.com/Workiva/furious/blob/c29823ec8b98549e7439d7273aa064d1e5830632/furious/job_utils.py#L146-L162
def decode_callbacks(encoded_callbacks): """Decode the callbacks to an executable form.""" from furious.async import Async callbacks = {} for event, callback in encoded_callbacks.iteritems(): if isinstance(callback, dict): async_type = Async if '_type' in callback: ...
[ "def", "decode_callbacks", "(", "encoded_callbacks", ")", ":", "from", "furious", ".", "async", "import", "Async", "callbacks", "=", "{", "}", "for", "event", ",", "callback", "in", "encoded_callbacks", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(...
Decode the callbacks to an executable form.
[ "Decode", "the", "callbacks", "to", "an", "executable", "form", "." ]
python
train
ulule/django-badgify
badgify/registry.py
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/registry.py#L47-L53
def unregister(self, recipe): """ Unregisters a given recipe class. """ recipe = self.get_recipe_instance_from_class(recipe) if recipe.slug in self._registry: del self._registry[recipe.slug]
[ "def", "unregister", "(", "self", ",", "recipe", ")", ":", "recipe", "=", "self", ".", "get_recipe_instance_from_class", "(", "recipe", ")", "if", "recipe", ".", "slug", "in", "self", ".", "_registry", ":", "del", "self", ".", "_registry", "[", "recipe", ...
Unregisters a given recipe class.
[ "Unregisters", "a", "given", "recipe", "class", "." ]
python
train
saltstack/salt
salt/utils/openstack/neutron.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/neutron.py#L786-L792
def delete_ikepolicy(self, ikepolicy): ''' Deletes the specified IKEPolicy ''' ikepolicy_id = self._find_ikepolicy_id(ikepolicy) ret = self.network_conn.delete_ikepolicy(ikepolicy_id) return ret if ret else True
[ "def", "delete_ikepolicy", "(", "self", ",", "ikepolicy", ")", ":", "ikepolicy_id", "=", "self", ".", "_find_ikepolicy_id", "(", "ikepolicy", ")", "ret", "=", "self", ".", "network_conn", ".", "delete_ikepolicy", "(", "ikepolicy_id", ")", "return", "ret", "if"...
Deletes the specified IKEPolicy
[ "Deletes", "the", "specified", "IKEPolicy" ]
python
train
timothyb0912/pylogit
pylogit/choice_tools.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/choice_tools.py#L718-L745
def get_original_order_unique_ids(id_array): """ Get the unique id's of id_array, in their original order of appearance. Parameters ---------- id_array : 1D ndarray. Should contain the ids that we want to extract the unique values from. Returns ------- original_order_unique_ids...
[ "def", "get_original_order_unique_ids", "(", "id_array", ")", ":", "assert", "isinstance", "(", "id_array", ",", "np", ".", "ndarray", ")", "assert", "len", "(", "id_array", ".", "shape", ")", "==", "1", "# Get the indices of the unique IDs in their order of appearanc...
Get the unique id's of id_array, in their original order of appearance. Parameters ---------- id_array : 1D ndarray. Should contain the ids that we want to extract the unique values from. Returns ------- original_order_unique_ids : 1D ndarray. Contains the unique ids from `id_a...
[ "Get", "the", "unique", "id", "s", "of", "id_array", "in", "their", "original", "order", "of", "appearance", "." ]
python
train
rm-hull/luma.core
luma/core/legacy/__init__.py
https://github.com/rm-hull/luma.core/blob/034b628fb304a01e77732a299c0b42e94d6443db/luma/core/legacy/__init__.py#L33-L58
def text(draw, xy, txt, fill=None, font=None): """ Draw a legacy font starting at :py:attr:`x`, :py:attr:`y` using the prescribed fill and font. :param draw: A valid canvas to draw the text onto. :type draw: PIL.ImageDraw :param txt: The text string to display (must be ASCII only). :type tx...
[ "def", "text", "(", "draw", ",", "xy", ",", "txt", ",", "fill", "=", "None", ",", "font", "=", "None", ")", ":", "font", "=", "font", "or", "DEFAULT_FONT", "x", ",", "y", "=", "xy", "for", "ch", "in", "txt", ":", "for", "byte", "in", "font", ...
Draw a legacy font starting at :py:attr:`x`, :py:attr:`y` using the prescribed fill and font. :param draw: A valid canvas to draw the text onto. :type draw: PIL.ImageDraw :param txt: The text string to display (must be ASCII only). :type txt: str :param xy: An ``(x, y)`` tuple denoting the top-...
[ "Draw", "a", "legacy", "font", "starting", "at", ":", "py", ":", "attr", ":", "x", ":", "py", ":", "attr", ":", "y", "using", "the", "prescribed", "fill", "and", "font", "." ]
python
train
paramiko/paramiko
paramiko/_winapi.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/_winapi.py#L351-L369
def GetTokenInformation(token, information_class): """ Given a token, get the token information for it. """ data_size = ctypes.wintypes.DWORD() ctypes.windll.advapi32.GetTokenInformation( token, information_class.num, 0, 0, ctypes.byref(data_size) ) data = ctypes.create_string_buffer...
[ "def", "GetTokenInformation", "(", "token", ",", "information_class", ")", ":", "data_size", "=", "ctypes", ".", "wintypes", ".", "DWORD", "(", ")", "ctypes", ".", "windll", ".", "advapi32", ".", "GetTokenInformation", "(", "token", ",", "information_class", "...
Given a token, get the token information for it.
[ "Given", "a", "token", "get", "the", "token", "information", "for", "it", "." ]
python
train
slacy/minimongo
minimongo/collection.py
https://github.com/slacy/minimongo/blob/29f38994831163b17bc625c82258068f1f90efa5/minimongo/collection.py#L50-L57
def find_one(self, *args, **kwargs): """Same as :meth:`pymongo.collection.Collection.find_one`, except it returns the right document class. """ data = super(Collection, self).find_one(*args, **kwargs) if data: return self.document_class(data) return None
[ "def", "find_one", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "super", "(", "Collection", ",", "self", ")", ".", "find_one", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "data", ":", "return", "self", ...
Same as :meth:`pymongo.collection.Collection.find_one`, except it returns the right document class.
[ "Same", "as", ":", "meth", ":", "pymongo", ".", "collection", ".", "Collection", ".", "find_one", "except", "it", "returns", "the", "right", "document", "class", "." ]
python
test
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L834-L849
def listofmodeluserfunctions(self): """User functions of the model class.""" lines = [] for (name, member) in vars(self.model.__class__).items(): if (inspect.isfunction(member) and (name not in ('run', 'new2old')) and ('fastaccess' in inspect.g...
[ "def", "listofmodeluserfunctions", "(", "self", ")", ":", "lines", "=", "[", "]", "for", "(", "name", ",", "member", ")", "in", "vars", "(", "self", ".", "model", ".", "__class__", ")", ".", "items", "(", ")", ":", "if", "(", "inspect", ".", "isfun...
User functions of the model class.
[ "User", "functions", "of", "the", "model", "class", "." ]
python
train
scheibler/khard
khard/address_book.py
https://github.com/scheibler/khard/blob/0f69430c2680f1ff5f073a977a3c5b753b96cc17/khard/address_book.py#L254-L276
def _find_vcard_files(self, search=None, search_in_source_files=False): """Find all vcard files inside this address book. If a search string is given only files which contents match that will be returned. :param search: a regular expression to limit the results :type search: st...
[ "def", "_find_vcard_files", "(", "self", ",", "search", "=", "None", ",", "search_in_source_files", "=", "False", ")", ":", "files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "\"*.vcf\"", ")", ")", ...
Find all vcard files inside this address book. If a search string is given only files which contents match that will be returned. :param search: a regular expression to limit the results :type search: str :param search_in_source_files: apply search regexp directly on the .vcf f...
[ "Find", "all", "vcard", "files", "inside", "this", "address", "book", "." ]
python
test
pypa/pipenv
pipenv/vendor/distlib/metadata.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/metadata.py#L563-L620
def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). """ self.set_metadata_version() mapping_1_0 = ( ('metada...
[ "def", "todict", "(", "self", ",", "skip_missing", "=", "False", ")", ":", "self", ".", "set_metadata_version", "(", ")", "mapping_1_0", "=", "(", "(", "'metadata_version'", ",", "'Metadata-Version'", ")", ",", "(", "'name'", ",", "'Name'", ")", ",", "(", ...
Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page).
[ "Return", "fields", "as", "a", "dict", "." ]
python
train
google/grumpy
third_party/stdlib/string.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/string.py#L63-L80
def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments mus...
[ "def", "maketrans", "(", "fromstr", ",", "tostr", ")", ":", "if", "len", "(", "fromstr", ")", "!=", "len", "(", "tostr", ")", ":", "raise", "ValueError", ",", "\"maketrans arguments must have same length\"", "global", "_idmapL", "if", "not", "_idmapL", ":", ...
maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length.
[ "maketrans", "(", "frm", "to", ")", "-", ">", "string" ]
python
valid
uw-it-aca/uw-restclients
restclients/models/__init__.py
https://github.com/uw-it-aca/uw-restclients/blob/e12dcd32bf5296b6ebdf71798031594afb7852cb/restclients/models/__init__.py#L260-L270
def get_surrogate_id(self): """ This is responsible for building the surrogate id from the model """ surrogate_id = "%s,%s,%s,%s,%s" % (self.year, self.quarter, self.curriculum_abbr.lower(), ...
[ "def", "get_surrogate_id", "(", "self", ")", ":", "surrogate_id", "=", "\"%s,%s,%s,%s,%s\"", "%", "(", "self", ".", "year", ",", "self", ".", "quarter", ",", "self", ".", "curriculum_abbr", ".", "lower", "(", ")", ",", "self", ".", "course_number", ",", ...
This is responsible for building the surrogate id from the model
[ "This", "is", "responsible", "for", "building", "the", "surrogate", "id", "from", "the", "model" ]
python
train
OCA/openupgradelib
openupgradelib/openupgrade.py
https://github.com/OCA/openupgradelib/blob/b220b6498075d62c1b64073cc934513a465cfd85/openupgradelib/openupgrade.py#L2049-L2069
def chunked(records, single=True): """ Memory and performance friendly method to iterate over a potentially large number of records. Yields either a whole chunk or a single record at the time. Don't nest calls to this method. """ if version_info[0] > 10: invalidate = records.env.cache.invalidate...
[ "def", "chunked", "(", "records", ",", "single", "=", "True", ")", ":", "if", "version_info", "[", "0", "]", ">", "10", ":", "invalidate", "=", "records", ".", "env", ".", "cache", ".", "invalidate", "elif", "version_info", "[", "0", "]", ">", "7", ...
Memory and performance friendly method to iterate over a potentially large number of records. Yields either a whole chunk or a single record at the time. Don't nest calls to this method.
[ "Memory", "and", "performance", "friendly", "method", "to", "iterate", "over", "a", "potentially", "large", "number", "of", "records", ".", "Yields", "either", "a", "whole", "chunk", "or", "a", "single", "record", "at", "the", "time", ".", "Don", "t", "nes...
python
train
tritemio/PyBroMo
pybromo/iter_chunks.py
https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L30-L39
def iter_chunk_slice(num_samples, chunksize): """Iterator used to iterate in chunks over an array of size `num_samples`. At each iteration returns a slice of size `chunksize`. In the last iteration the slice may be smaller. """ i = 0 for c_size in iter_chunksize(num_samples, chunksize): ...
[ "def", "iter_chunk_slice", "(", "num_samples", ",", "chunksize", ")", ":", "i", "=", "0", "for", "c_size", "in", "iter_chunksize", "(", "num_samples", ",", "chunksize", ")", ":", "yield", "slice", "(", "i", ",", "i", "+", "c_size", ")", "i", "+=", "c_s...
Iterator used to iterate in chunks over an array of size `num_samples`. At each iteration returns a slice of size `chunksize`. In the last iteration the slice may be smaller.
[ "Iterator", "used", "to", "iterate", "in", "chunks", "over", "an", "array", "of", "size", "num_samples", "." ]
python
valid
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/vm/deploy.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/vm/deploy.py#L88-L107
def deploy_from_template(self, si, logger, data_holder, vcenter_data_model, reservation_id, cancellation_context): """ :param cancellation_context: :param reservation_id: :param si: :param logger: :type data_holder: DeployFromTemplateDetails :type vcenter_data_mod...
[ "def", "deploy_from_template", "(", "self", ",", "si", ",", "logger", ",", "data_holder", ",", "vcenter_data_model", ",", "reservation_id", ",", "cancellation_context", ")", ":", "template_resource_model", "=", "data_holder", ".", "template_resource_model", "return", ...
:param cancellation_context: :param reservation_id: :param si: :param logger: :type data_holder: DeployFromTemplateDetails :type vcenter_data_model :rtype DeployAppResult: :return:
[ ":", "param", "cancellation_context", ":", ":", "param", "reservation_id", ":", ":", "param", "si", ":", ":", "param", "logger", ":", ":", "type", "data_holder", ":", "DeployFromTemplateDetails", ":", "type", "vcenter_data_model", ":", "rtype", "DeployAppResult", ...
python
train
icgood/pymap
pymap/mime/parsed.py
https://github.com/icgood/pymap/blob/e77d9a54d760e3cbe044a548883bb4299ed61dc2/pymap/mime/parsed.py#L63-L68
def content_type(self) -> Optional[ContentTypeHeader]: """The ``Content-Type`` header.""" try: return cast(ContentTypeHeader, self[b'content-type'][0]) except (KeyError, IndexError): return None
[ "def", "content_type", "(", "self", ")", "->", "Optional", "[", "ContentTypeHeader", "]", ":", "try", ":", "return", "cast", "(", "ContentTypeHeader", ",", "self", "[", "b'content-type'", "]", "[", "0", "]", ")", "except", "(", "KeyError", ",", "IndexError...
The ``Content-Type`` header.
[ "The", "Content", "-", "Type", "header", "." ]
python
train
fermiPy/fermipy
fermipy/jobs/target_collect.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/target_collect.py#L163-L197
def collect_summary_stats(data): """Collect summary statisitics from an array This creates a dictionry of output arrays of summary statistics, with the input array dimension reducted by one. Parameters ---------- data : `numpy.ndarray` Array with the collected input data Returns...
[ "def", "collect_summary_stats", "(", "data", ")", ":", "mean", "=", "np", ".", "mean", "(", "data", ",", "axis", "=", "0", ")", "std", "=", "np", ".", "std", "(", "data", ",", "axis", "=", "0", ")", "median", "=", "np", ".", "median", "(", "dat...
Collect summary statisitics from an array This creates a dictionry of output arrays of summary statistics, with the input array dimension reducted by one. Parameters ---------- data : `numpy.ndarray` Array with the collected input data Returns ------- output : dict ...
[ "Collect", "summary", "statisitics", "from", "an", "array" ]
python
train
fastai/fastai
old/fastai/rnn_reg.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/old/fastai/rnn_reg.py#L79-L94
def _setup(self): """ for each string defined in self.weights, the corresponding attribute in the wrapped module is referenced, then deleted, and subsequently registered as a new parameter with a slightly modified name. Args: None Returns: None ...
[ "def", "_setup", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "module", ",", "torch", ".", "nn", ".", "RNNBase", ")", ":", "self", ".", "module", ".", "flatten_parameters", "=", "noop", "for", "name_w", "in", "self", ".", "weights", "...
for each string defined in self.weights, the corresponding attribute in the wrapped module is referenced, then deleted, and subsequently registered as a new parameter with a slightly modified name. Args: None Returns: None
[ "for", "each", "string", "defined", "in", "self", ".", "weights", "the", "corresponding", "attribute", "in", "the", "wrapped", "module", "is", "referenced", "then", "deleted", "and", "subsequently", "registered", "as", "a", "new", "parameter", "with", "a", "sl...
python
train
saltstack/salt
salt/pillar/http_json.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/http_json.py#L66-L109
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 url, with_grains=False): ''' Read pillar data from HTTP response. :param str url: Url to request. :param bool with_grains: Whether to substitute strings in the url with their grain values. :retu...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "url", ",", "with_grains", "=", "False", ")", ":", "url", "=", "url", ".", "replace", "(", "'%s'", ",", "_quote", "(", "minion_id", ")", ")", "grain_pattern", "=", "r'<(?...
Read pillar data from HTTP response. :param str url: Url to request. :param bool with_grains: Whether to substitute strings in the url with their grain values. :return: A dictionary of the pillar data to add. :rtype: dict
[ "Read", "pillar", "data", "from", "HTTP", "response", "." ]
python
train
yakupadakli/python-unsplash
unsplash/search.py
https://github.com/yakupadakli/python-unsplash/blob/6e43dce3225237e1b8111fd475fb98b1ea33972c/unsplash/search.py#L19-L31
def photos(self, query, page=1, per_page=10): """ Get a single page of photo results for a query. :param query [string]: Search terms. :param page [integer]: Page number to retrieve. (Optional; default: 1) :param per_page [integer]: Number of items per page. (Optional; default: ...
[ "def", "photos", "(", "self", ",", "query", ",", "page", "=", "1", ",", "per_page", "=", "10", ")", ":", "url", "=", "\"/search/photos\"", "data", "=", "self", ".", "_search", "(", "url", ",", "query", ",", "page", "=", "page", ",", "per_page", "="...
Get a single page of photo results for a query. :param query [string]: Search terms. :param page [integer]: Page number to retrieve. (Optional; default: 1) :param per_page [integer]: Number of items per page. (Optional; default: 10) :return: [dict]: {u'total': 0, u'total_pages': 0, u're...
[ "Get", "a", "single", "page", "of", "photo", "results", "for", "a", "query", "." ]
python
train
faucamp/python-gsmmodem
gsmmodem/serial_comms.py
https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/serial_comms.py#L54-L58
def close(self): """ Stops the read thread, waits for it to exit cleanly, then closes the underlying serial port """ self.alive = False self.rxThread.join() self.serial.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "alive", "=", "False", "self", ".", "rxThread", ".", "join", "(", ")", "self", ".", "serial", ".", "close", "(", ")" ]
Stops the read thread, waits for it to exit cleanly, then closes the underlying serial port
[ "Stops", "the", "read", "thread", "waits", "for", "it", "to", "exit", "cleanly", "then", "closes", "the", "underlying", "serial", "port" ]
python
train
flatangle/flatlib
flatlib/lists.py
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/lists.py#L63-L66
def getObjectsInHouse(self, house): """ Returns a list with all objects in a house. """ res = [obj for obj in self if house.hasObject(obj)] return ObjectList(res)
[ "def", "getObjectsInHouse", "(", "self", ",", "house", ")", ":", "res", "=", "[", "obj", "for", "obj", "in", "self", "if", "house", ".", "hasObject", "(", "obj", ")", "]", "return", "ObjectList", "(", "res", ")" ]
Returns a list with all objects in a house.
[ "Returns", "a", "list", "with", "all", "objects", "in", "a", "house", "." ]
python
train
noahbenson/neuropythy
neuropythy/commands/register_retinotopy.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/commands/register_retinotopy.py#L363-L431
def calc_retinotopy(note, error, subject, clean, run_lh, run_rh, invert_rh_angle, max_in_eccen, min_in_eccen, angle_lh_file, theta_lh_file, eccen_lh_file, rho_lh_file, weight_lh_file, radius_lh_file, angle_rh_file, theta...
[ "def", "calc_retinotopy", "(", "note", ",", "error", ",", "subject", ",", "clean", ",", "run_lh", ",", "run_rh", ",", "invert_rh_angle", ",", "max_in_eccen", ",", "min_in_eccen", ",", "angle_lh_file", ",", "theta_lh_file", ",", "eccen_lh_file", ",", "rho_lh_file...
calc_retinotopy extracts the retinotopy options from the command line, loads the relevant files, and stores them as properties on the subject's lh and rh cortices.
[ "calc_retinotopy", "extracts", "the", "retinotopy", "options", "from", "the", "command", "line", "loads", "the", "relevant", "files", "and", "stores", "them", "as", "properties", "on", "the", "subject", "s", "lh", "and", "rh", "cortices", "." ]
python
train
ewels/MultiQC
multiqc/modules/dedup/dedup.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/dedup/dedup.py#L100-L119
def dedup_alignment_plot (self): """ Make the HighCharts HTML to plot the duplication rates """ # Specify the order of the different possible categories keys = OrderedDict() keys['not_removed'] = { 'name': 'Not Removed' } keys['reverse_removed'] = { 'name': 'Reverse Removed' } ...
[ "def", "dedup_alignment_plot", "(", "self", ")", ":", "# Specify the order of the different possible categories", "keys", "=", "OrderedDict", "(", ")", "keys", "[", "'not_removed'", "]", "=", "{", "'name'", ":", "'Not Removed'", "}", "keys", "[", "'reverse_removed'", ...
Make the HighCharts HTML to plot the duplication rates
[ "Make", "the", "HighCharts", "HTML", "to", "plot", "the", "duplication", "rates" ]
python
train
spyder-ide/conda-manager
conda_manager/api/download_api.py
https://github.com/spyder-ide/conda-manager/blob/89a2126cbecefc92185cf979347ccac1c5ee5d9d/conda_manager/api/download_api.py#L72-L95
def proxy_servers(self): """ Return the proxy servers available. First env variables will be searched and updated with values from condarc config file. """ proxy_servers = {} if self._load_rc_func is None: return proxy_servers else: ...
[ "def", "proxy_servers", "(", "self", ")", ":", "proxy_servers", "=", "{", "}", "if", "self", ".", "_load_rc_func", "is", "None", ":", "return", "proxy_servers", "else", ":", "HTTP_PROXY", "=", "os", ".", "environ", ".", "get", "(", "'HTTP_PROXY'", ")", "...
Return the proxy servers available. First env variables will be searched and updated with values from condarc config file.
[ "Return", "the", "proxy", "servers", "available", "." ]
python
train
kislyuk/aegea
aegea/packages/github3/github.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/github.py#L935-L940
def membership_in(self, organization): """Retrieve the user's membership in the specified organization.""" url = self._build_url('user', 'memberships', 'orgs', str(organization)) json = self._json(self._get(url), 200) return Membership(json, self)
[ "def", "membership_in", "(", "self", ",", "organization", ")", ":", "url", "=", "self", ".", "_build_url", "(", "'user'", ",", "'memberships'", ",", "'orgs'", ",", "str", "(", "organization", ")", ")", "json", "=", "self", ".", "_json", "(", "self", "....
Retrieve the user's membership in the specified organization.
[ "Retrieve", "the", "user", "s", "membership", "in", "the", "specified", "organization", "." ]
python
train
slightlynybbled/booty
booty/framer.py
https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L83-L128
def _parse_raw_data(self): """ Parses the incoming data and determines if it is valid. Valid data gets placed into self._messages :return: None """ if self._START_OF_FRAME in self._raw and self._END_OF_FRAME in self._raw: while self._raw[0] != self._START_OF...
[ "def", "_parse_raw_data", "(", "self", ")", ":", "if", "self", ".", "_START_OF_FRAME", "in", "self", ".", "_raw", "and", "self", ".", "_END_OF_FRAME", "in", "self", ".", "_raw", ":", "while", "self", ".", "_raw", "[", "0", "]", "!=", "self", ".", "_S...
Parses the incoming data and determines if it is valid. Valid data gets placed into self._messages :return: None
[ "Parses", "the", "incoming", "data", "and", "determines", "if", "it", "is", "valid", ".", "Valid", "data", "gets", "placed", "into", "self", ".", "_messages", ":", "return", ":", "None" ]
python
valid
yatiml/yatiml
yatiml/helpers.py
https://github.com/yatiml/yatiml/blob/4f55c058b72388350f0af3076ac3ea9bc1c142b0/yatiml/helpers.py#L50-L67
def is_scalar(self, typ: Type = _Any) -> bool: """Returns True iff this represents a scalar node. If a type is given, checks that the ScalarNode represents this \ type. Type may be `str`, `int`, `float`, `bool`, or `None`. If no type is given, any ScalarNode will return True. "...
[ "def", "is_scalar", "(", "self", ",", "typ", ":", "Type", "=", "_Any", ")", "->", "bool", ":", "if", "isinstance", "(", "self", ".", "yaml_node", ",", "yaml", ".", "ScalarNode", ")", ":", "if", "typ", "!=", "_Any", "and", "typ", "in", "scalar_type_to...
Returns True iff this represents a scalar node. If a type is given, checks that the ScalarNode represents this \ type. Type may be `str`, `int`, `float`, `bool`, or `None`. If no type is given, any ScalarNode will return True.
[ "Returns", "True", "iff", "this", "represents", "a", "scalar", "node", "." ]
python
train
splitkeycoffee/pyhottop
pyhottop/pyhottop.py
https://github.com/splitkeycoffee/pyhottop/blob/2986bbb2d848f7e41fa3ece5ebb1b33c8882219c/pyhottop/pyhottop.py#L656-L666
def reset(self): """Reset the internal roast properties. :returns: None """ self._roasting = False self._roast_start = None self._roast_end = None self._roast = dict() self._window = deque(list(), 5) self._init_controls()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_roasting", "=", "False", "self", ".", "_roast_start", "=", "None", "self", ".", "_roast_end", "=", "None", "self", ".", "_roast", "=", "dict", "(", ")", "self", ".", "_window", "=", "deque", "(", ...
Reset the internal roast properties. :returns: None
[ "Reset", "the", "internal", "roast", "properties", "." ]
python
train