repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
getsentry/raven-python
raven/conf/__init__.py
https://github.com/getsentry/raven-python/blob/d891c20f0f930153f508e9d698d9de42e910face/raven/conf/__init__.py#L26-L57
def setup_logging(handler, exclude=EXCLUDE_LOGGER_DEFAULTS): """ Configures logging to pipe to Sentry. - ``exclude`` is a list of loggers that shouldn't go to Sentry. For a typical Python install: >>> from raven.handlers.logging import SentryHandler >>> client = Sentry(...) >>> setup_logg...
[ "def", "setup_logging", "(", "handler", ",", "exclude", "=", "EXCLUDE_LOGGER_DEFAULTS", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ")", "if", "handler", ".", "__class__", "in", "map", "(", "type", ",", "logger", ".", "handlers", ")", ":", ...
Configures logging to pipe to Sentry. - ``exclude`` is a list of loggers that shouldn't go to Sentry. For a typical Python install: >>> from raven.handlers.logging import SentryHandler >>> client = Sentry(...) >>> setup_logging(SentryHandler(client)) Within Django: >>> from raven.contri...
[ "Configures", "logging", "to", "pipe", "to", "Sentry", "." ]
python
train
28.625
hyperledger/indy-plenum
plenum/server/monitor.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/monitor.py#L579-L592
def getThroughput(self, instId: int) -> float: """ Return the throughput of the specified instance. :param instId: the id of the protocol instance """ # We are using the instanceStarted time in the denominator instead of # a time interval. This is alright for now as all ...
[ "def", "getThroughput", "(", "self", ",", "instId", ":", "int", ")", "->", "float", ":", "# We are using the instanceStarted time in the denominator instead of", "# a time interval. This is alright for now as all the instances on a", "# node are started at almost the same time.", "if",...
Return the throughput of the specified instance. :param instId: the id of the protocol instance
[ "Return", "the", "throughput", "of", "the", "specified", "instance", "." ]
python
train
41.714286
NLeSC/scriptcwl
scriptcwl/yamlutils.py
https://github.com/NLeSC/scriptcwl/blob/33bb847a875379da3a5702c7a98dfa585306b960/scriptcwl/yamlutils.py#L22-L30
def str_presenter(dmpr, data): """Return correct str_presenter to write multiple lines to a yaml field. Source: http://stackoverflow.com/a/33300001 """ if is_multiline(data): return dmpr.represent_scalar('tag:yaml.org,2002:str', data, style='|') return dmpr.represent_scalar('tag:yaml.org,2...
[ "def", "str_presenter", "(", "dmpr", ",", "data", ")", ":", "if", "is_multiline", "(", "data", ")", ":", "return", "dmpr", ".", "represent_scalar", "(", "'tag:yaml.org,2002:str'", ",", "data", ",", "style", "=", "'|'", ")", "return", "dmpr", ".", "represen...
Return correct str_presenter to write multiple lines to a yaml field. Source: http://stackoverflow.com/a/33300001
[ "Return", "correct", "str_presenter", "to", "write", "multiple", "lines", "to", "a", "yaml", "field", "." ]
python
train
36.333333
theonion/django-bulbs
bulbs/content/serializers.py
https://github.com/theonion/django-bulbs/blob/0c0e6e3127a7dc487b96677fab95cacd2b3806da/bulbs/content/serializers.py#L24-L28
def to_internal_value(self, value): """Convert to integer id.""" natural_key = value.split("_") content_type = ContentType.objects.get_by_natural_key(*natural_key) return content_type.id
[ "def", "to_internal_value", "(", "self", ",", "value", ")", ":", "natural_key", "=", "value", ".", "split", "(", "\"_\"", ")", "content_type", "=", "ContentType", ".", "objects", ".", "get_by_natural_key", "(", "*", "natural_key", ")", "return", "content_type"...
Convert to integer id.
[ "Convert", "to", "integer", "id", "." ]
python
train
42.8
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/itsdangerous.py#L552-L558
def make_signer(self, salt=None): """A method that creates a new instance of the signer to be used. The default implementation uses the :class:`Signer` baseclass. """ if salt is None: salt = self.salt return self.signer(self.secret_key, salt=salt, **self.signer_kwargs...
[ "def", "make_signer", "(", "self", ",", "salt", "=", "None", ")", ":", "if", "salt", "is", "None", ":", "salt", "=", "self", ".", "salt", "return", "self", ".", "signer", "(", "self", ".", "secret_key", ",", "salt", "=", "salt", ",", "*", "*", "s...
A method that creates a new instance of the signer to be used. The default implementation uses the :class:`Signer` baseclass.
[ "A", "method", "that", "creates", "a", "new", "instance", "of", "the", "signer", "to", "be", "used", ".", "The", "default", "implementation", "uses", "the", ":", "class", ":", "Signer", "baseclass", "." ]
python
test
45
nerdvegas/rez
src/rez/status.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L120-L193
def print_tools(self, pattern=None, buf=sys.stdout): """Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern. """ seen = set() rows = [] context = self.context if context: data = context.get_too...
[ "def", "print_tools", "(", "self", ",", "pattern", "=", "None", ",", "buf", "=", "sys", ".", "stdout", ")", ":", "seen", "=", "set", "(", ")", "rows", "=", "[", "]", "context", "=", "self", ".", "context", "if", "context", ":", "data", "=", "cont...
Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern.
[ "Print", "a", "list", "of", "visible", "tools", "." ]
python
train
34.837838
paylogic/pip-accel
pip_accel/__init__.py
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L618-L627
def cleanup_temporary_directories(self): """Delete the build directories and any temporary directories created by pip.""" while self.build_directories: shutil.rmtree(self.build_directories.pop()) for requirement in self.reported_requirements: requirement.remove_temporary_...
[ "def", "cleanup_temporary_directories", "(", "self", ")", ":", "while", "self", ".", "build_directories", ":", "shutil", ".", "rmtree", "(", "self", ".", "build_directories", ".", "pop", "(", ")", ")", "for", "requirement", "in", "self", ".", "reported_require...
Delete the build directories and any temporary directories created by pip.
[ "Delete", "the", "build", "directories", "and", "any", "temporary", "directories", "created", "by", "pip", "." ]
python
train
48.7
Calysto/calysto
calysto/ai/conx.py
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L2384-L2409
def compute_error(self, **args): """ Computes error for all non-output layers backwards through all projections. """ for key in args: layer = self.getLayer(key) if layer.kind == 'Output': self.copyTargets(layer, args[key]) self.veri...
[ "def", "compute_error", "(", "self", ",", "*", "*", "args", ")", ":", "for", "key", "in", "args", ":", "layer", "=", "self", ".", "getLayer", "(", "key", ")", "if", "layer", ".", "kind", "==", "'Output'", ":", "self", ".", "copyTargets", "(", "laye...
Computes error for all non-output layers backwards through all projections.
[ "Computes", "error", "for", "all", "non", "-", "output", "layers", "backwards", "through", "all", "projections", "." ]
python
train
47.461538
google/grr
grr/server/grr_response_server/hunts/implementation.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L937-L957
def IsHuntStarted(self): """Is this hunt considered started? This method is used to check if new clients should be processed by this hunt. Note that child flow responses are always processed but new clients are not allowed to be scheduled unless the hunt is started. Returns: If a new cli...
[ "def", "IsHuntStarted", "(", "self", ")", ":", "state", "=", "self", ".", "hunt_obj", ".", "Get", "(", "self", ".", "hunt_obj", ".", "Schema", ".", "STATE", ")", "if", "state", "!=", "\"STARTED\"", ":", "return", "False", "# Stop the hunt due to expiry.", ...
Is this hunt considered started? This method is used to check if new clients should be processed by this hunt. Note that child flow responses are always processed but new clients are not allowed to be scheduled unless the hunt is started. Returns: If a new client is allowed to be scheduled o...
[ "Is", "this", "hunt", "considered", "started?" ]
python
train
26.47619
ethereum/py-evm
eth/chains/base.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/chains/base.py#L631-L635
def create_transaction(self, *args: Any, **kwargs: Any) -> BaseTransaction: """ Passthrough helper to the current VM class. """ return self.get_vm().create_transaction(*args, **kwargs)
[ "def", "create_transaction", "(", "self", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "BaseTransaction", ":", "return", "self", ".", "get_vm", "(", ")", ".", "create_transaction", "(", "*", "args", ",", "*", "*", "kw...
Passthrough helper to the current VM class.
[ "Passthrough", "helper", "to", "the", "current", "VM", "class", "." ]
python
train
42.4
Skype4Py/Skype4Py
Skype4Py/settings.py
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/settings.py#L75-L90
def RingToneStatus(self, Id=1, Set=None): """Enables/disables a ringtone. :Parameters: Id : int Ringtone Id Set : bool True/False if the ringtone should be enabled/disabled or None if the current status should be queried. :return: Current...
[ "def", "RingToneStatus", "(", "self", ",", "Id", "=", "1", ",", "Set", "=", "None", ")", ":", "if", "Set", "is", "None", ":", "return", "(", "self", ".", "_Skype", ".", "_Property", "(", "'RINGTONE'", ",", "Id", ",", "'STATUS'", ")", "==", "'ON'", ...
Enables/disables a ringtone. :Parameters: Id : int Ringtone Id Set : bool True/False if the ringtone should be enabled/disabled or None if the current status should be queried. :return: Current status if Set=None, None otherwise. :rtype: ...
[ "Enables", "/", "disables", "a", "ringtone", "." ]
python
train
34.8125
jupyterhub/kubespawner
kubespawner/spawner.py
https://github.com/jupyterhub/kubespawner/blob/46a4b109c5e657a4c3d5bfa8ea4731ec6564ea13/kubespawner/spawner.py#L1456-L1492
def poll(self): """ Check if the pod is still running. Uses the same interface as subprocess.Popen.poll(): if the pod is still running, returns None. If the pod has exited, return the exit code if we can determine it, or 1 if it has exited but we don't know how. These ...
[ "def", "poll", "(", "self", ")", ":", "# have to wait for first load of data before we have a valid answer", "if", "not", "self", ".", "pod_reflector", ".", "first_load_future", ".", "done", "(", ")", ":", "yield", "self", ".", "pod_reflector", ".", "first_load_future...
Check if the pod is still running. Uses the same interface as subprocess.Popen.poll(): if the pod is still running, returns None. If the pod has exited, return the exit code if we can determine it, or 1 if it has exited but we don't know how. These are the return values JupyterHub exp...
[ "Check", "if", "the", "pod", "is", "still", "running", "." ]
python
train
46.027027
weissercn/adaptive_binning_chisquared_2sam
adaptive_binning_chisquared_2sam/chi2_adaptive_binning.py
https://github.com/weissercn/adaptive_binning_chisquared_2sam/blob/f4684e70af94add187263522fa784bf02b096051/adaptive_binning_chisquared_2sam/chi2_adaptive_binning.py#L113-L299
def chi2_adaptive_binning(features_0,features_1,number_of_splits_list,systematics_fraction=0.0,title = "title", name="name", PLOT = True, DEBUG = False, transform='StandardScalar'): """This function takes in two 2D arrays with all features being columns""" max_number_of_splits = np.max(number_of_splits_list) #deter...
[ "def", "chi2_adaptive_binning", "(", "features_0", ",", "features_1", ",", "number_of_splits_list", ",", "systematics_fraction", "=", "0.0", ",", "title", "=", "\"title\"", ",", "name", "=", "\"name\"", ",", "PLOT", "=", "True", ",", "DEBUG", "=", "False", ","...
This function takes in two 2D arrays with all features being columns
[ "This", "function", "takes", "in", "two", "2D", "arrays", "with", "all", "features", "being", "columns" ]
python
train
43.491979
mabuchilab/QNET
src/qnet/algebra/pattern_matching/__init__.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/pattern_matching/__init__.py#L491-L523
def wc(name_mode="_", head=None, args=None, kwargs=None, *, conditions=None) \ -> Pattern: """Constructor for a wildcard-:class:`Pattern` Helper function to create a Pattern object with an emphasis on wildcard patterns, if we don't care about the arguments of the matched expressions (otherwise,...
[ "def", "wc", "(", "name_mode", "=", "\"_\"", ",", "head", "=", "None", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "*", ",", "conditions", "=", "None", ")", "->", "Pattern", ":", "rx", "=", "re", ".", "compile", "(", "r\"^([A-Za-z]?[...
Constructor for a wildcard-:class:`Pattern` Helper function to create a Pattern object with an emphasis on wildcard patterns, if we don't care about the arguments of the matched expressions (otherwise, use :func:`pattern`) Args: name_mode (str): Combined `wc_name` and `mode` for :class:`Patter...
[ "Constructor", "for", "a", "wildcard", "-", ":", "class", ":", "Pattern" ]
python
train
44.121212
klen/adrest
adrest/mixin/dynamic.py
https://github.com/klen/adrest/blob/8b75c67123cffabe5ed98c222bb7ab43c904d89c/adrest/mixin/dynamic.py#L169-L176
def paginate(self, request, collection): """ Paginate collection. :return object: Collection or paginator """ p = Paginator(request, self, collection) return p.paginator and p or UpdatedList(collection)
[ "def", "paginate", "(", "self", ",", "request", ",", "collection", ")", ":", "p", "=", "Paginator", "(", "request", ",", "self", ",", "collection", ")", "return", "p", ".", "paginator", "and", "p", "or", "UpdatedList", "(", "collection", ")" ]
Paginate collection. :return object: Collection or paginator
[ "Paginate", "collection", "." ]
python
train
29.625
balabit/typesafety
typesafety/finder.py
https://github.com/balabit/typesafety/blob/452242dd93da9ebd53c173c243156d1351cd96fd/typesafety/finder.py#L150-L167
def load_module(self, loader): ''' Load the module. Required for the Python meta-loading mechanism. ''' modfile, pathname, description = loader.info module = imp.load_module( loader.fullname, modfile, pathname, description ...
[ "def", "load_module", "(", "self", ",", "loader", ")", ":", "modfile", ",", "pathname", ",", "description", "=", "loader", ".", "info", "module", "=", "imp", ".", "load_module", "(", "loader", ".", "fullname", ",", "modfile", ",", "pathname", ",", "descr...
Load the module. Required for the Python meta-loading mechanism.
[ "Load", "the", "module", ".", "Required", "for", "the", "Python", "meta", "-", "loading", "mechanism", "." ]
python
train
27.722222
serge-sans-paille/pythran
pythran/syntax.py
https://github.com/serge-sans-paille/pythran/blob/7e1b5af2dddfabc50bd2a977f0178be269b349b5/pythran/syntax.py#L216-L242
def check_exports(mod, specs, renamings): ''' Does nothing but raising PythranSyntaxError if specs references an undefined global ''' functions = {renamings.get(k, k): v for k, v in specs.functions.items()} mod_functions = {node.name: node for node in mod.body if isinstance...
[ "def", "check_exports", "(", "mod", ",", "specs", ",", "renamings", ")", ":", "functions", "=", "{", "renamings", ".", "get", "(", "k", ",", "k", ")", ":", "v", "for", "k", ",", "v", "in", "specs", ".", "functions", ".", "items", "(", ")", "}", ...
Does nothing but raising PythranSyntaxError if specs references an undefined global
[ "Does", "nothing", "but", "raising", "PythranSyntaxError", "if", "specs", "references", "an", "undefined", "global" ]
python
train
39.333333
ultrabug/py3status
py3status/modules/xrandr.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/modules/xrandr.py#L378-L406
def _apply_workspaces(self, combination, mode): """ Allows user to force move a comma separated list of workspaces to the given output when it's activated. Example: - DP1_workspaces = "1,2,3" """ if len(combination) > 1 and mode == "extend": sleep...
[ "def", "_apply_workspaces", "(", "self", ",", "combination", ",", "mode", ")", ":", "if", "len", "(", "combination", ")", ">", "1", "and", "mode", "==", "\"extend\"", ":", "sleep", "(", "3", ")", "for", "output", "in", "combination", ":", "workspaces", ...
Allows user to force move a comma separated list of workspaces to the given output when it's activated. Example: - DP1_workspaces = "1,2,3"
[ "Allows", "user", "to", "force", "move", "a", "comma", "separated", "list", "of", "workspaces", "to", "the", "given", "output", "when", "it", "s", "activated", "." ]
python
train
39.827586
CamDavidsonPilon/lifelines
lifelines/generate_datasets.py
https://github.com/CamDavidsonPilon/lifelines/blob/bdf6be6f1d10eea4c46365ee0ee6a47d8c30edf8/lifelines/generate_datasets.py#L314-L328
def construct_survival_curves(hazard_rates, timelines): """ Given hazard rates, reconstruct the survival curves Parameters ---------- hazard_rates: (n,t) array timelines: (t,) the observational times Returns ------- t: survial curves, (n,t) array """ cumulative_hazards = cu...
[ "def", "construct_survival_curves", "(", "hazard_rates", ",", "timelines", ")", ":", "cumulative_hazards", "=", "cumulative_integral", "(", "hazard_rates", ".", "values", ",", "timelines", ")", "return", "pd", ".", "DataFrame", "(", "np", ".", "exp", "(", "-", ...
Given hazard rates, reconstruct the survival curves Parameters ---------- hazard_rates: (n,t) array timelines: (t,) the observational times Returns ------- t: survial curves, (n,t) array
[ "Given", "hazard", "rates", "reconstruct", "the", "survival", "curves" ]
python
train
28.333333
urinieto/msaf
msaf/algorithms/cnmf/segmenter.py
https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/cnmf/segmenter.py#L98-L166
def get_segmentation(X, rank, R, rank_labels, R_labels, niter=300, bound_idxs=None, in_labels=None): """ Gets the segmentation (boundaries and labels) from the factorization matrices. Parameters ---------- X: np.array() Features matrix (e.g. chromagram) rank: in...
[ "def", "get_segmentation", "(", "X", ",", "rank", ",", "R", ",", "rank_labels", ",", "R_labels", ",", "niter", "=", "300", ",", "bound_idxs", "=", "None", ",", "in_labels", "=", "None", ")", ":", "#import pylab as plt", "#plt.imshow(X, interpolation=\"nearest\",...
Gets the segmentation (boundaries and labels) from the factorization matrices. Parameters ---------- X: np.array() Features matrix (e.g. chromagram) rank: int Rank of decomposition R: int Size of the median filter for activation matrix niter: int Number of it...
[ "Gets", "the", "segmentation", "(", "boundaries", "and", "labels", ")", "from", "the", "factorization", "matrices", "." ]
python
test
29.811594
allianceauth/allianceauth
allianceauth/thirdparty/navhelper/templatetags/navactive.py
https://github.com/allianceauth/allianceauth/blob/6585b07e96571a99a4d6dc03cc03f9b8c8f690ca/allianceauth/thirdparty/navhelper/templatetags/navactive.py#L43-L63
def navactive(request, urls): """ {% navactive request "view_name another_view_name" %} """ url_list = set(urls.split()) resolved = resolve(request.path) resolved_urls = set() if resolved.url_name: resolved_urls.add(resolved.url_name) if resolved.namespaces: resolved_url...
[ "def", "navactive", "(", "request", ",", "urls", ")", ":", "url_list", "=", "set", "(", "urls", ".", "split", "(", ")", ")", "resolved", "=", "resolve", "(", "request", ".", "path", ")", "resolved_urls", "=", "set", "(", ")", "if", "resolved", ".", ...
{% navactive request "view_name another_view_name" %}
[ "{", "%", "navactive", "request", "view_name", "another_view_name", "%", "}" ]
python
train
55.666667
pyviz/holoviews
holoviews/plotting/links.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/links.py#L80-L86
def unlink(self): """ Unregisters the Link """ links = self.registry.get(self.source) if self in links: links.pop(links.index(self))
[ "def", "unlink", "(", "self", ")", ":", "links", "=", "self", ".", "registry", ".", "get", "(", "self", ".", "source", ")", "if", "self", "in", "links", ":", "links", ".", "pop", "(", "links", ".", "index", "(", "self", ")", ")" ]
Unregisters the Link
[ "Unregisters", "the", "Link" ]
python
train
25.428571
sendgrid/sendgrid-python
sendgrid/helpers/mail/attachment.py
https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/attachment.py#L196-L218
def get(self): """ Get a JSON-ready representation of this Attachment. :returns: This Attachment, ready for use in a request body. :rtype: dict """ attachment = {} if self.file_content is not None: attachment["content"] = self.file_content.get() ...
[ "def", "get", "(", "self", ")", ":", "attachment", "=", "{", "}", "if", "self", ".", "file_content", "is", "not", "None", ":", "attachment", "[", "\"content\"", "]", "=", "self", ".", "file_content", ".", "get", "(", ")", "if", "self", ".", "file_typ...
Get a JSON-ready representation of this Attachment. :returns: This Attachment, ready for use in a request body. :rtype: dict
[ "Get", "a", "JSON", "-", "ready", "representation", "of", "this", "Attachment", "." ]
python
train
31.173913
keon/algorithms
algorithms/tree/avl/avl.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/tree/avl/avl.py#L100-L110
def rotate_left(self): """ Left rotation """ new_root = self.node.right.node new_left_sub = new_root.left.node old_root = self.node self.node = new_root old_root.right.node = new_left_sub new_root.left.node = old_root
[ "def", "rotate_left", "(", "self", ")", ":", "new_root", "=", "self", ".", "node", ".", "right", ".", "node", "new_left_sub", "=", "new_root", ".", "left", ".", "node", "old_root", "=", "self", ".", "node", "self", ".", "node", "=", "new_root", "old_ro...
Left rotation
[ "Left", "rotation" ]
python
train
25.454545
jf-parent/brome
brome/runner/virtualbox_instance.py
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/runner/virtualbox_instance.py#L35-L68
def execute_command(self, command, **kwargs): """Execute a command on the node Args: command (str) Kwargs: username (str) """ self.info_log("executing command: %s" % command) try: ssh = paramiko.SSHClient() ssh.set_missi...
[ "def", "execute_command", "(", "self", ",", "command", ",", "*", "*", "kwargs", ")", ":", "self", ".", "info_log", "(", "\"executing command: %s\"", "%", "command", ")", "try", ":", "ssh", "=", "paramiko", ".", "SSHClient", "(", ")", "ssh", ".", "set_mis...
Execute a command on the node Args: command (str) Kwargs: username (str)
[ "Execute", "a", "command", "on", "the", "node" ]
python
train
25.852941
sentinel-hub/sentinelhub-py
sentinelhub/geopedia.py
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/geopedia.py#L299-L311
def _get_filename(request, item): """ Creates a filename """ if request.keep_image_names: filename = OgcImageService.finalize_filename(item['niceName'].replace(' ', '_')) else: filename = OgcImageService.finalize_filename( '_'.join([str(GeopediaSer...
[ "def", "_get_filename", "(", "request", ",", "item", ")", ":", "if", "request", ".", "keep_image_names", ":", "filename", "=", "OgcImageService", ".", "finalize_filename", "(", "item", "[", "'niceName'", "]", ".", "replace", "(", "' '", ",", "'_'", ")", ")...
Creates a filename
[ "Creates", "a", "filename" ]
python
train
38.846154
google/prettytensor
prettytensor/pretty_tensor_class.py
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_class.py#L1181-L1209
def bind(self, **bindings): """Creates a new template with the given unbound variables bound. Args: **bindings: Arguments for every deferred parameter. Returns: A new template with the given bindings. Raises: ValueError: If any of the bindings do not correspond to unbound variables. ...
[ "def", "bind", "(", "self", ",", "*", "*", "bindings", ")", ":", "new_context", "=", "dict", "(", "self", ".", "_partial_context", ")", "unknown_keys", "=", "[", "]", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "bindings", ")", ":", "...
Creates a new template with the given unbound variables bound. Args: **bindings: Arguments for every deferred parameter. Returns: A new template with the given bindings. Raises: ValueError: If any of the bindings do not correspond to unbound variables.
[ "Creates", "a", "new", "template", "with", "the", "given", "unbound", "variables", "bound", "." ]
python
train
36.827586
jschaf/ideone-api
ideone/__init__.py
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L181-L234
def submission_status(self, link): """ Given the unique link of a submission, returns its current status. Keyword Arguments ----------------- * link: the unique id string of a submission Returns ------- A dictionary of the error, the result cod...
[ "def", "submission_status", "(", "self", ",", "link", ")", ":", "result", "=", "self", ".", "client", ".", "service", ".", "getSubmissionStatus", "(", "self", ".", "user", ",", "self", ".", "password", ",", "link", ")", "result_dict", "=", "Ideone", ".",...
Given the unique link of a submission, returns its current status. Keyword Arguments ----------------- * link: the unique id string of a submission Returns ------- A dictionary of the error, the result code and the status code. Notes -...
[ "Given", "the", "unique", "link", "of", "a", "submission", "returns", "its", "current", "status", "." ]
python
train
28.555556
titusjan/argos
argos/inspector/qtplugins/table.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/qtplugins/table.py#L601-L606
def setFont(self, font): """ Sets the font that will be returned when data() is called with the Qt.FontRole. Can be a QFont or None if no font is set. """ check_class(font, QtGui.QFont, allow_none=True) self._font = font
[ "def", "setFont", "(", "self", ",", "font", ")", ":", "check_class", "(", "font", ",", "QtGui", ".", "QFont", ",", "allow_none", "=", "True", ")", "self", ".", "_font", "=", "font" ]
Sets the font that will be returned when data() is called with the Qt.FontRole. Can be a QFont or None if no font is set.
[ "Sets", "the", "font", "that", "will", "be", "returned", "when", "data", "()", "is", "called", "with", "the", "Qt", ".", "FontRole", ".", "Can", "be", "a", "QFont", "or", "None", "if", "no", "font", "is", "set", "." ]
python
train
43.166667
openstack/networking-arista
networking_arista/common/db_lib.py
https://github.com/openstack/networking-arista/blob/07ce6b1fc62ff74308a6eabfc4cc0ee09fb7b0fe/networking_arista/common/db_lib.py#L286-L296
def get_ports(device_owners=None, vnic_type=None, port_id=None, active=True): """Returns list of all ports in neutron the db""" session = db.get_reader_session() with session.begin(): port_model = models_v2.Port ports = (session .query(port_model) .filter_un...
[ "def", "get_ports", "(", "device_owners", "=", "None", ",", "vnic_type", "=", "None", ",", "port_id", "=", "None", ",", "active", "=", "True", ")", ":", "session", "=", "db", ".", "get_reader_session", "(", ")", "with", "session", ".", "begin", "(", ")...
Returns list of all ports in neutron the db
[ "Returns", "list", "of", "all", "ports", "in", "neutron", "the", "db" ]
python
train
42
Netflix-Skunkworks/historical
historical/security_group/collector.py
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/security_group/collector.py#L135-L170
def capture_update_records(records): """Writes all updated configuration info to DynamoDB""" for rec in records: data = cloudwatch.get_historical_base_info(rec) group = describe_group(rec, cloudwatch.get_region(rec)) if len(group) > 1: raise Exception(f'[X] Multiple groups f...
[ "def", "capture_update_records", "(", "records", ")", ":", "for", "rec", "in", "records", ":", "data", "=", "cloudwatch", ".", "get_historical_base_info", "(", "rec", ")", "group", "=", "describe_group", "(", "rec", ",", "cloudwatch", ".", "get_region", "(", ...
Writes all updated configuration info to DynamoDB
[ "Writes", "all", "updated", "configuration", "info", "to", "DynamoDB" ]
python
train
35.611111
LeKono/pyhgnc
src/pyhgnc/manager/query.py
https://github.com/LeKono/pyhgnc/blob/1cae20c40874bfb51581b7c5c1481707e942b5d0/src/pyhgnc/manager/query.py#L416-L465
def alias_symbol(self, alias_symbol=None, is_previous_symbol=None, hgnc_symbol=None, hgnc_identifier=None, limit=None, as_df=False): """Method to query :class:`.models.AliasSymbol` objec...
[ "def", "alias_symbol", "(", "self", ",", "alias_symbol", "=", "None", ",", "is_previous_symbol", "=", "None", ",", "hgnc_symbol", "=", "None", ",", "hgnc_identifier", "=", "None", ",", "limit", "=", "None", ",", "as_df", "=", "False", ")", ":", "q", "=",...
Method to query :class:`.models.AliasSymbol` objects in database :param alias_symbol: alias symbol(s) :type alias_symbol: str or tuple(str) or None :param is_previous_symbol: flag for 'is previous' :type is_previous_symbol: bool or tuple(bool) or None :param hgnc_symbol: HGNC ...
[ "Method", "to", "query", ":", "class", ":", ".", "models", ".", "AliasSymbol", "objects", "in", "database" ]
python
train
38.02
knipknap/exscript
Exscript/protocols/protocol.py
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/protocols/protocol.py#L1098-L1118
def add_monitor(self, pattern, callback, limit=80): """ Calls the given function whenever the given pattern matches the incoming data. .. HINT:: If you want to catch all incoming data regardless of a pattern, use the Protocol.data_received_event event instead. ...
[ "def", "add_monitor", "(", "self", ",", "pattern", ",", "callback", ",", "limit", "=", "80", ")", ":", "self", ".", "buffer", ".", "add_monitor", "(", "pattern", ",", "partial", "(", "callback", ",", "self", ")", ",", "limit", ")" ]
Calls the given function whenever the given pattern matches the incoming data. .. HINT:: If you want to catch all incoming data regardless of a pattern, use the Protocol.data_received_event event instead. Arguments passed to the callback are the protocol instance, the ...
[ "Calls", "the", "given", "function", "whenever", "the", "given", "pattern", "matches", "the", "incoming", "data", "." ]
python
train
42.666667
chop-dbhi/varify
varify/migrations/0004_remove_sample_as_queryable.py
https://github.com/chop-dbhi/varify/blob/5dc721e49ed9bd3582f4b117785fdd1a8b6ba777/varify/migrations/0004_remove_sample_as_queryable.py#L14-L17
def backwards(self, orm): "Write your backwards methods here." orm['avocado.DataConcept'].objects.filter(name='Sample')\ .update(queryable=True)
[ "def", "backwards", "(", "self", ",", "orm", ")", ":", "orm", "[", "'avocado.DataConcept'", "]", ".", "objects", ".", "filter", "(", "name", "=", "'Sample'", ")", ".", "update", "(", "queryable", "=", "True", ")" ]
Write your backwards methods here.
[ "Write", "your", "backwards", "methods", "here", "." ]
python
train
43.25
StackStorm/pybind
pybind/slxos/v17s_1_02/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/__init__.py#L4082-L4103
def _set_routing_system(self, v, load=False): """ Setter method for routing_system, mapped from YANG variable /routing_system (container) If this variable is read-only (config: false) in the source YANG file, then _set_routing_system is considered as a private method. Backends looking to populate th...
[ "def", "_set_routing_system", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", ...
Setter method for routing_system, mapped from YANG variable /routing_system (container) If this variable is read-only (config: false) in the source YANG file, then _set_routing_system is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_rout...
[ "Setter", "method", "for", "routing_system", "mapped", "from", "YANG", "variable", "/", "routing_system", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", "file", "...
python
train
77.272727
plivo/sharq
sharq/queue.py
https://github.com/plivo/sharq/blob/32bbfbdcbbaa8e154271ffd125ac4500382f3d19/sharq/queue.py#L33-L61
def _initialize(self): """Read the SharQ configuration and set appropriate variables. Open a redis connection pool and load all the Lua scripts. """ self._key_prefix = self._config.get('redis', 'key_prefix') self._job_expire_interval = int( self._config.get('s...
[ "def", "_initialize", "(", "self", ")", ":", "self", ".", "_key_prefix", "=", "self", ".", "_config", ".", "get", "(", "'redis'", ",", "'key_prefix'", ")", "self", ".", "_job_expire_interval", "=", "int", "(", "self", ".", "_config", ".", "get", "(", "...
Read the SharQ configuration and set appropriate variables. Open a redis connection pool and load all the Lua scripts.
[ "Read", "the", "SharQ", "configuration", "and", "set", "appropriate", "variables", ".", "Open", "a", "redis", "connection", "pool", "and", "load", "all", "the", "Lua", "scripts", "." ]
python
train
37.137931
obriencj/python-javatools
javatools/__init__.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/__init__.py#L179-L211
def unpack(self, unpacker): """ Unpacks the constant pool from an unpacker stream """ (count, ) = unpacker.unpack_struct(_H) # first item is never present in the actual data buffer, but # the count number acts like it would be. items = [(None, None), ] c...
[ "def", "unpack", "(", "self", ",", "unpacker", ")", ":", "(", "count", ",", ")", "=", "unpacker", ".", "unpack_struct", "(", "_H", ")", "# first item is never present in the actual data buffer, but", "# the count number acts like it would be.", "items", "=", "[", "(",...
Unpacks the constant pool from an unpacker stream
[ "Unpacks", "the", "constant", "pool", "from", "an", "unpacker", "stream" ]
python
train
28.151515
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L184-L191
def comments(case_id): """Upload a new comment.""" text = request.form['text'] variant_id = request.form.get('variant_id') username = request.form.get('username') case_obj = app.db.case(case_id) app.db.add_comment(case_obj, text, variant_id=variant_id, username=username) return redirect(requ...
[ "def", "comments", "(", "case_id", ")", ":", "text", "=", "request", ".", "form", "[", "'text'", "]", "variant_id", "=", "request", ".", "form", ".", "get", "(", "'variant_id'", ")", "username", "=", "request", ".", "form", ".", "get", "(", "'username'...
Upload a new comment.
[ "Upload", "a", "new", "comment", "." ]
python
train
40.75
JasonKessler/scattertext
scattertext/CorpusFromScikit.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/CorpusFromScikit.py#L46-L57
def build(self): ''' Returns ------- Corpus ''' constructor_kwargs = self._get_build_kwargs() if type(self.raw_texts) == list: constructor_kwargs['raw_texts'] = np.array(self.raw_texts) else: constructor_kwargs['raw_texts'] = self.raw_texts return Corpus(**constructor_kwargs)
[ "def", "build", "(", "self", ")", ":", "constructor_kwargs", "=", "self", ".", "_get_build_kwargs", "(", ")", "if", "type", "(", "self", ".", "raw_texts", ")", "==", "list", ":", "constructor_kwargs", "[", "'raw_texts'", "]", "=", "np", ".", "array", "("...
Returns ------- Corpus
[ "Returns", "-------", "Corpus" ]
python
train
24.083333
minhhoit/yacms
yacms/core/managers.py
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/managers.py#L182-L188
def order_by(self, *field_names): """ Mark the filter as being ordered if search has occurred. """ if not self._search_ordered: self._search_ordered = len(self._search_terms) > 0 return super(SearchableQuerySet, self).order_by(*field_names)
[ "def", "order_by", "(", "self", ",", "*", "field_names", ")", ":", "if", "not", "self", ".", "_search_ordered", ":", "self", ".", "_search_ordered", "=", "len", "(", "self", ".", "_search_terms", ")", ">", "0", "return", "super", "(", "SearchableQuerySet",...
Mark the filter as being ordered if search has occurred.
[ "Mark", "the", "filter", "as", "being", "ordered", "if", "search", "has", "occurred", "." ]
python
train
40.857143
TDG-Platform/cloud-harness
docker_runner/application_runner.py
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/docker_runner/application_runner.py#L57-L65
def extract_source(bundle_path, source_path): """ Extract the source bundle :param bundle_path: path to the aource bundle *.tar.gz :param source_path: path to location where to extractall """ with tarfile.open(bundle_path, 'r:gz') as tf: tf.extractall(path=source_path) logger.debug("...
[ "def", "extract_source", "(", "bundle_path", ",", "source_path", ")", ":", "with", "tarfile", ".", "open", "(", "bundle_path", ",", "'r:gz'", ")", "as", "tf", ":", "tf", ".", "extractall", "(", "path", "=", "source_path", ")", "logger", ".", "debug", "("...
Extract the source bundle :param bundle_path: path to the aource bundle *.tar.gz :param source_path: path to location where to extractall
[ "Extract", "the", "source", "bundle", ":", "param", "bundle_path", ":", "path", "to", "the", "aource", "bundle", "*", ".", "tar", ".", "gz", ":", "param", "source_path", ":", "path", "to", "location", "where", "to", "extractall" ]
python
test
41.555556
pysathq/pysat
pysat/solvers.py
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/solvers.py#L1280-L1290
def delete(self): """ Destructor. """ if self.glucose: pysolvers.glucose41_del(self.glucose) self.glucose = None if self.prfile: self.prfile.close()
[ "def", "delete", "(", "self", ")", ":", "if", "self", ".", "glucose", ":", "pysolvers", ".", "glucose41_del", "(", "self", ".", "glucose", ")", "self", ".", "glucose", "=", "None", "if", "self", ".", "prfile", ":", "self", ".", "prfile", ".", "close"...
Destructor.
[ "Destructor", "." ]
python
train
20.727273
opencobra/cobrapy
cobra/flux_analysis/summary.py
https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/flux_analysis/summary.py#L23-L144
def metabolite_summary(met, solution=None, threshold=0.01, fva=False, names=False, floatfmt='.3g'): """ Print a summary of the production and consumption fluxes. This method requires the model for which this metabolite is a part to be solved. Parameters ---------- so...
[ "def", "metabolite_summary", "(", "met", ",", "solution", "=", "None", ",", "threshold", "=", "0.01", ",", "fva", "=", "False", ",", "names", "=", "False", ",", "floatfmt", "=", "'.3g'", ")", ":", "if", "names", ":", "emit", "=", "attrgetter", "(", "...
Print a summary of the production and consumption fluxes. This method requires the model for which this metabolite is a part to be solved. Parameters ---------- solution : cobra.Solution, optional A previously solved model solution to use for generating the summary. If none provide...
[ "Print", "a", "summary", "of", "the", "production", "and", "consumption", "fluxes", "." ]
python
valid
38.090164
stain/forgetSQL
lib/forgetSQL.py
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L828-L852
def getAllText(cls, where=None, SEPERATOR=' ', orderBy=None): """Retrieve a list of of all possible instances of this class. The list is composed of tuples in the format (id, description) - where description is a string composed by the fields from cls._shortView, joint with SEPERATOR. ...
[ "def", "getAllText", "(", "cls", ",", "where", "=", "None", ",", "SEPERATOR", "=", "' '", ",", "orderBy", "=", "None", ")", ":", "(", "sql", ",", "fields", ")", "=", "cls", ".", "_prepareSQL", "(", "\"SELECTALL\"", ",", "where", ",", "orderBy", "=", ...
Retrieve a list of of all possible instances of this class. The list is composed of tuples in the format (id, description) - where description is a string composed by the fields from cls._shortView, joint with SEPERATOR.
[ "Retrieve", "a", "list", "of", "of", "all", "possible", "instances", "of", "this", "class", "." ]
python
train
41.04
phoebe-project/phoebe2
phoebe/backend/universe.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L230-L239
def get_body(self, component): """ TODO: add documentation """ if component in self._bodies.keys(): return self._bodies[component] else: # then hopefully we're a child star of an contact_binary envelope parent_component = self._parent_envelope_...
[ "def", "get_body", "(", "self", ",", "component", ")", ":", "if", "component", "in", "self", ".", "_bodies", ".", "keys", "(", ")", ":", "return", "self", ".", "_bodies", "[", "component", "]", "else", ":", "# then hopefully we're a child star of an contact_bi...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
python
train
39.4
lowandrew/OLCTools
accessoryFunctions/accessoryFunctions.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/accessoryFunctions/accessoryFunctions.py#L727-L770
def nested_genobject(self, metadata, attr, datastore): """ Allow for the printing of nested GenObjects :param metadata: Nested dictionary containing the metadata. Will be further populated by this method :param attr: Current attribute being evaluated. Must be a GenObject e.g. sample.gene...
[ "def", "nested_genobject", "(", "self", ",", "metadata", ",", "attr", ",", "datastore", ")", ":", "# Iterate through all the key: value pairs of the current datastore[attr] datastore", "# e.g. reverse_reads <accessoryFunctions.accessoryFunctions.GenObject object at 0x7fe153b725f8>", "for...
Allow for the printing of nested GenObjects :param metadata: Nested dictionary containing the metadata. Will be further populated by this method :param attr: Current attribute being evaluated. Must be a GenObject e.g. sample.general :param datastore: The dictionary of the current attribute. Will...
[ "Allow", "for", "the", "printing", "of", "nested", "GenObjects", ":", "param", "metadata", ":", "Nested", "dictionary", "containing", "the", "metadata", ".", "Will", "be", "further", "populated", "by", "this", "method", ":", "param", "attr", ":", "Current", ...
python
train
68.75
bitesofcode/projexui
projexui/widgets/xorbrecordbox.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbrecordbox.py#L180-L212
def addRecordsFromThread(self, records): """ Adds the given record to the system. :param records | [<orb.Table>, ..] """ label_mapper = self.labelMapper() icon_mapper = self.iconMapper() tree = None if self.showTreeP...
[ "def", "addRecordsFromThread", "(", "self", ",", "records", ")", ":", "label_mapper", "=", "self", ".", "labelMapper", "(", ")", "icon_mapper", "=", "self", ".", "iconMapper", "(", ")", "tree", "=", "None", "if", "self", ".", "showTreePopup", "(", ")", "...
Adds the given record to the system. :param records | [<orb.Table>, ..]
[ "Adds", "the", "given", "record", "to", "the", "system", ".", ":", "param", "records", "|", "[", "<orb", ".", "Table", ">", "..", "]" ]
python
train
32.545455
IdentityPython/pysaml2
src/saml2/entity.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/entity.py#L514-L532
def _add_info(self, msg, **kwargs): """ Add information to a SAML message. If the attribute is not part of what's defined in the SAML standard add it as an extension. :param msg: :param kwargs: :return: """ args, extensions = self._filter_args(msg, **kwa...
[ "def", "_add_info", "(", "self", ",", "msg", ",", "*", "*", "kwargs", ")", ":", "args", ",", "extensions", "=", "self", ".", "_filter_args", "(", "msg", ",", "*", "*", "kwargs", ")", "for", "key", ",", "val", "in", "args", ".", "items", "(", ")",...
Add information to a SAML message. If the attribute is not part of what's defined in the SAML standard add it as an extension. :param msg: :param kwargs: :return:
[ "Add", "information", "to", "a", "SAML", "message", ".", "If", "the", "attribute", "is", "not", "part", "of", "what", "s", "defined", "in", "the", "SAML", "standard", "add", "it", "as", "an", "extension", "." ]
python
train
30
StackStorm/pybind
pybind/nos/v6_0_2f/interface/fortygigabitethernet/storm_control/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/interface/fortygigabitethernet/storm_control/__init__.py#L92-L113
def _set_ingress(self, v, load=False): """ Setter method for ingress, mapped from YANG variable /interface/fortygigabitethernet/storm_control/ingress (list) If this variable is read-only (config: false) in the source YANG file, then _set_ingress is considered as a private method. Backends looking to...
[ "def", "_set_ingress", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base",...
Setter method for ingress, mapped from YANG variable /interface/fortygigabitethernet/storm_control/ingress (list) If this variable is read-only (config: false) in the source YANG file, then _set_ingress is considered as a private method. Backends looking to populate this variable should do so via callin...
[ "Setter", "method", "for", "ingress", "mapped", "from", "YANG", "variable", "/", "interface", "/", "fortygigabitethernet", "/", "storm_control", "/", "ingress", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false...
python
train
124.5
cokelaer/spectrum
src/spectrum/window.py
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1168-L1204
def window_taylor(N, nbar=4, sll=-30): """Taylor tapering window Taylor windows allows you to make tradeoffs between the mainlobe width and sidelobe level (sll). Implemented as described by Carrara, Goodman, and Majewski in 'Spotlight Synthetic Aperture Radar: Signal Processing Algorithms' Pa...
[ "def", "window_taylor", "(", "N", ",", "nbar", "=", "4", ",", "sll", "=", "-", "30", ")", ":", "B", "=", "10", "**", "(", "-", "sll", "/", "20", ")", "A", "=", "log", "(", "B", "+", "sqrt", "(", "B", "**", "2", "-", "1", ")", ")", "/", ...
Taylor tapering window Taylor windows allows you to make tradeoffs between the mainlobe width and sidelobe level (sll). Implemented as described by Carrara, Goodman, and Majewski in 'Spotlight Synthetic Aperture Radar: Signal Processing Algorithms' Pages 512-513 :param N: window length :...
[ "Taylor", "tapering", "window" ]
python
valid
31.108108
saltstack/salt
salt/client/ssh/wrapper/publish.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/publish.py#L25-L105
def _publish(tgt, fun, arg=None, tgt_type='glob', returner='', timeout=None, form='clean', roster=None): ''' Publish a command "from the minion out to other minions". In reality, the minion does not execute this funct...
[ "def", "_publish", "(", "tgt", ",", "fun", ",", "arg", "=", "None", ",", "tgt_type", "=", "'glob'", ",", "returner", "=", "''", ",", "timeout", "=", "None", ",", "form", "=", "'clean'", ",", "roster", "=", "None", ")", ":", "if", "fun", ".", "sta...
Publish a command "from the minion out to other minions". In reality, the minion does not execute this function, it is executed by the master. Thus, no access control is enabled, as minions cannot initiate publishes themselves. Salt-ssh publishes will default to whichever roster was used for the in...
[ "Publish", "a", "command", "from", "the", "minion", "out", "to", "other", "minions", ".", "In", "reality", "the", "minion", "does", "not", "execute", "this", "function", "it", "is", "executed", "by", "the", "master", ".", "Thus", "no", "access", "control",...
python
train
29.45679
joowani/binarytree
binarytree/__init__.py
https://github.com/joowani/binarytree/blob/23cb6f1e60e66b96133259031e97ec03e932ba13/binarytree/__init__.py#L1388-L1441
def properties(self): """Return various properties of the binary tree. :return: Binary tree properties. :rtype: dict **Example**: .. doctest:: >>> from binarytree import Node >>> >>> root = Node(1) >>> root.left = Node(2) ...
[ "def", "properties", "(", "self", ")", ":", "properties", "=", "_get_tree_properties", "(", "self", ")", "properties", ".", "update", "(", "{", "'is_bst'", ":", "_is_bst", "(", "self", ")", ",", "'is_balanced'", ":", "_is_balanced", "(", "self", ")", ">=",...
Return various properties of the binary tree. :return: Binary tree properties. :rtype: dict **Example**: .. doctest:: >>> from binarytree import Node >>> >>> root = Node(1) >>> root.left = Node(2) >>> root.right = Node(3) ...
[ "Return", "various", "properties", "of", "the", "binary", "tree", "." ]
python
train
34.851852
mikedh/trimesh
trimesh/exchange/ply.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/exchange/ply.py#L208-L286
def parse_header(file_obj): """ Read the ASCII header of a PLY file, and leave the file object at the position of the start of data but past the header. Parameters ----------- file_obj : open file object Positioned at the start of the file Returns ----------- elements : colle...
[ "def", "parse_header", "(", "file_obj", ")", ":", "if", "'ply'", "not", "in", "str", "(", "file_obj", ".", "readline", "(", ")", ")", ":", "raise", "ValueError", "(", "'not a ply file!'", ")", "# collect the encoding: binary or ASCII", "encoding", "=", "file_obj...
Read the ASCII header of a PLY file, and leave the file object at the position of the start of data but past the header. Parameters ----------- file_obj : open file object Positioned at the start of the file Returns ----------- elements : collections.OrderedDict Fields and data...
[ "Read", "the", "ASCII", "header", "of", "a", "PLY", "file", "and", "leave", "the", "file", "object", "at", "the", "position", "of", "the", "start", "of", "data", "but", "past", "the", "header", "." ]
python
train
32.088608
basho/riak-python-client
riak/resolver.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/resolver.py#L31-L40
def last_written_resolver(riak_object): """ A conflict-resolution function that resolves by selecting the most recently-modified sibling by timestamp. :param riak_object: an object-in-conflict that will be resolved :type riak_object: :class:`RiakObject <riak.riak_object.RiakObject>` """ ria...
[ "def", "last_written_resolver", "(", "riak_object", ")", ":", "riak_object", ".", "siblings", "=", "[", "max", "(", "riak_object", ".", "siblings", ",", "key", "=", "lambda", "x", ":", "x", ".", "last_modified", ")", ",", "]" ]
A conflict-resolution function that resolves by selecting the most recently-modified sibling by timestamp. :param riak_object: an object-in-conflict that will be resolved :type riak_object: :class:`RiakObject <riak.riak_object.RiakObject>`
[ "A", "conflict", "-", "resolution", "function", "that", "resolves", "by", "selecting", "the", "most", "recently", "-", "modified", "sibling", "by", "timestamp", "." ]
python
train
42.3
craffel/mir_eval
mir_eval/pattern.py
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L523-L568
def first_n_three_layer_P(reference_patterns, estimated_patterns, n=5): """First n three-layer precision. This metric is basically the same as the three-layer FPR but it is only applied to the first n estimated patterns, and it only returns the precision. In MIREX and typically, n = 5. Examples ...
[ "def", "first_n_three_layer_P", "(", "reference_patterns", ",", "estimated_patterns", ",", "n", "=", "5", ")", ":", "validate", "(", "reference_patterns", ",", "estimated_patterns", ")", "# If no patterns were provided, metric is zero", "if", "_n_onset_midi", "(", "refere...
First n three-layer precision. This metric is basically the same as the three-layer FPR but it is only applied to the first n estimated patterns, and it only returns the precision. In MIREX and typically, n = 5. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") ...
[ "First", "n", "three", "-", "layer", "precision", "." ]
python
train
34.173913
GaretJax/coolfig
setup.py
https://github.com/GaretJax/coolfig/blob/6952aabc6ad2c9684d5d98dc470313f8f13fe636/setup.py#L48-L60
def get_files(*bases): """ List all files in a data directory. """ for base in bases: basedir, _ = base.split(".", 1) base = os.path.join(os.path.dirname(__file__), *base.split(".")) rem = len(os.path.dirname(base)) + len(basedir) + 2 for...
[ "def", "get_files", "(", "*", "bases", ")", ":", "for", "base", "in", "bases", ":", "basedir", ",", "_", "=", "base", ".", "split", "(", "\".\"", ",", "1", ")", "base", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname"...
List all files in a data directory.
[ "List", "all", "files", "in", "a", "data", "directory", "." ]
python
train
34.230769
pmorissette/bt
bt/core.py
https://github.com/pmorissette/bt/blob/0363e6fa100d9392dd18e32e3d8379d5e83c28fa/bt/core.py#L676-L722
def rebalance(self, weight, child, base=np.nan, update=True): """ Rebalance a child to a given weight. This is a helper method to simplify code logic. This method is used when we want to se the weight of a particular child to a set amount. It is similar to allocate, but it calcu...
[ "def", "rebalance", "(", "self", ",", "weight", ",", "child", ",", "base", "=", "np", ".", "nan", ",", "update", "=", "True", ")", ":", "# if weight is 0 - we want to close child", "if", "weight", "==", "0", ":", "if", "child", "in", "self", ".", "childr...
Rebalance a child to a given weight. This is a helper method to simplify code logic. This method is used when we want to se the weight of a particular child to a set amount. It is similar to allocate, but it calculates the appropriate allocation based on the current weight. Arg...
[ "Rebalance", "a", "child", "to", "a", "given", "weight", "." ]
python
train
39.765957
mdgoldberg/sportsref
sportsref/nba/seasons.py
https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/seasons.py#L53-L59
def get_sub_doc(self, subpage): """Returns PyQuery object for a given subpage URL. :subpage: The subpage of the season, e.g. 'per_game'. :returns: PyQuery object. """ html = sportsref.utils.get_html(self._subpage_url(subpage)) return pq(html)
[ "def", "get_sub_doc", "(", "self", ",", "subpage", ")", ":", "html", "=", "sportsref", ".", "utils", ".", "get_html", "(", "self", ".", "_subpage_url", "(", "subpage", ")", ")", "return", "pq", "(", "html", ")" ]
Returns PyQuery object for a given subpage URL. :subpage: The subpage of the season, e.g. 'per_game'. :returns: PyQuery object.
[ "Returns", "PyQuery", "object", "for", "a", "given", "subpage", "URL", ".", ":", "subpage", ":", "The", "subpage", "of", "the", "season", "e", ".", "g", ".", "per_game", ".", ":", "returns", ":", "PyQuery", "object", "." ]
python
test
40.571429
openvax/varcode
varcode/variant_collection.py
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant_collection.py#L175-L196
def filter_by_transcript_expression( self, transcript_expression_dict, min_expression_value=0.0): """ Filters variants down to those which have overlap a transcript whose expression value in the transcript_expression_dict argument is greater than min_e...
[ "def", "filter_by_transcript_expression", "(", "self", ",", "transcript_expression_dict", ",", "min_expression_value", "=", "0.0", ")", ":", "return", "self", ".", "filter_any_above_threshold", "(", "multi_key_fn", "=", "lambda", "variant", ":", "variant", ".", "trans...
Filters variants down to those which have overlap a transcript whose expression value in the transcript_expression_dict argument is greater than min_expression_value. Parameters ---------- transcript_expression_dict : dict Dictionary mapping Ensembl transcript IDs to...
[ "Filters", "variants", "down", "to", "those", "which", "have", "overlap", "a", "transcript", "whose", "expression", "value", "in", "the", "transcript_expression_dict", "argument", "is", "greater", "than", "min_expression_value", "." ]
python
train
38.409091
pypa/pipenv
pipenv/patched/notpip/_internal/cli/base_command.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/base_command.py#L242-L306
def populate_requirement_set(requirement_set, # type: RequirementSet args, # type: List[str] options, # type: Values finder, # type: PackageFinder session, ...
[ "def", "populate_requirement_set", "(", "requirement_set", ",", "# type: RequirementSet", "args", ",", "# type: List[str]", "options", ",", "# type: Values", "finder", ",", "# type: PackageFinder", "session", ",", "# type: PipSession", "name", ",", "# type: str", "wheel_cac...
Marshal cmd line args into a requirement set.
[ "Marshal", "cmd", "line", "args", "into", "a", "requirement", "set", "." ]
python
train
44.246154
Parsl/parsl
parsl/executors/low_latency/executor.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/low_latency/executor.py#L144-L155
def _start_queue_management_thread(self): """ TODO: docstring """ if self._queue_management_thread is None: logger.debug("Starting queue management thread") self._queue_management_thread = threading.Thread( target=self._queue_management_worker) self._q...
[ "def", "_start_queue_management_thread", "(", "self", ")", ":", "if", "self", ".", "_queue_management_thread", "is", "None", ":", "logger", ".", "debug", "(", "\"Starting queue management thread\"", ")", "self", ".", "_queue_management_thread", "=", "threading", ".", ...
TODO: docstring
[ "TODO", ":", "docstring" ]
python
valid
45.166667
tylertreat/BigQuery-Python
bigquery/client.py
https://github.com/tylertreat/BigQuery-Python/blob/88d99de42d954d49fc281460068f0e95003da098/bigquery/client.py#L1605-L1627
def _in_range(self, start_time, end_time, time): """Indicate if the given time falls inside of the given range. Parameters ---------- start_time : int The unix time for the start of the range end_time : int The unix time for the end of the range t...
[ "def", "_in_range", "(", "self", ",", "start_time", ",", "end_time", ",", "time", ")", ":", "ONE_MONTH", "=", "2764800", "# 32 days", "return", "start_time", "<=", "time", "<=", "end_time", "or", "time", "<=", "start_time", "<=", "time", "+", "ONE_MONTH", ...
Indicate if the given time falls inside of the given range. Parameters ---------- start_time : int The unix time for the start of the range end_time : int The unix time for the end of the range time : int The unix time to check Return...
[ "Indicate", "if", "the", "given", "time", "falls", "inside", "of", "the", "given", "range", "." ]
python
train
29
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L62-L79
def toggleAttributesDOM(isEnabled): ''' toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM ...
[ "def", "toggleAttributesDOM", "(", "isEnabled", ")", ":", "if", "isEnabled", ":", "AdvancedTag", ".", "attributes", "=", "AdvancedTag", ".", "attributesDOM", "else", ":", "AdvancedTag", ".", "attributes", "=", "AdvancedTag", ".", "attributesDict" ]
toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM The dict version is always accessable as Advanced...
[ "toggleAttributesDOM", "-", "Toggle", "if", "the", "old", "DOM", "tag", ".", "attributes", "NamedNodeMap", "model", "should", "be", "used", "for", "the", ".", "attributes", "method", "versus" ]
python
train
42.111111
qwilka/vn-tree
vntree/node.py
https://github.com/qwilka/vn-tree/blob/f08106e9c7232d8748d78d1d39b019699a7407dd/vntree/node.py#L142-L154
def add_child(self, node): """Add a child node to the current node instance. :param node: the child node instance. :type node: Node :returns: The new child node instance. :rtype: Node """ if not issubclass(node.__class__, Node): raise TypeError("{...
[ "def", "add_child", "(", "self", ",", "node", ")", ":", "if", "not", "issubclass", "(", "node", ".", "__class__", ",", "Node", ")", ":", "raise", "TypeError", "(", "\"{}.add_child: arg «node»=«{}», type {} not valid.\".for", "m", "at(sel", "f", ".__c", "l", "a...
Add a child node to the current node instance. :param node: the child node instance. :type node: Node :returns: The new child node instance. :rtype: Node
[ "Add", "a", "child", "node", "to", "the", "current", "node", "instance", "." ]
python
train
37.538462
pandas-dev/pandas
pandas/core/internals/blocks.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/blocks.py#L2040-L2048
def get_values(self, dtype=None): """ return object dtype as boxed values, such as Timestamps/Timedelta """ if is_object_dtype(dtype): values = self.values.ravel() result = self._holder(values).astype(object) return result.reshape(self.values.shape) ...
[ "def", "get_values", "(", "self", ",", "dtype", "=", "None", ")", ":", "if", "is_object_dtype", "(", "dtype", ")", ":", "values", "=", "self", ".", "values", ".", "ravel", "(", ")", "result", "=", "self", ".", "_holder", "(", "values", ")", ".", "a...
return object dtype as boxed values, such as Timestamps/Timedelta
[ "return", "object", "dtype", "as", "boxed", "values", "such", "as", "Timestamps", "/", "Timedelta" ]
python
train
37.333333
sveetch/py-css-styleguide
py_css_styleguide/model.py
https://github.com/sveetch/py-css-styleguide/blob/5acc693f71b2fa7d944d7fed561ae0a7699ccd0f/py_css_styleguide/model.py#L89-L98
def set_rule(self, name, properties): """ Set a rules as object attribute. Arguments: name (string): Rule name to set as attribute name. properties (dict): Dictionnary of properties. """ self._rule_attrs.append(name) setattr(self, name, properties...
[ "def", "set_rule", "(", "self", ",", "name", ",", "properties", ")", ":", "self", ".", "_rule_attrs", ".", "append", "(", "name", ")", "setattr", "(", "self", ",", "name", ",", "properties", ")" ]
Set a rules as object attribute. Arguments: name (string): Rule name to set as attribute name. properties (dict): Dictionnary of properties.
[ "Set", "a", "rules", "as", "object", "attribute", "." ]
python
train
31.2
bwohlberg/sporco
sporco/dictlrn/cbpdndlmd.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/dictlrn/cbpdndlmd.py#L526-L541
def evaluate(self): """Evaluate functional value of previous iteration.""" if self.opt['AccurateDFid']: DX = self.reconstruct() S = self.xstep.S dfd = (np.linalg.norm(self.xstep.W * (DX - S))**2) / 2.0 if self.xmethod == 'fista': X = self....
[ "def", "evaluate", "(", "self", ")", ":", "if", "self", ".", "opt", "[", "'AccurateDFid'", "]", ":", "DX", "=", "self", ".", "reconstruct", "(", ")", "S", "=", "self", ".", "xstep", ".", "S", "dfd", "=", "(", "np", ".", "linalg", ".", "norm", "...
Evaluate functional value of previous iteration.
[ "Evaluate", "functional", "value", "of", "previous", "iteration", "." ]
python
train
34.875
xflr6/concepts
concepts/definitions.py
https://github.com/xflr6/concepts/blob/2801b27b05fa02cccee7d549451810ffcbf5c942/concepts/definitions.py#L317-L322
def rename_object(self, old, new): """Replace the name of an object by a new one.""" self._objects.replace(old, new) pairs = self._pairs pairs |= {(new, p) for p in self._properties if (old, p) in pairs and not pairs.remove((old, p))}
[ "def", "rename_object", "(", "self", ",", "old", ",", "new", ")", ":", "self", ".", "_objects", ".", "replace", "(", "old", ",", "new", ")", "pairs", "=", "self", ".", "_pairs", "pairs", "|=", "{", "(", "new", ",", "p", ")", "for", "p", "in", "...
Replace the name of an object by a new one.
[ "Replace", "the", "name", "of", "an", "object", "by", "a", "new", "one", "." ]
python
train
45.5
rgs1/zk_shell
zk_shell/shell.py
https://github.com/rgs1/zk_shell/blob/bbf34fdfcf1f81100e2a5816fad8af6afc782a54/zk_shell/shell.py#L266-L291
def _complete_path(self, cmd_param_text, full_cmd, *_): """ completes paths """ if full_cmd.endswith(" "): cmd_param, path = " ", " " else: pieces = shlex.split(full_cmd) if len(pieces) > 1: cmd_param = pieces[-1] else: ...
[ "def", "_complete_path", "(", "self", ",", "cmd_param_text", ",", "full_cmd", ",", "*", "_", ")", ":", "if", "full_cmd", ".", "endswith", "(", "\" \"", ")", ":", "cmd_param", ",", "path", "=", "\" \"", ",", "\" \"", "else", ":", "pieces", "=", "shlex",...
completes paths
[ "completes", "paths" ]
python
train
40.615385
alvations/lazyme
lazyme/string.py
https://github.com/alvations/lazyme/blob/961a8282198588ff72e15643f725ce895e51d06d/lazyme/string.py#L45-L53
def deduplicate(s, ch): """ From http://stackoverflow.com/q/42216559/610569 s = 'this is an irritating string with random spacing .' deduplicate(s) 'this is an irritating string with random spacing .' """ return ch.join([substring for substring in s.strip().split(ch) if su...
[ "def", "deduplicate", "(", "s", ",", "ch", ")", ":", "return", "ch", ".", "join", "(", "[", "substring", "for", "substring", "in", "s", ".", "strip", "(", ")", ".", "split", "(", "ch", ")", "if", "substring", "]", ")" ]
From http://stackoverflow.com/q/42216559/610569 s = 'this is an irritating string with random spacing .' deduplicate(s) 'this is an irritating string with random spacing .'
[ "From", "http", ":", "//", "stackoverflow", ".", "com", "/", "q", "/", "42216559", "/", "610569" ]
python
train
35.666667
rapidpro/dash
dash/orgs/tasks.py
https://github.com/rapidpro/dash/blob/e9dc05b31b86fe3fe72e956975d1ee0a275ac016/dash/orgs/tasks.py#L60-L115
def maybe_run_for_org(org, task_func, task_key, lock_timeout): """ Runs the given task function for the specified org provided it's not already running :param org: the org :param task_func: the task function :param task_key: the task key :param lock_timeout: the lock timeout in seconds """ ...
[ "def", "maybe_run_for_org", "(", "org", ",", "task_func", ",", "task_key", ",", "lock_timeout", ")", ":", "r", "=", "get_redis_connection", "(", ")", "key", "=", "TaskState", ".", "get_lock_key", "(", "org", ",", "task_key", ")", "if", "r", ".", "get", "...
Runs the given task function for the specified org provided it's not already running :param org: the org :param task_func: the task function :param task_key: the task key :param lock_timeout: the lock timeout in seconds
[ "Runs", "the", "given", "task", "function", "for", "the", "specified", "org", "provided", "it", "s", "not", "already", "running", ":", "param", "org", ":", "the", "org", ":", "param", "task_func", ":", "the", "task", "function", ":", "param", "task_key", ...
python
train
41.25
projecthamster/hamster-lib
hamster_lib/helpers/time.py
https://github.com/projecthamster/hamster-lib/blob/bc34c822c239a6fa0cde3a4f90b0d00506fb5a4f/hamster_lib/helpers/time.py#L300-L337
def parse_time(time): """ Parse a date/time string and return a corresponding datetime object. Args: time (str): A ``string` of one of the following formats: ``%H:%M``, ``%Y-%m-%d`` or ``%Y-%m-%d %H:%M``. Returns: datetime.datetime: Depending on input string either returns ...
[ "def", "parse_time", "(", "time", ")", ":", "length", "=", "len", "(", "time", ".", "strip", "(", ")", ".", "split", "(", ")", ")", "if", "length", "==", "1", ":", "try", ":", "result", "=", "datetime", ".", "datetime", ".", "strptime", "(", "tim...
Parse a date/time string and return a corresponding datetime object. Args: time (str): A ``string` of one of the following formats: ``%H:%M``, ``%Y-%m-%d`` or ``%Y-%m-%d %H:%M``. Returns: datetime.datetime: Depending on input string either returns ``datetime.date``, ``d...
[ "Parse", "a", "date", "/", "time", "string", "and", "return", "a", "corresponding", "datetime", "object", "." ]
python
train
33.657895
nion-software/nionswift
nion/swift/Facade.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1503-L1514
def add_data_item(self, data_item: DataItem) -> None: """Add a data item to the group. :param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add. .. versionadded:: 1.0 Scriptable: Yes """ display_item = data_item._data_item.container.get_display_item_f...
[ "def", "add_data_item", "(", "self", ",", "data_item", ":", "DataItem", ")", "->", "None", ":", "display_item", "=", "data_item", ".", "_data_item", ".", "container", ".", "get_display_item_for_data_item", "(", "data_item", ".", "_data_item", ")", "if", "data_it...
Add a data item to the group. :param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add. .. versionadded:: 1.0 Scriptable: Yes
[ "Add", "a", "data", "item", "to", "the", "group", "." ]
python
train
39.666667
skorch-dev/skorch
skorch/callbacks/lr_scheduler.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/skorch/callbacks/lr_scheduler.py#L383-L392
def batch_step(self, batch_idx=None): """Updates the learning rate for the batch index: ``batch_idx``. If ``batch_idx`` is None, ``CyclicLR`` will use an internal batch index to keep track of the index. """ if batch_idx is None: batch_idx = self.last_batch_idx + 1 ...
[ "def", "batch_step", "(", "self", ",", "batch_idx", "=", "None", ")", ":", "if", "batch_idx", "is", "None", ":", "batch_idx", "=", "self", ".", "last_batch_idx", "+", "1", "self", ".", "last_batch_idx", "=", "batch_idx", "for", "param_group", ",", "lr", ...
Updates the learning rate for the batch index: ``batch_idx``. If ``batch_idx`` is None, ``CyclicLR`` will use an internal batch index to keep track of the index.
[ "Updates", "the", "learning", "rate", "for", "the", "batch", "index", ":", "batch_idx", ".", "If", "batch_idx", "is", "None", "CyclicLR", "will", "use", "an", "internal", "batch", "index", "to", "keep", "track", "of", "the", "index", "." ]
python
train
46.2
stephenmcd/django-email-extras
email_extras/utils.py
https://github.com/stephenmcd/django-email-extras/blob/8399792998cee84810be2b315dd9b51b200f9218/email_extras/utils.py#L35-L127
def send_mail(subject, body_text, addr_from, recipient_list, fail_silently=False, auth_user=None, auth_password=None, attachments=None, body_html=None, html_message=None, connection=None, headers=None): """ Sends a multipart email containing text and html versions ...
[ "def", "send_mail", "(", "subject", ",", "body_text", ",", "addr_from", ",", "recipient_list", ",", "fail_silently", "=", "False", ",", "auth_user", "=", "None", ",", "auth_password", "=", "None", ",", "attachments", "=", "None", ",", "body_html", "=", "None...
Sends a multipart email containing text and html versions which are encrypted for each recipient that has a valid gpg key installed.
[ "Sends", "a", "multipart", "email", "containing", "text", "and", "html", "versions", "which", "are", "encrypted", "for", "each", "recipient", "that", "has", "a", "valid", "gpg", "key", "installed", "." ]
python
train
45.408602
bcbio/bcbio-nextgen
bcbio/pipeline/cleanbam.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L75-L106
def _target_chroms_and_header(bam_file, data): """Get a list of chromosomes to target and new updated ref_file header. Could potentially handle remapping from chr1 -> 1 but currently disabled due to speed issues. """ special_remaps = {"chrM": "MT", "MT": "chrM"} target_chroms = dict([(x.name, i...
[ "def", "_target_chroms_and_header", "(", "bam_file", ",", "data", ")", ":", "special_remaps", "=", "{", "\"chrM\"", ":", "\"MT\"", ",", "\"MT\"", ":", "\"chrM\"", "}", "target_chroms", "=", "dict", "(", "[", "(", "x", ".", "name", ",", "i", ")", "for", ...
Get a list of chromosomes to target and new updated ref_file header. Could potentially handle remapping from chr1 -> 1 but currently disabled due to speed issues.
[ "Get", "a", "list", "of", "chromosomes", "to", "target", "and", "new", "updated", "ref_file", "header", "." ]
python
train
57.34375
tanghaibao/goatools
goatools/gosubdag/rpt/write_hierarchy.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/write_hierarchy.py#L71-L76
def _get_namespace2go2term(go2terms): """Group GO IDs by namespace.""" namespace2go2term = cx.defaultdict(dict) for goid, goterm in go2terms.items(): namespace2go2term[goterm.namespace][goid] = goterm return namespace2go2term
[ "def", "_get_namespace2go2term", "(", "go2terms", ")", ":", "namespace2go2term", "=", "cx", ".", "defaultdict", "(", "dict", ")", "for", "goid", ",", "goterm", "in", "go2terms", ".", "items", "(", ")", ":", "namespace2go2term", "[", "goterm", ".", "namespace...
Group GO IDs by namespace.
[ "Group", "GO", "IDs", "by", "namespace", "." ]
python
train
44
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L2823-L2833
def getSortedTrackedDeviceIndicesOfClass(self, eTrackedDeviceClass, unTrackedDeviceIndexArrayCount, unRelativeToTrackedDeviceIndex): """ Get a sorted array of device indices of a given class of tracked devices (e.g. controllers). Devices are sorted right to left relative to the specified tracke...
[ "def", "getSortedTrackedDeviceIndicesOfClass", "(", "self", ",", "eTrackedDeviceClass", ",", "unTrackedDeviceIndexArrayCount", ",", "unRelativeToTrackedDeviceIndex", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getSortedTrackedDeviceIndicesOfClass", "punTrackedDevi...
Get a sorted array of device indices of a given class of tracked devices (e.g. controllers). Devices are sorted right to left relative to the specified tracked device (default: hmd -- pass in -1 for absolute tracking space). Returns the number of devices in the list, or the size of the array needed if...
[ "Get", "a", "sorted", "array", "of", "device", "indices", "of", "a", "given", "class", "of", "tracked", "devices", "(", "e", ".", "g", ".", "controllers", ")", ".", "Devices", "are", "sorted", "right", "to", "left", "relative", "to", "the", "specified", ...
python
train
74
veltzer/pypitools
pypitools/scripts/install_from_remote.py
https://github.com/veltzer/pypitools/blob/5f097be21e9bc65578eed5b6b7855c1945540701/pypitools/scripts/install_from_remote.py#L15-L51
def main(): """ Install a package from pypi or gemfury :return: """ pypitools.common.setup_main() config = pypitools.common.ConfigData() module_name = os.path.basename(os.getcwd()) args = [] if config.use_sudo: args.extend([ 'sudo', '-H', ]) ...
[ "def", "main", "(", ")", ":", "pypitools", ".", "common", ".", "setup_main", "(", ")", "config", "=", "pypitools", ".", "common", ".", "ConfigData", "(", ")", "module_name", "=", "os", ".", "path", ".", "basename", "(", "os", ".", "getcwd", "(", ")",...
Install a package from pypi or gemfury :return:
[ "Install", "a", "package", "from", "pypi", "or", "gemfury", ":", "return", ":" ]
python
train
24.810811
ebu/PlugIt
plugit_proxy/views.py
https://github.com/ebu/PlugIt/blob/de5f1e870f67caaef7a4a58e4bb1ed54d9c5dc53/plugit_proxy/views.py#L311-L343
def build_base_parameters(request): """Build the list of parameters to forward from the post and get parameters""" getParameters = {} postParameters = {} files = {} # Copy GET parameters, excluding ebuio_* for v in request.GET: if v[:6] != 'ebuio_': val = request.GET.getlis...
[ "def", "build_base_parameters", "(", "request", ")", ":", "getParameters", "=", "{", "}", "postParameters", "=", "{", "}", "files", "=", "{", "}", "# Copy GET parameters, excluding ebuio_*", "for", "v", "in", "request", ".", "GET", ":", "if", "v", "[", ":", ...
Build the list of parameters to forward from the post and get parameters
[ "Build", "the", "list", "of", "parameters", "to", "forward", "from", "the", "post", "and", "get", "parameters" ]
python
train
29.121212
keon/algorithms
algorithms/maths/base_conversion.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/maths/base_conversion.py#L11-L31
def int_to_base(n, base): """ :type n: int :type base: int :rtype: str """ is_negative = False if n == 0: return '0' elif n < 0: is_negative = True n *= -1 digit = string.digits + string.ascii_uppercase res = '' while n > 0: res += ...
[ "def", "int_to_base", "(", "n", ",", "base", ")", ":", "is_negative", "=", "False", "if", "n", "==", "0", ":", "return", "'0'", "elif", "n", "<", "0", ":", "is_negative", "=", "True", "n", "*=", "-", "1", "digit", "=", "string", ".", "digits", "+...
:type n: int :type base: int :rtype: str
[ ":", "type", "n", ":", "int", ":", "type", "base", ":", "int", ":", "rtype", ":", "str" ]
python
train
20
weso/CWR-DataApi
cwr/grammar/field/basic.py
https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L51-L105
def alphanum(columns, name=None, extended=False, isLast=False): """ Creates the grammar for an Alphanumeric (A) field, accepting only the specified number of characters. By default Alphanumeric fields accept only ASCII characters, excluding lowercases. If the extended flag is set to True, then non-...
[ "def", "alphanum", "(", "columns", ",", "name", "=", "None", ",", "extended", "=", "False", ",", "isLast", "=", "False", ")", ":", "if", "name", "is", "None", ":", "name", "=", "'Alphanumeric Field'", "if", "columns", "<", "0", ":", "# Can't be empty or ...
Creates the grammar for an Alphanumeric (A) field, accepting only the specified number of characters. By default Alphanumeric fields accept only ASCII characters, excluding lowercases. If the extended flag is set to True, then non-ASCII characters are allowed, but the no ASCII lowercase constraint is k...
[ "Creates", "the", "grammar", "for", "an", "Alphanumeric", "(", "A", ")", "field", "accepting", "only", "the", "specified", "number", "of", "characters", "." ]
python
train
31.272727
pgmpy/pgmpy
pgmpy/readwrite/PomdpX.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/readwrite/PomdpX.py#L434-L455
def _add_value_enum(self, var, tag): """ supports adding variables to the xml Parameters --------------- var: The SubElement variable tag: The SubElement tag to which enum value is to be added Return --------------- None """ if va...
[ "def", "_add_value_enum", "(", "self", ",", "var", ",", "tag", ")", ":", "if", "var", "[", "'ValueEnum'", "]", "[", "0", "]", "==", "'s0'", ":", "numvalues_tag", "=", "etree", ".", "SubElement", "(", "tag", ",", "'NumValues'", ")", "numvalues_tag", "."...
supports adding variables to the xml Parameters --------------- var: The SubElement variable tag: The SubElement tag to which enum value is to be added Return --------------- None
[ "supports", "adding", "variables", "to", "the", "xml" ]
python
train
33.227273
saltstack/salt
salt/state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/state.py#L677-L711
def apply_exclude(self, high): ''' Read in the __exclude__ list and remove all excluded objects from the high data ''' if '__exclude__' not in high: return high ex_sls = set() ex_id = set() exclude = high.pop('__exclude__') for exc in e...
[ "def", "apply_exclude", "(", "self", ",", "high", ")", ":", "if", "'__exclude__'", "not", "in", "high", ":", "return", "high", "ex_sls", "=", "set", "(", ")", "ex_id", "=", "set", "(", ")", "exclude", "=", "high", ".", "pop", "(", "'__exclude__'", ")...
Read in the __exclude__ list and remove all excluded objects from the high data
[ "Read", "in", "the", "__exclude__", "list", "and", "remove", "all", "excluded", "objects", "from", "the", "high", "data" ]
python
train
35.628571
prompt-toolkit/ptpython
ptpython/validator.py
https://github.com/prompt-toolkit/ptpython/blob/b1bba26a491324cd65e0ef46c7b818c4b88fd993/ptpython/validator.py#L19-L47
def validate(self, document): """ Check input for Python syntax errors. """ # When the input starts with Ctrl-Z, always accept. This means EOF in a # Python REPL. if document.text.startswith('\x1a'): return try: if self.get_compiler_flags:...
[ "def", "validate", "(", "self", ",", "document", ")", ":", "# When the input starts with Ctrl-Z, always accept. This means EOF in a", "# Python REPL.", "if", "document", ".", "text", ".", "startswith", "(", "'\\x1a'", ")", ":", "return", "try", ":", "if", "self", "....
Check input for Python syntax errors.
[ "Check", "input", "for", "Python", "syntax", "errors", "." ]
python
train
41.413793
pyrogram/pyrogram
pyrogram/client/types/messages_and_media/message.py
https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/types/messages_and_media/message.py#L2372-L2429
def edit( self, text: str, parse_mode: str = "", disable_web_page_preview: bool = None, reply_markup: Union[ "pyrogram.InlineKeyboardMarkup", "pyrogram.ReplyKeyboardMarkup", "pyrogram.ReplyKeyboardRemove", "pyrogram.ForceReply" ...
[ "def", "edit", "(", "self", ",", "text", ":", "str", ",", "parse_mode", ":", "str", "=", "\"\"", ",", "disable_web_page_preview", ":", "bool", "=", "None", ",", "reply_markup", ":", "Union", "[", "\"pyrogram.InlineKeyboardMarkup\"", ",", "\"pyrogram.ReplyKeyboar...
Bound method *edit* of :obj:`Message <pyrogram.Message>` Use as a shortcut for: .. code-block:: python client.edit_message_text( chat_id=message.chat.id, message_id=message.message_id, text="hello" ) Example: ...
[ "Bound", "method", "*", "edit", "*", "of", ":", "obj", ":", "Message", "<pyrogram", ".", "Message", ">" ]
python
train
31.465517
ccubed/Shosetsu
Shosetsu/Parsing.py
https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L3-L14
async def parse_vn_results(soup): """ Parse Visual Novel search pages. :param soup: The BS4 class object :return: A list of dictionaries containing a name and id. """ soup = soup.find_all('td', class_='tc1') vns = [] for item in soup[1:]: vns.append({'name': item.string, 'id': ...
[ "async", "def", "parse_vn_results", "(", "soup", ")", ":", "soup", "=", "soup", ".", "find_all", "(", "'td'", ",", "class_", "=", "'tc1'", ")", "vns", "=", "[", "]", "for", "item", "in", "soup", "[", "1", ":", "]", ":", "vns", ".", "append", "(",...
Parse Visual Novel search pages. :param soup: The BS4 class object :return: A list of dictionaries containing a name and id.
[ "Parse", "Visual", "Novel", "search", "pages", "." ]
python
test
29
MediaFire/mediafire-python-open-sdk
examples/mediafire-cli.py
https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/examples/mediafire-cli.py#L145-L273
def main(): # pylint: disable=too-many-statements """Main entry point""" parser = argparse.ArgumentParser(prog='mediafire-cli', description=__doc__) parser.add_argument('--debug', dest='debug', action='store_true', default=False, help='Enable de...
[ "def", "main", "(", ")", ":", "# pylint: disable=too-many-statements", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'mediafire-cli'", ",", "description", "=", "__doc__", ")", "parser", ".", "add_argument", "(", "'--debug'", ",", "dest", "...
Main entry point
[ "Main", "entry", "point" ]
python
train
42.341085
mediawiki-utilities/python-mwreverts
mwreverts/db.py
https://github.com/mediawiki-utilities/python-mwreverts/blob/d379ac941e14e235ad82a48bd445a3dfa6cc022e/mwreverts/db.py#L57-L153
def check(schema, rev_id, page_id=None, radius=defaults.RADIUS, before=None, window=None): """ Checks the revert status of a revision. With this method, you can determine whether an edit is a 'reverting' edit, was 'reverted' by another edit and/or was 'reverted_to' by another edit. :Para...
[ "def", "check", "(", "schema", ",", "rev_id", ",", "page_id", "=", "None", ",", "radius", "=", "defaults", ".", "RADIUS", ",", "before", "=", "None", ",", "window", "=", "None", ")", ":", "rev_id", "=", "int", "(", "rev_id", ")", "radius", "=", "in...
Checks the revert status of a revision. With this method, you can determine whether an edit is a 'reverting' edit, was 'reverted' by another edit and/or was 'reverted_to' by another edit. :Parameters: session : :class:`mwapi.Session` An API session to make use of rev_id : int ...
[ "Checks", "the", "revert", "status", "of", "a", "revision", ".", "With", "this", "method", "you", "can", "determine", "whether", "an", "edit", "is", "a", "reverting", "edit", "was", "reverted", "by", "another", "edit", "and", "/", "or", "was", "reverted_to...
python
train
35.948454
coursera-dl/coursera-dl
coursera/coursera_dl.py
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/coursera_dl.py#L100-L113
def list_courses(args): """ List enrolled courses. @param args: Command-line arguments. @type args: namedtuple """ session = get_session() login(session, args.username, args.password) extractor = CourseraExtractor(session) courses = extractor.list_courses() logging.info('Found %...
[ "def", "list_courses", "(", "args", ")", ":", "session", "=", "get_session", "(", ")", "login", "(", "session", ",", "args", ".", "username", ",", "args", ".", "password", ")", "extractor", "=", "CourseraExtractor", "(", "session", ")", "courses", "=", "...
List enrolled courses. @param args: Command-line arguments. @type args: namedtuple
[ "List", "enrolled", "courses", "." ]
python
train
27.714286
Azure/azure-sdk-for-python
azure-servicebus/azure/servicebus/servicebus_client.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/servicebus_client.py#L515-L547
def settle_deferred_messages(self, settlement, messages, **kwargs): """Settle messages that have been previously deferred. :param settlement: How the messages are to be settled. This must be a string of one of the following values: 'completed', 'suspended', 'abandoned'. :type settlemen...
[ "def", "settle_deferred_messages", "(", "self", ",", "settlement", ",", "messages", ",", "*", "*", "kwargs", ")", ":", "if", "(", "self", ".", "entity", "and", "self", ".", "requires_session", ")", "or", "kwargs", ".", "get", "(", "'session'", ")", ":", ...
Settle messages that have been previously deferred. :param settlement: How the messages are to be settled. This must be a string of one of the following values: 'completed', 'suspended', 'abandoned'. :type settlement: str :param messages: A list of deferred messages to be settled. ...
[ "Settle", "messages", "that", "have", "been", "previously", "deferred", "." ]
python
test
52.181818
coin-or/GiMPy
src/gimpy/graph.py
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L429-L444
def check_edge(self, name1, name2): ''' API: check_edge(self, name1, name2) Description: Return True if edge exists, False otherwise. Input: name1: name of the source node. name2: name of the sink node. Return: Returns True if edge exis...
[ "def", "check_edge", "(", "self", ",", "name1", ",", "name2", ")", ":", "if", "self", ".", "graph_type", "is", "DIRECTED_GRAPH", ":", "return", "(", "name1", ",", "name2", ")", "in", "self", ".", "edge_attr", "else", ":", "return", "(", "(", "name1", ...
API: check_edge(self, name1, name2) Description: Return True if edge exists, False otherwise. Input: name1: name of the source node. name2: name of the sink node. Return: Returns True if edge exists, False otherwise.
[ "API", ":", "check_edge", "(", "self", "name1", "name2", ")", "Description", ":", "Return", "True", "if", "edge", "exists", "False", "otherwise", ".", "Input", ":", "name1", ":", "name", "of", "the", "source", "node", ".", "name2", ":", "name", "of", "...
python
train
34.9375
MacHu-GWU/uszipcode-project
uszipcode/pkg/sqlalchemy_mate/pkg/prettytable/factory.py
https://github.com/MacHu-GWU/uszipcode-project/blob/96282b779a3efb422802de83c48ca284598ba952/uszipcode/pkg/sqlalchemy_mate/pkg/prettytable/factory.py#L99-L115
def generate_table(self, rows): """ Generates from a list of rows a PrettyTable object. """ table = PrettyTable(**self.kwargs) for row in self.rows: if len(row[0]) < self.max_row_width: appends = self.max_row_width - len(row[0]) for i i...
[ "def", "generate_table", "(", "self", ",", "rows", ")", ":", "table", "=", "PrettyTable", "(", "*", "*", "self", ".", "kwargs", ")", "for", "row", "in", "self", ".", "rows", ":", "if", "len", "(", "row", "[", "0", "]", ")", "<", "self", ".", "m...
Generates from a list of rows a PrettyTable object.
[ "Generates", "from", "a", "list", "of", "rows", "a", "PrettyTable", "object", "." ]
python
train
33.117647
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L5220-L5227
def create_payload(self): """Remove ``smart_class_parameter_id`` or ``smart_variable_id``""" payload = super(OverrideValue, self).create_payload() if hasattr(self, 'smart_class_parameter'): del payload['smart_class_parameter_id'] if hasattr(self, 'smart_variable'): ...
[ "def", "create_payload", "(", "self", ")", ":", "payload", "=", "super", "(", "OverrideValue", ",", "self", ")", ".", "create_payload", "(", ")", "if", "hasattr", "(", "self", ",", "'smart_class_parameter'", ")", ":", "del", "payload", "[", "'smart_class_par...
Remove ``smart_class_parameter_id`` or ``smart_variable_id``
[ "Remove", "smart_class_parameter_id", "or", "smart_variable_id" ]
python
train
46.25
ewels/MultiQC
multiqc/modules/homer/tagdirectory.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/homer/tagdirectory.py#L121-L159
def parse_tagInfo_data(self): """parses and plots taginfo files""" # Find and parse homer taginfo reports for f in self.find_log_files('homer/tagInfo', filehandles=True): s_name = os.path.basename(f['root']) s_name = self.clean_s_name(s_name, f['root']) parsed...
[ "def", "parse_tagInfo_data", "(", "self", ")", ":", "# Find and parse homer taginfo reports", "for", "f", "in", "self", ".", "find_log_files", "(", "'homer/tagInfo'", ",", "filehandles", "=", "True", ")", ":", "s_name", "=", "os", ".", "path", ".", "basename", ...
parses and plots taginfo files
[ "parses", "and", "plots", "taginfo", "files" ]
python
train
58.230769
eternnoir/pyTelegramBotAPI
telebot/types.py
https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/types.py#L840-L858
def add(self, *args): """ This function adds strings to the keyboard, while not exceeding row_width. E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]} when row_width is set to 1. When row_width is set to 2, the following is the r...
[ "def", "add", "(", "self", ",", "*", "args", ")", ":", "i", "=", "1", "row", "=", "[", "]", "for", "button", "in", "args", ":", "row", ".", "append", "(", "button", ".", "to_dic", "(", ")", ")", "if", "i", "%", "self", ".", "row_width", "==",...
This function adds strings to the keyboard, while not exceeding row_width. E.g. ReplyKeyboardMarkup#add("A", "B", "C") yields the json result {keyboard: [["A"], ["B"], ["C"]]} when row_width is set to 1. When row_width is set to 2, the following is the result of this function: {keyboard: [["A", ...
[ "This", "function", "adds", "strings", "to", "the", "keyboard", "while", "not", "exceeding", "row_width", ".", "E", ".", "g", ".", "ReplyKeyboardMarkup#add", "(", "A", "B", "C", ")", "yields", "the", "json", "result", "{", "keyboard", ":", "[[", "A", "]"...
python
train
41.368421
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/iam/apis/aggregator_account_admin_api.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/iam/apis/aggregator_account_admin_api.py#L1435-L1456
def delete_account_invitation(self, account_id, invitation_id, **kwargs): # noqa: E501 """Delete a user invitation. # noqa: E501 An endpoint for deleting an active user invitation which has been sent for a new or an existing user to join the account. **Example usage:** `curl -X DELETE https://api.u...
[ "def", "delete_account_invitation", "(", "self", ",", "account_id", ",", "invitation_id", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'asynchronous'", ")", ":...
Delete a user invitation. # noqa: E501 An endpoint for deleting an active user invitation which has been sent for a new or an existing user to join the account. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/accounts/{account-id}/user-invitations/{invitation-id} -H 'Authorization:...
[ "Delete", "a", "user", "invitation", ".", "#", "noqa", ":", "E501" ]
python
train
62.227273
krukas/Trionyx
trionyx/trionyx/middleware.py
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/middleware.py#L32-L38
def process_request(self, request): """Check if user is logged in""" assert hasattr(request, 'user') if not request.user.is_authenticated(): path = request.path_info.lstrip('/') if not any(m.match(path) for m in EXEMPT_URLS): return HttpResponseRedirect(re...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "assert", "hasattr", "(", "request", ",", "'user'", ")", "if", "not", "request", ".", "user", ".", "is_authenticated", "(", ")", ":", "path", "=", "request", ".", "path_info", ".", "lstrip"...
Check if user is logged in
[ "Check", "if", "user", "is", "logged", "in" ]
python
train
48.571429
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendaritem.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendaritem.py#L240-L259
def rebuild( self ): """ Rebuilds the current item in the scene. """ self.markForRebuild(False) self._textData = [] if ( self.rebuildBlocked() ): return scene = self.scene() if ( not scene ): ...
[ "def", "rebuild", "(", "self", ")", ":", "self", ".", "markForRebuild", "(", "False", ")", "self", ".", "_textData", "=", "[", "]", "if", "(", "self", ".", "rebuildBlocked", "(", ")", ")", ":", "return", "scene", "=", "self", ".", "scene", "(", ")"...
Rebuilds the current item in the scene.
[ "Rebuilds", "the", "current", "item", "in", "the", "scene", "." ]
python
train
27.3
google/prettytensor
prettytensor/pretty_tensor_methods.py
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_methods.py#L412-L424
def apply_op(input_layer, operation, *op_args, **op_kwargs): """Applies the given operation to this before without adding any summaries. Args: input_layer: The input layer for this op. operation: An operation that takes a tensor and the supplied args. *op_args: Extra arguments for operation. **op_k...
[ "def", "apply_op", "(", "input_layer", ",", "operation", ",", "*", "op_args", ",", "*", "*", "op_kwargs", ")", ":", "return", "input_layer", ".", "with_tensor", "(", "operation", "(", "input_layer", ".", "tensor", ",", "*", "op_args", ",", "*", "*", "op_...
Applies the given operation to this before without adding any summaries. Args: input_layer: The input layer for this op. operation: An operation that takes a tensor and the supplied args. *op_args: Extra arguments for operation. **op_kwargs: Keyword arguments for the operation. Returns: A new l...
[ "Applies", "the", "given", "operation", "to", "this", "before", "without", "adding", "any", "summaries", "." ]
python
train
38.615385