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
YeoLab/anchor
anchor/infotheory.py
https://github.com/YeoLab/anchor/blob/1f9c9d6d30235b1e77b945e6ef01db5a0e55d53a/anchor/infotheory.py#L218-L266
def cross_phenotype_jsd(data, groupby, bins, n_iter=100): """Jensen-Shannon divergence of features across phenotypes Parameters ---------- data : pandas.DataFrame A (n_samples, n_features) Dataframe groupby : mappable A samples to phenotypes mapping n_iter : int Number o...
[ "def", "cross_phenotype_jsd", "(", "data", ",", "groupby", ",", "bins", ",", "n_iter", "=", "100", ")", ":", "grouped", "=", "data", ".", "groupby", "(", "groupby", ")", "jsds", "=", "[", "]", "seen", "=", "set", "(", "[", "]", ")", "for", "phenoty...
Jensen-Shannon divergence of features across phenotypes Parameters ---------- data : pandas.DataFrame A (n_samples, n_features) Dataframe groupby : mappable A samples to phenotypes mapping n_iter : int Number of bootstrap resampling iterations to perform for the with...
[ "Jensen", "-", "Shannon", "divergence", "of", "features", "across", "phenotypes" ]
python
train
ronniedada/tabula
tabula/section.py
https://github.com/ronniedada/tabula/blob/ba18bb2f7db75972256b950711415031dc5421c7/tabula/section.py#L216-L235
def apply_meta(self, arr, funcs): """ Apply metadata to help formatting the output: - conv_funcs: convert data before column alignments - deco_funcs: decorate data after column alignments """ if arr is None: logging.error("unable to convert data: emtpy sectio...
[ "def", "apply_meta", "(", "self", ",", "arr", ",", "funcs", ")", ":", "if", "arr", "is", "None", ":", "logging", ".", "error", "(", "\"unable to convert data: emtpy section\"", ")", "return", "None", "tmp", "=", "np", ".", "copy", "(", "arr", ")", "for",...
Apply metadata to help formatting the output: - conv_funcs: convert data before column alignments - deco_funcs: decorate data after column alignments
[ "Apply", "metadata", "to", "help", "formatting", "the", "output", ":" ]
python
train
ekzhu/datasketch
datasketch/b_bit_minhash.py
https://github.com/ekzhu/datasketch/blob/b3e4129987890a2beb04f2c0b6dc618ae35f2e14/datasketch/b_bit_minhash.py#L129-L136
def _calc_a(self, r, b): ''' Compute the function A(r, b) ''' if r == 0.0: # Find the limit of A(r, b) as r -> 0. return 1.0 / (1 << b) return r * (1 - r) ** (2 ** b - 1) / (1 - (1 - r) ** (2 * b))
[ "def", "_calc_a", "(", "self", ",", "r", ",", "b", ")", ":", "if", "r", "==", "0.0", ":", "# Find the limit of A(r, b) as r -> 0.", "return", "1.0", "/", "(", "1", "<<", "b", ")", "return", "r", "*", "(", "1", "-", "r", ")", "**", "(", "2", "**",...
Compute the function A(r, b)
[ "Compute", "the", "function", "A", "(", "r", "b", ")" ]
python
test
sryza/spark-timeseries
python/sparkts/datetimeindex.py
https://github.com/sryza/spark-timeseries/blob/280aa887dc08ab114411245268f230fdabb76eec/python/sparkts/datetimeindex.py#L129-L153
def uniform(start, end=None, periods=None, freq=None, sc=None): """ Instantiates a uniform DateTimeIndex. Either end or periods must be specified. Parameters ---------- start : string, long (nanos from epoch), or Pandas Timestamp end : string, long (nanos from epoch), or Pandas...
[ "def", "uniform", "(", "start", ",", "end", "=", "None", ",", "periods", "=", "None", ",", "freq", "=", "None", ",", "sc", "=", "None", ")", ":", "dtmodule", "=", "sc", ".", "_jvm", ".", "com", ".", "cloudera", ".", "sparkts", ".", "__getattr__", ...
Instantiates a uniform DateTimeIndex. Either end or periods must be specified. Parameters ---------- start : string, long (nanos from epoch), or Pandas Timestamp end : string, long (nanos from epoch), or Pandas Timestamp periods : int freq : a frequency object s...
[ "Instantiates", "a", "uniform", "DateTimeIndex", "." ]
python
train
flatangle/flatlib
flatlib/aspects.py
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/aspects.py#L275-L285
def movement(self): """ Returns the movement of this aspect. The movement is the one of the active object, except if the active is separating but within less than 1 degree. """ mov = self.active.movement if self.orb < 1 and mov == const.SEPARATIVE: ...
[ "def", "movement", "(", "self", ")", ":", "mov", "=", "self", ".", "active", ".", "movement", "if", "self", ".", "orb", "<", "1", "and", "mov", "==", "const", ".", "SEPARATIVE", ":", "mov", "=", "const", ".", "EXACT", "return", "mov" ]
Returns the movement of this aspect. The movement is the one of the active object, except if the active is separating but within less than 1 degree.
[ "Returns", "the", "movement", "of", "this", "aspect", ".", "The", "movement", "is", "the", "one", "of", "the", "active", "object", "except", "if", "the", "active", "is", "separating", "but", "within", "less", "than", "1", "degree", "." ]
python
train
widdowquinn/pyani
pyani/anib.py
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/pyani/anib.py#L250-L267
def generate_blastdb_commands(filenames, outdir, blastdb_exe=None, mode="ANIb"): """Return a list of makeblastdb command-lines for ANIb/ANIblastall - filenames - a list of paths to input FASTA files - outdir - path to output directory - blastdb_exe - path to the makeblastdb executable """ if mo...
[ "def", "generate_blastdb_commands", "(", "filenames", ",", "outdir", ",", "blastdb_exe", "=", "None", ",", "mode", "=", "\"ANIb\"", ")", ":", "if", "mode", "==", "\"ANIb\"", ":", "construct_db_cmdline", "=", "construct_makeblastdb_cmd", "else", ":", "construct_db_...
Return a list of makeblastdb command-lines for ANIb/ANIblastall - filenames - a list of paths to input FASTA files - outdir - path to output directory - blastdb_exe - path to the makeblastdb executable
[ "Return", "a", "list", "of", "makeblastdb", "command", "-", "lines", "for", "ANIb", "/", "ANIblastall" ]
python
train
gitpython-developers/GitPython
git/remote.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/remote.py#L224-L245
def refresh(cls): """This gets called by the refresh function (see the top level __init__). """ # clear the old values in _flag_map try: del cls._flag_map["t"] except KeyError: pass try: del cls._flag_map["-"] except Ke...
[ "def", "refresh", "(", "cls", ")", ":", "# clear the old values in _flag_map", "try", ":", "del", "cls", ".", "_flag_map", "[", "\"t\"", "]", "except", "KeyError", ":", "pass", "try", ":", "del", "cls", ".", "_flag_map", "[", "\"-\"", "]", "except", "KeyEr...
This gets called by the refresh function (see the top level __init__).
[ "This", "gets", "called", "by", "the", "refresh", "function", "(", "see", "the", "top", "level", "__init__", ")", "." ]
python
train
djordon/queueing-tool
queueing_tool/network/queue_network.py
https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L987-L1012
def next_event_description(self): """Returns whether the next event is an arrival or a departure and the queue the event is accuring at. Returns ------- des : str Indicates whether the next event is an arrival, a departure, or nothing; returns ``'Arrival'...
[ "def", "next_event_description", "(", "self", ")", ":", "if", "self", ".", "_fancy_heap", ".", "size", "==", "0", ":", "event_type", "=", "'Nothing'", "edge_index", "=", "None", "else", ":", "s", "=", "[", "q", ".", "_key", "(", ")", "for", "q", "in"...
Returns whether the next event is an arrival or a departure and the queue the event is accuring at. Returns ------- des : str Indicates whether the next event is an arrival, a departure, or nothing; returns ``'Arrival'``, ``'Departure'``, or ``'Nothin...
[ "Returns", "whether", "the", "next", "event", "is", "an", "arrival", "or", "a", "departure", "and", "the", "queue", "the", "event", "is", "accuring", "at", "." ]
python
valid
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/XMLSchema.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/XMLSchema.py#L648-L664
def getXMLNS(self, prefix=None): """deference prefix or by default xmlns, returns namespace. """ if prefix == XMLSchemaComponent.xml: return XMLNS.XML parent = self ns = self.attributes[XMLSchemaComponent.xmlns].get(prefix or\ XMLSchemaComponent.xmlns...
[ "def", "getXMLNS", "(", "self", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "==", "XMLSchemaComponent", ".", "xml", ":", "return", "XMLNS", ".", "XML", "parent", "=", "self", "ns", "=", "self", ".", "attributes", "[", "XMLSchemaComponent", ".",...
deference prefix or by default xmlns, returns namespace.
[ "deference", "prefix", "or", "by", "default", "xmlns", "returns", "namespace", "." ]
python
train
saltstack/salt
salt/modules/libcloud_compute.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L255-L282
def list_volume_snapshots(volume_id, profile, **libcloud_kwargs): ''' Return a list of storage volumes snapshots for this cloud :param volume_id: The volume identifier :type volume_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments...
[ "def", "list_volume_snapshots", "(", "volume_id", ",", "profile", ",", "*", "*", "libcloud_kwargs", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "("...
Return a list of storage volumes snapshots for this cloud :param volume_id: The volume identifier :type volume_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_volume_snapshots method :type libcloud_kwargs: ``d...
[ "Return", "a", "list", "of", "storage", "volumes", "snapshots", "for", "this", "cloud" ]
python
train
kytos/kytos-utils
kytos/cli/commands/napps/parser.py
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/cli/commands/napps/parser.py#L57-L61
def call(subcommand, args): """Call a subcommand passing the args.""" args['<napp>'] = parse_napps(args['<napp>']) func = getattr(NAppsAPI, subcommand) func(args)
[ "def", "call", "(", "subcommand", ",", "args", ")", ":", "args", "[", "'<napp>'", "]", "=", "parse_napps", "(", "args", "[", "'<napp>'", "]", ")", "func", "=", "getattr", "(", "NAppsAPI", ",", "subcommand", ")", "func", "(", "args", ")" ]
Call a subcommand passing the args.
[ "Call", "a", "subcommand", "passing", "the", "args", "." ]
python
train
CivicSpleen/ambry
ambry/orm/database.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/database.py#L580-L589
def delete_partitions(self, ds): """Fast delete of all of a datasets codes, columns, partitions and tables""" from ambry.orm import Partition ssq = self.session.query ssq(Process).filter(Process.d_vid == ds.vid).delete() ssq(Code).filter(Code.d_vid == ds.vid).delete() s...
[ "def", "delete_partitions", "(", "self", ",", "ds", ")", ":", "from", "ambry", ".", "orm", "import", "Partition", "ssq", "=", "self", ".", "session", ".", "query", "ssq", "(", "Process", ")", ".", "filter", "(", "Process", ".", "d_vid", "==", "ds", "...
Fast delete of all of a datasets codes, columns, partitions and tables
[ "Fast", "delete", "of", "all", "of", "a", "datasets", "codes", "columns", "partitions", "and", "tables" ]
python
train
noahbenson/neuropythy
neuropythy/graphics/core.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/graphics/core.py#L259-L276
def color_overlap(color1, *args): ''' color_overlap(color1, color2...) yields the rgba value associated with overlaying color2 on top of color1 followed by any additional colors (overlaid left to right). This respects alpha values when calculating the results. Note that colors may be lists of co...
[ "def", "color_overlap", "(", "color1", ",", "*", "args", ")", ":", "args", "=", "list", "(", "args", ")", "args", ".", "insert", "(", "0", ",", "color1", ")", "rgba", "=", "np", ".", "asarray", "(", "[", "0.5", ",", "0.5", ",", "0.5", ",", "0",...
color_overlap(color1, color2...) yields the rgba value associated with overlaying color2 on top of color1 followed by any additional colors (overlaid left to right). This respects alpha values when calculating the results. Note that colors may be lists of colors, in which case a matrix of RGBA values is...
[ "color_overlap", "(", "color1", "color2", "...", ")", "yields", "the", "rgba", "value", "associated", "with", "overlaying", "color2", "on", "top", "of", "color1", "followed", "by", "any", "additional", "colors", "(", "overlaid", "left", "to", "right", ")", "...
python
train
FutunnOpen/futuquant
futuquant/common/open_context_base.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/common/open_context_base.py#L154-L190
def _get_sync_query_processor(self, pack_func, unpack_func, is_create_socket=True): """ synchronize the query processor :param pack_func: back :param unpack_func: unpack :return: sync_query_processor """ def sync_query_processor(**kargs): """sync quer...
[ "def", "_get_sync_query_processor", "(", "self", ",", "pack_func", ",", "unpack_func", ",", "is_create_socket", "=", "True", ")", ":", "def", "sync_query_processor", "(", "*", "*", "kargs", ")", ":", "\"\"\"sync query processor\"\"\"", "while", "True", ":", "with"...
synchronize the query processor :param pack_func: back :param unpack_func: unpack :return: sync_query_processor
[ "synchronize", "the", "query", "processor", ":", "param", "pack_func", ":", "back", ":", "param", "unpack_func", ":", "unpack", ":", "return", ":", "sync_query_processor" ]
python
train
kpn-digital/py-timeexecution
time_execution/backends/elasticsearch.py
https://github.com/kpn-digital/py-timeexecution/blob/79b991e83f783196c41b830d0acef21ac5462596/time_execution/backends/elasticsearch.py#L110-L125
def bulk_write(self, metrics): """ Write multiple metrics to elasticsearch in one request Args: metrics (list): data with mappings to send to elasticsearch """ actions = [] index = self.get_index() for metric in metrics: actions.append({'i...
[ "def", "bulk_write", "(", "self", ",", "metrics", ")", ":", "actions", "=", "[", "]", "index", "=", "self", ".", "get_index", "(", ")", "for", "metric", "in", "metrics", ":", "actions", ".", "append", "(", "{", "'index'", ":", "{", "'_index'", ":", ...
Write multiple metrics to elasticsearch in one request Args: metrics (list): data with mappings to send to elasticsearch
[ "Write", "multiple", "metrics", "to", "elasticsearch", "in", "one", "request" ]
python
train
pmuller/versions
versions/operators.py
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/operators.py#L51-L64
def parse(cls, string): """Parses `string` and returns an :class:`Operator` object. :raises: :exc:`InvalidOperatorExpression` If `string` is not \ a valid operator. Valid operators are ``==``, ``!=``, ``<``, ``>``, ``<=``, and ``>=``. """ if string in STR_TO_OP...
[ "def", "parse", "(", "cls", ",", "string", ")", ":", "if", "string", "in", "STR_TO_OP_FUNC", ":", "return", "cls", "(", "STR_TO_OP_FUNC", "[", "string", "]", ",", "string", ")", "else", ":", "raise", "InvalidOperatorExpression", "(", "string", ")" ]
Parses `string` and returns an :class:`Operator` object. :raises: :exc:`InvalidOperatorExpression` If `string` is not \ a valid operator. Valid operators are ``==``, ``!=``, ``<``, ``>``, ``<=``, and ``>=``.
[ "Parses", "string", "and", "returns", "an", ":", "class", ":", "Operator", "object", "." ]
python
train
lightning-viz/lightning-python
lightning/types/base.py
https://github.com/lightning-viz/lightning-python/blob/68563e1da82d162d204069d7586f7c695b8bd4a6/lightning/types/base.py#L181-L195
def update(self, *args, **kwargs): """ Base method for updating data. Applies a plot-type specific cleaning operation, then updates the data in the visualization. """ data = self._clean_data(*args, **kwargs) if 'images' in data: images = data['images...
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "_clean_data", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "'images'", "in", "data", ":", "images", "=", "data", "[", "'images'...
Base method for updating data. Applies a plot-type specific cleaning operation, then updates the data in the visualization.
[ "Base", "method", "for", "updating", "data", "." ]
python
train
benedictpaten/sonLib
bioio.py
https://github.com/benedictpaten/sonLib/blob/1decb75bb439b70721ec776f685ce98e25217d26/bioio.py#L151-L170
def setLoggingFromOptions(options): """Sets the logging from a dictionary of name/value options. """ #We can now set up the logging info. if options.logLevel is not None: setLogLevel(options.logLevel) #Use log level, unless flags are set.. if options.logOff: setLogLevel("OFF") e...
[ "def", "setLoggingFromOptions", "(", "options", ")", ":", "#We can now set up the logging info.", "if", "options", ".", "logLevel", "is", "not", "None", ":", "setLogLevel", "(", "options", ".", "logLevel", ")", "#Use log level, unless flags are set..", "if", "options", ...
Sets the logging from a dictionary of name/value options.
[ "Sets", "the", "logging", "from", "a", "dictionary", "of", "name", "/", "value", "options", "." ]
python
train
adafruit/Adafruit_Python_BluefruitLE
Adafruit_BluefruitLE/bluez_dbus/provider.py
https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/bluez_dbus/provider.py#L109-L130
def _user_thread_main(self, target): """Main entry point for the thread that will run user's code.""" try: # Wait for GLib main loop to start running before starting user code. while True: if self._gobject_mainloop is not None and self._gobject_mainloop.is_running...
[ "def", "_user_thread_main", "(", "self", ",", "target", ")", ":", "try", ":", "# Wait for GLib main loop to start running before starting user code.", "while", "True", ":", "if", "self", ".", "_gobject_mainloop", "is", "not", "None", "and", "self", ".", "_gobject_main...
Main entry point for the thread that will run user's code.
[ "Main", "entry", "point", "for", "the", "thread", "that", "will", "run", "user", "s", "code", "." ]
python
valid
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L422-L449
def Parse(text, message, allow_unknown_extension=False, allow_field_number=False, descriptor_pool=None): """Parses a text representation of a protocol message into a message. Args: text: Message text representation. message: A protocol buffer message to merge into. ...
[ "def", "Parse", "(", "text", ",", "message", ",", "allow_unknown_extension", "=", "False", ",", "allow_field_number", "=", "False", ",", "descriptor_pool", "=", "None", ")", ":", "if", "not", "isinstance", "(", "text", ",", "str", ")", ":", "text", "=", ...
Parses a text representation of a protocol message into a message. Args: text: Message text representation. message: A protocol buffer message to merge into. allow_unknown_extension: if True, skip over missing extensions and keep parsing allow_field_number: if True, both field number and field ...
[ "Parses", "a", "text", "representation", "of", "a", "protocol", "message", "into", "a", "message", "." ]
python
train
Nic30/hwt
hwt/hdl/ifContainter.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/ifContainter.py#L261-L303
def _try_reduce(self) -> Tuple[bool, List[HdlStatement]]: """ Doc on parent class :meth:`HdlStatement._try_reduce` """ # flag if IO of statement has changed io_change = False self.ifTrue, rank_decrease, _io_change = self._try_reduce_list( self.ifTrue) ...
[ "def", "_try_reduce", "(", "self", ")", "->", "Tuple", "[", "bool", ",", "List", "[", "HdlStatement", "]", "]", ":", "# flag if IO of statement has changed", "io_change", "=", "False", "self", ".", "ifTrue", ",", "rank_decrease", ",", "_io_change", "=", "self"...
Doc on parent class :meth:`HdlStatement._try_reduce`
[ "Doc", "on", "parent", "class", ":", "meth", ":", "HdlStatement", ".", "_try_reduce" ]
python
test
slickqa/python-client
slickqa/connection.py
https://github.com/slickqa/python-client/blob/1d36b4977cd4140d7d24917cab2b3f82b60739c2/slickqa/connection.py#L200-L225
def create(self): """Create the specified object (perform a POST to the api). You specify the object as a parameter, using the parent object as a function. Example: proj = Project() ... add project data here proj = slick.projects(proj).create() """ obj = self.da...
[ "def", "create", "(", "self", ")", ":", "obj", "=", "self", ".", "data", "self", ".", "data", "=", "None", "url", "=", "self", ".", "getUrl", "(", ")", "# hopefully when we discover what problems exist in slick to require this, we can take the loop out", "for", "ret...
Create the specified object (perform a POST to the api). You specify the object as a parameter, using the parent object as a function. Example: proj = Project() ... add project data here proj = slick.projects(proj).create()
[ "Create", "the", "specified", "object", "(", "perform", "a", "POST", "to", "the", "api", ")", ".", "You", "specify", "the", "object", "as", "a", "parameter", "using", "the", "parent", "object", "as", "a", "function", ".", "Example", ":", "proj", "=", "...
python
train
merll/docker-fabric
dockerfabric/tasks.py
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L148-L156
def list_networks(full_ids=False): """ Lists networks on the Docker remote host, similar to ``docker network ls``. :param full_ids: Shows the full network ids. When ``False`` (default) only shows the first 12 characters. :type full_ids: bool """ networks = docker_fabric().networks() _format...
[ "def", "list_networks", "(", "full_ids", "=", "False", ")", ":", "networks", "=", "docker_fabric", "(", ")", ".", "networks", "(", ")", "_format_output_table", "(", "networks", ",", "NETWORK_COLUMNS", ",", "full_ids", ")" ]
Lists networks on the Docker remote host, similar to ``docker network ls``. :param full_ids: Shows the full network ids. When ``False`` (default) only shows the first 12 characters. :type full_ids: bool
[ "Lists", "networks", "on", "the", "Docker", "remote", "host", "similar", "to", "docker", "network", "ls", "." ]
python
train
merll/docker-map
dockermap/client/docker_util.py
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/docker_util.py#L313-L322
def get_image_tags(self): """ Fetches image labels (repository / tags) from Docker. :return: A dictionary, with image name and tags as the key and the image id as value. :rtype: dict """ current_images = self.images() tags = {tag: i['Id'] for i in current_images ...
[ "def", "get_image_tags", "(", "self", ")", ":", "current_images", "=", "self", ".", "images", "(", ")", "tags", "=", "{", "tag", ":", "i", "[", "'Id'", "]", "for", "i", "in", "current_images", "for", "tag", "in", "i", "[", "'RepoTags'", "]", "}", "...
Fetches image labels (repository / tags) from Docker. :return: A dictionary, with image name and tags as the key and the image id as value. :rtype: dict
[ "Fetches", "image", "labels", "(", "repository", "/", "tags", ")", "from", "Docker", "." ]
python
train
chrisspen/burlap
burlap/system.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/system.py#L85-L103
def distrib_release(): """ Get the release number of the distribution. Example:: from burlap.system import distrib_id, distrib_release if distrib_id() == 'CentOS' and distrib_release() == '6.1': print(u"CentOS 6.2 has been released. Please upgrade.") """ with settings...
[ "def", "distrib_release", "(", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "kernel", "=", "(", "run", "(", "'uname -s'", ")", "or", "''", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", ...
Get the release number of the distribution. Example:: from burlap.system import distrib_id, distrib_release if distrib_id() == 'CentOS' and distrib_release() == '6.1': print(u"CentOS 6.2 has been released. Please upgrade.")
[ "Get", "the", "release", "number", "of", "the", "distribution", "." ]
python
valid
benley/butcher
butcher/targets/__init__.py
https://github.com/benley/butcher/blob/8b18828ea040af56b7835beab5fd03eab23cc9ee/butcher/targets/__init__.py#L28-L44
def new(ruletype, **kwargs): """Instantiate a new build rule based on kwargs. Appropriate args list varies with rule type. Minimum args required: [... fill this in ...] """ try: ruleclass = TYPE_MAP[ruletype] except KeyError: raise error.InvalidRule('Unrecognized rule type...
[ "def", "new", "(", "ruletype", ",", "*", "*", "kwargs", ")", ":", "try", ":", "ruleclass", "=", "TYPE_MAP", "[", "ruletype", "]", "except", "KeyError", ":", "raise", "error", ".", "InvalidRule", "(", "'Unrecognized rule type: %s'", "%", "ruletype", ")", "t...
Instantiate a new build rule based on kwargs. Appropriate args list varies with rule type. Minimum args required: [... fill this in ...]
[ "Instantiate", "a", "new", "build", "rule", "based", "on", "kwargs", "." ]
python
train
LabKey/labkey-api-python
labkey/unsupported/wiki.py
https://github.com/LabKey/labkey-api-python/blob/3c8d393384d7cbb2785f8a7f5fe34007b17a76b8/labkey/unsupported/wiki.py#L31-L111
def update_wiki(server_context, wiki_name, wiki_body, container_path=None): """ Used to update an existing wiki page :param server_context: A LabKey server context. See labkey.utils.create_server_context. :param wiki_name: The name of the wiki. :param wiki_body: The body of the wiki. :param cont...
[ "def", "update_wiki", "(", "server_context", ",", "wiki_name", ",", "wiki_body", ",", "container_path", "=", "None", ")", ":", "# Build the URL for reading the wiki page", "read_wiki_url", "=", "server_context", ".", "build_url", "(", "'wiki'", ",", "'editWiki.api'", ...
Used to update an existing wiki page :param server_context: A LabKey server context. See labkey.utils.create_server_context. :param wiki_name: The name of the wiki. :param wiki_body: The body of the wiki. :param container_path: Optional container path that can be used to override the server_context cont...
[ "Used", "to", "update", "an", "existing", "wiki", "page", ":", "param", "server_context", ":", "A", "LabKey", "server", "context", ".", "See", "labkey", ".", "utils", ".", "create_server_context", ".", ":", "param", "wiki_name", ":", "The", "name", "of", "...
python
train
readbeyond/aeneas
aeneas/validator.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/validator.py#L493-L504
def _check_utf8_encoding(self, bstring): """ Check whether the given sequence of bytes is properly encoded in UTF-8. :param bytes bstring: the byte string to be checked """ if not gf.is_bytes(bstring): self._failed(u"The given string is not a sequence of byte...
[ "def", "_check_utf8_encoding", "(", "self", ",", "bstring", ")", ":", "if", "not", "gf", ".", "is_bytes", "(", "bstring", ")", ":", "self", ".", "_failed", "(", "u\"The given string is not a sequence of bytes\"", ")", "return", "if", "not", "gf", ".", "is_utf8...
Check whether the given sequence of bytes is properly encoded in UTF-8. :param bytes bstring: the byte string to be checked
[ "Check", "whether", "the", "given", "sequence", "of", "bytes", "is", "properly", "encoded", "in", "UTF", "-", "8", "." ]
python
train
d0c-s4vage/pfp
pfp/interp.py
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L1903-L1917
def _handle_expr_list(self, node, scope, ctxt, stream): """Handle ExprList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling expression list") exprs = [ self._handle_node(expr, scope, ctx...
[ "def", "_handle_expr_list", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_dlog", "(", "\"handling expression list\"", ")", "exprs", "=", "[", "self", ".", "_handle_node", "(", "expr", ",", "scope", ",", "ctx...
Handle ExprList nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
[ "Handle", "ExprList", "nodes" ]
python
train
Genida/django-meerkat
src/meerkat/utils/ip_info.py
https://github.com/Genida/django-meerkat/blob/486502a75bb0800266db785fd32717d8c0eb8deb/src/meerkat/utils/ip_info.py#L100-L122
def _get(self, ip): """ Get information about an IP. Args: ip (str): an IP (xxx.xxx.xxx.xxx). Returns: dict: see http://ipinfo.io/developers/getting-started """ # Geoloc updated up to once a week: # http://ipinfo.io/developers/data#geoloc...
[ "def", "_get", "(", "self", ",", "ip", ")", ":", "# Geoloc updated up to once a week:", "# http://ipinfo.io/developers/data#geolocation-data", "retries", "=", "10", "for", "retry", "in", "range", "(", "retries", ")", ":", "try", ":", "response", "=", "requests", "...
Get information about an IP. Args: ip (str): an IP (xxx.xxx.xxx.xxx). Returns: dict: see http://ipinfo.io/developers/getting-started
[ "Get", "information", "about", "an", "IP", "." ]
python
train
daxlab/Flask-Cache-Buster
flask_cache_buster/__init__.py
https://github.com/daxlab/Flask-Cache-Buster/blob/4c10bed9ab46020904df565a9c0014a7f2e4f6b3/flask_cache_buster/__init__.py#L20-L27
def __is_file_to_be_busted(self, filepath): """ :param filepath: :return: True or False """ if not self.extensions: return True return Path(filepath).suffix in self.extensions if filepath else False
[ "def", "__is_file_to_be_busted", "(", "self", ",", "filepath", ")", ":", "if", "not", "self", ".", "extensions", ":", "return", "True", "return", "Path", "(", "filepath", ")", ".", "suffix", "in", "self", ".", "extensions", "if", "filepath", "else", "False...
:param filepath: :return: True or False
[ ":", "param", "filepath", ":", ":", "return", ":", "True", "or", "False" ]
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/ClientFactory.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ClientFactory.py#L344-L350
def create_environment_vip(self): """Get an instance of environment_vip services facade.""" return EnvironmentVIP( self.networkapi_url, self.user, self.password, self.user_ldap)
[ "def", "create_environment_vip", "(", "self", ")", ":", "return", "EnvironmentVIP", "(", "self", ".", "networkapi_url", ",", "self", ".", "user", ",", "self", ".", "password", ",", "self", ".", "user_ldap", ")" ]
Get an instance of environment_vip services facade.
[ "Get", "an", "instance", "of", "environment_vip", "services", "facade", "." ]
python
train
CivicSpleen/ambry
ambry/run.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L132-L157
def load_accounts(extra_path=None, load_user=True): """Load the yaml account files :param load_user: :return: An `AttrDict` """ from os.path import getmtime try: accts_file = find_config_file(ACCOUNTS_FILE, extra_path=extra_path, load_user=load_user) except ConfigurationError: ...
[ "def", "load_accounts", "(", "extra_path", "=", "None", ",", "load_user", "=", "True", ")", ":", "from", "os", ".", "path", "import", "getmtime", "try", ":", "accts_file", "=", "find_config_file", "(", "ACCOUNTS_FILE", ",", "extra_path", "=", "extra_path", "...
Load the yaml account files :param load_user: :return: An `AttrDict`
[ "Load", "the", "yaml", "account", "files" ]
python
train
hhatto/autopep8
autopep8.py
https://github.com/hhatto/autopep8/blob/fda3bb39181437b6b8a0aa0185f21ae5f14385dd/autopep8.py#L766-L776
def fix_e262(self, result): """Fix spacing after comment hash.""" target = self.source[result['line'] - 1] offset = result['column'] code = target[:offset].rstrip(' \t#') comment = target[offset:].lstrip(' \t#') fixed = code + (' # ' + comment if comment.strip() else '...
[ "def", "fix_e262", "(", "self", ",", "result", ")", ":", "target", "=", "self", ".", "source", "[", "result", "[", "'line'", "]", "-", "1", "]", "offset", "=", "result", "[", "'column'", "]", "code", "=", "target", "[", ":", "offset", "]", ".", "...
Fix spacing after comment hash.
[ "Fix", "spacing", "after", "comment", "hash", "." ]
python
train
joke2k/faker
faker/cli.py
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/cli.py#L267-L276
def execute_from_command_line(argv=None): """A simple method that runs a Command.""" if sys.stdout.encoding is None: print('please set python env PYTHONIOENCODING=UTF-8, example: ' 'export PYTHONIOENCODING=UTF-8, when writing to stdout', file=sys.stderr) exit(1) ...
[ "def", "execute_from_command_line", "(", "argv", "=", "None", ")", ":", "if", "sys", ".", "stdout", ".", "encoding", "is", "None", ":", "print", "(", "'please set python env PYTHONIOENCODING=UTF-8, example: '", "'export PYTHONIOENCODING=UTF-8, when writing to stdout'", ",",...
A simple method that runs a Command.
[ "A", "simple", "method", "that", "runs", "a", "Command", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/git/git_client_base.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/git/git_client_base.py#L1692-L1717
def delete_pull_request_labels(self, repository_id, pull_request_id, label_id_or_name, project=None, project_id=None): """DeletePullRequestLabels. [Preview API] Removes a label from the set of those assigned to the pull request. :param str repository_id: The repository ID of the pull request’s t...
[ "def", "delete_pull_request_labels", "(", "self", ",", "repository_id", ",", "pull_request_id", ",", "label_id_or_name", ",", "project", "=", "None", ",", "project_id", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None",...
DeletePullRequestLabels. [Preview API] Removes a label from the set of those assigned to the pull request. :param str repository_id: The repository ID of the pull request’s target branch. :param int pull_request_id: ID of the pull request. :param str label_id_or_name: The name or ID of t...
[ "DeletePullRequestLabels", ".", "[", "Preview", "API", "]", "Removes", "a", "label", "from", "the", "set", "of", "those", "assigned", "to", "the", "pull", "request", ".", ":", "param", "str", "repository_id", ":", "The", "repository", "ID", "of", "the", "p...
python
train
Microsoft/ApplicationInsights-Python
applicationinsights/channel/contracts/DataPoint.py
https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/channel/contracts/DataPoint.py#L124-L133
def count(self, value): """The count property. Args: value (int). the property value. """ if value == self._defaults['count'] and 'count' in self._values: del self._values['count'] else: self._values['count'] = value
[ "def", "count", "(", "self", ",", "value", ")", ":", "if", "value", "==", "self", ".", "_defaults", "[", "'count'", "]", "and", "'count'", "in", "self", ".", "_values", ":", "del", "self", ".", "_values", "[", "'count'", "]", "else", ":", "self", "...
The count property. Args: value (int). the property value.
[ "The", "count", "property", ".", "Args", ":", "value", "(", "int", ")", ".", "the", "property", "value", "." ]
python
train
closeio/redis-hashring
redis_hashring/__init__.py
https://github.com/closeio/redis-hashring/blob/d767018571fbfb5705b6115d81619b2e84b6e50e/redis_hashring/__init__.py#L235-L242
def cleanup(self): """ Removes expired nodes/replicas from the ring. """ now = time.time() expired = now - NODE_TIMEOUT if self.conn.zremrangebyscore(self.key, 0, expired): self._notify()
[ "def", "cleanup", "(", "self", ")", ":", "now", "=", "time", ".", "time", "(", ")", "expired", "=", "now", "-", "NODE_TIMEOUT", "if", "self", ".", "conn", ".", "zremrangebyscore", "(", "self", ".", "key", ",", "0", ",", "expired", ")", ":", "self",...
Removes expired nodes/replicas from the ring.
[ "Removes", "expired", "nodes", "/", "replicas", "from", "the", "ring", "." ]
python
train
binux/pyspider
pyspider/scheduler/scheduler.py
https://github.com/binux/pyspider/blob/3fccfabe2b057b7a56d4a4c79dc0dd6cd2239fe9/pyspider/scheduler/scheduler.py#L937-L988
def on_task_failed(self, task): '''Called when a task is failed, called by `on_task_status`''' if 'schedule' not in task: old_task = self.taskdb.get_task(task['project'], task['taskid'], fields=['schedule']) if old_task is None: logging.error('unknown status pack...
[ "def", "on_task_failed", "(", "self", ",", "task", ")", ":", "if", "'schedule'", "not", "in", "task", ":", "old_task", "=", "self", ".", "taskdb", ".", "get_task", "(", "task", "[", "'project'", "]", ",", "task", "[", "'taskid'", "]", ",", "fields", ...
Called when a task is failed, called by `on_task_status`
[ "Called", "when", "a", "task", "is", "failed", "called", "by", "on_task_status" ]
python
train
quantopian/zipline
zipline/__main__.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/__main__.py#L287-L317
def zipline_magic(line, cell=None): """The zipline IPython cell magic. """ load_extensions( default=True, extensions=[], strict=True, environ=os.environ, ) try: return run.main( # put our overrides at the start of the parameter list so that ...
[ "def", "zipline_magic", "(", "line", ",", "cell", "=", "None", ")", ":", "load_extensions", "(", "default", "=", "True", ",", "extensions", "=", "[", "]", ",", "strict", "=", "True", ",", "environ", "=", "os", ".", "environ", ",", ")", "try", ":", ...
The zipline IPython cell magic.
[ "The", "zipline", "IPython", "cell", "magic", "." ]
python
train
quantopian/zipline
zipline/utils/preprocess.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/preprocess.py#L115-L139
def call(f): """ Wrap a function in a processor that calls `f` on the argument before passing it along. Useful for creating simple arguments to the `@preprocess` decorator. Parameters ---------- f : function Function accepting a single argument and returning a replacement. Exa...
[ "def", "call", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "processor", "(", "func", ",", "argname", ",", "arg", ")", ":", "return", "f", "(", "arg", ")", "return", "processor" ]
Wrap a function in a processor that calls `f` on the argument before passing it along. Useful for creating simple arguments to the `@preprocess` decorator. Parameters ---------- f : function Function accepting a single argument and returning a replacement. Examples -------- >>...
[ "Wrap", "a", "function", "in", "a", "processor", "that", "calls", "f", "on", "the", "argument", "before", "passing", "it", "along", "." ]
python
train
NASA-AMMOS/AIT-Core
ait/core/tlm.py
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/tlm.py#L465-L470
def _assertField(self, fieldname): """Raise AttributeError when Packet has no field with the given name.""" if not self._hasattr(fieldname): values = self._defn.name, fieldname raise AttributeError("Packet '%s' has no field '%s'" % values)
[ "def", "_assertField", "(", "self", ",", "fieldname", ")", ":", "if", "not", "self", ".", "_hasattr", "(", "fieldname", ")", ":", "values", "=", "self", ".", "_defn", ".", "name", ",", "fieldname", "raise", "AttributeError", "(", "\"Packet '%s' has no field ...
Raise AttributeError when Packet has no field with the given name.
[ "Raise", "AttributeError", "when", "Packet", "has", "no", "field", "with", "the", "given", "name", "." ]
python
train
gwastro/pycbc
pycbc/io/hdf.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/io/hdf.py#L897-L914
def recursively_save_dict_contents_to_group(h5file, path, dic): """ Parameters ---------- h5file: h5py file to be written to path: path within h5py file to saved dictionary dic: python dictionary to be converted to hdf5 format """ for key, item in dic.items(): ...
[ "def", "recursively_save_dict_contents_to_group", "(", "h5file", ",", "path", ",", "dic", ")", ":", "for", "key", ",", "item", "in", "dic", ".", "items", "(", ")", ":", "if", "isinstance", "(", "item", ",", "(", "np", ".", "ndarray", ",", "np", ".", ...
Parameters ---------- h5file: h5py file to be written to path: path within h5py file to saved dictionary dic: python dictionary to be converted to hdf5 format
[ "Parameters", "----------", "h5file", ":", "h5py", "file", "to", "be", "written", "to", "path", ":", "path", "within", "h5py", "file", "to", "saved", "dictionary", "dic", ":", "python", "dictionary", "to", "be", "converted", "to", "hdf5", "format" ]
python
train
iamteem/redisco
redisco/models/base.py
https://github.com/iamteem/redisco/blob/a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91/redisco/models/base.py#L324-L327
def exists(cls, id): """Checks if the model with id exists.""" return bool(redisco.get_client().exists(cls._key[str(id)]) or redisco.get_client().sismember(cls._key['all'], str(id)))
[ "def", "exists", "(", "cls", ",", "id", ")", ":", "return", "bool", "(", "redisco", ".", "get_client", "(", ")", ".", "exists", "(", "cls", ".", "_key", "[", "str", "(", "id", ")", "]", ")", "or", "redisco", ".", "get_client", "(", ")", ".", "s...
Checks if the model with id exists.
[ "Checks", "if", "the", "model", "with", "id", "exists", "." ]
python
train
acutesoftware/AIKIF
aikif/cls_file_mapping.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/cls_file_mapping.py#L117-L121
def get_full_filename(self, dataType, subjectArea): """ returns the file based on dataType and subjectArea """ return dataPath + os.sep + 'core' + os.sep + dataType + '_' + subjectArea + '.CSV'
[ "def", "get_full_filename", "(", "self", ",", "dataType", ",", "subjectArea", ")", ":", "return", "dataPath", "+", "os", ".", "sep", "+", "'core'", "+", "os", ".", "sep", "+", "dataType", "+", "'_'", "+", "subjectArea", "+", "'.CSV'" ]
returns the file based on dataType and subjectArea
[ "returns", "the", "file", "based", "on", "dataType", "and", "subjectArea" ]
python
train
bcbio/bcbio-nextgen
bcbio/bed/__init__.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L20-L44
def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if x] if len(bed_files) == 0: if catted: # move to a .bed extension for downstream tools if not already ...
[ "def", "concat", "(", "bed_files", ",", "catted", "=", "None", ")", ":", "bed_files", "=", "[", "x", "for", "x", "in", "bed_files", "if", "x", "]", "if", "len", "(", "bed_files", ")", "==", "0", ":", "if", "catted", ":", "# move to a .bed extension for...
recursively concat a set of BED files, returning a sorted bedtools object of the result
[ "recursively", "concat", "a", "set", "of", "BED", "files", "returning", "a", "sorted", "bedtools", "object", "of", "the", "result" ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/mygaphas/constraint.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L315-L328
def get_adjusted_border_positions(self): """ Calculates the positions to limit the port movement to :return: Adjusted positions nw_x, nw_y, se_x, se_y """ nw_x, nw_y = self._rect[0] se_x, se_y = self._rect[1] nw_x += self._distance_to_border nw_y += self....
[ "def", "get_adjusted_border_positions", "(", "self", ")", ":", "nw_x", ",", "nw_y", "=", "self", ".", "_rect", "[", "0", "]", "se_x", ",", "se_y", "=", "self", ".", "_rect", "[", "1", "]", "nw_x", "+=", "self", ".", "_distance_to_border", "nw_y", "+=",...
Calculates the positions to limit the port movement to :return: Adjusted positions nw_x, nw_y, se_x, se_y
[ "Calculates", "the", "positions", "to", "limit", "the", "port", "movement", "to", ":", "return", ":", "Adjusted", "positions", "nw_x", "nw_y", "se_x", "se_y" ]
python
train
jsfenfen/990-xml-reader
irs_reader/xmlrunner.py
https://github.com/jsfenfen/990-xml-reader/blob/00020529b789081329a31a2e30b5ee729ce7596a/irs_reader/xmlrunner.py#L161-L182
def run_sked(self, object_id, sked, verbose=False): """ sked is the proper name of the schedule: IRS990, IRS990EZ, IRS990PF, IRS990ScheduleA, etc. """ self.whole_filing_data = [] self.filing_keyerr_data = [] this_filing = Filing(object_id) this_filing.proc...
[ "def", "run_sked", "(", "self", ",", "object_id", ",", "sked", ",", "verbose", "=", "False", ")", ":", "self", ".", "whole_filing_data", "=", "[", "]", "self", ".", "filing_keyerr_data", "=", "[", "]", "this_filing", "=", "Filing", "(", "object_id", ")",...
sked is the proper name of the schedule: IRS990, IRS990EZ, IRS990PF, IRS990ScheduleA, etc.
[ "sked", "is", "the", "proper", "name", "of", "the", "schedule", ":", "IRS990", "IRS990EZ", "IRS990PF", "IRS990ScheduleA", "etc", "." ]
python
train
binux/pyspider
pyspider/fetcher/tornado_fetcher.py
https://github.com/binux/pyspider/blob/3fccfabe2b057b7a56d4a4c79dc0dd6cd2239fe9/pyspider/fetcher/tornado_fetcher.py#L792-L825
def xmlrpc_run(self, port=24444, bind='127.0.0.1', logRequests=False): '''Run xmlrpc server''' import umsgpack from pyspider.libs.wsgi_xmlrpc import WSGIXMLRPCApplication try: from xmlrpc.client import Binary except ImportError: from xmlrpclib import Binar...
[ "def", "xmlrpc_run", "(", "self", ",", "port", "=", "24444", ",", "bind", "=", "'127.0.0.1'", ",", "logRequests", "=", "False", ")", ":", "import", "umsgpack", "from", "pyspider", ".", "libs", ".", "wsgi_xmlrpc", "import", "WSGIXMLRPCApplication", "try", ":"...
Run xmlrpc server
[ "Run", "xmlrpc", "server" ]
python
train
abilian/abilian-core
abilian/web/admin/panels/dashboard.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/web/admin/panels/dashboard.py#L148-L207
def uniquelogins(sessions): """Unique logins per days/weeks/months. :return: daily, weekly, monthly 3 lists of dictionaries of the following format [{'x':epoch, 'y': value},] """ # sessions = LoginSession.query.order_by(LoginSession.started_at.asc()).all() if not sessions: return [], []...
[ "def", "uniquelogins", "(", "sessions", ")", ":", "# sessions = LoginSession.query.order_by(LoginSession.started_at.asc()).all()", "if", "not", "sessions", ":", "return", "[", "]", ",", "[", "]", ",", "[", "]", "dates", "=", "{", "}", "for", "session", "in", "se...
Unique logins per days/weeks/months. :return: daily, weekly, monthly 3 lists of dictionaries of the following format [{'x':epoch, 'y': value},]
[ "Unique", "logins", "per", "days", "/", "weeks", "/", "months", "." ]
python
train
saltstack/salt
salt/modules/puppet.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/puppet.py#L259-L296
def status(): ''' .. versionadded:: 2014.7.0 Display puppet agent status CLI Example: .. code-block:: bash salt '*' puppet.status ''' puppet = _Puppet() if os.path.isfile(puppet.disabled_lockfile): return 'Administratively disabled' if os.path.isfile(puppet.run_...
[ "def", "status", "(", ")", ":", "puppet", "=", "_Puppet", "(", ")", "if", "os", ".", "path", ".", "isfile", "(", "puppet", ".", "disabled_lockfile", ")", ":", "return", "'Administratively disabled'", "if", "os", ".", "path", ".", "isfile", "(", "puppet",...
.. versionadded:: 2014.7.0 Display puppet agent status CLI Example: .. code-block:: bash salt '*' puppet.status
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
python
train
MaxStrange/AudioSegment
audiosegment.py
https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/audiosegment.py#L691-L759
def fft(self, start_s=None, duration_s=None, start_sample=None, num_samples=None, zero_pad=False): """ Transforms the indicated slice of the AudioSegment into the frequency domain and returns the bins and the values. If neither `start_s` or `start_sample` is specified, the first sample ...
[ "def", "fft", "(", "self", ",", "start_s", "=", "None", ",", "duration_s", "=", "None", ",", "start_sample", "=", "None", ",", "num_samples", "=", "None", ",", "zero_pad", "=", "False", ")", ":", "if", "start_s", "is", "not", "None", "and", "start_samp...
Transforms the indicated slice of the AudioSegment into the frequency domain and returns the bins and the values. If neither `start_s` or `start_sample` is specified, the first sample of the slice will be the first sample of the AudioSegment. If neither `duration_s` or `num_samples` is...
[ "Transforms", "the", "indicated", "slice", "of", "the", "AudioSegment", "into", "the", "frequency", "domain", "and", "returns", "the", "bins", "and", "the", "values", "." ]
python
test
rcarmo/pngcanvas
pngcanvas.py
https://github.com/rcarmo/pngcanvas/blob/e2eaa0d5ba353005b3b658f6ee453c1956340670/pngcanvas.py#L310-L351
def defilter(cur, prev, filter_type, bpp=4): """Decode a chunk""" if filter_type == 0: # No filter return cur elif filter_type == 1: # Sub xp = 0 for xc in range(bpp, len(cur)): cur[xc] = (cur[xc] + cur[xp]) % 256 xp += 1 ...
[ "def", "defilter", "(", "cur", ",", "prev", ",", "filter_type", ",", "bpp", "=", "4", ")", ":", "if", "filter_type", "==", "0", ":", "# No filter", "return", "cur", "elif", "filter_type", "==", "1", ":", "# Sub", "xp", "=", "0", "for", "xc", "in", ...
Decode a chunk
[ "Decode", "a", "chunk" ]
python
train
wbond/vat_moss-python
vat_moss/phone_number.py
https://github.com/wbond/vat_moss-python/blob/5089dcf036eb2e9abc58e78186fd46b522a50620/vat_moss/phone_number.py#L91-L113
def _lookup_country_code(phone_number): """ Accepts an international form of a phone number (+ followed by digits), and returns a two-character country code. :param phone_number: The string phone number, in international format with leading + :return: A two-character string or None...
[ "def", "_lookup_country_code", "(", "phone_number", ")", ":", "leading_digit", "=", "phone_number", "[", "0", "]", "if", "leading_digit", "not", "in", "CALLING_CODE_MAPPING", ":", "return", "None", "for", "mapping", "in", "CALLING_CODE_MAPPING", "[", "leading_digit"...
Accepts an international form of a phone number (+ followed by digits), and returns a two-character country code. :param phone_number: The string phone number, in international format with leading + :return: A two-character string or None if no match
[ "Accepts", "an", "international", "form", "of", "a", "phone", "number", "(", "+", "followed", "by", "digits", ")", "and", "returns", "a", "two", "-", "character", "country", "code", "." ]
python
train
gmr/rejected
rejected/log.py
https://github.com/gmr/rejected/blob/610a3e1401122ecb98d891b6795cca0255e5b044/rejected/log.py#L104-L117
def process(self, msg, kwargs): """Process the logging message and keyword arguments passed in to a logging call to insert contextual information. :param str msg: The message to process :param dict kwargs: The kwargs to append :rtype: (str, dict) """ kwargs['ext...
[ "def", "process", "(", "self", ",", "msg", ",", "kwargs", ")", ":", "kwargs", "[", "'extra'", "]", "=", "{", "'correlation_id'", ":", "self", ".", "parent", ".", "correlation_id", ",", "'parent'", ":", "self", ".", "parent", ".", "name", "}", "return",...
Process the logging message and keyword arguments passed in to a logging call to insert contextual information. :param str msg: The message to process :param dict kwargs: The kwargs to append :rtype: (str, dict)
[ "Process", "the", "logging", "message", "and", "keyword", "arguments", "passed", "in", "to", "a", "logging", "call", "to", "insert", "contextual", "information", "." ]
python
train
hubo1016/vlcp
vlcp/utils/flowupdater.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/flowupdater.py#L167-L248
async def main(self): """ Main coroutine """ try: lastkeys = set() dataupdate = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.DATAUPDATED) startwalk = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.STARTWALK) ...
[ "async", "def", "main", "(", "self", ")", ":", "try", ":", "lastkeys", "=", "set", "(", ")", "dataupdate", "=", "FlowUpdaterNotification", ".", "createMatcher", "(", "self", ",", "FlowUpdaterNotification", ".", "DATAUPDATED", ")", "startwalk", "=", "FlowUpdate...
Main coroutine
[ "Main", "coroutine" ]
python
train
Atomistica/atomistica
src/python/atomistica/atomic_strain.py
https://github.com/Atomistica/atomistica/blob/5ed79d776c92b91a566be22615bfb304ecc75db7/src/python/atomistica/atomic_strain.py#L34-L47
def get_XIJ(nat, i_now, dr_now, dr_old): """ Calculates the X_{ij} matrix """ # Do an element-wise outer product dr_dr = dr_now.reshape(-1,3,1)*dr_old.reshape(-1,1,3) xij = np.zeros([nat,3,3]) for i in range(3): for j in range(3): # For each atom, sum over all neighbors ...
[ "def", "get_XIJ", "(", "nat", ",", "i_now", ",", "dr_now", ",", "dr_old", ")", ":", "# Do an element-wise outer product", "dr_dr", "=", "dr_now", ".", "reshape", "(", "-", "1", ",", "3", ",", "1", ")", "*", "dr_old", ".", "reshape", "(", "-", "1", ",...
Calculates the X_{ij} matrix
[ "Calculates", "the", "X_", "{", "ij", "}", "matrix" ]
python
train
GaryLee/cmdlet
cmdlet/cmds.py
https://github.com/GaryLee/cmdlet/blob/5852a63fc2c7dd723a3d7abe18455f8dacb49433/cmdlet/cmds.py#L698-L702
def safe_substitute(prev, *args, **kw): '''alias of string.Template.safe_substitute''' template_obj = string.Template(*args, **kw) for data in prev: yield template_obj.safe_substitute(data)
[ "def", "safe_substitute", "(", "prev", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "template_obj", "=", "string", ".", "Template", "(", "*", "args", ",", "*", "*", "kw", ")", "for", "data", "in", "prev", ":", "yield", "template_obj", ".", "saf...
alias of string.Template.safe_substitute
[ "alias", "of", "string", ".", "Template", ".", "safe_substitute" ]
python
valid
etcher-be/emiz
emiz/avwx/core.py
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/core.py#L584-L596
def split_taf(txt: str) -> [str]: # type: ignore """ Splits a TAF report into each distinct time period """ lines = [] split = txt.split() last_index = 0 for i, item in enumerate(split): if starts_new_line(item) and i != 0 and not split[i - 1].startswith('PROB'): lines.a...
[ "def", "split_taf", "(", "txt", ":", "str", ")", "->", "[", "str", "]", ":", "# type: ignore", "lines", "=", "[", "]", "split", "=", "txt", ".", "split", "(", ")", "last_index", "=", "0", "for", "i", ",", "item", "in", "enumerate", "(", "split", ...
Splits a TAF report into each distinct time period
[ "Splits", "a", "TAF", "report", "into", "each", "distinct", "time", "period" ]
python
train
mbedmicro/pyOCD
pyocd/__main__.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/__main__.py#L463-L485
def do_erase(self): """! @brief Handle 'erase' subcommand.""" self._increase_logging(["pyocd.tools.loader", "pyocd"]) session = ConnectHelper.session_with_chosen_probe( project_dir=self._args.project_dir, config_file=self._args.con...
[ "def", "do_erase", "(", "self", ")", ":", "self", ".", "_increase_logging", "(", "[", "\"pyocd.tools.loader\"", ",", "\"pyocd\"", "]", ")", "session", "=", "ConnectHelper", ".", "session_with_chosen_probe", "(", "project_dir", "=", "self", ".", "_args", ".", "...
! @brief Handle 'erase' subcommand.
[ "!" ]
python
train
simoninireland/epyc
epyc/experiment.py
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/experiment.py#L120-L135
def report( self, params, meta, res ): """Return a properly-structured dict of results. The default returns a dict with results keyed by :attr:`Experiment.RESULTS`, the data point in the parameter space keyed by :attr:`Experiment.PARAMETERS`, and timing and other metadata keyed by :attr:...
[ "def", "report", "(", "self", ",", "params", ",", "meta", ",", "res", ")", ":", "rc", "=", "dict", "(", ")", "rc", "[", "self", ".", "PARAMETERS", "]", "=", "params", ".", "copy", "(", ")", "rc", "[", "self", ".", "METADATA", "]", "=", "meta", ...
Return a properly-structured dict of results. The default returns a dict with results keyed by :attr:`Experiment.RESULTS`, the data point in the parameter space keyed by :attr:`Experiment.PARAMETERS`, and timing and other metadata keyed by :attr:`Experiment.METADATA`. Overriding this method can ...
[ "Return", "a", "properly", "-", "structured", "dict", "of", "results", ".", "The", "default", "returns", "a", "dict", "with", "results", "keyed", "by", ":", "attr", ":", "Experiment", ".", "RESULTS", "the", "data", "point", "in", "the", "parameter", "space...
python
train
Kronuz/pyScss
yapps2.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/yapps2.py#L111-L117
def equal_set(self, a, b): "See if a and b have the same elements" if len(a) != len(b): return 0 if a == b: return 1 return self.subset(a, b) and self.subset(b, a)
[ "def", "equal_set", "(", "self", ",", "a", ",", "b", ")", ":", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", ":", "return", "0", "if", "a", "==", "b", ":", "return", "1", "return", "self", ".", "subset", "(", "a", ",", "b", ")", ...
See if a and b have the same elements
[ "See", "if", "a", "and", "b", "have", "the", "same", "elements" ]
python
train
tensorflow/probability
experimental/mcmc/elliptical_slice_sampler.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/experimental/mcmc/elliptical_slice_sampler.py#L228-L372
def one_step(self, current_state, previous_kernel_results): """Runs one iteration of the Elliptical Slice Sampler. Args: current_state: `Tensor` or Python `list` of `Tensor`s representing the current state(s) of the Markov chain(s). The first `r` dimensions index independent chains, ...
[ "def", "one_step", "(", "self", ",", "current_state", ",", "previous_kernel_results", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "name", "=", "mcmc_util", ".", "make_name", "(", "self", ".", "name", ",", "'elliptical_slice'", ...
Runs one iteration of the Elliptical Slice Sampler. Args: current_state: `Tensor` or Python `list` of `Tensor`s representing the current state(s) of the Markov chain(s). The first `r` dimensions index independent chains, `r = tf.rank(log_likelihood_fn(*normal_sampler_fn()))`. pr...
[ "Runs", "one", "iteration", "of", "the", "Elliptical", "Slice", "Sampler", "." ]
python
test
volafiled/python-volapi
volapi/auxo.py
https://github.com/volafiled/python-volapi/blob/5f0bc03dbde703264ac6ed494e2050761f688a3e/volapi/auxo.py#L33-L51
def call_async(func): """Decorates a function to be called async on the loop thread""" @wraps(func) def wrapper(self, *args, **kw): """Wraps instance method to be called on loop thread""" def call(): """Calls function on loop thread""" try: func(self...
[ "def", "call_async", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "\"\"\"Wraps instance method to be called on loop thread\"\"\"", "def", "call", "(", ")", ":", "\"\"...
Decorates a function to be called async on the loop thread
[ "Decorates", "a", "function", "to", "be", "called", "async", "on", "the", "loop", "thread" ]
python
train
sony/nnabla
python/src/nnabla/functions.py
https://github.com/sony/nnabla/blob/aaf3d33b7cbb38f2a03aa754178ba8f7c8481320/python/src/nnabla/functions.py#L230-L275
def slice(ctx, x, start=None, stop=None, step=None, n_outputs=-1, outputs=None): r""" Slice arrays along specified axis. This function complies with python slice wherre `slice(None, None, -1)` and `slice(-1, None, -1)` are the special case, which flips the input array and results in the output ar...
[ "def", "slice", "(", "ctx", ",", "x", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "step", "=", "None", ",", "n_outputs", "=", "-", "1", ",", "outputs", "=", "None", ")", ":", "import", "copy", "start", "=", "copy", ".", "copy", "(...
r""" Slice arrays along specified axis. This function complies with python slice wherre `slice(None, None, -1)` and `slice(-1, None, -1)` are the special case, which flips the input array and results in the output array from the end to the beginning of the input array along the corresponding dime...
[ "r", "Slice", "arrays", "along", "specified", "axis", ".", "This", "function", "complies", "with", "python", "slice", "wherre", "slice", "(", "None", "None", "-", "1", ")", "and", "slice", "(", "-", "1", "None", "-", "1", ")", "are", "the", "special", ...
python
train
earwig/mwparserfromhell
mwparserfromhell/parser/tokenizer.py
https://github.com/earwig/mwparserfromhell/blob/98dc30902d35c714a70aca8e6616f49d71cb24cc/mwparserfromhell/parser/tokenizer.py#L450-L503
def _really_parse_external_link(self, brackets): """Really parse an external link.""" if brackets: self._parse_bracketed_uri_scheme() invalid = ("\n", " ", "]") else: self._parse_free_uri_scheme() invalid = ("\n", " ", "[", "]") punct =...
[ "def", "_really_parse_external_link", "(", "self", ",", "brackets", ")", ":", "if", "brackets", ":", "self", ".", "_parse_bracketed_uri_scheme", "(", ")", "invalid", "=", "(", "\"\\n\"", ",", "\" \"", ",", "\"]\"", ")", "else", ":", "self", ".", "_parse_free...
Really parse an external link.
[ "Really", "parse", "an", "external", "link", "." ]
python
train
tensorflow/datasets
tensorflow_datasets/core/registered.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/registered.py#L343-L354
def _cast_to_pod(val): """Try cast to int, float, bool, str, in that order.""" bools = {"True": True, "False": False} if val in bools: return bools[val] try: return int(val) except ValueError: try: return float(val) except ValueError: return tf.compat.as_text(val)
[ "def", "_cast_to_pod", "(", "val", ")", ":", "bools", "=", "{", "\"True\"", ":", "True", ",", "\"False\"", ":", "False", "}", "if", "val", "in", "bools", ":", "return", "bools", "[", "val", "]", "try", ":", "return", "int", "(", "val", ")", "except...
Try cast to int, float, bool, str, in that order.
[ "Try", "cast", "to", "int", "float", "bool", "str", "in", "that", "order", "." ]
python
train
agile-geoscience/striplog
striplog/striplog.py
https://github.com/agile-geoscience/striplog/blob/8033b673a151f96c29802b43763e863519a3124c/striplog/striplog.py#L410-L444
def from_petrel(cls, filename, stop=None, points=False, null=None, function=None, include=None, exclude=None, remap=None, ignore=None): """ Mak...
[ "def", "from_petrel", "(", "cls", ",", "filename", ",", "stop", "=", "None", ",", "points", "=", "False", ",", "null", "=", "None", ",", "function", "=", "None", ",", "include", "=", "None", ",", "exclude", "=", "None", ",", "remap", "=", "None", "...
Makes a striplog from a Petrel text file. Returns: striplog.
[ "Makes", "a", "striplog", "from", "a", "Petrel", "text", "file", "." ]
python
test
angr/angr
angr/project.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L710-L717
def is_java_jni_project(self): """ Indicates if the project's main binary is a Java Archive, which interacts during its execution with native libraries (via JNI). """ if self._is_java_jni_project is None: self._is_java_jni_project = isinstance(self.arch, ArchSoot) and...
[ "def", "is_java_jni_project", "(", "self", ")", ":", "if", "self", ".", "_is_java_jni_project", "is", "None", ":", "self", ".", "_is_java_jni_project", "=", "isinstance", "(", "self", ".", "arch", ",", "ArchSoot", ")", "and", "self", ".", "simos", ".", "is...
Indicates if the project's main binary is a Java Archive, which interacts during its execution with native libraries (via JNI).
[ "Indicates", "if", "the", "project", "s", "main", "binary", "is", "a", "Java", "Archive", "which", "interacts", "during", "its", "execution", "with", "native", "libraries", "(", "via", "JNI", ")", "." ]
python
train
Calysto/calysto
calysto/ai/conx.py
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L4700-L4709
def copyHiddenToContext(self): """ Uses key to identify the hidden layer associated with each layer in the self.contextLayers dictionary. """ for item in list(self.contextLayers.items()): if self.verbosity > 2: print('Hidden layer: ', self.getLayer(item[0]).activatio...
[ "def", "copyHiddenToContext", "(", "self", ")", ":", "for", "item", "in", "list", "(", "self", ".", "contextLayers", ".", "items", "(", ")", ")", ":", "if", "self", ".", "verbosity", ">", "2", ":", "print", "(", "'Hidden layer: '", ",", "self", ".", ...
Uses key to identify the hidden layer associated with each layer in the self.contextLayers dictionary.
[ "Uses", "key", "to", "identify", "the", "hidden", "layer", "associated", "with", "each", "layer", "in", "the", "self", ".", "contextLayers", "dictionary", "." ]
python
train
wummel/linkchecker
linkcheck/logger/text.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/text.py#L144-L148
def write_url (self, url_data): """Write url_data.base_url.""" self.write(self.part('url') + self.spaces('url')) txt = strformat.strline(url_data.base_url) self.writeln(txt, color=self.colorurl)
[ "def", "write_url", "(", "self", ",", "url_data", ")", ":", "self", ".", "write", "(", "self", ".", "part", "(", "'url'", ")", "+", "self", ".", "spaces", "(", "'url'", ")", ")", "txt", "=", "strformat", ".", "strline", "(", "url_data", ".", "base_...
Write url_data.base_url.
[ "Write", "url_data", ".", "base_url", "." ]
python
train
bolt-project/bolt
bolt/local/array.py
https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/local/array.py#L66-L92
def filter(self, func, axis=(0,)): """ Filter array along an axis. Applies a function which should evaluate to boolean, along a single axis or multiple axes. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. ...
[ "def", "filter", "(", "self", ",", "func", ",", "axis", "=", "(", "0", ",", ")", ")", ":", "axes", "=", "sorted", "(", "tupleize", "(", "axis", ")", ")", "reshaped", "=", "self", ".", "_align", "(", "axes", ")", "filtered", "=", "asarray", "(", ...
Filter array along an axis. Applies a function which should evaluate to boolean, along a single axis or multiple axes. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Parameters ---------- func : func...
[ "Filter", "array", "along", "an", "axis", "." ]
python
test
dropbox/stone
stone/frontend/parser.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/parser.py#L567-L576
def p_field_void(self, p): """field : ID NL | ID NL INDENT annotation_ref_list docsection DEDENT""" p[0] = AstVoidField(self.path, p.lineno(1), p.lexpos(1), p[1]) if len(p) > 3: if p[4] is not None: p[0].set_annotations(p[4]) if p[5] is n...
[ "def", "p_field_void", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "AstVoidField", "(", "self", ".", "path", ",", "p", ".", "lineno", "(", "1", ")", ",", "p", ".", "lexpos", "(", "1", ")", ",", "p", "[", "1", "]", ")", "if", ...
field : ID NL | ID NL INDENT annotation_ref_list docsection DEDENT
[ "field", ":", "ID", "NL", "|", "ID", "NL", "INDENT", "annotation_ref_list", "docsection", "DEDENT" ]
python
train
UCSBarchlab/PyRTL
pyrtl/rtllib/aes.py
https://github.com/UCSBarchlab/PyRTL/blob/0988e5c9c10ededd5e1f58d5306603f9edf4b3e2/pyrtl/rtllib/aes.py#L127-L149
def decryption(self, ciphertext, key): """ Builds a single cycle AES Decryption circuit :param WireVector ciphertext: data to decrypt :param WireVector key: AES key to use to encrypt (AES is symmetric) :return: a WireVector containing the plaintext """ if len(cip...
[ "def", "decryption", "(", "self", ",", "ciphertext", ",", "key", ")", ":", "if", "len", "(", "ciphertext", ")", "!=", "self", ".", "_key_len", ":", "raise", "pyrtl", ".", "PyrtlError", "(", "\"Ciphertext length is invalid\"", ")", "if", "len", "(", "key", ...
Builds a single cycle AES Decryption circuit :param WireVector ciphertext: data to decrypt :param WireVector key: AES key to use to encrypt (AES is symmetric) :return: a WireVector containing the plaintext
[ "Builds", "a", "single", "cycle", "AES", "Decryption", "circuit" ]
python
train
sixty-north/cosmic-ray
plugins/execution-engines/celery4/cosmic_ray_celery4_engine/worker.py
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/plugins/execution-engines/celery4/cosmic_ray_celery4_engine/worker.py#L25-L48
def worker_task(work_item, config): """The celery task which performs a single mutation and runs a test suite. This runs `cosmic-ray worker` in a subprocess and returns the results, passing `config` to it via stdin. Args: work_item: A dict describing a WorkItem. config: The configurati...
[ "def", "worker_task", "(", "work_item", ",", "config", ")", ":", "global", "_workspace", "_ensure_workspace", "(", "config", ")", "result", "=", "worker", "(", "work_item", ".", "module_path", ",", "config", ".", "python_version", ",", "work_item", ".", "opera...
The celery task which performs a single mutation and runs a test suite. This runs `cosmic-ray worker` in a subprocess and returns the results, passing `config` to it via stdin. Args: work_item: A dict describing a WorkItem. config: The configuration to use for the test execution. Retu...
[ "The", "celery", "task", "which", "performs", "a", "single", "mutation", "and", "runs", "a", "test", "suite", "." ]
python
train
mailgun/talon
talon/html_quotations.py
https://github.com/mailgun/talon/blob/cdd84563dd329c4f887591807870d10015e0c7a7/talon/html_quotations.py#L20-L42
def add_checkpoint(html_note, counter): """Recursively adds checkpoints to html tree. """ if html_note.text: html_note.text = (html_note.text + CHECKPOINT_PREFIX + str(counter) + CHECKPOINT_SUFFIX) else: html_note.text = (CHECKPOINT_PREFIX + str(counter) + ...
[ "def", "add_checkpoint", "(", "html_note", ",", "counter", ")", ":", "if", "html_note", ".", "text", ":", "html_note", ".", "text", "=", "(", "html_note", ".", "text", "+", "CHECKPOINT_PREFIX", "+", "str", "(", "counter", ")", "+", "CHECKPOINT_SUFFIX", ")"...
Recursively adds checkpoints to html tree.
[ "Recursively", "adds", "checkpoints", "to", "html", "tree", "." ]
python
train
CodyKochmann/generators
generators/uniq.py
https://github.com/CodyKochmann/generators/blob/e4ca4dd25d5023a94b0349c69d6224070cc2526f/generators/uniq.py#L7-L16
def uniq(pipe): ''' this works like bash's uniq command where the generator only iterates if the next value is not the previous ''' pipe = iter(pipe) previous = next(pipe) yield previous for i in pipe: if i is not previous: previous = i yield i
[ "def", "uniq", "(", "pipe", ")", ":", "pipe", "=", "iter", "(", "pipe", ")", "previous", "=", "next", "(", "pipe", ")", "yield", "previous", "for", "i", "in", "pipe", ":", "if", "i", "is", "not", "previous", ":", "previous", "=", "i", "yield", "i...
this works like bash's uniq command where the generator only iterates if the next value is not the previous
[ "this", "works", "like", "bash", "s", "uniq", "command", "where", "the", "generator", "only", "iterates", "if", "the", "next", "value", "is", "not", "the", "previous" ]
python
train
WTRMQDev/lnoise
lnoise/noisetypes.py
https://github.com/WTRMQDev/lnoise/blob/7f8d9faf135025a6aac50131d14a34d1009e8cdd/lnoise/noisetypes.py#L69-L85
def hkdf(self, chaining_key, input_key_material, dhlen=64): """Hash-based key derivation function Takes a ``chaining_key'' byte sequence of len HASHLEN, and an ``input_key_material'' byte sequence with length either zero bytes, 32 bytes or dhlen bytes. Returns two byte sequence...
[ "def", "hkdf", "(", "self", ",", "chaining_key", ",", "input_key_material", ",", "dhlen", "=", "64", ")", ":", "if", "len", "(", "chaining_key", ")", "!=", "self", ".", "HASHLEN", ":", "raise", "HashError", "(", "\"Incorrect chaining key length\"", ")", "if"...
Hash-based key derivation function Takes a ``chaining_key'' byte sequence of len HASHLEN, and an ``input_key_material'' byte sequence with length either zero bytes, 32 bytes or dhlen bytes. Returns two byte sequences of length HASHLEN
[ "Hash", "-", "based", "key", "derivation", "function" ]
python
train
sanger-pathogens/circlator
circlator/merge.py
https://github.com/sanger-pathogens/circlator/blob/a4befb8c9dbbcd4b3ad1899a95aa3e689d58b638/circlator/merge.py#L210-L217
def _has_qry_hit_longer_than(self, nucmer_hits, min_length, hits_to_exclude=None): '''Returns True iff list of nucmer_hits has a hit longer than min_length, not counting the hits in hits_to_exclude''' if hits_to_exclude is None: to_exclude = set() else: to_exclude = hits_...
[ "def", "_has_qry_hit_longer_than", "(", "self", ",", "nucmer_hits", ",", "min_length", ",", "hits_to_exclude", "=", "None", ")", ":", "if", "hits_to_exclude", "is", "None", ":", "to_exclude", "=", "set", "(", ")", "else", ":", "to_exclude", "=", "hits_to_exclu...
Returns True iff list of nucmer_hits has a hit longer than min_length, not counting the hits in hits_to_exclude
[ "Returns", "True", "iff", "list", "of", "nucmer_hits", "has", "a", "hit", "longer", "than", "min_length", "not", "counting", "the", "hits", "in", "hits_to_exclude" ]
python
train
6809/MC6809
MC6809/components/mc6809_tools.py
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_tools.py#L120-L149
def calc_new_count(min_value, value, max_value, trigger, target): """ change 'value' between 'min_value' and 'max_value' so that 'trigger' will be match 'target' >>> calc_new_count(min_value=0, value=100, max_value=200, trigger=30, target=30) 100 >>> calc_new_count(min_value=0, value=100, ...
[ "def", "calc_new_count", "(", "min_value", ",", "value", ",", "max_value", ",", "trigger", ",", "target", ")", ":", "try", ":", "new_value", "=", "float", "(", "value", ")", "/", "float", "(", "trigger", ")", "*", "target", "except", "ZeroDivisionError", ...
change 'value' between 'min_value' and 'max_value' so that 'trigger' will be match 'target' >>> calc_new_count(min_value=0, value=100, max_value=200, trigger=30, target=30) 100 >>> calc_new_count(min_value=0, value=100, max_value=200, trigger=50, target=5) 55 >>> calc_new_count(min_value=6...
[ "change", "value", "between", "min_value", "and", "max_value", "so", "that", "trigger", "will", "be", "match", "target", ">>>", "calc_new_count", "(", "min_value", "=", "0", "value", "=", "100", "max_value", "=", "200", "trigger", "=", "30", "target", "=", ...
python
train
SuperCowPowers/workbench
workbench/workers/pe_classifier.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/workers/pe_classifier.py#L12-L25
def execute(self, input_data): ''' This worker classifies PEFiles as Evil or AOK (TOY not a real classifier at this point)''' # In general you'd do something different with these two outputs # for this toy example will just smash them in a big string pefile_output = input_data['pe_feat...
[ "def", "execute", "(", "self", ",", "input_data", ")", ":", "# In general you'd do something different with these two outputs", "# for this toy example will just smash them in a big string", "pefile_output", "=", "input_data", "[", "'pe_features'", "]", "indicators", "=", "input_...
This worker classifies PEFiles as Evil or AOK (TOY not a real classifier at this point)
[ "This", "worker", "classifies", "PEFiles", "as", "Evil", "or", "AOK", "(", "TOY", "not", "a", "real", "classifier", "at", "this", "point", ")" ]
python
train
quantopian/zipline
zipline/pipeline/loaders/earnings_estimates.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/earnings_estimates.py#L810-L838
def get_zeroth_quarter_idx(self, stacked_last_per_qtr): """ Filters for releases that are on or after each simulation date and determines the previous quarter by picking out the most recent release relative to each date in the index. Parameters ---------- stacked...
[ "def", "get_zeroth_quarter_idx", "(", "self", ",", "stacked_last_per_qtr", ")", ":", "previous_releases_per_date", "=", "stacked_last_per_qtr", ".", "loc", "[", "stacked_last_per_qtr", "[", "EVENT_DATE_FIELD_NAME", "]", "<=", "stacked_last_per_qtr", ".", "index", ".", "...
Filters for releases that are on or after each simulation date and determines the previous quarter by picking out the most recent release relative to each date in the index. Parameters ---------- stacked_last_per_qtr : pd.DataFrame A DataFrame with index of calendar ...
[ "Filters", "for", "releases", "that", "are", "on", "or", "after", "each", "simulation", "date", "and", "determines", "the", "previous", "quarter", "by", "picking", "out", "the", "most", "recent", "release", "relative", "to", "each", "date", "in", "the", "ind...
python
train
quantumlib/Cirq
cirq/circuits/circuit.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/circuits/circuit.py#L1068-L1100
def insert_at_frontier(self, operations: ops.OP_TREE, start: int, frontier: Dict[ops.Qid, int] = None ) -> Dict[ops.Qid, int]: """Inserts operations inline at frontier. Args: operatio...
[ "def", "insert_at_frontier", "(", "self", ",", "operations", ":", "ops", ".", "OP_TREE", ",", "start", ":", "int", ",", "frontier", ":", "Dict", "[", "ops", ".", "Qid", ",", "int", "]", "=", "None", ")", "->", "Dict", "[", "ops", ".", "Qid", ",", ...
Inserts operations inline at frontier. Args: operations: the operations to insert start: the moment at which to start inserting the operations frontier: frontier[q] is the earliest moment in which an operation acting on qubit q can be placed.
[ "Inserts", "operations", "inline", "at", "frontier", "." ]
python
train
kytos/python-openflow
pyof/v0x01/controller2switch/stats_reply.py
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/v0x01/controller2switch/stats_reply.py#L35-L54
def pack(self, value=None): """Pack a StatsReply using the object's attributes. This method will pack the attribute body and body_type before pack the StatsReply object, then will return this struct as a binary data. Returns: bytes: Binary data with StatsReply packed. ...
[ "def", "pack", "(", "self", ",", "value", "=", "None", ")", ":", "buff", "=", "self", ".", "body", "if", "not", "value", ":", "value", "=", "self", ".", "body", "if", "value", "and", "hasattr", "(", "value", ",", "'pack'", ")", ":", "self", ".", ...
Pack a StatsReply using the object's attributes. This method will pack the attribute body and body_type before pack the StatsReply object, then will return this struct as a binary data. Returns: bytes: Binary data with StatsReply packed.
[ "Pack", "a", "StatsReply", "using", "the", "object", "s", "attributes", "." ]
python
train
scikit-hep/probfit
probfit/plotting.py
https://github.com/scikit-hep/probfit/blob/de3593798ea3877dd2785062bed6877dd9058a02/probfit/plotting.py#L135-L193
def draw_residual(x, y, yerr, xerr, show_errbars=True, ax=None, zero_line=True, grid=True, **kwargs): """Draw a residual plot on the axis. By default, if show_errbars if True, residuals are drawn as blue points with errorbars with no endcaps. If show_er...
[ "def", "draw_residual", "(", "x", ",", "y", ",", "yerr", ",", "xerr", ",", "show_errbars", "=", "True", ",", "ax", "=", "None", ",", "zero_line", "=", "True", ",", "grid", "=", "True", ",", "*", "*", "kwargs", ")", ":", "from", "matplotlib", "impor...
Draw a residual plot on the axis. By default, if show_errbars if True, residuals are drawn as blue points with errorbars with no endcaps. If show_errbars is False, residuals are drawn as a bar graph with black bars. **Arguments** - **x** array of numbers, x-coordinates - **y** array ...
[ "Draw", "a", "residual", "plot", "on", "the", "axis", "." ]
python
train
PythonCharmers/python-future
src/future/backports/email/header.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/email/header.py#L157-L176
def make_header(decoded_seq, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a Header from a sequence of pairs as returned by decode_header() decode_header() takes a header value string and returns a sequence of pairs of the format (decoded_string, charset) where charset ...
[ "def", "make_header", "(", "decoded_seq", ",", "maxlinelen", "=", "None", ",", "header_name", "=", "None", ",", "continuation_ws", "=", "' '", ")", ":", "h", "=", "Header", "(", "maxlinelen", "=", "maxlinelen", ",", "header_name", "=", "header_name", ",", ...
Create a Header from a sequence of pairs as returned by decode_header() decode_header() takes a header value string and returns a sequence of pairs of the format (decoded_string, charset) where charset is the string name of the character set. This function takes one of those sequence of pairs and retu...
[ "Create", "a", "Header", "from", "a", "sequence", "of", "pairs", "as", "returned", "by", "decode_header", "()" ]
python
train
RI-imaging/qpsphere
qpsphere/imagefit/interp.py
https://github.com/RI-imaging/qpsphere/blob/3cfa0e9fb8e81be8c820abbeccd47242e7972ac1/qpsphere/imagefit/interp.py#L124-L167
def get_border_phase(self, idn=0, idr=0): """Return one of nine border fields Parameters ---------- idn: int Index for refractive index. One of -1 (left), 0 (center), 1 (right) idr: int Index for radius. One of -1 (left), 0 (center...
[ "def", "get_border_phase", "(", "self", ",", "idn", "=", "0", ",", "idr", "=", "0", ")", ":", "assert", "idn", "in", "[", "-", "1", ",", "0", ",", "1", "]", "assert", "idr", "in", "[", "-", "1", ",", "0", ",", "1", "]", "n", "=", "self", ...
Return one of nine border fields Parameters ---------- idn: int Index for refractive index. One of -1 (left), 0 (center), 1 (right) idr: int Index for radius. One of -1 (left), 0 (center), 1 (right)
[ "Return", "one", "of", "nine", "border", "fields" ]
python
train
pkkid/python-plexapi
plexapi/media.py
https://github.com/pkkid/python-plexapi/blob/9efbde96441c2bfbf410eacfb46e811e108e8bbc/plexapi/media.py#L191-L196
def parse(server, data, initpath): # pragma: no cover seems to be dead code. """ Factory method returns a new MediaPartStream from xml data. """ STREAMCLS = {1: VideoStream, 2: AudioStream, 3: SubtitleStream} stype = cast(int, data.attrib.get('streamType')) cls = STREAMCLS.get(stype, Me...
[ "def", "parse", "(", "server", ",", "data", ",", "initpath", ")", ":", "# pragma: no cover seems to be dead code.", "STREAMCLS", "=", "{", "1", ":", "VideoStream", ",", "2", ":", "AudioStream", ",", "3", ":", "SubtitleStream", "}", "stype", "=", "cast", "(",...
Factory method returns a new MediaPartStream from xml data.
[ "Factory", "method", "returns", "a", "new", "MediaPartStream", "from", "xml", "data", "." ]
python
train
waqasbhatti/astrobase
astrobase/hatsurveys/hatlc.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/hatsurveys/hatlc.py#L482-L514
def _gzip_sqlitecurve(sqlitecurve, force=False): '''This just compresses the sqlitecurve in gzip format. FIXME: this doesn't work with gzip < 1.6 or non-GNU gzip (probably). ''' # -k to keep the input file just in case something explodes if force: cmd = 'gzip -k -f %s' % sqlitecurve e...
[ "def", "_gzip_sqlitecurve", "(", "sqlitecurve", ",", "force", "=", "False", ")", ":", "# -k to keep the input file just in case something explodes", "if", "force", ":", "cmd", "=", "'gzip -k -f %s'", "%", "sqlitecurve", "else", ":", "cmd", "=", "'gzip -k %s'", "%", ...
This just compresses the sqlitecurve in gzip format. FIXME: this doesn't work with gzip < 1.6 or non-GNU gzip (probably).
[ "This", "just", "compresses", "the", "sqlitecurve", "in", "gzip", "format", "." ]
python
valid
biolink/ontobio
ontobio/golr/golr_query.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/golr/golr_query.py#L1629-L1639
def map_id(self,id, prefix, closure_list): """ Map identifiers based on an equivalence closure list. """ prefixc = prefix + ':' ids = [eid for eid in closure_list if eid.startswith(prefixc)] # TODO: add option to fail if no mapping, or if >1 mapping if len(ids) ==...
[ "def", "map_id", "(", "self", ",", "id", ",", "prefix", ",", "closure_list", ")", ":", "prefixc", "=", "prefix", "+", "':'", "ids", "=", "[", "eid", "for", "eid", "in", "closure_list", "if", "eid", ".", "startswith", "(", "prefixc", ")", "]", "# TODO...
Map identifiers based on an equivalence closure list.
[ "Map", "identifiers", "based", "on", "an", "equivalence", "closure", "list", "." ]
python
train
jmcarp/nplusone
tasks.py
https://github.com/jmcarp/nplusone/blob/2f1e25d8f52c691519c528c4ed583a315bc1ccf9/tasks.py#L62-L72
def watch_docs(ctx): """Run build the docs when a file changes.""" try: import sphinx_autobuild # noqa except ImportError: print('ERROR: watch task requires the sphinx_autobuild package.') print('Install it with:') print(' pip install sphinx-autobuild') sys.exit(1...
[ "def", "watch_docs", "(", "ctx", ")", ":", "try", ":", "import", "sphinx_autobuild", "# noqa", "except", "ImportError", ":", "print", "(", "'ERROR: watch task requires the sphinx_autobuild package.'", ")", "print", "(", "'Install it with:'", ")", "print", "(", "' p...
Run build the docs when a file changes.
[ "Run", "build", "the", "docs", "when", "a", "file", "changes", "." ]
python
train
totalgood/nlpia
src/nlpia/talk.py
https://github.com/totalgood/nlpia/blob/efa01126275e9cd3c3a5151a644f1c798a9ec53f/src/nlpia/talk.py#L67-L80
def transcribe(decoder, audio_file, libdir=None): """ Decode streaming audio data from raw binary file on disk. """ decoder = get_decoder() decoder.start_utt() stream = open(audio_file, 'rb') while True: buf = stream.read(1024) if buf: decoder.process_raw(buf, False, Fal...
[ "def", "transcribe", "(", "decoder", ",", "audio_file", ",", "libdir", "=", "None", ")", ":", "decoder", "=", "get_decoder", "(", ")", "decoder", ".", "start_utt", "(", ")", "stream", "=", "open", "(", "audio_file", ",", "'rb'", ")", "while", "True", "...
Decode streaming audio data from raw binary file on disk.
[ "Decode", "streaming", "audio", "data", "from", "raw", "binary", "file", "on", "disk", "." ]
python
train
OpenAgInitiative/openag_python
openag/cli/cloud/db.py
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/cloud/db.py#L52-L61
def deinit(ctx): """ Detach from the current cloud server """ utils.check_for_cloud_server() if config["local_server"]["url"]: utils.cancel_global_db_replication() if config["cloud_server"]["username"]: ctx.invoke(logout_user) config["cloud_server"]["url"] = None
[ "def", "deinit", "(", "ctx", ")", ":", "utils", ".", "check_for_cloud_server", "(", ")", "if", "config", "[", "\"local_server\"", "]", "[", "\"url\"", "]", ":", "utils", ".", "cancel_global_db_replication", "(", ")", "if", "config", "[", "\"cloud_server\"", ...
Detach from the current cloud server
[ "Detach", "from", "the", "current", "cloud", "server" ]
python
train
zsiciarz/pygcvs
pygcvs/helpers.py
https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/helpers.py#L23-L36
def dict_to_body(star_dict): """ Converts a dictionary of variable star data to a `Body` instance. Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed. """ if ephem is None: # pragma: no cover raise NotImplementedError("Please install PyEphem in order to use dict_to_body."...
[ "def", "dict_to_body", "(", "star_dict", ")", ":", "if", "ephem", "is", "None", ":", "# pragma: no cover", "raise", "NotImplementedError", "(", "\"Please install PyEphem in order to use dict_to_body.\"", ")", "body", "=", "ephem", ".", "FixedBody", "(", ")", "body", ...
Converts a dictionary of variable star data to a `Body` instance. Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed.
[ "Converts", "a", "dictionary", "of", "variable", "star", "data", "to", "a", "Body", "instance", "." ]
python
train
sods/ods
pods/datasets.py
https://github.com/sods/ods/blob/3995c659f25a0a640f6009ed7fcc2559ce659b1d/pods/datasets.py#L1271-L1304
def olympic_sprints(data_set='rogers_girolami_data'): """All olympics sprint winning times for multiple output prediction.""" X = np.zeros((0, 2)) Y = np.zeros((0, 1)) cats = {} for i, dataset in enumerate([olympic_100m_men, olympic_100m_women, ...
[ "def", "olympic_sprints", "(", "data_set", "=", "'rogers_girolami_data'", ")", ":", "X", "=", "np", ".", "zeros", "(", "(", "0", ",", "2", ")", ")", "Y", "=", "np", ".", "zeros", "(", "(", "0", ",", "1", ")", ")", "cats", "=", "{", "}", "for", ...
All olympics sprint winning times for multiple output prediction.
[ "All", "olympics", "sprint", "winning", "times", "for", "multiple", "output", "prediction", "." ]
python
train
opencivicdata/pupa
pupa/importers/organizations.py
https://github.com/opencivicdata/pupa/blob/18e0ddc4344804987ee0f2227bf600375538dbd5/pupa/importers/organizations.py#L61-L122
def _prepare_imports(self, dicts): """ an override for prepare imports that sorts the imports by parent_id dependencies """ # all pseudo parent ids we've seen pseudo_ids = set() # pseudo matches pseudo_matches = {} # get prepared imports from parent prepared = di...
[ "def", "_prepare_imports", "(", "self", ",", "dicts", ")", ":", "# all pseudo parent ids we've seen", "pseudo_ids", "=", "set", "(", ")", "# pseudo matches", "pseudo_matches", "=", "{", "}", "# get prepared imports from parent", "prepared", "=", "dict", "(", "super", ...
an override for prepare imports that sorts the imports by parent_id dependencies
[ "an", "override", "for", "prepare", "imports", "that", "sorts", "the", "imports", "by", "parent_id", "dependencies" ]
python
train
Alignak-monitoring/alignak
alignak/external_command.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L2165-L2178
def disable_host_freshness_check(self, host): """Disable freshness check for a host Format of the line that triggers function call:: DISABLE_HOST_FRESHNESS_CHECK;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None """ ...
[ "def", "disable_host_freshness_check", "(", "self", ",", "host", ")", ":", "if", "host", ".", "check_freshness", ":", "host", ".", "modified_attributes", "|=", "DICT_MODATTR", "[", "\"MODATTR_FRESHNESS_CHECKS_ENABLED\"", "]", ".", "value", "host", ".", "check_freshn...
Disable freshness check for a host Format of the line that triggers function call:: DISABLE_HOST_FRESHNESS_CHECK;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None
[ "Disable", "freshness", "check", "for", "a", "host", "Format", "of", "the", "line", "that", "triggers", "function", "call", "::" ]
python
train
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewprofile.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewprofile.py#L326-L358
def toXml(self, xparent=None): """ Converts the data for this profile into an XML blob. :return <xml.etree.ElementTree.Element> """ if xparent is not None: xprofile = ElementTree.SubElement(xparent, 'profile') else: xprofile =...
[ "def", "toXml", "(", "self", ",", "xparent", "=", "None", ")", ":", "if", "xparent", "is", "not", "None", ":", "xprofile", "=", "ElementTree", ".", "SubElement", "(", "xparent", ",", "'profile'", ")", "else", ":", "xprofile", "=", "ElementTree", ".", "...
Converts the data for this profile into an XML blob. :return <xml.etree.ElementTree.Element>
[ "Converts", "the", "data", "for", "this", "profile", "into", "an", "XML", "blob", ".", ":", "return", "<xml", ".", "etree", ".", "ElementTree", ".", "Element", ">" ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_tile.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_tile.py#L140-L147
def url(self, service): '''return URL for a tile''' if service not in TILE_SERVICES: raise TileException('unknown tile service %s' % service) url = string.Template(TILE_SERVICES[service]) (x,y) = self.tile tile_info = TileServiceInfo(x, y, self.zoom) return url.substitute(tile_info)
[ "def", "url", "(", "self", ",", "service", ")", ":", "if", "service", "not", "in", "TILE_SERVICES", ":", "raise", "TileException", "(", "'unknown tile service %s'", "%", "service", ")", "url", "=", "string", ".", "Template", "(", "TILE_SERVICES", "[", "servi...
return URL for a tile
[ "return", "URL", "for", "a", "tile" ]
python
train
markovmodel/PyEMMA
pyemma/coordinates/data/featurization/featurizer.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/coordinates/data/featurization/featurizer.py#L850-L860
def dimension(self): """ current dimension due to selected features Returns ------- dim : int total dimension due to all selection features """ dim = sum(f.dimension for f in self.active_features) return dim
[ "def", "dimension", "(", "self", ")", ":", "dim", "=", "sum", "(", "f", ".", "dimension", "for", "f", "in", "self", ".", "active_features", ")", "return", "dim" ]
current dimension due to selected features Returns ------- dim : int total dimension due to all selection features
[ "current", "dimension", "due", "to", "selected", "features" ]
python
train