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
ArabellaTech/django-basic-cms
basic_cms/utils.py
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/utils.py#L163-L181
def get_placeholders(template_name): """Return a list of PlaceholderNode found in the given template. :param template_name: the name of the template file """ try: temp = loader.get_template(template_name) except TemplateDoesNotExist: return [] plist, blist = [], [] try: ...
[ "def", "get_placeholders", "(", "template_name", ")", ":", "try", ":", "temp", "=", "loader", ".", "get_template", "(", "template_name", ")", "except", "TemplateDoesNotExist", ":", "return", "[", "]", "plist", ",", "blist", "=", "[", "]", ",", "[", "]", ...
Return a list of PlaceholderNode found in the given template. :param template_name: the name of the template file
[ "Return", "a", "list", "of", "PlaceholderNode", "found", "in", "the", "given", "template", "." ]
python
train
log2timeline/dfdatetime
dfdatetime/time_elements.py
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/time_elements.py#L298-L312
def CopyFromDateTimeString(self, time_string): """Copies time elements from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be ...
[ "def", "CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "date_time_values", "=", "self", ".", "_CopyDateTimeFromString", "(", "time_string", ")", "self", ".", "_CopyFromDateTimeValues", "(", "date_time_values", ")" ]
Copies time elements from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "time", "elements", "from", "a", "date", "and", "time", "string", "." ]
python
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L236-L287
def asini(b, orbit, solve_for=None): """ Create a constraint for asini in an orbit. If any of the required parameters ('asini', 'sma', 'incl') do not exist in the orbit, they will be created. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit ...
[ "def", "asini", "(", "b", ",", "orbit", ",", "solve_for", "=", "None", ")", ":", "orbit_ps", "=", "_get_system_ps", "(", "b", ",", "orbit", ")", "# We want to get the parameters in THIS orbit, but calling through", "# the bundle in case we need to create it.", "# To do th...
Create a constraint for asini in an orbit. If any of the required parameters ('asini', 'sma', 'incl') do not exist in the orbit, they will be created. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be built ...
[ "Create", "a", "constraint", "for", "asini", "in", "an", "orbit", "." ]
python
train
SuperCowPowers/bat
bat/bro_log_reader.py
https://github.com/SuperCowPowers/bat/blob/069e6bc52843dc07760969c531cc442ca7da8e0c/bat/bro_log_reader.py#L99-L113
def _readrows(self): """Internal method _readrows, see readrows() for description""" # Read in the Bro Headers offset, self.field_names, self.field_types, self.type_converters = self._parse_bro_header(self._filepath) # Use parent class to yield each row as a dictionary for line...
[ "def", "_readrows", "(", "self", ")", ":", "# Read in the Bro Headers", "offset", ",", "self", ".", "field_names", ",", "self", ".", "field_types", ",", "self", ".", "type_converters", "=", "self", ".", "_parse_bro_header", "(", "self", ".", "_filepath", ")", ...
Internal method _readrows, see readrows() for description
[ "Internal", "method", "_readrows", "see", "readrows", "()", "for", "description" ]
python
train
SwissDataScienceCenter/renku-python
renku/cli/workflow.py
https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/workflow.py#L59-L77
def workflow(ctx, client): """List or manage workflows with subcommands.""" if ctx.invoked_subcommand is None: from renku.models.refs import LinkReference names = defaultdict(list) for ref in LinkReference.iter_items(client, common_path='workflows'): names[ref.reference.name...
[ "def", "workflow", "(", "ctx", ",", "client", ")", ":", "if", "ctx", ".", "invoked_subcommand", "is", "None", ":", "from", "renku", ".", "models", ".", "refs", "import", "LinkReference", "names", "=", "defaultdict", "(", "list", ")", "for", "ref", "in", ...
List or manage workflows with subcommands.
[ "List", "or", "manage", "workflows", "with", "subcommands", "." ]
python
train
fedora-python/pyp2rpm
pyp2rpm/command/extract_dist.py
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/command/extract_dist.py#L75-L86
def to_list(var): """Checks if given value is a list, tries to convert, if it is not.""" if var is None: return [] if isinstance(var, str): var = var.split('\n') elif not isinstance(var, list): try: var = list(var) except TypeError: raise ValueErro...
[ "def", "to_list", "(", "var", ")", ":", "if", "var", "is", "None", ":", "return", "[", "]", "if", "isinstance", "(", "var", ",", "str", ")", ":", "var", "=", "var", ".", "split", "(", "'\\n'", ")", "elif", "not", "isinstance", "(", "var", ",", ...
Checks if given value is a list, tries to convert, if it is not.
[ "Checks", "if", "given", "value", "is", "a", "list", "tries", "to", "convert", "if", "it", "is", "not", "." ]
python
train
getsentry/libsourcemap
libsourcemap/highlevel.py
https://github.com/getsentry/libsourcemap/blob/94b5a34814fafee9dc23da8ec0ccca77f30e3370/libsourcemap/highlevel.py#L303-L308
def from_bytes(buffer): """Creates a sourcemap view from a JSON string.""" buffer = to_bytes(buffer) return ProguardView._from_ptr(rustcall( _lib.lsm_proguard_mapping_from_bytes, buffer, len(buffer)))
[ "def", "from_bytes", "(", "buffer", ")", ":", "buffer", "=", "to_bytes", "(", "buffer", ")", "return", "ProguardView", ".", "_from_ptr", "(", "rustcall", "(", "_lib", ".", "lsm_proguard_mapping_from_bytes", ",", "buffer", ",", "len", "(", "buffer", ")", ")",...
Creates a sourcemap view from a JSON string.
[ "Creates", "a", "sourcemap", "view", "from", "a", "JSON", "string", "." ]
python
train
blueset/ehForwarderBot
ehforwarderbot/wizard.py
https://github.com/blueset/ehForwarderBot/blob/62e8fcfe77b2993aba91623f538f404a90f59f1d/ehforwarderbot/wizard.py#L700-L738
def prerequisite_check(): """ Check prerequisites of the framework, including Python version, installation of modules, etc. Returns: Optional[str]: If the check is not passed, return error message regarding failed test case. None is returned otherwise. """ # Check Python v...
[ "def", "prerequisite_check", "(", ")", ":", "# Check Python version", "if", "sys", ".", "version_info", "<", "(", "3", ",", "6", ")", ":", "version_str", "=", "\"%s.%s.%s\"", "%", "sys", ".", "version_info", "[", ":", "3", "]", "# TRANSLATORS: This word is use...
Check prerequisites of the framework, including Python version, installation of modules, etc. Returns: Optional[str]: If the check is not passed, return error message regarding failed test case. None is returned otherwise.
[ "Check", "prerequisites", "of", "the", "framework", "including", "Python", "version", "installation", "of", "modules", "etc", "." ]
python
train
CalebBell/thermo
thermo/thermal_conductivity.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/thermal_conductivity.py#L1066-L1110
def DIPPR9H(ws, ks): r'''Calculates thermal conductivity of a liquid mixture according to mixing rules in [1]_ and also in [2]_. .. math:: \lambda_m = \left( \sum_i w_i \lambda_i^{-2}\right)^{-1/2} Parameters ---------- ws : float Mass fractions of components ks : float ...
[ "def", "DIPPR9H", "(", "ws", ",", "ks", ")", ":", "if", "not", "none_and_length_check", "(", "[", "ks", ",", "ws", "]", ")", ":", "# check same-length inputs", "raise", "Exception", "(", "'Function inputs are incorrect format'", ")", "return", "sum", "(", "ws"...
r'''Calculates thermal conductivity of a liquid mixture according to mixing rules in [1]_ and also in [2]_. .. math:: \lambda_m = \left( \sum_i w_i \lambda_i^{-2}\right)^{-1/2} Parameters ---------- ws : float Mass fractions of components ks : float Liquid thermal condu...
[ "r", "Calculates", "thermal", "conductivity", "of", "a", "liquid", "mixture", "according", "to", "mixing", "rules", "in", "[", "1", "]", "_", "and", "also", "in", "[", "2", "]", "_", "." ]
python
valid
nikhilkumarsingh/content-downloader
ctdl/gui.py
https://github.com/nikhilkumarsingh/content-downloader/blob/8b14af3a6eadcc43581e0425dc1d218208de12df/ctdl/gui.py#L258-L273
def click_download(self, event): """ event for download button """ args ['parallel'] = self.p.get() args ['file_type'] = self.optionmenu.get() args ['no_redirects'] = self.t.get() args ['query'] = self.entry_query.get() args ['min_file_size'] = int( self.entry_min.get()) args ['max_file_size'] = int( ...
[ "def", "click_download", "(", "self", ",", "event", ")", ":", "args", "[", "'parallel'", "]", "=", "self", ".", "p", ".", "get", "(", ")", "args", "[", "'file_type'", "]", "=", "self", ".", "optionmenu", ".", "get", "(", ")", "args", "[", "'no_redi...
event for download button
[ "event", "for", "download", "button" ]
python
train
benoitguigal/python-epson-printer
epson_printer/epsonprinter.py
https://github.com/benoitguigal/python-epson-printer/blob/7d89b2f21bc76d2cc4d5ad548e19a356ca92fbc5/epson_printer/epsonprinter.py#L258-L264
def print_images(self, *printable_images): """ This method allows printing several images in one shot. This is useful if the client code does not want the printer to make pause during printing """ printable_image = reduce(lambda x, y: x.append(y), list(printable_images)) ...
[ "def", "print_images", "(", "self", ",", "*", "printable_images", ")", ":", "printable_image", "=", "reduce", "(", "lambda", "x", ",", "y", ":", "x", ".", "append", "(", "y", ")", ",", "list", "(", "printable_images", ")", ")", "self", ".", "print_imag...
This method allows printing several images in one shot. This is useful if the client code does not want the printer to make pause during printing
[ "This", "method", "allows", "printing", "several", "images", "in", "one", "shot", ".", "This", "is", "useful", "if", "the", "client", "code", "does", "not", "want", "the", "printer", "to", "make", "pause", "during", "printing" ]
python
train
perimosocordiae/viztricks
viztricks/extensions.py
https://github.com/perimosocordiae/viztricks/blob/bae2f8a9ce9278ce0197f8efc34cc4fef1dfe1eb/viztricks/extensions.py#L189-L213
def jitterplot(data, positions=None, ax=None, vert=True, scale=0.1, **scatter_kwargs): '''Plots jittered points as a distribution visualizer. Scatter plot arguments default to: marker='.', c='k', alpha=0.75 Also known as a stripplot. See also: boxplot, violinplot, beeswarm ''' if ax is None:...
[ "def", "jitterplot", "(", "data", ",", "positions", "=", "None", ",", "ax", "=", "None", ",", "vert", "=", "True", ",", "scale", "=", "0.1", ",", "*", "*", "scatter_kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", ...
Plots jittered points as a distribution visualizer. Scatter plot arguments default to: marker='.', c='k', alpha=0.75 Also known as a stripplot. See also: boxplot, violinplot, beeswarm
[ "Plots", "jittered", "points", "as", "a", "distribution", "visualizer", "." ]
python
train
oceanprotocol/squid-py
squid_py/keeper/conditions/access.py
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/access.py#L55-L76
def get_purchased_assets_by_address(self, address, from_block=0, to_block='latest'): """ Get the list of the assets dids consumed for an address. :param address: is the address of the granted user, hex-str :param from_block: block to start to listen :param to_block: block to sto...
[ "def", "get_purchased_assets_by_address", "(", "self", ",", "address", ",", "from_block", "=", "0", ",", "to_block", "=", "'latest'", ")", ":", "block_filter", "=", "EventFilter", "(", "ConditionBase", ".", "FULFILLED_EVENT", ",", "getattr", "(", "self", ".", ...
Get the list of the assets dids consumed for an address. :param address: is the address of the granted user, hex-str :param from_block: block to start to listen :param to_block: block to stop to listen :return: list of dids
[ "Get", "the", "list", "of", "the", "assets", "dids", "consumed", "for", "an", "address", "." ]
python
train
sirfoga/pyhal
hal/files/parsers.py
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/files/parsers.py#L41-L52
def get_matrix(self): """Stores values in array, store lines in array :return: 2D matrix """ data = [] with open(self.path, encoding=self.encoding) as csv_file: csv_reader = csv.reader(csv_file, delimiter=",", quotechar="\"") for row in csv_reader: ...
[ "def", "get_matrix", "(", "self", ")", ":", "data", "=", "[", "]", "with", "open", "(", "self", ".", "path", ",", "encoding", "=", "self", ".", "encoding", ")", "as", "csv_file", ":", "csv_reader", "=", "csv", ".", "reader", "(", "csv_file", ",", "...
Stores values in array, store lines in array :return: 2D matrix
[ "Stores", "values", "in", "array", "store", "lines", "in", "array" ]
python
train
rueckstiess/mtools
mtools/mloginfo/sections/query_section.py
https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mloginfo/sections/query_section.py#L52-L138
def run(self): """Run this section and print out information.""" grouping = Grouping(group_by=lambda x: (x.namespace, x.operation, x.pattern)) logfile = self.mloginfo.logfile if logfile.start and logfile.end: progress_start = s...
[ "def", "run", "(", "self", ")", ":", "grouping", "=", "Grouping", "(", "group_by", "=", "lambda", "x", ":", "(", "x", ".", "namespace", ",", "x", ".", "operation", ",", "x", ".", "pattern", ")", ")", "logfile", "=", "self", ".", "mloginfo", ".", ...
Run this section and print out information.
[ "Run", "this", "section", "and", "print", "out", "information", "." ]
python
train
jjkester/django-auditlog
src/auditlog/receivers.py
https://github.com/jjkester/django-auditlog/blob/a22978e05b7ed43b87e4b6109550b86c738578fe/src/auditlog/receivers.py#L25-L47
def log_update(sender, instance, **kwargs): """ Signal receiver that creates a log entry when a model instance is changed and saved to the database. Direct use is discouraged, connect your model through :py:func:`auditlog.registry.register` instead. """ if instance.pk is not None: try: ...
[ "def", "log_update", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "instance", ".", "pk", "is", "not", "None", ":", "try", ":", "old", "=", "sender", ".", "objects", ".", "get", "(", "pk", "=", "instance", ".", "pk", ")...
Signal receiver that creates a log entry when a model instance is changed and saved to the database. Direct use is discouraged, connect your model through :py:func:`auditlog.registry.register` instead.
[ "Signal", "receiver", "that", "creates", "a", "log", "entry", "when", "a", "model", "instance", "is", "changed", "and", "saved", "to", "the", "database", "." ]
python
train
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L93-L140
def network_field_data(request, include_empty_option=False, with_cidr=False, for_launch=False): """Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request...
[ "def", "network_field_data", "(", "request", ",", "include_empty_option", "=", "False", ",", "with_cidr", "=", "False", ",", "for_launch", "=", "False", ")", ":", "tenant_id", "=", "request", ".", "user", ".", "tenant_id", "networks", "=", "[", "]", "if", ...
Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :param with_cidr:...
[ "Returns", "a", "list", "of", "tuples", "of", "all", "networks", "." ]
python
train
bolt-project/bolt
bolt/factory.py
https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/factory.py#L9-L35
def wrapped(f): """ Decorator to append routed docstrings """ import inspect def extract(func): append = "" args = inspect.getargspec(func) for i, a in enumerate(args.args): if i < (len(args) - len(args.defaults)): append += str(a) + ", " ...
[ "def", "wrapped", "(", "f", ")", ":", "import", "inspect", "def", "extract", "(", "func", ")", ":", "append", "=", "\"\"", "args", "=", "inspect", ".", "getargspec", "(", "func", ")", "for", "i", ",", "a", "in", "enumerate", "(", "args", ".", "args...
Decorator to append routed docstrings
[ "Decorator", "to", "append", "routed", "docstrings" ]
python
test
kgori/treeCl
treeCl/tasks.py
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tasks.py#L46-L53
def eucdist_task(newick_string_a, newick_string_b, normalise, min_overlap=4, overlap_fail_value=0): """ Distributed version of tree_distance.eucdist Parameters: two valid newick strings and a boolean """ tree_a = Tree(newick_string_a) tree_b = Tree(newick_string_b) return treedist.eucdist(tr...
[ "def", "eucdist_task", "(", "newick_string_a", ",", "newick_string_b", ",", "normalise", ",", "min_overlap", "=", "4", ",", "overlap_fail_value", "=", "0", ")", ":", "tree_a", "=", "Tree", "(", "newick_string_a", ")", "tree_b", "=", "Tree", "(", "newick_string...
Distributed version of tree_distance.eucdist Parameters: two valid newick strings and a boolean
[ "Distributed", "version", "of", "tree_distance", ".", "eucdist", "Parameters", ":", "two", "valid", "newick", "strings", "and", "a", "boolean" ]
python
train
alex-kostirin/pyatomac
atomac/ldtpd/table.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L523-L554
def doubleclickrow(self, window_name, object_name, row_text): """ Double click row matching given text @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type ...
[ "def", "doubleclickrow", "(", "self", ",", "window_name", ",", "object_name", ",", "row_text", ")", ":", "object_handle", "=", "self", ".", "_get_object_handle", "(", "window_name", ",", "object_name", ")", "if", "not", "object_handle", ".", "AXEnabled", ":", ...
Double click row matching given text @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's name convention, or a Unix glob. @ty...
[ "Double", "click", "row", "matching", "given", "text" ]
python
valid
radjkarl/fancyTools
fancytools/fcollections/FIFObuffer.py
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/fcollections/FIFObuffer.py#L79-L87
def splitPos(self): """return the position of where to split the array to get the values in the right order""" if self._ind < self.shape: return 0 v = int(self._splitPos) if v >= 1: self._splitPos = 0 return v
[ "def", "splitPos", "(", "self", ")", ":", "if", "self", ".", "_ind", "<", "self", ".", "shape", ":", "return", "0", "v", "=", "int", "(", "self", ".", "_splitPos", ")", "if", "v", ">=", "1", ":", "self", ".", "_splitPos", "=", "0", "return", "v...
return the position of where to split the array to get the values in the right order
[ "return", "the", "position", "of", "where", "to", "split", "the", "array", "to", "get", "the", "values", "in", "the", "right", "order" ]
python
train
mikedh/trimesh
trimesh/triangles.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/triangles.py#L34-L57
def area(triangles=None, crosses=None, sum=False): """ Calculates the sum area of input triangles Parameters ---------- triangles : (n, 3, 3) float Vertices of triangles crosses : (n, 3) float or None As a speedup don't re- compute cross products sum : bool Return summed a...
[ "def", "area", "(", "triangles", "=", "None", ",", "crosses", "=", "None", ",", "sum", "=", "False", ")", ":", "if", "crosses", "is", "None", ":", "crosses", "=", "cross", "(", "triangles", ")", "area", "=", "(", "np", ".", "sum", "(", "crosses", ...
Calculates the sum area of input triangles Parameters ---------- triangles : (n, 3, 3) float Vertices of triangles crosses : (n, 3) float or None As a speedup don't re- compute cross products sum : bool Return summed area or individual triangle area Returns ---------- ...
[ "Calculates", "the", "sum", "area", "of", "input", "triangles" ]
python
train
sernst/cauldron
cauldron/session/exposed.py
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/session/exposed.py#L41-L47
def display(self) -> typing.Union[None, report.Report]: """The display report for the current project.""" return ( self._project.current_step.report if self._project and self._project.current_step else None )
[ "def", "display", "(", "self", ")", "->", "typing", ".", "Union", "[", "None", ",", "report", ".", "Report", "]", ":", "return", "(", "self", ".", "_project", ".", "current_step", ".", "report", "if", "self", ".", "_project", "and", "self", ".", "_pr...
The display report for the current project.
[ "The", "display", "report", "for", "the", "current", "project", "." ]
python
train
senaite/senaite.core
bika/lims/idserver.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/idserver.py#L361-L367
def make_storage_key(portal_type, prefix=None): """Make a storage (dict-) key for the number generator """ key = portal_type.lower() if prefix: key = "{}-{}".format(key, prefix) return key
[ "def", "make_storage_key", "(", "portal_type", ",", "prefix", "=", "None", ")", ":", "key", "=", "portal_type", ".", "lower", "(", ")", "if", "prefix", ":", "key", "=", "\"{}-{}\"", ".", "format", "(", "key", ",", "prefix", ")", "return", "key" ]
Make a storage (dict-) key for the number generator
[ "Make", "a", "storage", "(", "dict", "-", ")", "key", "for", "the", "number", "generator" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py#L305-L317
def tacacs_server_host_port(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") tacacs_server = ET.SubElement(config, "tacacs-server", xmlns="urn:brocade.com:mgmt:brocade-aaa") host = ET.SubElement(tacacs_server, "host") hostname_key = ET.SubElement(...
[ "def", "tacacs_server_host_port", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "tacacs_server", "=", "ET", ".", "SubElement", "(", "config", ",", "\"tacacs-server\"", ",", "xmlns", "=", "\"urn...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
gwastro/pycbc
pycbc/types/timeseries.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/types/timeseries.py#L247-L306
def almost_equal_elem(self,other,tol,relative=True,dtol=0.0): """ Compare whether two time series are almost equal, element by element. If the 'relative' parameter is 'True' (the default) then the 'tol' parameter (which must be positive) is interpreted as a relative tole...
[ "def", "almost_equal_elem", "(", "self", ",", "other", ",", "tol", ",", "relative", "=", "True", ",", "dtol", "=", "0.0", ")", ":", "# Check that the delta_t tolerance is non-negative; raise an exception", "# if needed.", "if", "(", "dtol", "<", "0.0", ")", ":", ...
Compare whether two time series are almost equal, element by element. If the 'relative' parameter is 'True' (the default) then the 'tol' parameter (which must be positive) is interpreted as a relative tolerance, and the comparison returns 'True' only if abs(self[i]-other[i]) <= ...
[ "Compare", "whether", "two", "time", "series", "are", "almost", "equal", "element", "by", "element", "." ]
python
train
cloudtools/stacker
stacker/lookups/handlers/file.py
https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/file.py#L174-L201
def _parameterize_obj(obj): """Recursively parameterize all strings contained in an object. Parameterizes all values of a Mapping, all items of a Sequence, an unicode string, or pass other objects through unmodified. Byte strings will be interpreted as UTF-8. Args: obj: data to parameteri...
[ "def", "_parameterize_obj", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "Mapping", ")", ":", "return", "dict", "(", "(", "key", ",", "_parameterize_obj", "(", "value", ")", ")", "for", "key", ",", "value", "in", "obj", ".", "items", "(...
Recursively parameterize all strings contained in an object. Parameterizes all values of a Mapping, all items of a Sequence, an unicode string, or pass other objects through unmodified. Byte strings will be interpreted as UTF-8. Args: obj: data to parameterize Return: A parameter...
[ "Recursively", "parameterize", "all", "strings", "contained", "in", "an", "object", "." ]
python
train
django-salesforce/django-salesforce
salesforce/router.py
https://github.com/django-salesforce/django-salesforce/blob/6fd5643dba69d49c5881de50875cf90204a8f808/salesforce/router.py#L60-L85
def allow_migrate(self, db, app_label, model_name=None, **hints): """ Don't attempt to sync SF models to non SF databases and vice versa. """ if model_name: model = apps.get_model(app_label, model_name) else: # hints are used with less priority, because ma...
[ "def", "allow_migrate", "(", "self", ",", "db", ",", "app_label", ",", "model_name", "=", "None", ",", "*", "*", "hints", ")", ":", "if", "model_name", ":", "model", "=", "apps", ".", "get_model", "(", "app_label", ",", "model_name", ")", "else", ":", ...
Don't attempt to sync SF models to non SF databases and vice versa.
[ "Don", "t", "attempt", "to", "sync", "SF", "models", "to", "non", "SF", "databases", "and", "vice", "versa", "." ]
python
train
nerdvegas/rez
src/rez/build_system.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/build_system.py#L198-L243
def get_standard_vars(cls, context, variant, build_type, install, build_path, install_path=None): """Returns a standard set of environment variables that can be set for the build system to use """ from rez.config import config package = variant.parent ...
[ "def", "get_standard_vars", "(", "cls", ",", "context", ",", "variant", ",", "build_type", ",", "install", ",", "build_path", ",", "install_path", "=", "None", ")", ":", "from", "rez", ".", "config", "import", "config", "package", "=", "variant", ".", "par...
Returns a standard set of environment variables that can be set for the build system to use
[ "Returns", "a", "standard", "set", "of", "environment", "variables", "that", "can", "be", "set", "for", "the", "build", "system", "to", "use" ]
python
train
dagster-io/dagster
python_modules/dagster/dagster/core/events/logging.py
https://github.com/dagster-io/dagster/blob/4119f8c773089de64831b1dfb9e168e353d401dc/python_modules/dagster/dagster/core/events/logging.py#L149-L167
def construct_json_event_logger(json_path): '''Record a stream of event records to json''' check.str_param(json_path, 'json_path') return construct_single_handler_logger( "json-event-record-logger", DEBUG, JsonEventLoggerHandler( json_path, lambda record: cons...
[ "def", "construct_json_event_logger", "(", "json_path", ")", ":", "check", ".", "str_param", "(", "json_path", ",", "'json_path'", ")", "return", "construct_single_handler_logger", "(", "\"json-event-record-logger\"", ",", "DEBUG", ",", "JsonEventLoggerHandler", "(", "j...
Record a stream of event records to json
[ "Record", "a", "stream", "of", "event", "records", "to", "json" ]
python
test
dnanexus/dx-toolkit
src/python/dxpy/api.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1361-L1367
def user_update(object_id, input_params={}, always_retry=False, **kwargs): """ Invokes the /user-xxxx/update API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate """ return DXHTTPRequest('/%s/update' % object_id, input_params, ...
[ "def", "user_update", "(", "object_id", ",", "input_params", "=", "{", "}", ",", "always_retry", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "DXHTTPRequest", "(", "'/%s/update'", "%", "object_id", ",", "input_params", ",", "always_retry", "=",...
Invokes the /user-xxxx/update API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate
[ "Invokes", "the", "/", "user", "-", "xxxx", "/", "update", "API", "method", "." ]
python
train
garenchan/policy
setup.py
https://github.com/garenchan/policy/blob/7709ae5f371146f8c90380d0877a5e59d731f644/setup.py#L61-L68
def get_install_requires(): """return package's install requires""" base = os.path.abspath(os.path.dirname(__file__)) requirements_file = os.path.join(base, 'requirements.txt') if not os.path.exists(requirements_file): return [] with open(requirements_file, mode='rt', encoding='utf-8') as f:...
[ "def", "get_install_requires", "(", ")", ":", "base", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "requirements_file", "=", "os", ".", "path", ".", "join", "(", "base", ",", "'requirements....
return package's install requires
[ "return", "package", "s", "install", "requires" ]
python
train
flipagram/smarterling
smarterling/__init__.py
https://github.com/flipagram/smarterling/blob/2ea0957edad0657ba4c54280796869ffc1031b11/smarterling/__init__.py#L25-L33
def get(self, key, default_val=None, require_value=False): """ Returns a dictionary value """ val = dict.get(self, key, default_val) if val is None and require_value: raise KeyError('key "%s" not found' % key) if isinstance(val, dict): return AttributeDict...
[ "def", "get", "(", "self", ",", "key", ",", "default_val", "=", "None", ",", "require_value", "=", "False", ")", ":", "val", "=", "dict", ".", "get", "(", "self", ",", "key", ",", "default_val", ")", "if", "val", "is", "None", "and", "require_value",...
Returns a dictionary value
[ "Returns", "a", "dictionary", "value" ]
python
train
twilio/twilio-python
twilio/rest/serverless/v1/service/asset/asset_version.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/serverless/v1/service/asset/asset_version.py#L209-L223
def get_instance(self, payload): """ Build an instance of AssetVersionInstance :param dict payload: Payload response from the API :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance :rtype: twilio.rest.serverless.v1.service.asset.asset_version.A...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "AssetVersionInstance", "(", "self", ".", "_version", ",", "payload", ",", "service_sid", "=", "self", ".", "_solution", "[", "'service_sid'", "]", ",", "asset_sid", "=", "self", ".", ...
Build an instance of AssetVersionInstance :param dict payload: Payload response from the API :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance
[ "Build", "an", "instance", "of", "AssetVersionInstance" ]
python
train
fr33jc/bang
bang/providers/hpcloud/__init__.py
https://github.com/fr33jc/bang/blob/8f000713f88d2a9a8c1193b63ca10a6578560c16/bang/providers/hpcloud/__init__.py#L29-L104
def create_db(self, instance_name, instance_type, admin_username, admin_password, security_groups=None, db_name=None, storage_size_gb=DEFAULT_STORAGE_SIZE_GB, timeout_s=DEFAULT_TIMEOUT_S): """ Creates a database instance. This method blocks until the db insta...
[ "def", "create_db", "(", "self", ",", "instance_name", ",", "instance_type", ",", "admin_username", ",", "admin_password", ",", "security_groups", "=", "None", ",", "db_name", "=", "None", ",", "storage_size_gb", "=", "DEFAULT_STORAGE_SIZE_GB", ",", "timeout_s", "...
Creates a database instance. This method blocks until the db instance is active, or until :attr:`timeout_s` has elapsed. By default, hpcloud *assigns* an automatically-generated set of credentials for an admin user. In addition to launching the db instance, this method uses th...
[ "Creates", "a", "database", "instance", "." ]
python
train
BerkeleyAutomation/perception
perception/orthographic_intrinsics.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L144-L191
def project_to_image(self, point_cloud, round_px=True): """Projects a point cloud onto the camera image plane and creates a depth image. Zero depth means no point projected into the camera at that pixel location (i.e. infinite depth). Parameters ---------- point_cloud : ...
[ "def", "project_to_image", "(", "self", ",", "point_cloud", ",", "round_px", "=", "True", ")", ":", "if", "not", "isinstance", "(", "point_cloud", ",", "PointCloud", ")", "and", "not", "(", "isinstance", "(", "point_cloud", ",", "Point", ")", "and", "point...
Projects a point cloud onto the camera image plane and creates a depth image. Zero depth means no point projected into the camera at that pixel location (i.e. infinite depth). Parameters ---------- point_cloud : :obj:`autolab_core.PointCloud` or :obj:`autolab_core.Point` ...
[ "Projects", "a", "point", "cloud", "onto", "the", "camera", "image", "plane", "and", "creates", "a", "depth", "image", ".", "Zero", "depth", "means", "no", "point", "projected", "into", "the", "camera", "at", "that", "pixel", "location", "(", "i", ".", "...
python
train
IBMStreams/pypi.streamsx
streamsx/rest_primitives.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest_primitives.py#L2465-L2488
def update(self, properties=None, description=None): """Update this application configuration. To create or update a property provide its key-value pair in `properties`. To delete a property provide its key with the value ``None`` in properties. Args: prope...
[ "def", "update", "(", "self", ",", "properties", "=", "None", ",", "description", "=", "None", ")", ":", "cv", "=", "ApplicationConfiguration", ".", "_props", "(", "properties", "=", "properties", ",", "description", "=", "description", ")", "res", "=", "s...
Update this application configuration. To create or update a property provide its key-value pair in `properties`. To delete a property provide its key with the value ``None`` in properties. Args: properties (dict): Property values to be updated. If ``None`` the pro...
[ "Update", "this", "application", "configuration", "." ]
python
train
ReadabilityHoldings/python-readability-api
readability/clients.py
https://github.com/ReadabilityHoldings/python-readability-api/blob/4b746166877d5a8dc29222aedccb18c2506a5385/readability/clients.py#L128-L152
def get_bookmarks(self, **filters): """ Get Bookmarks for the current user. Filters: :param archive: Filter Bookmarks returned by archived status. :param favorite: Filter Bookmarks returned by favorite status. :param domain: Filter Bookmarks returned by a domain. ...
[ "def", "get_bookmarks", "(", "self", ",", "*", "*", "filters", ")", ":", "filter_dict", "=", "filter_args_to_dict", "(", "filters", ",", "ACCEPTED_BOOKMARK_FILTERS", ")", "url", "=", "self", ".", "_generate_url", "(", "'bookmarks'", ",", "query_params", "=", "...
Get Bookmarks for the current user. Filters: :param archive: Filter Bookmarks returned by archived status. :param favorite: Filter Bookmarks returned by favorite status. :param domain: Filter Bookmarks returned by a domain. :param added_since: Filter bookmarks by date added (si...
[ "Get", "Bookmarks", "for", "the", "current", "user", "." ]
python
train
ContextLab/hypertools
hypertools/tools/format_data.py
https://github.com/ContextLab/hypertools/blob/b76c7ac8061998b560e969ff8e4f4c915088e7a0/hypertools/tools/format_data.py#L10-L164
def format_data(x, vectorizer='CountVectorizer', semantic='LatentDirichletAllocation', corpus='wiki', ppca=True, text_align='hyper'): """ Formats data into a list of numpy arrays This function is useful to identify rows of your array that contain missing data or nans. The returned indi...
[ "def", "format_data", "(", "x", ",", "vectorizer", "=", "'CountVectorizer'", ",", "semantic", "=", "'LatentDirichletAllocation'", ",", "corpus", "=", "'wiki'", ",", "ppca", "=", "True", ",", "text_align", "=", "'hyper'", ")", ":", "# not sure why i needed to impor...
Formats data into a list of numpy arrays This function is useful to identify rows of your array that contain missing data or nans. The returned indices can be used to remove the rows with missing data, or label the missing data points that are interpolated using PPCA. Parameters ---------- ...
[ "Formats", "data", "into", "a", "list", "of", "numpy", "arrays" ]
python
train
thiagopbueno/tf-rddlsim
tfrddlsim/policy/random_policy.py
https://github.com/thiagopbueno/tf-rddlsim/blob/d7102a0ad37d179dbb23141640254ea383d3b43f/tfrddlsim/policy/random_policy.py#L70-L86
def _sample_actions(self, state: Sequence[tf.Tensor]) -> Tuple[Sequence[tf.Tensor], tf.Tensor, tf.Tensor]: '''Returns sampled action fluents and tensors related to the sampling. Args: state (Sequence[tf.Tensor]): A list of state fluents. Returns: Tuple[Seque...
[ "def", "_sample_actions", "(", "self", ",", "state", ":", "Sequence", "[", "tf", ".", "Tensor", "]", ")", "->", "Tuple", "[", "Sequence", "[", "tf", ".", "Tensor", "]", ",", "tf", ".", "Tensor", ",", "tf", ".", "Tensor", "]", ":", "default", "=", ...
Returns sampled action fluents and tensors related to the sampling. Args: state (Sequence[tf.Tensor]): A list of state fluents. Returns: Tuple[Sequence[tf.Tensor], tf.Tensor, tf.Tensor]: A tuple with action fluents, an integer tensor for the number of samples, and ...
[ "Returns", "sampled", "action", "fluents", "and", "tensors", "related", "to", "the", "sampling", "." ]
python
train
wolfhong/formic
formic/formic.py
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L835-L857
def match(self, files): """Given a set of files in this directory, returns all the files that match the :class:`Pattern` instances which match this directory.""" if not files: return set() if (self.matched_inherit.all_files() or self.matched_and_subdir.all_fi...
[ "def", "match", "(", "self", ",", "files", ")", ":", "if", "not", "files", ":", "return", "set", "(", ")", "if", "(", "self", ".", "matched_inherit", ".", "all_files", "(", ")", "or", "self", ".", "matched_and_subdir", ".", "all_files", "(", ")", "or...
Given a set of files in this directory, returns all the files that match the :class:`Pattern` instances which match this directory.
[ "Given", "a", "set", "of", "files", "in", "this", "directory", "returns", "all", "the", "files", "that", "match", "the", ":", "class", ":", "Pattern", "instances", "which", "match", "this", "directory", "." ]
python
train
20c/vaping
vaping/config.py
https://github.com/20c/vaping/blob/c51f00586c99edb3d51e4abdbdfe3174755533ee/vaping/config.py#L8-L33
def parse_interval(val): """ converts a string to float of seconds .5 = 500ms 90 = 1m30s """ re_intv = re.compile(r"([\d\.]+)([a-zA-Z]+)") val = val.strip() total = 0.0 for match in re_intv.findall(val): unit = match[1] count = float(match[0]) if unit...
[ "def", "parse_interval", "(", "val", ")", ":", "re_intv", "=", "re", ".", "compile", "(", "r\"([\\d\\.]+)([a-zA-Z]+)\"", ")", "val", "=", "val", ".", "strip", "(", ")", "total", "=", "0.0", "for", "match", "in", "re_intv", ".", "findall", "(", "val", "...
converts a string to float of seconds .5 = 500ms 90 = 1m30s
[ "converts", "a", "string", "to", "float", "of", "seconds", ".", "5", "=", "500ms", "90", "=", "1m30s" ]
python
train
awesto/djangoshop-stripe
shop_stripe/payment.py
https://github.com/awesto/djangoshop-stripe/blob/010d4642f971961cfeb415520ad819b3751281cb/shop_stripe/payment.py#L28-L38
def get_payment_request(self, cart, request): """ From the given request, add a snippet to the page. """ try: self.charge(cart, request) thank_you_url = OrderModel.objects.get_latest_url() js_expression = 'window.location.href="{}";'.format(thank_you_u...
[ "def", "get_payment_request", "(", "self", ",", "cart", ",", "request", ")", ":", "try", ":", "self", ".", "charge", "(", "cart", ",", "request", ")", "thank_you_url", "=", "OrderModel", ".", "objects", ".", "get_latest_url", "(", ")", "js_expression", "="...
From the given request, add a snippet to the page.
[ "From", "the", "given", "request", "add", "a", "snippet", "to", "the", "page", "." ]
python
train
KnorrFG/pyparadigm
pyparadigm/surface_composition.py
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L264-L282
def from_scale(scale_w, scale_h=None): """Creates a padding by the remaining space after scaling the content. E.g. Padding.from_scale(0.5) would produce Padding(0.25, 0.25, 0.25, 0.25) and Padding.from_scale(0.5, 1) would produce Padding(0.25, 0.25, 0, 0) because the content would not b...
[ "def", "from_scale", "(", "scale_w", ",", "scale_h", "=", "None", ")", ":", "if", "not", "scale_h", ":", "scale_h", "=", "scale_w", "w_padding", "=", "[", "(", "1", "-", "scale_w", ")", "*", "0.5", "]", "*", "2", "h_padding", "=", "[", "(", "1", ...
Creates a padding by the remaining space after scaling the content. E.g. Padding.from_scale(0.5) would produce Padding(0.25, 0.25, 0.25, 0.25) and Padding.from_scale(0.5, 1) would produce Padding(0.25, 0.25, 0, 0) because the content would not be scaled (since scale_h=1) and therefore t...
[ "Creates", "a", "padding", "by", "the", "remaining", "space", "after", "scaling", "the", "content", "." ]
python
train
twilio/twilio-python
twilio/rest/api/v2010/account/connect_app.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/connect_app.py#L231-L273
def update(self, authorize_redirect_url=values.unset, company_name=values.unset, deauthorize_callback_method=values.unset, deauthorize_callback_url=values.unset, description=values.unset, friendly_name=values.unset, homepage_url=values.unset, permissions=value...
[ "def", "update", "(", "self", ",", "authorize_redirect_url", "=", "values", ".", "unset", ",", "company_name", "=", "values", ".", "unset", ",", "deauthorize_callback_method", "=", "values", ".", "unset", ",", "deauthorize_callback_url", "=", "values", ".", "uns...
Update the ConnectAppInstance :param unicode authorize_redirect_url: The URL to redirect the user to after authorization :param unicode company_name: The company name to set for the Connect App :param unicode deauthorize_callback_method: The HTTP method to use when calling deauthorize_callback_...
[ "Update", "the", "ConnectAppInstance" ]
python
train
mozilla/elasticutils
elasticutils/contrib/django/__init__.py
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/contrib/django/__init__.py#L298-L310
def get_indexable(cls): """Returns the queryset of ids of all things to be indexed. Defaults to:: cls.get_model().objects.order_by('id').values_list( 'id', flat=True) :returns: iterable of ids of objects to be indexed """ model = cls.get_model() ...
[ "def", "get_indexable", "(", "cls", ")", ":", "model", "=", "cls", ".", "get_model", "(", ")", "return", "model", ".", "objects", ".", "order_by", "(", "'id'", ")", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")" ]
Returns the queryset of ids of all things to be indexed. Defaults to:: cls.get_model().objects.order_by('id').values_list( 'id', flat=True) :returns: iterable of ids of objects to be indexed
[ "Returns", "the", "queryset", "of", "ids", "of", "all", "things", "to", "be", "indexed", "." ]
python
train
williamgilpin/pypdb
pypdb/pypdb.py
https://github.com/williamgilpin/pypdb/blob/bfb9e1b15b4ad097c5add50c4c176ac6cb28ee15/pypdb/pypdb.py#L313-L341
def get_info(pdb_id, url_root='http://www.rcsb.org/pdb/rest/describeMol?structureId='): '''Look up all information about a given PDB ID Parameters ---------- pdb_id : string A 4 character string giving a pdb entry of interest url_root : string The string root of the specific url f...
[ "def", "get_info", "(", "pdb_id", ",", "url_root", "=", "'http://www.rcsb.org/pdb/rest/describeMol?structureId='", ")", ":", "url", "=", "url_root", "+", "pdb_id", "req", "=", "urllib", ".", "request", ".", "Request", "(", "url", ")", "f", "=", "urllib", ".", ...
Look up all information about a given PDB ID Parameters ---------- pdb_id : string A 4 character string giving a pdb entry of interest url_root : string The string root of the specific url for the request type Returns ------- out : OrderedDict An ordered dictiona...
[ "Look", "up", "all", "information", "about", "a", "given", "PDB", "ID" ]
python
train
twilio/twilio-python
twilio/rest/ip_messaging/v1/service/channel/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/ip_messaging/v1/service/channel/__init__.py#L317-L330
def members(self): """ Access the members :returns: twilio.rest.chat.v1.service.channel.member.MemberList :rtype: twilio.rest.chat.v1.service.channel.member.MemberList """ if self._members is None: self._members = MemberList( self._version, ...
[ "def", "members", "(", "self", ")", ":", "if", "self", ".", "_members", "is", "None", ":", "self", ".", "_members", "=", "MemberList", "(", "self", ".", "_version", ",", "service_sid", "=", "self", ".", "_solution", "[", "'service_sid'", "]", ",", "cha...
Access the members :returns: twilio.rest.chat.v1.service.channel.member.MemberList :rtype: twilio.rest.chat.v1.service.channel.member.MemberList
[ "Access", "the", "members" ]
python
train
saltstack/salt
salt/utils/vmware.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L1155-L1181
def update_dvs(dvs_ref, dvs_config_spec): ''' Updates a distributed virtual switch with the config_spec. dvs_ref The DVS reference. dvs_config_spec The updated config spec (vim.VMwareDVSConfigSpec) to be applied to the DVS. ''' dvs_name = get_managed_object_name(dvs_ref...
[ "def", "update_dvs", "(", "dvs_ref", ",", "dvs_config_spec", ")", ":", "dvs_name", "=", "get_managed_object_name", "(", "dvs_ref", ")", "log", ".", "trace", "(", "'Updating dvs \\'%s\\''", ",", "dvs_name", ")", "try", ":", "task", "=", "dvs_ref", ".", "Reconfi...
Updates a distributed virtual switch with the config_spec. dvs_ref The DVS reference. dvs_config_spec The updated config spec (vim.VMwareDVSConfigSpec) to be applied to the DVS.
[ "Updates", "a", "distributed", "virtual", "switch", "with", "the", "config_spec", "." ]
python
train
wrboyce/telegrambot
telegrambot/api/__init__.py
https://github.com/wrboyce/telegrambot/blob/c35ce19886df4c306a2a19851cc1f63e3066d70d/telegrambot/api/__init__.py#L201-L208
def set_web_hook(self, url=None, certificate=None): """ Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update...
[ "def", "set_web_hook", "(", "self", ",", "url", "=", "None", ",", "certificate", "=", "None", ")", ":", "payload", "=", "dict", "(", "url", "=", "url", ",", "certificate", "=", "certificate", ")", "return", "self", ".", "_get", "(", "'setWebHook'", ","...
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amo...
[ "Use", "this", "method", "to", "specify", "a", "url", "and", "receive", "incoming", "updates", "via", "an", "outgoing", "webhook", ".", "Whenever", "there", "is", "an", "update", "for", "the", "bot", "we", "will", "send", "an", "HTTPS", "POST", "request", ...
python
train
loli/medpy
medpy/io/save.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/medpy/io/save.py#L33-L120
def save(arr, filename, hdr = False, force = True, use_compression = False): r""" Save the image ``arr`` as filename using information encoded in ``hdr``. The target image format is determined by the ``filename`` suffix. If the ``force`` parameter is set to true, an already existing image is overwritten...
[ "def", "save", "(", "arr", ",", "filename", ",", "hdr", "=", "False", ",", "force", "=", "True", ",", "use_compression", "=", "False", ")", ":", "logger", "=", "Logger", ".", "getInstance", "(", ")", "logger", ".", "info", "(", "'Saving image as {}...'",...
r""" Save the image ``arr`` as filename using information encoded in ``hdr``. The target image format is determined by the ``filename`` suffix. If the ``force`` parameter is set to true, an already existing image is overwritten silently. Otherwise an error is thrown. The header (``hdr``) object is ...
[ "r", "Save", "the", "image", "arr", "as", "filename", "using", "information", "encoded", "in", "hdr", ".", "The", "target", "image", "format", "is", "determined", "by", "the", "filename", "suffix", ".", "If", "the", "force", "parameter", "is", "set", "to",...
python
train
great-expectations/great_expectations
great_expectations/cli.py
https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/cli.py#L55-L112
def validate(parsed_args): """ Read a dataset file and validate it using a config saved in another file. Uses parameters defined in the dispatch method. :param parsed_args: A Namespace object containing parsed arguments from the dispatch method. :return: The number of unsucessful expectations "...
[ "def", "validate", "(", "parsed_args", ")", ":", "parsed_args", "=", "vars", "(", "parsed_args", ")", "data_set", "=", "parsed_args", "[", "'dataset'", "]", "expectations_config_file", "=", "parsed_args", "[", "'expectations_config_file'", "]", "expectations_config", ...
Read a dataset file and validate it using a config saved in another file. Uses parameters defined in the dispatch method. :param parsed_args: A Namespace object containing parsed arguments from the dispatch method. :return: The number of unsucessful expectations
[ "Read", "a", "dataset", "file", "and", "validate", "it", "using", "a", "config", "saved", "in", "another", "file", ".", "Uses", "parameters", "defined", "in", "the", "dispatch", "method", "." ]
python
train
bids-standard/pybids
bids/utils.py
https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/utils.py#L29-L41
def natural_sort(l, field=None): ''' based on snippet found at http://stackoverflow.com/a/4836734/2445984 ''' convert = lambda text: int(text) if text.isdigit() else text.lower() def alphanum_key(key): if field is not None: key = getattr(key, field) if not isinstance(key...
[ "def", "natural_sort", "(", "l", ",", "field", "=", "None", ")", ":", "convert", "=", "lambda", "text", ":", "int", "(", "text", ")", "if", "text", ".", "isdigit", "(", ")", "else", "text", ".", "lower", "(", ")", "def", "alphanum_key", "(", "key",...
based on snippet found at http://stackoverflow.com/a/4836734/2445984
[ "based", "on", "snippet", "found", "at", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "4836734", "/", "2445984" ]
python
train
maas/python-libmaas
maas/client/viscera/ipranges.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/viscera/ipranges.py#L31-L74
async def create( cls, start_ip: str, end_ip: str, *, type: IPRangeType = IPRangeType.RESERVED, comment: str = None, subnet: Union[Subnet, int] = None): """ Create a `IPRange` in MAAS. :param start_ip: First IP address in the range (required). :type s...
[ "async", "def", "create", "(", "cls", ",", "start_ip", ":", "str", ",", "end_ip", ":", "str", ",", "*", ",", "type", ":", "IPRangeType", "=", "IPRangeType", ".", "RESERVED", ",", "comment", ":", "str", "=", "None", ",", "subnet", ":", "Union", "[", ...
Create a `IPRange` in MAAS. :param start_ip: First IP address in the range (required). :type start_ip: `str` :parma end_ip: Last IP address in the range (required). :type end_ip: `str` :param type: Type of IP address range (optional). :type type: `IPRangeType` :p...
[ "Create", "a", "IPRange", "in", "MAAS", "." ]
python
train
quantopian/empyrical
empyrical/utils.py
https://github.com/quantopian/empyrical/blob/badbdca75f5b293f28b5e947974894de041d6868/empyrical/utils.py#L349-L375
def load_portfolio_risk_factors(filepath_prefix=None, start=None, end=None): """ Load risk factors Mkt-Rf, SMB, HML, Rf, and UMD. Data is stored in HDF5 file. If the data is more than 2 days old, redownload from Dartmouth. Returns ------- five_factors : pd.DataFrame Risk factors time...
[ "def", "load_portfolio_risk_factors", "(", "filepath_prefix", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "if", "start", "is", "None", ":", "start", "=", "'1/1/1970'", "if", "end", "is", "None", ":", "end", "=", "_1_bday_ag...
Load risk factors Mkt-Rf, SMB, HML, Rf, and UMD. Data is stored in HDF5 file. If the data is more than 2 days old, redownload from Dartmouth. Returns ------- five_factors : pd.DataFrame Risk factors timeseries.
[ "Load", "risk", "factors", "Mkt", "-", "Rf", "SMB", "HML", "Rf", "and", "UMD", ".", "Data", "is", "stored", "in", "HDF5", "file", ".", "If", "the", "data", "is", "more", "than", "2", "days", "old", "redownload", "from", "Dartmouth", ".", "Returns", "...
python
train
tradenity/python-sdk
tradenity/resources/free_item_coupon.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/free_item_coupon.py#L531-L551
def delete_free_item_coupon_by_id(cls, free_item_coupon_id, **kwargs): """Delete FreeItemCoupon Delete an instance of FreeItemCoupon by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api....
[ "def", "delete_free_item_coupon_by_id", "(", "cls", ",", "free_item_coupon_id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_dele...
Delete FreeItemCoupon Delete an instance of FreeItemCoupon by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_free_item_coupon_by_id(free_item_coupon_id, async=True) >>> result ...
[ "Delete", "FreeItemCoupon" ]
python
train
pydata/xarray
xarray/core/dataset.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L1547-L1588
def _get_indexers_coords_and_indexes(self, indexers): """ Extract coordinates from indexers. Returns an OrderedDict mapping from coordinate name to the coordinate variable. Only coordinate with a name different from any of self.variables will be attached. """ fr...
[ "def", "_get_indexers_coords_and_indexes", "(", "self", ",", "indexers", ")", ":", "from", ".", "dataarray", "import", "DataArray", "coord_list", "=", "[", "]", "indexes", "=", "OrderedDict", "(", ")", "for", "k", ",", "v", "in", "indexers", ".", "items", ...
Extract coordinates from indexers. Returns an OrderedDict mapping from coordinate name to the coordinate variable. Only coordinate with a name different from any of self.variables will be attached.
[ "Extract", "coordinates", "from", "indexers", ".", "Returns", "an", "OrderedDict", "mapping", "from", "coordinate", "name", "to", "the", "coordinate", "variable", "." ]
python
train
mikekatz04/BOWIE
bowie/plotutils/forminput.py
https://github.com/mikekatz04/BOWIE/blob/a941342a3536cb57c817a1643896d99a3f354a86/bowie/plotutils/forminput.py#L503-L571
def add_dataset(self, name=None, label=None, x_column_label=None, y_column_label=None, index=None, control=False): """Add a dataset to a specific plot. This method adds a dataset to a plot. Its functional use is imperative to the plot generation. It handles adding new files ...
[ "def", "add_dataset", "(", "self", ",", "name", "=", "None", ",", "label", "=", "None", ",", "x_column_label", "=", "None", ",", "y_column_label", "=", "None", ",", "index", "=", "None", ",", "control", "=", "False", ")", ":", "if", "name", "is", "No...
Add a dataset to a specific plot. This method adds a dataset to a plot. Its functional use is imperative to the plot generation. It handles adding new files as well as indexing to files that are added to other plots. All Args default to None. However, these are note the defaults ...
[ "Add", "a", "dataset", "to", "a", "specific", "plot", "." ]
python
train
TeamHG-Memex/tensorboard_logger
tensorboard_logger/tensorboard_logger.py
https://github.com/TeamHG-Memex/tensorboard_logger/blob/93968344a471532530f035622118693845f32649/tensorboard_logger/tensorboard_logger.py#L71-L92
def log_value(self, name, value, step=None): """Log new value for given name on given step. Args: name (str): name of the variable (it will be converted to a valid tensorflow summary name). value (float): this is a real number to be logged as a scalar. ...
[ "def", "log_value", "(", "self", ",", "name", ",", "value", ",", "step", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "'\"value\" should be a number, got {}'", ".", "format", ...
Log new value for given name on given step. Args: name (str): name of the variable (it will be converted to a valid tensorflow summary name). value (float): this is a real number to be logged as a scalar. step (int): non-negative integer used for visualizatio...
[ "Log", "new", "value", "for", "given", "name", "on", "given", "step", "." ]
python
train
frictionlessdata/datapackage-py
datapackage/registry.py
https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/registry.py#L129-L135
def _get_absolute_path(self, relative_path): '''str: Return the received relative_path joined with the base path (None if there were some error).''' try: return os.path.join(self.base_path, relative_path) except (AttributeError, TypeError): pass
[ "def", "_get_absolute_path", "(", "self", ",", "relative_path", ")", ":", "try", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "base_path", ",", "relative_path", ")", "except", "(", "AttributeError", ",", "TypeError", ")", ":", "pass" ]
str: Return the received relative_path joined with the base path (None if there were some error).
[ "str", ":", "Return", "the", "received", "relative_path", "joined", "with", "the", "base", "path", "(", "None", "if", "there", "were", "some", "error", ")", "." ]
python
valid
acutesoftware/AIKIF
aikif/index.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/index.py#L26-L58
def index(): """ main function - outputs in following format BEFORE consolidation (which is TODO) # filename, word, linenumbers # refAction.csv, ActionTypeName, 1 # refAction.csv, PhysicalType, 1 # goals.csv, Cleanliness, 11 """ lg = mod_log.Log(mod_cf...
[ "def", "index", "(", ")", ":", "lg", "=", "mod_log", ".", "Log", "(", "mod_cfg", ".", "fldrs", "[", "'localPath'", "]", ")", "lg", ".", "record_command", "(", "'Starting indexing'", ",", "'index.py'", ")", "# sys.modules[self.__module__].__file__)", "if", "sil...
main function - outputs in following format BEFORE consolidation (which is TODO) # filename, word, linenumbers # refAction.csv, ActionTypeName, 1 # refAction.csv, PhysicalType, 1 # goals.csv, Cleanliness, 11
[ "main", "function", "-", "outputs", "in", "following", "format", "BEFORE", "consolidation", "(", "which", "is", "TODO", ")", "#", "filename", "word", "linenumbers", "#", "refAction", ".", "csv", "ActionTypeName", "1", "#", "refAction", ".", "csv", "PhysicalTyp...
python
train
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L120-L132
def attach_issue(context, id, url): """attach_issue(context, id, url) Attach an issue to a job. >>> dcictl job-attach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string url: URL of the issue to attach to the job [required] """ result = job.att...
[ "def", "attach_issue", "(", "context", ",", "id", ",", "url", ")", ":", "result", "=", "job", ".", "attach_issue", "(", "context", ",", "id", "=", "id", ",", "url", "=", "url", ")", "utils", ".", "format_output", "(", "result", ",", "context", ".", ...
attach_issue(context, id, url) Attach an issue to a job. >>> dcictl job-attach-issue [OPTIONS] :param string id: ID of the job to attach the issue to [required] :param string url: URL of the issue to attach to the job [required]
[ "attach_issue", "(", "context", "id", "url", ")" ]
python
train
ethereum/py-evm
eth/db/journal.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/db/journal.py#L93-L109
def record_changeset(self, custom_changeset_id: uuid.UUID = None) -> uuid.UUID: """ Creates a new changeset. Changesets are referenced by a random uuid4 to prevent collisions between multiple changesets. """ if custom_changeset_id is not None: if custom_changeset_id i...
[ "def", "record_changeset", "(", "self", ",", "custom_changeset_id", ":", "uuid", ".", "UUID", "=", "None", ")", "->", "uuid", ".", "UUID", ":", "if", "custom_changeset_id", "is", "not", "None", ":", "if", "custom_changeset_id", "in", "self", ".", "journal_da...
Creates a new changeset. Changesets are referenced by a random uuid4 to prevent collisions between multiple changesets.
[ "Creates", "a", "new", "changeset", ".", "Changesets", "are", "referenced", "by", "a", "random", "uuid4", "to", "prevent", "collisions", "between", "multiple", "changesets", "." ]
python
train
optimizely/python-sdk
optimizely/helpers/condition_tree_evaluator.py
https://github.com/optimizely/python-sdk/blob/ec028d9efcf22498c3820f2650fa10f5c30bec90/optimizely/helpers/condition_tree_evaluator.py#L17-L40
def and_evaluator(conditions, leaf_evaluator): """ Evaluates a list of conditions as if the evaluator had been applied to each entry and the results AND-ed together. Args: conditions: List of conditions ex: [operand_1, operand_2]. leaf_evaluator: Function which will be called to evaluate leaf condition v...
[ "def", "and_evaluator", "(", "conditions", ",", "leaf_evaluator", ")", ":", "saw_null_result", "=", "False", "for", "condition", "in", "conditions", ":", "result", "=", "evaluate", "(", "condition", ",", "leaf_evaluator", ")", "if", "result", "is", "False", ":...
Evaluates a list of conditions as if the evaluator had been applied to each entry and the results AND-ed together. Args: conditions: List of conditions ex: [operand_1, operand_2]. leaf_evaluator: Function which will be called to evaluate leaf condition values. Returns: Boolean: - True if all o...
[ "Evaluates", "a", "list", "of", "conditions", "as", "if", "the", "evaluator", "had", "been", "applied", "to", "each", "entry", "and", "the", "results", "AND", "-", "ed", "together", "." ]
python
train
tritemio/PyBroMo
pybromo/diffusion.py
https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L863-L990
def simulate_timestamps_mix_da(self, max_rates_d, max_rates_a, populations, bg_rate_d, bg_rate_a, rs=None, seed=1, chunksize=2**16, comp_filter=None, overwrite=False, skip_existing...
[ "def", "simulate_timestamps_mix_da", "(", "self", ",", "max_rates_d", ",", "max_rates_a", ",", "populations", ",", "bg_rate_d", ",", "bg_rate_a", ",", "rs", "=", "None", ",", "seed", "=", "1", ",", "chunksize", "=", "2", "**", "16", ",", "comp_filter", "="...
Compute D and A timestamps arrays for a mixture of N populations. This method reads the emission from disk once, and generates a pair of timestamps arrays (e.g. donor and acceptor) from each chunk. Timestamp data are saved to disk and accessible as pytables arrays in `._timestamps_d/a`...
[ "Compute", "D", "and", "A", "timestamps", "arrays", "for", "a", "mixture", "of", "N", "populations", "." ]
python
valid
prompt-toolkit/pymux
pymux/main.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/main.py#L201-L227
def sync_focus(self, *_): """ Focus the focused window from the pymux arrangement. """ # Pop-up displayed? if self.display_popup: self.app.layout.focus(self.layout_manager.popup_dialog) return # Confirm. if self.confirm_text: r...
[ "def", "sync_focus", "(", "self", ",", "*", "_", ")", ":", "# Pop-up displayed?", "if", "self", ".", "display_popup", ":", "self", ".", "app", ".", "layout", ".", "focus", "(", "self", ".", "layout_manager", ".", "popup_dialog", ")", "return", "# Confirm."...
Focus the focused window from the pymux arrangement.
[ "Focus", "the", "focused", "window", "from", "the", "pymux", "arrangement", "." ]
python
train
mar10/wsgidav
wsgidav/util.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/util.py#L1103-L1185
def evaluate_http_conditionals(dav_res, last_modified, entitytag, environ): """Handle 'If-...:' headers (but not 'If:' header). If-Match @see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24 Only perform the action if the client supplied entity matches the same entity on...
[ "def", "evaluate_http_conditionals", "(", "dav_res", ",", "last_modified", ",", "entitytag", ",", "environ", ")", ":", "if", "not", "dav_res", ":", "return", "# Conditions", "# An HTTP/1.1 origin server, upon receiving a conditional request that includes both a", "# Last-Modifi...
Handle 'If-...:' headers (but not 'If:' header). If-Match @see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24 Only perform the action if the client supplied entity matches the same entity on the server. This is mainly for methods like PUT to only update a resource ...
[ "Handle", "If", "-", "...", ":", "headers", "(", "but", "not", "If", ":", "header", ")", "." ]
python
valid
gwastro/pycbc
pycbc/inference/io/base_hdf.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/io/base_hdf.py#L554-L568
def write_injections(self, injection_file): """Writes injection parameters from the given injection file. Everything in the injection file is copied to ``injections_group``. Parameters ---------- injection_file : str Path to HDF injection file. """ t...
[ "def", "write_injections", "(", "self", ",", "injection_file", ")", ":", "try", ":", "with", "h5py", ".", "File", "(", "injection_file", ",", "\"r\"", ")", "as", "fp", ":", "super", "(", "BaseInferenceFile", ",", "self", ")", ".", "copy", "(", "fp", ",...
Writes injection parameters from the given injection file. Everything in the injection file is copied to ``injections_group``. Parameters ---------- injection_file : str Path to HDF injection file.
[ "Writes", "injection", "parameters", "from", "the", "given", "injection", "file", "." ]
python
train
gtaylor/django-dynamodb-sessions
dynamodb_sessions/backends/dynamodb.py
https://github.com/gtaylor/django-dynamodb-sessions/blob/434031aa483b26b0b7b5acbdf683bbe1575956f1/dynamodb_sessions/backends/dynamodb.py#L136-L179
def save(self, must_create=False): """ Saves the current session data to the database. :keyword bool must_create: If ``True``, a ``CreateError`` exception will be raised if the saving operation doesn't create a *new* entry (as opposed to possibly updating an existing ent...
[ "def", "save", "(", "self", ",", "must_create", "=", "False", ")", ":", "# If the save method is called with must_create equal to True, I'm", "# setting self._session_key equal to None and when", "# self.get_or_create_session_key is called the new", "# session_key will be created.", "if"...
Saves the current session data to the database. :keyword bool must_create: If ``True``, a ``CreateError`` exception will be raised if the saving operation doesn't create a *new* entry (as opposed to possibly updating an existing entry). :raises: ``CreateError`` if ``must_create`...
[ "Saves", "the", "current", "session", "data", "to", "the", "database", "." ]
python
train
resync/resync
resync/dump.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/dump.py#L188-L197
def archive_path(self, real_path): """Return the archive path for file with real_path. Mapping is based on removal of self.path_prefix which is determined by self.check_files(). """ if (not self.path_prefix): return(real_path) else: return(os.path...
[ "def", "archive_path", "(", "self", ",", "real_path", ")", ":", "if", "(", "not", "self", ".", "path_prefix", ")", ":", "return", "(", "real_path", ")", "else", ":", "return", "(", "os", ".", "path", ".", "relpath", "(", "real_path", ",", "self", "."...
Return the archive path for file with real_path. Mapping is based on removal of self.path_prefix which is determined by self.check_files().
[ "Return", "the", "archive", "path", "for", "file", "with", "real_path", "." ]
python
train
abilian/abilian-core
abilian/web/assets/mixin.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/web/assets/mixin.py#L115-L138
def register_asset(self, type_, *assets): """Register webassets bundle to be served on all pages. :param type_: `"css"`, `"js-top"` or `"js""`. :param assets: a path to file, a :ref:`webassets.Bundle <webassets:bundles>` instance or a callable that returns a ...
[ "def", "register_asset", "(", "self", ",", "type_", ",", "*", "assets", ")", ":", "supported", "=", "list", "(", "self", ".", "_assets_bundles", ".", "keys", "(", ")", ")", "if", "type_", "not", "in", "supported", ":", "msg", "=", "\"Invalid type: {}. Va...
Register webassets bundle to be served on all pages. :param type_: `"css"`, `"js-top"` or `"js""`. :param assets: a path to file, a :ref:`webassets.Bundle <webassets:bundles>` instance or a callable that returns a :ref:`webassets.Bundle <webassets:bundles>` instance...
[ "Register", "webassets", "bundle", "to", "be", "served", "on", "all", "pages", "." ]
python
train
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1964-L1977
def schema_to_json(self, schema_list, destination): """Takes a list of schema field objects. Serializes the list of schema field objects as json to a file. Destination is a file path or a file object. """ json_schema_list = [f.to_api_repr() for f in schema_list] if isi...
[ "def", "schema_to_json", "(", "self", ",", "schema_list", ",", "destination", ")", ":", "json_schema_list", "=", "[", "f", ".", "to_api_repr", "(", ")", "for", "f", "in", "schema_list", "]", "if", "isinstance", "(", "destination", ",", "io", ".", "IOBase",...
Takes a list of schema field objects. Serializes the list of schema field objects as json to a file. Destination is a file path or a file object.
[ "Takes", "a", "list", "of", "schema", "field", "objects", "." ]
python
train
utek/pyseaweed
pyseaweed/weed.py
https://github.com/utek/pyseaweed/blob/218049329885425a2b8370157fa44952e64516be/pyseaweed/weed.py#L140-L147
def delete_file(self, fid): """ Delete file from WeedFS :param string fid: File ID """ url = self.get_file_url(fid) return self.conn.delete_data(url)
[ "def", "delete_file", "(", "self", ",", "fid", ")", ":", "url", "=", "self", ".", "get_file_url", "(", "fid", ")", "return", "self", ".", "conn", ".", "delete_data", "(", "url", ")" ]
Delete file from WeedFS :param string fid: File ID
[ "Delete", "file", "from", "WeedFS" ]
python
train
mushkevych/scheduler
synergy/scheduler/timetable.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L125-L152
def skip_tree_node(self, tree_node, tx_context=None): """ method skips the node and all its dependants and child nodes """ if not tx_context: # create transaction context if one was not provided # format: {process_name: {timeperiod: AbstractTreeNode} } tx_context = co...
[ "def", "skip_tree_node", "(", "self", ",", "tree_node", ",", "tx_context", "=", "None", ")", ":", "if", "not", "tx_context", ":", "# create transaction context if one was not provided", "# format: {process_name: {timeperiod: AbstractTreeNode} }", "tx_context", "=", "collectio...
method skips the node and all its dependants and child nodes
[ "method", "skips", "the", "node", "and", "all", "its", "dependants", "and", "child", "nodes" ]
python
train
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L33-L59
def add_workflow_definitions(sbi_config: dict): """Add any missing SBI workflow definitions as placeholders. This is a utility function used in testing and adds mock / test workflow definitions to the database for workflows defined in the specified SBI config. Args: sbi_config (dict): SBI ...
[ "def", "add_workflow_definitions", "(", "sbi_config", ":", "dict", ")", ":", "registered_workflows", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "sbi_config", "[", "'processing_blocks'", "]", ")", ")", ":", "workflow_config", "=", "sbi_config", ...
Add any missing SBI workflow definitions as placeholders. This is a utility function used in testing and adds mock / test workflow definitions to the database for workflows defined in the specified SBI config. Args: sbi_config (dict): SBI configuration dictionary.
[ "Add", "any", "missing", "SBI", "workflow", "definitions", "as", "placeholders", "." ]
python
train
dswah/pyGAM
pygam/utils.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/utils.py#L802-L830
def flatten(iterable): """convenience tool to flatten any nested iterable example: flatten([[[],[4]],[[[5,[6,7, []]]]]]) >>> [4, 5, 6, 7] flatten('hello') >>> 'hello' Parameters ---------- iterable Returns ------- flattened object """ if isite...
[ "def", "flatten", "(", "iterable", ")", ":", "if", "isiterable", "(", "iterable", ")", ":", "flat", "=", "[", "]", "for", "item", "in", "list", "(", "iterable", ")", ":", "item", "=", "flatten", "(", "item", ")", "if", "not", "isiterable", "(", "it...
convenience tool to flatten any nested iterable example: flatten([[[],[4]],[[[5,[6,7, []]]]]]) >>> [4, 5, 6, 7] flatten('hello') >>> 'hello' Parameters ---------- iterable Returns ------- flattened object
[ "convenience", "tool", "to", "flatten", "any", "nested", "iterable" ]
python
train
intake/intake
intake/catalog/local.py
https://github.com/intake/intake/blob/277b96bfdee39d8a3048ea5408c6d6716d568336/intake/catalog/local.py#L263-L272
def get(self, **user_parameters): """Instantiate the DataSource for the given parameters""" plugin, open_args = self._create_open_args(user_parameters) data_source = plugin(**open_args) data_source.catalog_object = self._catalog data_source.name = self.name data_source.de...
[ "def", "get", "(", "self", ",", "*", "*", "user_parameters", ")", ":", "plugin", ",", "open_args", "=", "self", ".", "_create_open_args", "(", "user_parameters", ")", "data_source", "=", "plugin", "(", "*", "*", "open_args", ")", "data_source", ".", "catal...
Instantiate the DataSource for the given parameters
[ "Instantiate", "the", "DataSource", "for", "the", "given", "parameters" ]
python
train
Kozea/cairocffi
cairocffi/context.py
https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/context.py#L1709-L1752
def select_font_face(self, family='', slant=constants.FONT_SLANT_NORMAL, weight=constants.FONT_WEIGHT_NORMAL): """Selects a family and style of font from a simplified description as a family name, slant and weight. .. note:: The :meth:`select_font_face` met...
[ "def", "select_font_face", "(", "self", ",", "family", "=", "''", ",", "slant", "=", "constants", ".", "FONT_SLANT_NORMAL", ",", "weight", "=", "constants", ".", "FONT_WEIGHT_NORMAL", ")", ":", "cairo", ".", "cairo_select_font_face", "(", "self", ".", "_pointe...
Selects a family and style of font from a simplified description as a family name, slant and weight. .. note:: The :meth:`select_font_face` method is part of what the cairo designers call the "toy" text API. It is convenient for short demos and simple programs, ...
[ "Selects", "a", "family", "and", "style", "of", "font", "from", "a", "simplified", "description", "as", "a", "family", "name", "slant", "and", "weight", "." ]
python
train
inveniosoftware/invenio-webhooks
invenio_webhooks/views.py
https://github.com/inveniosoftware/invenio-webhooks/blob/f407cb2245464543ee474a81189fb9d3978bdde5/invenio_webhooks/views.py#L69-L81
def make_response(event): """Make a response from webhook event.""" code, message = event.status response = jsonify(**event.response) response.headers['X-Hub-Event'] = event.receiver_id response.headers['X-Hub-Delivery'] = event.id if message: response.headers['X-Hub-Info'] = message ...
[ "def", "make_response", "(", "event", ")", ":", "code", ",", "message", "=", "event", ".", "status", "response", "=", "jsonify", "(", "*", "*", "event", ".", "response", ")", "response", ".", "headers", "[", "'X-Hub-Event'", "]", "=", "event", ".", "re...
Make a response from webhook event.
[ "Make", "a", "response", "from", "webhook", "event", "." ]
python
train
erik/alexandra
alexandra/util.py
https://github.com/erik/alexandra/blob/8bea94efa1af465254a553dc4dfea3fa552b18da/alexandra/util.py#L87-L112
def validate_request_timestamp(req_body, max_diff=150): """Ensure the request's timestamp doesn't fall outside of the app's specified tolerance. Returns True if this request is valid, False otherwise. :param req_body: JSON object parsed out of the raw POST data of a request. :param max_diff: Maxim...
[ "def", "validate_request_timestamp", "(", "req_body", ",", "max_diff", "=", "150", ")", ":", "time_str", "=", "req_body", ".", "get", "(", "'request'", ",", "{", "}", ")", ".", "get", "(", "'timestamp'", ")", "if", "not", "time_str", ":", "log", ".", "...
Ensure the request's timestamp doesn't fall outside of the app's specified tolerance. Returns True if this request is valid, False otherwise. :param req_body: JSON object parsed out of the raw POST data of a request. :param max_diff: Maximum allowable difference in seconds between request time...
[ "Ensure", "the", "request", "s", "timestamp", "doesn", "t", "fall", "outside", "of", "the", "app", "s", "specified", "tolerance", "." ]
python
train
CalebBell/thermo
thermo/chemical.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/chemical.py#L2322-L2343
def alphal(self): r'''Thermal diffusivity of the liquid phase of the chemical at its current temperature and pressure, in units of [m^2/s]. .. math:: \alpha = \frac{k}{\rho Cp} Utilizes the temperature and pressure dependent object oriented interfaces :obj:`thermo.v...
[ "def", "alphal", "(", "self", ")", ":", "kl", ",", "rhol", ",", "Cpl", "=", "self", ".", "kl", ",", "self", ".", "rhol", ",", "self", ".", "Cpl", "if", "all", "(", "[", "kl", ",", "rhol", ",", "Cpl", "]", ")", ":", "return", "thermal_diffusivit...
r'''Thermal diffusivity of the liquid phase of the chemical at its current temperature and pressure, in units of [m^2/s]. .. math:: \alpha = \frac{k}{\rho Cp} Utilizes the temperature and pressure dependent object oriented interfaces :obj:`thermo.volume.VolumeLiquid`, ...
[ "r", "Thermal", "diffusivity", "of", "the", "liquid", "phase", "of", "the", "chemical", "at", "its", "current", "temperature", "and", "pressure", "in", "units", "of", "[", "m^2", "/", "s", "]", "." ]
python
valid
valohai/valohai-yaml
valohai_yaml/parsing.py
https://github.com/valohai/valohai-yaml/blob/3d2e92381633d84cdba039f6905df34c9633a2e1/valohai_yaml/parsing.py#L6-L21
def parse(yaml, validate=True): """ Parse the given YAML data into a `Config` object, optionally validating it first. :param yaml: YAML data (either a string, a stream, or pre-parsed Python dict/list) :type yaml: list|dict|str|file :param validate: Whether to validate the data before attempting to ...
[ "def", "parse", "(", "yaml", ",", "validate", "=", "True", ")", ":", "data", "=", "read_yaml", "(", "yaml", ")", "if", "validate", ":", "# pragma: no branch", "from", ".", "validation", "import", "validate", "validate", "(", "data", ",", "raise_exc", "=", ...
Parse the given YAML data into a `Config` object, optionally validating it first. :param yaml: YAML data (either a string, a stream, or pre-parsed Python dict/list) :type yaml: list|dict|str|file :param validate: Whether to validate the data before attempting to parse it. :type validate: bool :retu...
[ "Parse", "the", "given", "YAML", "data", "into", "a", "Config", "object", "optionally", "validating", "it", "first", "." ]
python
train
uber/doubles
doubles/target.py
https://github.com/uber/doubles/blob/15e68dcf98f709b19a581915fa6af5ef49ebdd8a/doubles/target.py#L48-L62
def _determine_doubled_obj(self): """Return the target object. Returns the object that should be treated as the target object. For partial doubles, this will be the same as ``self.obj``, but for pure doubles, it's pulled from the special ``_doubles_target`` attribute. :return: ...
[ "def", "_determine_doubled_obj", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "obj", ",", "ObjectDouble", ")", ":", "return", "self", ".", "obj", ".", "_doubles_target", "else", ":", "return", "self", ".", "obj" ]
Return the target object. Returns the object that should be treated as the target object. For partial doubles, this will be the same as ``self.obj``, but for pure doubles, it's pulled from the special ``_doubles_target`` attribute. :return: The object to be doubled. :rtype: obj...
[ "Return", "the", "target", "object", "." ]
python
train
idlesign/uwsgiconf
uwsgiconf/options/alarms.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/alarms.py#L133-L145
def alarm_on_segfault(self, alarm): """Raise the specified alarm when the segmentation fault handler is executed. Sends a backtrace. :param AlarmType|list[AlarmType] alarm: Alarm. """ self.register_alarm(alarm) for alarm in listify(alarm): self._set('alarm-...
[ "def", "alarm_on_segfault", "(", "self", ",", "alarm", ")", ":", "self", ".", "register_alarm", "(", "alarm", ")", "for", "alarm", "in", "listify", "(", "alarm", ")", ":", "self", ".", "_set", "(", "'alarm-segfault'", ",", "alarm", ".", "alias", ",", "...
Raise the specified alarm when the segmentation fault handler is executed. Sends a backtrace. :param AlarmType|list[AlarmType] alarm: Alarm.
[ "Raise", "the", "specified", "alarm", "when", "the", "segmentation", "fault", "handler", "is", "executed", "." ]
python
train
niolabs/python-xbee
xbee/backend/base.py
https://github.com/niolabs/python-xbee/blob/b91be3d0ee7ccaa1990120b5b5490999d8e6cbc7/xbee/backend/base.py#L286-L326
def _parse_samples(self, io_bytes): """ _parse_samples: binary data in XBee IO data format -> [ {"dio-0":True, "dio-1":False, "adc-0":100"}, ...] _parse_samples reads binary data from an XBee device in the IO ...
[ "def", "_parse_samples", "(", "self", ",", "io_bytes", ")", ":", "sample_count", ",", "dio_chans", ",", "aio_chans", ",", "dio_mask", ",", "header_size", "=", "self", ".", "_parse_samples_header", "(", "io_bytes", ")", "samples", "=", "[", "]", "# split the sa...
_parse_samples: binary data in XBee IO data format -> [ {"dio-0":True, "dio-1":False, "adc-0":100"}, ...] _parse_samples reads binary data from an XBee device in the IO data format specified by the API. It will then return a ...
[ "_parse_samples", ":", "binary", "data", "in", "XBee", "IO", "data", "format", "-", ">", "[", "{", "dio", "-", "0", ":", "True", "dio", "-", "1", ":", "False", "adc", "-", "0", ":", "100", "}", "...", "]" ]
python
train
openvax/mhcflurry
mhcflurry/parallelism.py
https://github.com/openvax/mhcflurry/blob/deb7c1629111254b484a2711619eb2347db36524/mhcflurry/parallelism.py#L115-L188
def make_worker_pool( processes=None, initializer=None, initializer_kwargs_per_process=None, max_tasks_per_worker=None): """ Convenience wrapper to create a multiprocessing.Pool. This function adds support for per-worker initializer arguments, which are not natively supp...
[ "def", "make_worker_pool", "(", "processes", "=", "None", ",", "initializer", "=", "None", ",", "initializer_kwargs_per_process", "=", "None", ",", "max_tasks_per_worker", "=", "None", ")", ":", "if", "not", "processes", ":", "processes", "=", "cpu_count", "(", ...
Convenience wrapper to create a multiprocessing.Pool. This function adds support for per-worker initializer arguments, which are not natively supported by the multiprocessing module. The motivation for this feature is to support allocating each worker to a (different) GPU. IMPLEMENTATION NOTE: ...
[ "Convenience", "wrapper", "to", "create", "a", "multiprocessing", ".", "Pool", "." ]
python
train
nephics/mat4py
mat4py/savemat.py
https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/savemat.py#L207-L225
def write_numeric_array(fd, header, array): """Write the numeric array""" # make a memory file for writing array data bd = BytesIO() # write matrix header to memory file write_var_header(bd, header) if not isinstance(array, basestring) and header['dims'][0] > 1: # list array data in co...
[ "def", "write_numeric_array", "(", "fd", ",", "header", ",", "array", ")", ":", "# make a memory file for writing array data", "bd", "=", "BytesIO", "(", ")", "# write matrix header to memory file", "write_var_header", "(", "bd", ",", "header", ")", "if", "not", "is...
Write the numeric array
[ "Write", "the", "numeric", "array" ]
python
valid
spyder-ide/conda-manager
conda_manager/api/manager_api.py
https://github.com/spyder-ide/conda-manager/blob/89a2126cbecefc92185cf979347ccac1c5ee5d9d/conda_manager/api/manager_api.py#L151-L171
def _download_repodata(self, checked_repos): """Dowload repodata.""" self._files_downloaded = [] self._repodata_files = [] self.__counter = -1 if checked_repos: for repo in checked_repos: path = self._repo_url_to_path(repo) self._files...
[ "def", "_download_repodata", "(", "self", ",", "checked_repos", ")", ":", "self", ".", "_files_downloaded", "=", "[", "]", "self", ".", "_repodata_files", "=", "[", "]", "self", ".", "__counter", "=", "-", "1", "if", "checked_repos", ":", "for", "repo", ...
Dowload repodata.
[ "Dowload", "repodata", "." ]
python
train
stevelittlefish/easyforms
easyforms/form.py
https://github.com/stevelittlefish/easyforms/blob/f5dd2635b045beec9af970b249909f8429cedc57/easyforms/form.py#L763-L770
def disable_validation(self, field_name): """Disable the validation rules for a field""" field = self.field_dict.get(field_name) if not field: raise exceptions.FieldNotFound('Field not found: \'%s\' when trying to disable validation' % field_name) field.validators =...
[ "def", "disable_validation", "(", "self", ",", "field_name", ")", ":", "field", "=", "self", ".", "field_dict", ".", "get", "(", "field_name", ")", "if", "not", "field", ":", "raise", "exceptions", ".", "FieldNotFound", "(", "'Field not found: \\'%s\\' when tryi...
Disable the validation rules for a field
[ "Disable", "the", "validation", "rules", "for", "a", "field" ]
python
train
daviddrysdale/python-phonenumbers
python/phonenumbers/phonenumberutil.py
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/phonenumberutil.py#L704-L769
def length_of_national_destination_code(numobj): """Return length of the national destination code code for a number. Gets the length of the national destination code (NDC) from the PhoneNumber object passed in, so that clients could use it to split a national significant number into NDC and subscriber...
[ "def", "length_of_national_destination_code", "(", "numobj", ")", ":", "if", "numobj", ".", "extension", "is", "not", "None", ":", "# We don't want to alter the object given to us, but we don't want to", "# include the extension when we format it, so we copy it and clear the", "# ext...
Return length of the national destination code code for a number. Gets the length of the national destination code (NDC) from the PhoneNumber object passed in, so that clients could use it to split a national significant number into NDC and subscriber number. The NDC of a phone number is normally the f...
[ "Return", "length", "of", "the", "national", "destination", "code", "code", "for", "a", "number", "." ]
python
train
f3at/feat
src/feat/models/setter.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/models/setter.py#L50-L62
def source_attr(attr_name): """ Creates a setter that will set the specified source attribute to the current value. @param attr_name: the name of an attribute belonging to the source. @type attr_name: str """ def source_attr(value, context, **_params): setattr(context["model"].sourc...
[ "def", "source_attr", "(", "attr_name", ")", ":", "def", "source_attr", "(", "value", ",", "context", ",", "*", "*", "_params", ")", ":", "setattr", "(", "context", "[", "\"model\"", "]", ".", "source", ",", "attr_name", ",", "value", ")", "return", "_...
Creates a setter that will set the specified source attribute to the current value. @param attr_name: the name of an attribute belonging to the source. @type attr_name: str
[ "Creates", "a", "setter", "that", "will", "set", "the", "specified", "source", "attribute", "to", "the", "current", "value", "." ]
python
train
wandb/client
wandb/vendor/prompt_toolkit/layout/controls.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/layout/controls.py#L136-L149
def get_height_for_line(self, lineno, width): """ Return the height that a given line would need if it is rendered in a space with the given width. """ try: return self._line_heights[lineno, width] except KeyError: text = token_list_to_text(self.ge...
[ "def", "get_height_for_line", "(", "self", ",", "lineno", ",", "width", ")", ":", "try", ":", "return", "self", ".", "_line_heights", "[", "lineno", ",", "width", "]", "except", "KeyError", ":", "text", "=", "token_list_to_text", "(", "self", ".", "get_lin...
Return the height that a given line would need if it is rendered in a space with the given width.
[ "Return", "the", "height", "that", "a", "given", "line", "would", "need", "if", "it", "is", "rendered", "in", "a", "space", "with", "the", "given", "width", "." ]
python
train
shreyaspotnis/rampage
rampage/daq/gpib.py
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/daq/gpib.py#L34-L56
def set_fm_ext(self, freq, amplitude, peak_freq_dev=None, output_state=True): """Sets the func generator to frequency modulation with external modulation. freq is the carrier frequency in Hz.""" if peak_freq_dev is None: peak_freq_dev = freq commands = ['F...
[ "def", "set_fm_ext", "(", "self", ",", "freq", ",", "amplitude", ",", "peak_freq_dev", "=", "None", ",", "output_state", "=", "True", ")", ":", "if", "peak_freq_dev", "is", "None", ":", "peak_freq_dev", "=", "freq", "commands", "=", "[", "'FUNC SIN'", ",",...
Sets the func generator to frequency modulation with external modulation. freq is the carrier frequency in Hz.
[ "Sets", "the", "func", "generator", "to", "frequency", "modulation", "with", "external", "modulation", ".", "freq", "is", "the", "carrier", "frequency", "in", "Hz", "." ]
python
train
nathancahill/mimicdb
mimicdb/s3/bucket.py
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L74-L92
def delete_keys(self, *args, **kwargs): """Remove each key or key name in an iterable from the bucket set. """ ikeys = iter(kwargs.get('keys', args[0] if args else [])) while True: try: key = ikeys.next() except StopIteration: brea...
[ "def", "delete_keys", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ikeys", "=", "iter", "(", "kwargs", ".", "get", "(", "'keys'", ",", "args", "[", "0", "]", "if", "args", "else", "[", "]", ")", ")", "while", "True", ":", ...
Remove each key or key name in an iterable from the bucket set.
[ "Remove", "each", "key", "or", "key", "name", "in", "an", "iterable", "from", "the", "bucket", "set", "." ]
python
valid
hydpy-dev/hydpy
hydpy/core/modeltools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/modeltools.py#L751-L780
def extrapolate_error(self): """Estimate the numerical error to be expected when applying all methods available based on the results of the current and the last method. Note that this expolation strategy cannot be applied on the first method. If the current method is the first ...
[ "def", "extrapolate_error", "(", "self", ")", ":", "if", "self", ".", "numvars", ".", "idx_method", ">", "2", ":", "self", ".", "numvars", ".", "extrapolated_error", "=", "modelutils", ".", "exp", "(", "modelutils", ".", "log", "(", "self", ".", "numvars...
Estimate the numerical error to be expected when applying all methods available based on the results of the current and the last method. Note that this expolation strategy cannot be applied on the first method. If the current method is the first one, `-999.9` is returned. >>> ...
[ "Estimate", "the", "numerical", "error", "to", "be", "expected", "when", "applying", "all", "methods", "available", "based", "on", "the", "results", "of", "the", "current", "and", "the", "last", "method", "." ]
python
train
opendatateam/udata
udata/core/spatial/models.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/core/spatial/models.py#L185-L191
def child_level(self): """Return the child level given handled levels.""" HANDLED_LEVELS = current_app.config.get('HANDLED_LEVELS') try: return HANDLED_LEVELS[HANDLED_LEVELS.index(self.level) - 1] except (IndexError, ValueError): return None
[ "def", "child_level", "(", "self", ")", ":", "HANDLED_LEVELS", "=", "current_app", ".", "config", ".", "get", "(", "'HANDLED_LEVELS'", ")", "try", ":", "return", "HANDLED_LEVELS", "[", "HANDLED_LEVELS", ".", "index", "(", "self", ".", "level", ")", "-", "1...
Return the child level given handled levels.
[ "Return", "the", "child", "level", "given", "handled", "levels", "." ]
python
train
snowman2/pangaea
pangaea/read.py
https://github.com/snowman2/pangaea/blob/a304e9a489cfc0bc1c74e7cb50c3335a4f3d596f/pangaea/read.py#L18-L145
def open_mfdataset(path_to_lsm_files, lat_var, lon_var, time_var, lat_dim, lon_dim, time_dim, lon_to_180=False, coords_projected=False, loader=None, ...
[ "def", "open_mfdataset", "(", "path_to_lsm_files", ",", "lat_var", ",", "lon_var", ",", "time_var", ",", "lat_dim", ",", "lon_dim", ",", "time_dim", ",", "lon_to_180", "=", "False", ",", "coords_projected", "=", "False", ",", "loader", "=", "None", ",", "eng...
Wrapper to open land surface model netcdf files using :func:`xarray.open_mfdataset`. .. warning:: The time dimension and variable will both be renamed to 'time' to enable slicing. Parameters ---------- path_to_lsm_files: :obj:`str` Path to land surface model files with wildcard. ...
[ "Wrapper", "to", "open", "land", "surface", "model", "netcdf", "files", "using", ":", "func", ":", "xarray", ".", "open_mfdataset", "." ]
python
train
genialis/resolwe
resolwe/flow/serializers/contributor.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/serializers/contributor.py#L35-L45
def to_internal_value(self, data): """Format the internal value.""" # When setting the contributor, it may be passed as an integer. if isinstance(data, dict) and isinstance(data.get('id', None), int): data = data['id'] elif isinstance(data, int): pass else...
[ "def", "to_internal_value", "(", "self", ",", "data", ")", ":", "# When setting the contributor, it may be passed as an integer.", "if", "isinstance", "(", "data", ",", "dict", ")", "and", "isinstance", "(", "data", ".", "get", "(", "'id'", ",", "None", ")", ","...
Format the internal value.
[ "Format", "the", "internal", "value", "." ]
python
train
Esri/ArcREST
src/arcrest/enrichment/_geoenrichment.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L548-L712
def standardGeographyQuery(self, sourceCountry=None, optionalCountryDataset=None, geographyLayers=None, geographyIDs=None, geographyQuery=None, ...
[ "def", "standardGeographyQuery", "(", "self", ",", "sourceCountry", "=", "None", ",", "optionalCountryDataset", "=", "None", ",", "geographyLayers", "=", "None", ",", "geographyIDs", "=", "None", ",", "geographyQuery", "=", "None", ",", "returnSubGeographyLayer", ...
The GeoEnrichment service provides a helper method that returns standard geography IDs and features for the supported geographic levels in the United States and Canada. As indicated throughout this documentation guide, the GeoEnrichment service uses the concept of a study area to define ...
[ "The", "GeoEnrichment", "service", "provides", "a", "helper", "method", "that", "returns", "standard", "geography", "IDs", "and", "features", "for", "the", "supported", "geographic", "levels", "in", "the", "United", "States", "and", "Canada", ".", "As", "indicat...
python
train
buildbot/buildbot
worker/buildbot_worker/runprocess.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L589-L607
def _spawnProcess(self, processProtocol, executable, args=(), env=None, path=None, uid=None, gid=None, usePTY=False, childFDs=None): """private implementation of reactor.spawnProcess, to allow use of L{ProcGroupProcess}""" if env is None: env = {} # use...
[ "def", "_spawnProcess", "(", "self", ",", "processProtocol", ",", "executable", ",", "args", "=", "(", ")", ",", "env", "=", "None", ",", "path", "=", "None", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "usePTY", "=", "False", ",", "chil...
private implementation of reactor.spawnProcess, to allow use of L{ProcGroupProcess}
[ "private", "implementation", "of", "reactor", ".", "spawnProcess", "to", "allow", "use", "of", "L", "{", "ProcGroupProcess", "}" ]
python
train