id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
11,800 | heroku/heroku.py | heroku/models.py | App.domains | def domains(self):
"""The domains for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'domains'),
obj=Domain, app=self
) | python | def domains(self):
"""The domains for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'domains'),
obj=Domain, app=self
) | [
"def",
"domains",
"(",
"self",
")",
":",
"return",
"self",
".",
"_h",
".",
"_get_resources",
"(",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'domains'",
")",
",",
"obj",
"=",
"Domain",
",",
"app",
"=",
"self",
")"
] | The domains for this app. | [
"The",
"domains",
"for",
"this",
"app",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L222-L227 |
11,801 | heroku/heroku.py | heroku/models.py | App.releases | def releases(self):
"""The releases for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'releases'),
obj=Release, app=self
) | python | def releases(self):
"""The releases for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'releases'),
obj=Release, app=self
) | [
"def",
"releases",
"(",
"self",
")",
":",
"return",
"self",
".",
"_h",
".",
"_get_resources",
"(",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'releases'",
")",
",",
"obj",
"=",
"Release",
",",
"app",
"=",
"self",
")"
] | The releases for this app. | [
"The",
"releases",
"for",
"this",
"app",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L230-L235 |
11,802 | heroku/heroku.py | heroku/models.py | App.processes | def processes(self):
"""The proccesses for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'ps'),
obj=Process, app=self, map=ProcessListResource
) | python | def processes(self):
"""The proccesses for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'ps'),
obj=Process, app=self, map=ProcessListResource
) | [
"def",
"processes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_h",
".",
"_get_resources",
"(",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'ps'",
")",
",",
"obj",
"=",
"Process",
",",
"app",
"=",
"self",
",",
"map",
"=",
... | The proccesses for this app. | [
"The",
"proccesses",
"for",
"this",
"app",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L238-L243 |
11,803 | heroku/heroku.py | heroku/models.py | App.config | def config(self):
"""The envs for this app."""
return self._h._get_resource(
resource=('apps', self.name, 'config_vars'),
obj=ConfigVars, app=self
) | python | def config(self):
"""The envs for this app."""
return self._h._get_resource(
resource=('apps', self.name, 'config_vars'),
obj=ConfigVars, app=self
) | [
"def",
"config",
"(",
"self",
")",
":",
"return",
"self",
".",
"_h",
".",
"_get_resource",
"(",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'config_vars'",
")",
",",
"obj",
"=",
"ConfigVars",
",",
"app",
"=",
"self",
")"
] | The envs for this app. | [
"The",
"envs",
"for",
"this",
"app",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L246-L252 |
11,804 | heroku/heroku.py | heroku/models.py | App.info | def info(self):
"""Returns current info for this app."""
return self._h._get_resource(
resource=('apps', self.name),
obj=App,
) | python | def info(self):
"""Returns current info for this app."""
return self._h._get_resource(
resource=('apps', self.name),
obj=App,
) | [
"def",
"info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_h",
".",
"_get_resource",
"(",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
")",
",",
"obj",
"=",
"App",
",",
")"
] | Returns current info for this app. | [
"Returns",
"current",
"info",
"for",
"this",
"app",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L255-L261 |
11,805 | heroku/heroku.py | heroku/models.py | App.rollback | def rollback(self, release):
"""Rolls back the release to the given version."""
r = self._h._http_resource(
method='POST',
resource=('apps', self.name, 'releases'),
data={'rollback': release}
)
return self.releases[-1] | python | def rollback(self, release):
"""Rolls back the release to the given version."""
r = self._h._http_resource(
method='POST',
resource=('apps', self.name, 'releases'),
data={'rollback': release}
)
return self.releases[-1] | [
"def",
"rollback",
"(",
"self",
",",
"release",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'POST'",
",",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'releases'",
")",
",",
"data",
"=",
"{"... | Rolls back the release to the given version. | [
"Rolls",
"back",
"the",
"release",
"to",
"the",
"given",
"version",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L270-L277 |
11,806 | heroku/heroku.py | heroku/models.py | App.rename | def rename(self, name):
"""Renames app to given name."""
r = self._h._http_resource(
method='PUT',
resource=('apps', self.name),
data={'app[name]': name}
)
return r.ok | python | def rename(self, name):
"""Renames app to given name."""
r = self._h._http_resource(
method='PUT',
resource=('apps', self.name),
data={'app[name]': name}
)
return r.ok | [
"def",
"rename",
"(",
"self",
",",
"name",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'PUT'",
",",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
")",
",",
"data",
"=",
"{",
"'app[name]'",
":",
"... | Renames app to given name. | [
"Renames",
"app",
"to",
"given",
"name",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L280-L288 |
11,807 | heroku/heroku.py | heroku/models.py | App.transfer | def transfer(self, user):
"""Transfers app to given username's account."""
r = self._h._http_resource(
method='PUT',
resource=('apps', self.name),
data={'app[transfer_owner]': user}
)
return r.ok | python | def transfer(self, user):
"""Transfers app to given username's account."""
r = self._h._http_resource(
method='PUT',
resource=('apps', self.name),
data={'app[transfer_owner]': user}
)
return r.ok | [
"def",
"transfer",
"(",
"self",
",",
"user",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'PUT'",
",",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
")",
",",
"data",
"=",
"{",
"'app[transfer_owner]'"... | Transfers app to given username's account. | [
"Transfers",
"app",
"to",
"given",
"username",
"s",
"account",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L290-L298 |
11,808 | heroku/heroku.py | heroku/models.py | App.maintenance | def maintenance(self, on=True):
"""Toggles maintenance mode."""
r = self._h._http_resource(
method='POST',
resource=('apps', self.name, 'server', 'maintenance'),
data={'maintenance_mode': int(on)}
)
return r.ok | python | def maintenance(self, on=True):
"""Toggles maintenance mode."""
r = self._h._http_resource(
method='POST',
resource=('apps', self.name, 'server', 'maintenance'),
data={'maintenance_mode': int(on)}
)
return r.ok | [
"def",
"maintenance",
"(",
"self",
",",
"on",
"=",
"True",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'POST'",
",",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'server'",
",",
"'maintenance'... | Toggles maintenance mode. | [
"Toggles",
"maintenance",
"mode",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L300-L308 |
11,809 | heroku/heroku.py | heroku/models.py | App.destroy | def destroy(self):
"""Destoys the app. Do be careful."""
r = self._h._http_resource(
method='DELETE',
resource=('apps', self.name)
)
return r.ok | python | def destroy(self):
"""Destoys the app. Do be careful."""
r = self._h._http_resource(
method='DELETE',
resource=('apps', self.name)
)
return r.ok | [
"def",
"destroy",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'DELETE'",
",",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
")",
")",
"return",
"r",
".",
"ok"
] | Destoys the app. Do be careful. | [
"Destoys",
"the",
"app",
".",
"Do",
"be",
"careful",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L310-L317 |
11,810 | heroku/heroku.py | heroku/models.py | App.logs | def logs(self, num=None, source=None, ps=None, tail=False):
"""Returns the requested log."""
# Bootstrap payload package.
payload = {'logplex': 'true'}
if num:
payload['num'] = num
if source:
payload['source'] = source
if ps:
payloa... | python | def logs(self, num=None, source=None, ps=None, tail=False):
"""Returns the requested log."""
# Bootstrap payload package.
payload = {'logplex': 'true'}
if num:
payload['num'] = num
if source:
payload['source'] = source
if ps:
payloa... | [
"def",
"logs",
"(",
"self",
",",
"num",
"=",
"None",
",",
"source",
"=",
"None",
",",
"ps",
"=",
"None",
",",
"tail",
"=",
"False",
")",
":",
"# Bootstrap payload package.",
"payload",
"=",
"{",
"'logplex'",
":",
"'true'",
"}",
"if",
"num",
":",
"pay... | Returns the requested log. | [
"Returns",
"the",
"requested",
"log",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L319-L351 |
11,811 | heroku/heroku.py | heroku/models.py | Key.delete | def delete(self):
"""Deletes the key."""
r = self._h._http_resource(
method='DELETE',
resource=('user', 'keys', self.id)
)
r.raise_for_status() | python | def delete(self):
"""Deletes the key."""
r = self._h._http_resource(
method='DELETE',
resource=('user', 'keys', self.id)
)
r.raise_for_status() | [
"def",
"delete",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'DELETE'",
",",
"resource",
"=",
"(",
"'user'",
",",
"'keys'",
",",
"self",
".",
"id",
")",
")",
"r",
".",
"raise_for_status",
"(",
")"... | Deletes the key. | [
"Deletes",
"the",
"key",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L492-L499 |
11,812 | heroku/heroku.py | heroku/models.py | Process.restart | def restart(self, all=False):
"""Restarts the given process."""
if all:
data = {'type': self.type}
else:
data = {'ps': self.process}
r = self._h._http_resource(
method='POST',
resource=('apps', self.app.name, 'ps', 'restart'),
... | python | def restart(self, all=False):
"""Restarts the given process."""
if all:
data = {'type': self.type}
else:
data = {'ps': self.process}
r = self._h._http_resource(
method='POST',
resource=('apps', self.app.name, 'ps', 'restart'),
... | [
"def",
"restart",
"(",
"self",
",",
"all",
"=",
"False",
")",
":",
"if",
"all",
":",
"data",
"=",
"{",
"'type'",
":",
"self",
".",
"type",
"}",
"else",
":",
"data",
"=",
"{",
"'ps'",
":",
"self",
".",
"process",
"}",
"r",
"=",
"self",
".",
"_... | Restarts the given process. | [
"Restarts",
"the",
"given",
"process",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L547-L562 |
11,813 | heroku/heroku.py | heroku/models.py | Process.scale | def scale(self, quantity):
"""Scales the given process to the given number of dynos."""
r = self._h._http_resource(
method='POST',
resource=('apps', self.app.name, 'ps', 'scale'),
data={'type': self.type, 'qty': quantity}
)
r.raise_for_status()
... | python | def scale(self, quantity):
"""Scales the given process to the given number of dynos."""
r = self._h._http_resource(
method='POST',
resource=('apps', self.app.name, 'ps', 'scale'),
data={'type': self.type, 'qty': quantity}
)
r.raise_for_status()
... | [
"def",
"scale",
"(",
"self",
",",
"quantity",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'POST'",
",",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"app",
".",
"name",
",",
"'ps'",
",",
"'scale'",
")",
... | Scales the given process to the given number of dynos. | [
"Scales",
"the",
"given",
"process",
"to",
"the",
"given",
"number",
"of",
"dynos",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L581-L595 |
11,814 | heroku/heroku.py | heroku/helpers.py | is_collection | def is_collection(obj):
"""Tests if an object is a collection."""
col = getattr(obj, '__getitem__', False)
val = False if (not col) else True
if isinstance(obj, basestring):
val = False
return val | python | def is_collection(obj):
"""Tests if an object is a collection."""
col = getattr(obj, '__getitem__', False)
val = False if (not col) else True
if isinstance(obj, basestring):
val = False
return val | [
"def",
"is_collection",
"(",
"obj",
")",
":",
"col",
"=",
"getattr",
"(",
"obj",
",",
"'__getitem__'",
",",
"False",
")",
"val",
"=",
"False",
"if",
"(",
"not",
"col",
")",
"else",
"True",
"if",
"isinstance",
"(",
"obj",
",",
"basestring",
")",
":",
... | Tests if an object is a collection. | [
"Tests",
"if",
"an",
"object",
"is",
"a",
"collection",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/helpers.py#L19-L28 |
11,815 | heroku/heroku.py | heroku/helpers.py | to_python | def to_python(obj,
in_dict,
str_keys=None,
date_keys=None,
int_keys=None,
object_map=None,
bool_keys=None,
dict_keys=None,
**kwargs):
"""Extends a given object for API Consumption.
:param obj: Object to extend.
:param in_dict: Dict to extract data from.
:param string_key... | python | def to_python(obj,
in_dict,
str_keys=None,
date_keys=None,
int_keys=None,
object_map=None,
bool_keys=None,
dict_keys=None,
**kwargs):
"""Extends a given object for API Consumption.
:param obj: Object to extend.
:param in_dict: Dict to extract data from.
:param string_key... | [
"def",
"to_python",
"(",
"obj",
",",
"in_dict",
",",
"str_keys",
"=",
"None",
",",
"date_keys",
"=",
"None",
",",
"int_keys",
"=",
"None",
",",
"object_map",
"=",
"None",
",",
"bool_keys",
"=",
"None",
",",
"dict_keys",
"=",
"None",
",",
"*",
"*",
"k... | Extends a given object for API Consumption.
:param obj: Object to extend.
:param in_dict: Dict to extract data from.
:param string_keys: List of in_dict keys that will be extracted as strings.
:param date_keys: List of in_dict keys that will be extrad as datetimes.
:param object_map: Dict of {key, ... | [
"Extends",
"a",
"given",
"object",
"for",
"API",
"Consumption",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/helpers.py#L33-L95 |
11,816 | heroku/heroku.py | heroku/helpers.py | to_api | def to_api(in_dict, int_keys=None, date_keys=None, bool_keys=None):
"""Extends a given object for API Production."""
# Cast all int_keys to int()
if int_keys:
for in_key in int_keys:
if (in_key in in_dict) and (in_dict.get(in_key, None) is not None):
in_dict[in_key] = in... | python | def to_api(in_dict, int_keys=None, date_keys=None, bool_keys=None):
"""Extends a given object for API Production."""
# Cast all int_keys to int()
if int_keys:
for in_key in int_keys:
if (in_key in in_dict) and (in_dict.get(in_key, None) is not None):
in_dict[in_key] = in... | [
"def",
"to_api",
"(",
"in_dict",
",",
"int_keys",
"=",
"None",
",",
"date_keys",
"=",
"None",
",",
"bool_keys",
"=",
"None",
")",
":",
"# Cast all int_keys to int()",
"if",
"int_keys",
":",
"for",
"in_key",
"in",
"int_keys",
":",
"if",
"(",
"in_key",
"in",... | Extends a given object for API Production. | [
"Extends",
"a",
"given",
"object",
"for",
"API",
"Production",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/helpers.py#L99-L131 |
11,817 | heroku/heroku.py | heroku/structures.py | SSHKeyListResource.clear | def clear(self):
"""Removes all SSH keys from a user's system."""
r = self._h._http_resource(
method='DELETE',
resource=('user', 'keys'),
)
return r.ok | python | def clear(self):
"""Removes all SSH keys from a user's system."""
r = self._h._http_resource(
method='DELETE',
resource=('user', 'keys'),
)
return r.ok | [
"def",
"clear",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"_h",
".",
"_http_resource",
"(",
"method",
"=",
"'DELETE'",
",",
"resource",
"=",
"(",
"'user'",
",",
"'keys'",
")",
",",
")",
"return",
"r",
".",
"ok"
] | Removes all SSH keys from a user's system. | [
"Removes",
"all",
"SSH",
"keys",
"from",
"a",
"user",
"s",
"system",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/structures.py#L108-L116 |
11,818 | heroku/heroku.py | heroku/api.py | HerokuCore.authenticate | def authenticate(self, api_key):
"""Logs user into Heroku with given api_key."""
self._api_key = api_key
# Attach auth to session.
self._session.auth = ('', self._api_key)
return self._verify_api_key() | python | def authenticate(self, api_key):
"""Logs user into Heroku with given api_key."""
self._api_key = api_key
# Attach auth to session.
self._session.auth = ('', self._api_key)
return self._verify_api_key() | [
"def",
"authenticate",
"(",
"self",
",",
"api_key",
")",
":",
"self",
".",
"_api_key",
"=",
"api_key",
"# Attach auth to session.",
"self",
".",
"_session",
".",
"auth",
"=",
"(",
"''",
",",
"self",
".",
"_api_key",
")",
"return",
"self",
".",
"_verify_api... | Logs user into Heroku with given api_key. | [
"Logs",
"user",
"into",
"Heroku",
"with",
"given",
"api_key",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/api.py#L40-L47 |
11,819 | heroku/heroku.py | heroku/api.py | HerokuCore._get_resource | def _get_resource(self, resource, obj, params=None, **kwargs):
"""Returns a mapped object from an HTTP resource."""
r = self._http_resource('GET', resource, params=params)
item = self._resource_deserialize(r.content.decode("utf-8"))
return obj.new_from_dict(item, h=self, **kwargs) | python | def _get_resource(self, resource, obj, params=None, **kwargs):
"""Returns a mapped object from an HTTP resource."""
r = self._http_resource('GET', resource, params=params)
item = self._resource_deserialize(r.content.decode("utf-8"))
return obj.new_from_dict(item, h=self, **kwargs) | [
"def",
"_get_resource",
"(",
"self",
",",
"resource",
",",
"obj",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"self",
".",
"_http_resource",
"(",
"'GET'",
",",
"resource",
",",
"params",
"=",
"params",
")",
"item",
"=",
... | Returns a mapped object from an HTTP resource. | [
"Returns",
"a",
"mapped",
"object",
"from",
"an",
"HTTP",
"resource",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/api.py#L110-L115 |
11,820 | heroku/heroku.py | heroku/api.py | HerokuCore._get_resources | def _get_resources(self, resource, obj, params=None, map=None, **kwargs):
"""Returns a list of mapped objects from an HTTP resource."""
r = self._http_resource('GET', resource, params=params)
d_items = self._resource_deserialize(r.content.decode("utf-8"))
items = [obj.new_from_dict(ite... | python | def _get_resources(self, resource, obj, params=None, map=None, **kwargs):
"""Returns a list of mapped objects from an HTTP resource."""
r = self._http_resource('GET', resource, params=params)
d_items = self._resource_deserialize(r.content.decode("utf-8"))
items = [obj.new_from_dict(ite... | [
"def",
"_get_resources",
"(",
"self",
",",
"resource",
",",
"obj",
",",
"params",
"=",
"None",
",",
"map",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"self",
".",
"_http_resource",
"(",
"'GET'",
",",
"resource",
",",
"params",
"=",
"... | Returns a list of mapped objects from an HTTP resource. | [
"Returns",
"a",
"list",
"of",
"mapped",
"objects",
"from",
"an",
"HTTP",
"resource",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/api.py#L117-L132 |
11,821 | heroku/heroku.py | heroku/core.py | from_key | def from_key(api_key, **kwargs):
"""Returns an authenticated Heroku instance, via API Key."""
h = Heroku(**kwargs)
# Login.
h.authenticate(api_key)
return h | python | def from_key(api_key, **kwargs):
"""Returns an authenticated Heroku instance, via API Key."""
h = Heroku(**kwargs)
# Login.
h.authenticate(api_key)
return h | [
"def",
"from_key",
"(",
"api_key",
",",
"*",
"*",
"kwargs",
")",
":",
"h",
"=",
"Heroku",
"(",
"*",
"*",
"kwargs",
")",
"# Login.",
"h",
".",
"authenticate",
"(",
"api_key",
")",
"return",
"h"
] | Returns an authenticated Heroku instance, via API Key. | [
"Returns",
"an",
"authenticated",
"Heroku",
"instance",
"via",
"API",
"Key",
"."
] | cadc0a074896cf29c65a457c5c5bdb2069470af0 | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/core.py#L12-L20 |
11,822 | pyviz/param | param/version.py | OldDeprecatedVersion.abbrev | def abbrev(self,dev_suffix=""):
"""
Abbreviated string representation, optionally declaring whether it is
a development version.
"""
return '.'.join(str(el) for el in self.release) + \
(dev_suffix if self.commit_count > 0 or self.dirty else "") | python | def abbrev(self,dev_suffix=""):
"""
Abbreviated string representation, optionally declaring whether it is
a development version.
"""
return '.'.join(str(el) for el in self.release) + \
(dev_suffix if self.commit_count > 0 or self.dirty else "") | [
"def",
"abbrev",
"(",
"self",
",",
"dev_suffix",
"=",
"\"\"",
")",
":",
"return",
"'.'",
".",
"join",
"(",
"str",
"(",
"el",
")",
"for",
"el",
"in",
"self",
".",
"release",
")",
"+",
"(",
"dev_suffix",
"if",
"self",
".",
"commit_count",
">",
"0",
... | Abbreviated string representation, optionally declaring whether it is
a development version. | [
"Abbreviated",
"string",
"representation",
"optionally",
"declaring",
"whether",
"it",
"is",
"a",
"development",
"version",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/version.py#L704-L710 |
11,823 | pyviz/param | param/version.py | OldDeprecatedVersion.verify | def verify(self, string_version=None):
"""
Check that the version information is consistent with the VCS
before doing a release. If supplied with a string version,
this is also checked against the current version. Should be
called from setup.py with the declared package version b... | python | def verify(self, string_version=None):
"""
Check that the version information is consistent with the VCS
before doing a release. If supplied with a string version,
this is also checked against the current version. Should be
called from setup.py with the declared package version b... | [
"def",
"verify",
"(",
"self",
",",
"string_version",
"=",
"None",
")",
":",
"if",
"string_version",
"and",
"string_version",
"!=",
"str",
"(",
"self",
")",
":",
"raise",
"Exception",
"(",
"\"Supplied string version does not match current version.\"",
")",
"if",
"s... | Check that the version information is consistent with the VCS
before doing a release. If supplied with a string version,
this is also checked against the current version. Should be
called from setup.py with the declared package version before
releasing to PyPI. | [
"Check",
"that",
"the",
"version",
"information",
"is",
"consistent",
"with",
"the",
"VCS",
"before",
"doing",
"a",
"release",
".",
"If",
"supplied",
"with",
"a",
"string",
"version",
"this",
"is",
"also",
"checked",
"against",
"the",
"current",
"version",
"... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/version.py#L743-L764 |
11,824 | pyviz/param | numbergen/__init__.py | TimeAware._check_time_fn | def _check_time_fn(self, time_instance=False):
"""
If time_fn is the global time function supplied by
param.Dynamic.time_fn, make sure Dynamic parameters are using
this time function to control their behaviour.
If time_instance is True, time_fn must be a param.Time instance.
... | python | def _check_time_fn(self, time_instance=False):
"""
If time_fn is the global time function supplied by
param.Dynamic.time_fn, make sure Dynamic parameters are using
this time function to control their behaviour.
If time_instance is True, time_fn must be a param.Time instance.
... | [
"def",
"_check_time_fn",
"(",
"self",
",",
"time_instance",
"=",
"False",
")",
":",
"if",
"time_instance",
"and",
"not",
"isinstance",
"(",
"self",
".",
"time_fn",
",",
"param",
".",
"Time",
")",
":",
"raise",
"AssertionError",
"(",
"\"%s requires a Time objec... | If time_fn is the global time function supplied by
param.Dynamic.time_fn, make sure Dynamic parameters are using
this time function to control their behaviour.
If time_instance is True, time_fn must be a param.Time instance. | [
"If",
"time_fn",
"is",
"the",
"global",
"time",
"function",
"supplied",
"by",
"param",
".",
"Dynamic",
".",
"time_fn",
"make",
"sure",
"Dynamic",
"parameters",
"are",
"using",
"this",
"time",
"function",
"to",
"control",
"their",
"behaviour",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/numbergen/__init__.py#L48-L64 |
11,825 | pyviz/param | numbergen/__init__.py | Hash._rational | def _rational(self, val):
"""Convert the given value to a rational, if necessary."""
I32 = 4294967296 # Maximum 32 bit unsigned int (i.e. 'I') value
if isinstance(val, int):
numer, denom = val, 1
elif isinstance(val, fractions.Fraction):
numer, denom = val.numer... | python | def _rational(self, val):
"""Convert the given value to a rational, if necessary."""
I32 = 4294967296 # Maximum 32 bit unsigned int (i.e. 'I') value
if isinstance(val, int):
numer, denom = val, 1
elif isinstance(val, fractions.Fraction):
numer, denom = val.numer... | [
"def",
"_rational",
"(",
"self",
",",
"val",
")",
":",
"I32",
"=",
"4294967296",
"# Maximum 32 bit unsigned int (i.e. 'I') value",
"if",
"isinstance",
"(",
"val",
",",
"int",
")",
":",
"numer",
",",
"denom",
"=",
"val",
",",
"1",
"elif",
"isinstance",
"(",
... | Convert the given value to a rational, if necessary. | [
"Convert",
"the",
"given",
"value",
"to",
"a",
"rational",
"if",
"necessary",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/numbergen/__init__.py#L200-L215 |
11,826 | pyviz/param | numbergen/__init__.py | TimeAwareRandomState._initialize_random_state | def _initialize_random_state(self, seed=None, shared=True, name=None):
"""
Initialization method to be called in the constructor of
subclasses to initialize the random state correctly.
If seed is None, there is no control over the random stream
(no reproducibility of the stream)... | python | def _initialize_random_state(self, seed=None, shared=True, name=None):
"""
Initialization method to be called in the constructor of
subclasses to initialize the random state correctly.
If seed is None, there is no control over the random stream
(no reproducibility of the stream)... | [
"def",
"_initialize_random_state",
"(",
"self",
",",
"seed",
"=",
"None",
",",
"shared",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"None",
":",
"# Equivalent to an uncontrolled seed.",
"seed",
"=",
"random",
".",
"Random",
"(",
"... | Initialization method to be called in the constructor of
subclasses to initialize the random state correctly.
If seed is None, there is no control over the random stream
(no reproducibility of the stream).
If shared is True (and not time-dependent), the random state
is shared a... | [
"Initialization",
"method",
"to",
"be",
"called",
"in",
"the",
"constructor",
"of",
"subclasses",
"to",
"initialize",
"the",
"random",
"state",
"correctly",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/numbergen/__init__.py#L300-L338 |
11,827 | pyviz/param | numbergen/__init__.py | TimeAwareRandomState._verify_constrained_hash | def _verify_constrained_hash(self):
"""
Warn if the object name is not explicitly set.
"""
changed_params = dict(self.param.get_param_values(onlychanged=True))
if self.time_dependent and ('name' not in changed_params):
self.param.warning("Default object name used to s... | python | def _verify_constrained_hash(self):
"""
Warn if the object name is not explicitly set.
"""
changed_params = dict(self.param.get_param_values(onlychanged=True))
if self.time_dependent and ('name' not in changed_params):
self.param.warning("Default object name used to s... | [
"def",
"_verify_constrained_hash",
"(",
"self",
")",
":",
"changed_params",
"=",
"dict",
"(",
"self",
".",
"param",
".",
"get_param_values",
"(",
"onlychanged",
"=",
"True",
")",
")",
"if",
"self",
".",
"time_dependent",
"and",
"(",
"'name'",
"not",
"in",
... | Warn if the object name is not explicitly set. | [
"Warn",
"if",
"the",
"object",
"name",
"is",
"not",
"explicitly",
"set",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/numbergen/__init__.py#L341-L348 |
11,828 | pyviz/param | setup.py | get_setup_version | def get_setup_version(reponame):
"""Use autover to get up to date version."""
# importing self into setup.py is unorthodox, but param has no
# required dependencies outside of python
from param.version import Version
return Version.setup_version(os.path.dirname(__file__),reponame,archive_commit="$Fo... | python | def get_setup_version(reponame):
"""Use autover to get up to date version."""
# importing self into setup.py is unorthodox, but param has no
# required dependencies outside of python
from param.version import Version
return Version.setup_version(os.path.dirname(__file__),reponame,archive_commit="$Fo... | [
"def",
"get_setup_version",
"(",
"reponame",
")",
":",
"# importing self into setup.py is unorthodox, but param has no",
"# required dependencies outside of python",
"from",
"param",
".",
"version",
"import",
"Version",
"return",
"Version",
".",
"setup_version",
"(",
"os",
".... | Use autover to get up to date version. | [
"Use",
"autover",
"to",
"get",
"up",
"to",
"date",
"version",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/setup.py#L8-L13 |
11,829 | pyviz/param | param/ipython.py | ParamPager.get_param_info | def get_param_info(self, obj, include_super=True):
"""
Get the parameter dictionary, the list of modifed parameters
and the dictionary or parameter values. If include_super is
True, parameters are also collected from the super classes.
"""
params = dict(obj.param.objects... | python | def get_param_info(self, obj, include_super=True):
"""
Get the parameter dictionary, the list of modifed parameters
and the dictionary or parameter values. If include_super is
True, parameters are also collected from the super classes.
"""
params = dict(obj.param.objects... | [
"def",
"get_param_info",
"(",
"self",
",",
"obj",
",",
"include_super",
"=",
"True",
")",
":",
"params",
"=",
"dict",
"(",
"obj",
".",
"param",
".",
"objects",
"(",
"'existing'",
")",
")",
"if",
"isinstance",
"(",
"obj",
",",
"type",
")",
":",
"chang... | Get the parameter dictionary, the list of modifed parameters
and the dictionary or parameter values. If include_super is
True, parameters are also collected from the super classes. | [
"Get",
"the",
"parameter",
"dictionary",
"the",
"list",
"of",
"modifed",
"parameters",
"and",
"the",
"dictionary",
"or",
"parameter",
"values",
".",
"If",
"include_super",
"is",
"True",
"parameters",
"are",
"also",
"collected",
"from",
"the",
"super",
"classes",... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/ipython.py#L55-L77 |
11,830 | pyviz/param | param/ipython.py | ParamPager._build_table | def _build_table(self, info, order, max_col_len=40, only_changed=False):
"""
Collect the information about parameters needed to build a
properly formatted table and then tabulate it.
"""
info_dict, bounds_dict = {}, {}
(params, val_dict, changed) = info
col_width... | python | def _build_table(self, info, order, max_col_len=40, only_changed=False):
"""
Collect the information about parameters needed to build a
properly formatted table and then tabulate it.
"""
info_dict, bounds_dict = {}, {}
(params, val_dict, changed) = info
col_width... | [
"def",
"_build_table",
"(",
"self",
",",
"info",
",",
"order",
",",
"max_col_len",
"=",
"40",
",",
"only_changed",
"=",
"False",
")",
":",
"info_dict",
",",
"bounds_dict",
"=",
"{",
"}",
",",
"{",
"}",
"(",
"params",
",",
"val_dict",
",",
"changed",
... | Collect the information about parameters needed to build a
properly formatted table and then tabulate it. | [
"Collect",
"the",
"information",
"about",
"parameters",
"needed",
"to",
"build",
"a",
"properly",
"formatted",
"table",
"and",
"then",
"tabulate",
"it",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/ipython.py#L127-L176 |
11,831 | pyviz/param | param/ipython.py | ParamPager._tabulate | def _tabulate(self, info_dict, col_widths, changed, order, bounds_dict):
"""
Returns the supplied information as a table suitable for
printing or paging.
info_dict: Dictionary of the parameters name, type and mode.
col_widths: Dictionary of column widths in characters
c... | python | def _tabulate(self, info_dict, col_widths, changed, order, bounds_dict):
"""
Returns the supplied information as a table suitable for
printing or paging.
info_dict: Dictionary of the parameters name, type and mode.
col_widths: Dictionary of column widths in characters
c... | [
"def",
"_tabulate",
"(",
"self",
",",
"info_dict",
",",
"col_widths",
",",
"changed",
",",
"order",
",",
"bounds_dict",
")",
":",
"contents",
",",
"tail",
"=",
"[",
"]",
",",
"[",
"]",
"column_set",
"=",
"set",
"(",
"k",
"for",
"row",
"in",
"info_dic... | Returns the supplied information as a table suitable for
printing or paging.
info_dict: Dictionary of the parameters name, type and mode.
col_widths: Dictionary of column widths in characters
changed: List of parameters modified from their defaults.
order: The order of ... | [
"Returns",
"the",
"supplied",
"information",
"as",
"a",
"table",
"suitable",
"for",
"printing",
"or",
"paging",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/ipython.py#L179-L229 |
11,832 | pyviz/param | param/__init__.py | is_ordered_dict | def is_ordered_dict(d):
"""
Predicate checking for ordered dictionaries. OrderedDict is always
ordered, and vanilla Python dictionaries are ordered for Python 3.6+
"""
py3_ordered_dicts = (sys.version_info.major == 3) and (sys.version_info.minor >= 6)
vanilla_odicts = (sys.version_info.major > 3... | python | def is_ordered_dict(d):
"""
Predicate checking for ordered dictionaries. OrderedDict is always
ordered, and vanilla Python dictionaries are ordered for Python 3.6+
"""
py3_ordered_dicts = (sys.version_info.major == 3) and (sys.version_info.minor >= 6)
vanilla_odicts = (sys.version_info.major > 3... | [
"def",
"is_ordered_dict",
"(",
"d",
")",
":",
"py3_ordered_dicts",
"=",
"(",
"sys",
".",
"version_info",
".",
"major",
"==",
"3",
")",
"and",
"(",
"sys",
".",
"version_info",
".",
"minor",
">=",
"6",
")",
"vanilla_odicts",
"=",
"(",
"sys",
".",
"versio... | Predicate checking for ordered dictionaries. OrderedDict is always
ordered, and vanilla Python dictionaries are ordered for Python 3.6+ | [
"Predicate",
"checking",
"for",
"ordered",
"dictionaries",
".",
"OrderedDict",
"is",
"always",
"ordered",
"and",
"vanilla",
"Python",
"dictionaries",
"are",
"ordered",
"for",
"Python",
"3",
".",
"6",
"+"
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L91-L98 |
11,833 | pyviz/param | param/__init__.py | named_objs | def named_objs(objlist, namesdict=None):
"""
Given a list of objects, returns a dictionary mapping from
string name for the object to the object itself. Accepts
an optional name,obj dictionary, which will override any other
name if that item is present in the dictionary.
"""
objs = OrderedDi... | python | def named_objs(objlist, namesdict=None):
"""
Given a list of objects, returns a dictionary mapping from
string name for the object to the object itself. Accepts
an optional name,obj dictionary, which will override any other
name if that item is present in the dictionary.
"""
objs = OrderedDi... | [
"def",
"named_objs",
"(",
"objlist",
",",
"namesdict",
"=",
"None",
")",
":",
"objs",
"=",
"OrderedDict",
"(",
")",
"if",
"namesdict",
"is",
"not",
"None",
":",
"objtoname",
"=",
"{",
"hashable",
"(",
"v",
")",
":",
"k",
"for",
"k",
",",
"v",
"in",... | Given a list of objects, returns a dictionary mapping from
string name for the object to the object itself. Accepts
an optional name,obj dictionary, which will override any other
name if that item is present in the dictionary. | [
"Given",
"a",
"list",
"of",
"objects",
"returns",
"a",
"dictionary",
"mapping",
"from",
"string",
"name",
"for",
"the",
"object",
"to",
"the",
"object",
"itself",
".",
"Accepts",
"an",
"optional",
"name",
"obj",
"dictionary",
"which",
"will",
"override",
"an... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L117-L139 |
11,834 | pyviz/param | param/__init__.py | guess_param_types | def guess_param_types(**kwargs):
"""
Given a set of keyword literals, promote to the appropriate
parameter type based on some simple heuristics.
"""
params = {}
for k, v in kwargs.items():
kws = dict(default=v, constant=True)
if isinstance(v, Parameter):
params[k] = v... | python | def guess_param_types(**kwargs):
"""
Given a set of keyword literals, promote to the appropriate
parameter type based on some simple heuristics.
"""
params = {}
for k, v in kwargs.items():
kws = dict(default=v, constant=True)
if isinstance(v, Parameter):
params[k] = v... | [
"def",
"guess_param_types",
"(",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"kws",
"=",
"dict",
"(",
"default",
"=",
"v",
",",
"constant",
"=",
"True",
")",
"if",
"i... | Given a set of keyword literals, promote to the appropriate
parameter type based on some simple heuristics. | [
"Given",
"a",
"set",
"of",
"keyword",
"literals",
"promote",
"to",
"the",
"appropriate",
"parameter",
"type",
"based",
"on",
"some",
"simple",
"heuristics",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L164-L208 |
11,835 | pyviz/param | param/__init__.py | guess_bounds | def guess_bounds(params, **overrides):
"""
Given a dictionary of Parameter instances, return a corresponding
set of copies with the bounds appropriately set.
If given a set of override keywords, use those numeric tuple bounds.
"""
guessed = {}
for name, p in params.items():
new_par... | python | def guess_bounds(params, **overrides):
"""
Given a dictionary of Parameter instances, return a corresponding
set of copies with the bounds appropriately set.
If given a set of override keywords, use those numeric tuple bounds.
"""
guessed = {}
for name, p in params.items():
new_par... | [
"def",
"guess_bounds",
"(",
"params",
",",
"*",
"*",
"overrides",
")",
":",
"guessed",
"=",
"{",
"}",
"for",
"name",
",",
"p",
"in",
"params",
".",
"items",
"(",
")",
":",
"new_param",
"=",
"copy",
".",
"copy",
"(",
"p",
")",
"if",
"isinstance",
... | Given a dictionary of Parameter instances, return a corresponding
set of copies with the bounds appropriately set.
If given a set of override keywords, use those numeric tuple bounds. | [
"Given",
"a",
"dictionary",
"of",
"Parameter",
"instances",
"return",
"a",
"corresponding",
"set",
"of",
"copies",
"with",
"the",
"bounds",
"appropriately",
"set",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L221-L239 |
11,836 | pyviz/param | param/__init__.py | Dynamic._initialize_generator | def _initialize_generator(self,gen,obj=None):
"""
Add 'last time' and 'last value' attributes to the generator.
"""
# CEBALERT: use a dictionary to hold these things.
if hasattr(obj,"_Dynamic_time_fn"):
gen._Dynamic_time_fn = obj._Dynamic_time_fn
gen._Dynamic... | python | def _initialize_generator(self,gen,obj=None):
"""
Add 'last time' and 'last value' attributes to the generator.
"""
# CEBALERT: use a dictionary to hold these things.
if hasattr(obj,"_Dynamic_time_fn"):
gen._Dynamic_time_fn = obj._Dynamic_time_fn
gen._Dynamic... | [
"def",
"_initialize_generator",
"(",
"self",
",",
"gen",
",",
"obj",
"=",
"None",
")",
":",
"# CEBALERT: use a dictionary to hold these things.",
"if",
"hasattr",
"(",
"obj",
",",
"\"_Dynamic_time_fn\"",
")",
":",
"gen",
".",
"_Dynamic_time_fn",
"=",
"obj",
".",
... | Add 'last time' and 'last value' attributes to the generator. | [
"Add",
"last",
"time",
"and",
"last",
"value",
"attributes",
"to",
"the",
"generator",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L576-L590 |
11,837 | pyviz/param | param/__init__.py | Dynamic._produce_value | def _produce_value(self,gen,force=False):
"""
Return a value from gen.
If there is no time_fn, then a new value will be returned
(i.e. gen will be asked to produce a new value).
If force is True, or the value of time_fn() is different from
what it was was last time prod... | python | def _produce_value(self,gen,force=False):
"""
Return a value from gen.
If there is no time_fn, then a new value will be returned
(i.e. gen will be asked to produce a new value).
If force is True, or the value of time_fn() is different from
what it was was last time prod... | [
"def",
"_produce_value",
"(",
"self",
",",
"gen",
",",
"force",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"gen",
",",
"\"_Dynamic_time_fn\"",
")",
":",
"time_fn",
"=",
"gen",
".",
"_Dynamic_time_fn",
"else",
":",
"time_fn",
"=",
"self",
".",
"time_fn... | Return a value from gen.
If there is no time_fn, then a new value will be returned
(i.e. gen will be asked to produce a new value).
If force is True, or the value of time_fn() is different from
what it was was last time produce_value was called, a new
value will be produced and... | [
"Return",
"a",
"value",
"from",
"gen",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L623-L655 |
11,838 | pyviz/param | param/__init__.py | Dynamic._inspect | def _inspect(self,obj,objtype=None):
"""Return the last generated value for this parameter."""
gen=super(Dynamic,self).__get__(obj,objtype)
if hasattr(gen,'_Dynamic_last'):
return gen._Dynamic_last
else:
return gen | python | def _inspect(self,obj,objtype=None):
"""Return the last generated value for this parameter."""
gen=super(Dynamic,self).__get__(obj,objtype)
if hasattr(gen,'_Dynamic_last'):
return gen._Dynamic_last
else:
return gen | [
"def",
"_inspect",
"(",
"self",
",",
"obj",
",",
"objtype",
"=",
"None",
")",
":",
"gen",
"=",
"super",
"(",
"Dynamic",
",",
"self",
")",
".",
"__get__",
"(",
"obj",
",",
"objtype",
")",
"if",
"hasattr",
"(",
"gen",
",",
"'_Dynamic_last'",
")",
":"... | Return the last generated value for this parameter. | [
"Return",
"the",
"last",
"generated",
"value",
"for",
"this",
"parameter",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L666-L673 |
11,839 | pyviz/param | param/__init__.py | Dynamic._force | def _force(self,obj,objtype=None):
"""Force a new value to be generated, and return it."""
gen=super(Dynamic,self).__get__(obj,objtype)
if hasattr(gen,'_Dynamic_last'):
return self._produce_value(gen,force=True)
else:
return gen | python | def _force(self,obj,objtype=None):
"""Force a new value to be generated, and return it."""
gen=super(Dynamic,self).__get__(obj,objtype)
if hasattr(gen,'_Dynamic_last'):
return self._produce_value(gen,force=True)
else:
return gen | [
"def",
"_force",
"(",
"self",
",",
"obj",
",",
"objtype",
"=",
"None",
")",
":",
"gen",
"=",
"super",
"(",
"Dynamic",
",",
"self",
")",
".",
"__get__",
"(",
"obj",
",",
"objtype",
")",
"if",
"hasattr",
"(",
"gen",
",",
"'_Dynamic_last'",
")",
":",
... | Force a new value to be generated, and return it. | [
"Force",
"a",
"new",
"value",
"to",
"be",
"generated",
"and",
"return",
"it",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L676-L683 |
11,840 | pyviz/param | param/__init__.py | Number.set_in_bounds | def set_in_bounds(self,obj,val):
"""
Set to the given value, but cropped to be within the legal bounds.
All objects are accepted, and no exceptions will be raised. See
crop_to_bounds for details on how cropping is done.
"""
if not callable(val):
bounded_val =... | python | def set_in_bounds(self,obj,val):
"""
Set to the given value, but cropped to be within the legal bounds.
All objects are accepted, and no exceptions will be raised. See
crop_to_bounds for details on how cropping is done.
"""
if not callable(val):
bounded_val =... | [
"def",
"set_in_bounds",
"(",
"self",
",",
"obj",
",",
"val",
")",
":",
"if",
"not",
"callable",
"(",
"val",
")",
":",
"bounded_val",
"=",
"self",
".",
"crop_to_bounds",
"(",
"val",
")",
"else",
":",
"bounded_val",
"=",
"val",
"super",
"(",
"Number",
... | Set to the given value, but cropped to be within the legal bounds.
All objects are accepted, and no exceptions will be raised. See
crop_to_bounds for details on how cropping is done. | [
"Set",
"to",
"the",
"given",
"value",
"but",
"cropped",
"to",
"be",
"within",
"the",
"legal",
"bounds",
".",
"All",
"objects",
"are",
"accepted",
"and",
"no",
"exceptions",
"will",
"be",
"raised",
".",
"See",
"crop_to_bounds",
"for",
"details",
"on",
"how"... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L786-L796 |
11,841 | pyviz/param | param/__init__.py | Number.crop_to_bounds | def crop_to_bounds(self,val):
"""
Return the given value cropped to be within the hard bounds
for this parameter.
If a numeric value is passed in, check it is within the hard
bounds. If it is larger than the high bound, return the high
bound. If it's smaller, return the ... | python | def crop_to_bounds(self,val):
"""
Return the given value cropped to be within the hard bounds
for this parameter.
If a numeric value is passed in, check it is within the hard
bounds. If it is larger than the high bound, return the high
bound. If it's smaller, return the ... | [
"def",
"crop_to_bounds",
"(",
"self",
",",
"val",
")",
":",
"# Currently, values outside the bounds are silently cropped to",
"# be inside the bounds; it may be appropriate to add a warning",
"# in such cases.",
"if",
"_is_number",
"(",
"val",
")",
":",
"if",
"self",
".",
"bo... | Return the given value cropped to be within the hard bounds
for this parameter.
If a numeric value is passed in, check it is within the hard
bounds. If it is larger than the high bound, return the high
bound. If it's smaller, return the low bound. In either case, the
returned va... | [
"Return",
"the",
"given",
"value",
"cropped",
"to",
"be",
"within",
"the",
"hard",
"bounds",
"for",
"this",
"parameter",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L801-L835 |
11,842 | pyviz/param | param/__init__.py | ObjectSelector._validate | def _validate(self, val):
"""
val must be None or one of the objects in self.objects.
"""
if not self.check_on_set:
self._ensure_value_is_in_objects(val)
return
if not (val in self.objects or (self.allow_None and val is None)):
# CEBALERT: can... | python | def _validate(self, val):
"""
val must be None or one of the objects in self.objects.
"""
if not self.check_on_set:
self._ensure_value_is_in_objects(val)
return
if not (val in self.objects or (self.allow_None and val is None)):
# CEBALERT: can... | [
"def",
"_validate",
"(",
"self",
",",
"val",
")",
":",
"if",
"not",
"self",
".",
"check_on_set",
":",
"self",
".",
"_ensure_value_is_in_objects",
"(",
"val",
")",
"return",
"if",
"not",
"(",
"val",
"in",
"self",
".",
"objects",
"or",
"(",
"self",
".",
... | val must be None or one of the objects in self.objects. | [
"val",
"must",
"be",
"None",
"or",
"one",
"of",
"the",
"objects",
"in",
"self",
".",
"objects",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L1206-L1235 |
11,843 | pyviz/param | param/__init__.py | ObjectSelector._ensure_value_is_in_objects | def _ensure_value_is_in_objects(self,val):
"""
Make sure that the provided value is present on the objects list.
Subclasses can override if they support multiple items on a list,
to check each item instead.
"""
if not (val in self.objects):
self.objects.append(... | python | def _ensure_value_is_in_objects(self,val):
"""
Make sure that the provided value is present on the objects list.
Subclasses can override if they support multiple items on a list,
to check each item instead.
"""
if not (val in self.objects):
self.objects.append(... | [
"def",
"_ensure_value_is_in_objects",
"(",
"self",
",",
"val",
")",
":",
"if",
"not",
"(",
"val",
"in",
"self",
".",
"objects",
")",
":",
"self",
".",
"objects",
".",
"append",
"(",
"val",
")"
] | Make sure that the provided value is present on the objects list.
Subclasses can override if they support multiple items on a list,
to check each item instead. | [
"Make",
"sure",
"that",
"the",
"provided",
"value",
"is",
"present",
"on",
"the",
"objects",
"list",
".",
"Subclasses",
"can",
"override",
"if",
"they",
"support",
"multiple",
"items",
"on",
"a",
"list",
"to",
"check",
"each",
"item",
"instead",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L1237-L1244 |
11,844 | pyviz/param | param/__init__.py | ClassSelector._validate | def _validate(self,val):
"""val must be None, an instance of self.class_ if self.is_instance=True or a subclass of self_class if self.is_instance=False"""
if isinstance(self.class_, tuple):
class_name = ('(%s)' % ', '.join(cl.__name__ for cl in self.class_))
else:
class_n... | python | def _validate(self,val):
"""val must be None, an instance of self.class_ if self.is_instance=True or a subclass of self_class if self.is_instance=False"""
if isinstance(self.class_, tuple):
class_name = ('(%s)' % ', '.join(cl.__name__ for cl in self.class_))
else:
class_n... | [
"def",
"_validate",
"(",
"self",
",",
"val",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"class_",
",",
"tuple",
")",
":",
"class_name",
"=",
"(",
"'(%s)'",
"%",
"', '",
".",
"join",
"(",
"cl",
".",
"__name__",
"for",
"cl",
"in",
"self",
".",
... | val must be None, an instance of self.class_ if self.is_instance=True or a subclass of self_class if self.is_instance=False | [
"val",
"must",
"be",
"None",
"an",
"instance",
"of",
"self",
".",
"class_",
"if",
"self",
".",
"is_instance",
"=",
"True",
"or",
"a",
"subclass",
"of",
"self_class",
"if",
"self",
".",
"is_instance",
"=",
"False"
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L1303-L1318 |
11,845 | pyviz/param | param/__init__.py | ClassSelector.get_range | def get_range(self):
"""
Return the possible types for this parameter's value.
(I.e. return {name: <class>} for all classes that are
concrete_descendents() of self.class_.)
Only classes from modules that have been imported are added
(see concrete_descendents()).
... | python | def get_range(self):
"""
Return the possible types for this parameter's value.
(I.e. return {name: <class>} for all classes that are
concrete_descendents() of self.class_.)
Only classes from modules that have been imported are added
(see concrete_descendents()).
... | [
"def",
"get_range",
"(",
"self",
")",
":",
"classes",
"=",
"concrete_descendents",
"(",
"self",
".",
"class_",
")",
"d",
"=",
"OrderedDict",
"(",
"(",
"name",
",",
"class_",
")",
"for",
"name",
",",
"class_",
"in",
"classes",
".",
"items",
"(",
")",
... | Return the possible types for this parameter's value.
(I.e. return {name: <class>} for all classes that are
concrete_descendents() of self.class_.)
Only classes from modules that have been imported are added
(see concrete_descendents()). | [
"Return",
"the",
"possible",
"types",
"for",
"this",
"parameter",
"s",
"value",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L1321-L1335 |
11,846 | pyviz/param | param/__init__.py | List._validate | def _validate(self, val):
"""
Checks that the list is of the right length and has the right contents.
Otherwise, an exception is raised.
"""
if self.allow_None and val is None:
return
if not isinstance(val, list):
raise ValueError("List '%s' must ... | python | def _validate(self, val):
"""
Checks that the list is of the right length and has the right contents.
Otherwise, an exception is raised.
"""
if self.allow_None and val is None:
return
if not isinstance(val, list):
raise ValueError("List '%s' must ... | [
"def",
"_validate",
"(",
"self",
",",
"val",
")",
":",
"if",
"self",
".",
"allow_None",
"and",
"val",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"raise",
"ValueError",
"(",
"\"List '%s' must be a list.\"",
... | Checks that the list is of the right length and has the right contents.
Otherwise, an exception is raised. | [
"Checks",
"that",
"the",
"list",
"is",
"of",
"the",
"right",
"length",
"and",
"has",
"the",
"right",
"contents",
".",
"Otherwise",
"an",
"exception",
"is",
"raised",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L1357-L1381 |
11,847 | pyviz/param | param/parameterized.py | logging_level | def logging_level(level):
"""
Temporarily modify param's logging level.
"""
level = level.upper()
levels = [DEBUG, INFO, WARNING, ERROR, CRITICAL, VERBOSE]
level_names = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'VERBOSE']
if level not in level_names:
raise Exception("Level ... | python | def logging_level(level):
"""
Temporarily modify param's logging level.
"""
level = level.upper()
levels = [DEBUG, INFO, WARNING, ERROR, CRITICAL, VERBOSE]
level_names = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'VERBOSE']
if level not in level_names:
raise Exception("Level ... | [
"def",
"logging_level",
"(",
"level",
")",
":",
"level",
"=",
"level",
".",
"upper",
"(",
")",
"levels",
"=",
"[",
"DEBUG",
",",
"INFO",
",",
"WARNING",
",",
"ERROR",
",",
"CRITICAL",
",",
"VERBOSE",
"]",
"level_names",
"=",
"[",
"'DEBUG'",
",",
"'IN... | Temporarily modify param's logging level. | [
"Temporarily",
"modify",
"param",
"s",
"logging",
"level",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L69-L86 |
11,848 | pyviz/param | param/parameterized.py | batch_watch | def batch_watch(parameterized, run=True):
"""
Context manager to batch watcher events on a parameterized object.
The context manager will queue any events triggered by setting a
parameter on the supplied parameterized object and dispatch them
all at once when the context manager exits. If run=False ... | python | def batch_watch(parameterized, run=True):
"""
Context manager to batch watcher events on a parameterized object.
The context manager will queue any events triggered by setting a
parameter on the supplied parameterized object and dispatch them
all at once when the context manager exits. If run=False ... | [
"def",
"batch_watch",
"(",
"parameterized",
",",
"run",
"=",
"True",
")",
":",
"BATCH_WATCH",
"=",
"parameterized",
".",
"param",
".",
"_BATCH_WATCH",
"parameterized",
".",
"param",
".",
"_BATCH_WATCH",
"=",
"True",
"try",
":",
"yield",
"finally",
":",
"para... | Context manager to batch watcher events on a parameterized object.
The context manager will queue any events triggered by setting a
parameter on the supplied parameterized object and dispatch them
all at once when the context manager exits. If run=False the
queued events are not dispatched and should be... | [
"Context",
"manager",
"to",
"batch",
"watcher",
"events",
"on",
"a",
"parameterized",
"object",
".",
"The",
"context",
"manager",
"will",
"queue",
"any",
"events",
"triggered",
"by",
"setting",
"a",
"parameter",
"on",
"the",
"supplied",
"parameterized",
"object"... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L90-L105 |
11,849 | pyviz/param | param/parameterized.py | get_all_slots | def get_all_slots(class_):
"""
Return a list of slot names for slots defined in class_ and its
superclasses.
"""
# A subclass's __slots__ attribute does not contain slots defined
# in its superclass (the superclass' __slots__ end up as
# attributes of the subclass).
all_slots = []
pa... | python | def get_all_slots(class_):
"""
Return a list of slot names for slots defined in class_ and its
superclasses.
"""
# A subclass's __slots__ attribute does not contain slots defined
# in its superclass (the superclass' __slots__ end up as
# attributes of the subclass).
all_slots = []
pa... | [
"def",
"get_all_slots",
"(",
"class_",
")",
":",
"# A subclass's __slots__ attribute does not contain slots defined",
"# in its superclass (the superclass' __slots__ end up as",
"# attributes of the subclass).",
"all_slots",
"=",
"[",
"]",
"parent_param_classes",
"=",
"[",
"c",
"fo... | Return a list of slot names for slots defined in class_ and its
superclasses. | [
"Return",
"a",
"list",
"of",
"slot",
"names",
"for",
"slots",
"defined",
"in",
"class_",
"and",
"its",
"superclasses",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L136-L149 |
11,850 | pyviz/param | param/parameterized.py | get_occupied_slots | def get_occupied_slots(instance):
"""
Return a list of slots for which values have been set.
(While a slot might be defined, if a value for that slot hasn't
been set, then it's an AttributeError to request the slot's
value.)
"""
return [slot for slot in get_all_slots(type(instance))
... | python | def get_occupied_slots(instance):
"""
Return a list of slots for which values have been set.
(While a slot might be defined, if a value for that slot hasn't
been set, then it's an AttributeError to request the slot's
value.)
"""
return [slot for slot in get_all_slots(type(instance))
... | [
"def",
"get_occupied_slots",
"(",
"instance",
")",
":",
"return",
"[",
"slot",
"for",
"slot",
"in",
"get_all_slots",
"(",
"type",
"(",
"instance",
")",
")",
"if",
"hasattr",
"(",
"instance",
",",
"slot",
")",
"]"
] | Return a list of slots for which values have been set.
(While a slot might be defined, if a value for that slot hasn't
been set, then it's an AttributeError to request the slot's
value.) | [
"Return",
"a",
"list",
"of",
"slots",
"for",
"which",
"values",
"have",
"been",
"set",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L152-L161 |
11,851 | pyviz/param | param/parameterized.py | all_equal | def all_equal(arg1,arg2):
"""
Return a single boolean for arg1==arg2, even for numpy arrays
using element-wise comparison.
Uses all(arg1==arg2) for sequences, and arg1==arg2 otherwise.
If both objects have an '_infinitely_iterable' attribute, they are
not be zipped together and are compared di... | python | def all_equal(arg1,arg2):
"""
Return a single boolean for arg1==arg2, even for numpy arrays
using element-wise comparison.
Uses all(arg1==arg2) for sequences, and arg1==arg2 otherwise.
If both objects have an '_infinitely_iterable' attribute, they are
not be zipped together and are compared di... | [
"def",
"all_equal",
"(",
"arg1",
",",
"arg2",
")",
":",
"if",
"all",
"(",
"hasattr",
"(",
"el",
",",
"'_infinitely_iterable'",
")",
"for",
"el",
"in",
"[",
"arg1",
",",
"arg2",
"]",
")",
":",
"return",
"arg1",
"==",
"arg2",
"try",
":",
"return",
"a... | Return a single boolean for arg1==arg2, even for numpy arrays
using element-wise comparison.
Uses all(arg1==arg2) for sequences, and arg1==arg2 otherwise.
If both objects have an '_infinitely_iterable' attribute, they are
not be zipped together and are compared directly instead. | [
"Return",
"a",
"single",
"boolean",
"for",
"arg1",
"==",
"arg2",
"even",
"for",
"numpy",
"arrays",
"using",
"element",
"-",
"wise",
"comparison",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L164-L179 |
11,852 | pyviz/param | param/parameterized.py | output | def output(func, *output, **kw):
"""
output allows annotating a method on a Parameterized class to
declare that it returns an output of a specific type. The outputs
of a Parameterized class can be queried using the
Parameterized.param.outputs method. By default the output will
inherit the method... | python | def output(func, *output, **kw):
"""
output allows annotating a method on a Parameterized class to
declare that it returns an output of a specific type. The outputs
of a Parameterized class can be queried using the
Parameterized.param.outputs method. By default the output will
inherit the method... | [
"def",
"output",
"(",
"func",
",",
"*",
"output",
",",
"*",
"*",
"kw",
")",
":",
"if",
"output",
":",
"outputs",
"=",
"[",
"]",
"for",
"i",
",",
"out",
"in",
"enumerate",
"(",
"output",
")",
":",
"i",
"=",
"i",
"if",
"len",
"(",
"output",
")"... | output allows annotating a method on a Parameterized class to
declare that it returns an output of a specific type. The outputs
of a Parameterized class can be queried using the
Parameterized.param.outputs method. By default the output will
inherit the method name but a custom name can be declared by
... | [
"output",
"allows",
"annotating",
"a",
"method",
"on",
"a",
"Parameterized",
"class",
"to",
"declare",
"that",
"it",
"returns",
"an",
"output",
"of",
"a",
"specific",
"type",
".",
"The",
"outputs",
"of",
"a",
"Parameterized",
"class",
"can",
"be",
"queried",... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L293-L384 |
11,853 | pyviz/param | param/parameterized.py | Parameters._setup_params | def _setup_params(self_,**params):
"""
Initialize default and keyword parameter values.
First, ensures that all Parameters with 'instantiate=True'
(typically used for mutable Parameters) are copied directly
into each object, to ensure that there is an independent copy
(t... | python | def _setup_params(self_,**params):
"""
Initialize default and keyword parameter values.
First, ensures that all Parameters with 'instantiate=True'
(typically used for mutable Parameters) are copied directly
into each object, to ensure that there is an independent copy
(t... | [
"def",
"_setup_params",
"(",
"self_",
",",
"*",
"*",
"params",
")",
":",
"self",
"=",
"self_",
".",
"param",
".",
"self",
"## Deepcopy all 'instantiate=True' parameters",
"# (build a set of names first to avoid redundantly instantiating",
"# a later-overridden parent class's p... | Initialize default and keyword parameter values.
First, ensures that all Parameters with 'instantiate=True'
(typically used for mutable Parameters) are copied directly
into each object, to ensure that there is an independent copy
(to avoid suprising aliasing errors). Then sets each of ... | [
"Initialize",
"default",
"and",
"keyword",
"parameter",
"values",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1094-L1129 |
11,854 | pyviz/param | param/parameterized.py | Parameters.deprecate | def deprecate(cls, fn):
"""
Decorator to issue warnings for API moving onto the param
namespace and to add a docstring directing people to the
appropriate method.
"""
def inner(*args, **kwargs):
if cls._disable_stubs:
raise AssertionError('Stub... | python | def deprecate(cls, fn):
"""
Decorator to issue warnings for API moving onto the param
namespace and to add a docstring directing people to the
appropriate method.
"""
def inner(*args, **kwargs):
if cls._disable_stubs:
raise AssertionError('Stub... | [
"def",
"deprecate",
"(",
"cls",
",",
"fn",
")",
":",
"def",
"inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"cls",
".",
"_disable_stubs",
":",
"raise",
"AssertionError",
"(",
"'Stubs supporting old API disabled'",
")",
"elif",
"cls",
... | Decorator to issue warnings for API moving onto the param
namespace and to add a docstring directing people to the
appropriate method. | [
"Decorator",
"to",
"issue",
"warnings",
"for",
"API",
"moving",
"onto",
"the",
"param",
"namespace",
"and",
"to",
"add",
"a",
"docstring",
"directing",
"people",
"to",
"the",
"appropriate",
"method",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1132-L1149 |
11,855 | pyviz/param | param/parameterized.py | Parameters.print_param_defaults | def print_param_defaults(self_):
"""Print the default values of all cls's Parameters."""
cls = self_.cls
for key,val in cls.__dict__.items():
if isinstance(val,Parameter):
print(cls.__name__+'.'+key+ '='+ repr(val.default)) | python | def print_param_defaults(self_):
"""Print the default values of all cls's Parameters."""
cls = self_.cls
for key,val in cls.__dict__.items():
if isinstance(val,Parameter):
print(cls.__name__+'.'+key+ '='+ repr(val.default)) | [
"def",
"print_param_defaults",
"(",
"self_",
")",
":",
"cls",
"=",
"self_",
".",
"cls",
"for",
"key",
",",
"val",
"in",
"cls",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"Parameter",
")",
":",
"print",
"(",
"... | Print the default values of all cls's Parameters. | [
"Print",
"the",
"default",
"values",
"of",
"all",
"cls",
"s",
"Parameters",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1188-L1193 |
11,856 | pyviz/param | param/parameterized.py | Parameters.set_default | def set_default(self_,param_name,value):
"""
Set the default value of param_name.
Equivalent to setting param_name on the class.
"""
cls = self_.cls
setattr(cls,param_name,value) | python | def set_default(self_,param_name,value):
"""
Set the default value of param_name.
Equivalent to setting param_name on the class.
"""
cls = self_.cls
setattr(cls,param_name,value) | [
"def",
"set_default",
"(",
"self_",
",",
"param_name",
",",
"value",
")",
":",
"cls",
"=",
"self_",
".",
"cls",
"setattr",
"(",
"cls",
",",
"param_name",
",",
"value",
")"
] | Set the default value of param_name.
Equivalent to setting param_name on the class. | [
"Set",
"the",
"default",
"value",
"of",
"param_name",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1196-L1203 |
11,857 | pyviz/param | param/parameterized.py | Parameters._add_parameter | def _add_parameter(self_, param_name,param_obj):
"""
Add a new Parameter object into this object's class.
Supposed to result in a Parameter equivalent to one declared
in the class's source code.
"""
# CEBALERT: can't we just do
# setattr(cls,param_name,param_obj)... | python | def _add_parameter(self_, param_name,param_obj):
"""
Add a new Parameter object into this object's class.
Supposed to result in a Parameter equivalent to one declared
in the class's source code.
"""
# CEBALERT: can't we just do
# setattr(cls,param_name,param_obj)... | [
"def",
"_add_parameter",
"(",
"self_",
",",
"param_name",
",",
"param_obj",
")",
":",
"# CEBALERT: can't we just do",
"# setattr(cls,param_name,param_obj)? The metaclass's",
"# __setattr__ is actually written to handle that. (Would also",
"# need to do something about the params() cache.... | Add a new Parameter object into this object's class.
Supposed to result in a Parameter equivalent to one declared
in the class's source code. | [
"Add",
"a",
"new",
"Parameter",
"object",
"into",
"this",
"object",
"s",
"class",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1206-L1228 |
11,858 | pyviz/param | param/parameterized.py | Parameters.set_param | def set_param(self_, *args,**kwargs):
"""
For each param=value keyword argument, sets the corresponding
parameter of this object or class to the given value.
For backwards compatibility, also accepts
set_param("param",value) for a single parameter value using
positional ... | python | def set_param(self_, *args,**kwargs):
"""
For each param=value keyword argument, sets the corresponding
parameter of this object or class to the given value.
For backwards compatibility, also accepts
set_param("param",value) for a single parameter value using
positional ... | [
"def",
"set_param",
"(",
"self_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"BATCH_WATCH",
"=",
"self_",
".",
"self_or_cls",
".",
"param",
".",
"_BATCH_WATCH",
"self_",
".",
"self_or_cls",
".",
"param",
".",
"_BATCH_WATCH",
"=",
"True",
"self_... | For each param=value keyword argument, sets the corresponding
parameter of this object or class to the given value.
For backwards compatibility, also accepts
set_param("param",value) for a single parameter value using
positional arguments, but the keyword interface is preferred
... | [
"For",
"each",
"param",
"=",
"value",
"keyword",
"argument",
"sets",
"the",
"corresponding",
"parameter",
"of",
"this",
"object",
"or",
"class",
"to",
"the",
"given",
"value",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1259-L1292 |
11,859 | pyviz/param | param/parameterized.py | Parameters.objects | def objects(self_, instance=True):
"""
Returns the Parameters of this instance or class
If instance=True and called on a Parameterized instance it
will create instance parameters for all Parameters defined on
the class. To force class parameters to be returned use
instan... | python | def objects(self_, instance=True):
"""
Returns the Parameters of this instance or class
If instance=True and called on a Parameterized instance it
will create instance parameters for all Parameters defined on
the class. To force class parameters to be returned use
instan... | [
"def",
"objects",
"(",
"self_",
",",
"instance",
"=",
"True",
")",
":",
"cls",
"=",
"self_",
".",
"cls",
"# CB: we cache the parameters because this method is called often,",
"# and parameters are rarely added (and cannot be deleted)",
"try",
":",
"pdict",
"=",
"getattr",
... | Returns the Parameters of this instance or class
If instance=True and called on a Parameterized instance it
will create instance parameters for all Parameters defined on
the class. To force class parameters to be returned use
instance=False. Since classes avoid creating instance
... | [
"Returns",
"the",
"Parameters",
"of",
"this",
"instance",
"or",
"class"
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1295-L1333 |
11,860 | pyviz/param | param/parameterized.py | Parameters.trigger | def trigger(self_, *param_names):
"""
Trigger watchers for the given set of parameter names. Watchers
will be triggered whether or not the parameter values have
actually changed.
"""
events = self_.self_or_cls.param._events
watchers = self_.self_or_cls.param._watc... | python | def trigger(self_, *param_names):
"""
Trigger watchers for the given set of parameter names. Watchers
will be triggered whether or not the parameter values have
actually changed.
"""
events = self_.self_or_cls.param._events
watchers = self_.self_or_cls.param._watc... | [
"def",
"trigger",
"(",
"self_",
",",
"*",
"param_names",
")",
":",
"events",
"=",
"self_",
".",
"self_or_cls",
".",
"param",
".",
"_events",
"watchers",
"=",
"self_",
".",
"self_or_cls",
".",
"param",
".",
"_watchers",
"self_",
".",
"self_or_cls",
".",
"... | Trigger watchers for the given set of parameter names. Watchers
will be triggered whether or not the parameter values have
actually changed. | [
"Trigger",
"watchers",
"for",
"the",
"given",
"set",
"of",
"parameter",
"names",
".",
"Watchers",
"will",
"be",
"triggered",
"whether",
"or",
"not",
"the",
"parameter",
"values",
"have",
"actually",
"changed",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1336-L1352 |
11,861 | pyviz/param | param/parameterized.py | Parameters._update_event_type | def _update_event_type(self_, watcher, event, triggered):
"""
Returns an updated Event object with the type field set appropriately.
"""
if triggered:
event_type = 'triggered'
else:
event_type = 'changed' if watcher.onlychanged else 'set'
return Ev... | python | def _update_event_type(self_, watcher, event, triggered):
"""
Returns an updated Event object with the type field set appropriately.
"""
if triggered:
event_type = 'triggered'
else:
event_type = 'changed' if watcher.onlychanged else 'set'
return Ev... | [
"def",
"_update_event_type",
"(",
"self_",
",",
"watcher",
",",
"event",
",",
"triggered",
")",
":",
"if",
"triggered",
":",
"event_type",
"=",
"'triggered'",
"else",
":",
"event_type",
"=",
"'changed'",
"if",
"watcher",
".",
"onlychanged",
"else",
"'set'",
... | Returns an updated Event object with the type field set appropriately. | [
"Returns",
"an",
"updated",
"Event",
"object",
"with",
"the",
"type",
"field",
"set",
"appropriately",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1355-L1364 |
11,862 | pyviz/param | param/parameterized.py | Parameters._call_watcher | def _call_watcher(self_, watcher, event):
"""
Invoke the given the watcher appropriately given a Event object.
"""
if self_.self_or_cls.param._TRIGGER:
pass
elif watcher.onlychanged and (not self_._changed(event)):
return
if self_.self_or_cls.para... | python | def _call_watcher(self_, watcher, event):
"""
Invoke the given the watcher appropriately given a Event object.
"""
if self_.self_or_cls.param._TRIGGER:
pass
elif watcher.onlychanged and (not self_._changed(event)):
return
if self_.self_or_cls.para... | [
"def",
"_call_watcher",
"(",
"self_",
",",
"watcher",
",",
"event",
")",
":",
"if",
"self_",
".",
"self_or_cls",
".",
"param",
".",
"_TRIGGER",
":",
"pass",
"elif",
"watcher",
".",
"onlychanged",
"and",
"(",
"not",
"self_",
".",
"_changed",
"(",
"event",... | Invoke the given the watcher appropriately given a Event object. | [
"Invoke",
"the",
"given",
"the",
"watcher",
"appropriately",
"given",
"a",
"Event",
"object",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1366-L1385 |
11,863 | pyviz/param | param/parameterized.py | Parameters._batch_call_watchers | def _batch_call_watchers(self_):
"""
Batch call a set of watchers based on the parameter value
settings in kwargs using the queued Event and watcher objects.
"""
while self_.self_or_cls.param._events:
event_dict = OrderedDict([((event.name, event.what), event)
... | python | def _batch_call_watchers(self_):
"""
Batch call a set of watchers based on the parameter value
settings in kwargs using the queued Event and watcher objects.
"""
while self_.self_or_cls.param._events:
event_dict = OrderedDict([((event.name, event.what), event)
... | [
"def",
"_batch_call_watchers",
"(",
"self_",
")",
":",
"while",
"self_",
".",
"self_or_cls",
".",
"param",
".",
"_events",
":",
"event_dict",
"=",
"OrderedDict",
"(",
"[",
"(",
"(",
"event",
".",
"name",
",",
"event",
".",
"what",
")",
",",
"event",
")... | Batch call a set of watchers based on the parameter value
settings in kwargs using the queued Event and watcher objects. | [
"Batch",
"call",
"a",
"set",
"of",
"watchers",
"based",
"on",
"the",
"parameter",
"value",
"settings",
"in",
"kwargs",
"using",
"the",
"queued",
"Event",
"and",
"watcher",
"objects",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1388-L1409 |
11,864 | pyviz/param | param/parameterized.py | Parameters.set_dynamic_time_fn | def set_dynamic_time_fn(self_,time_fn,sublistattr=None):
"""
Set time_fn for all Dynamic Parameters of this class or
instance object that are currently being dynamically
generated.
Additionally, sets _Dynamic_time_fn=time_fn on this class or
instance object, so that any ... | python | def set_dynamic_time_fn(self_,time_fn,sublistattr=None):
"""
Set time_fn for all Dynamic Parameters of this class or
instance object that are currently being dynamically
generated.
Additionally, sets _Dynamic_time_fn=time_fn on this class or
instance object, so that any ... | [
"def",
"set_dynamic_time_fn",
"(",
"self_",
",",
"time_fn",
",",
"sublistattr",
"=",
"None",
")",
":",
"self_or_cls",
"=",
"self_",
".",
"self_or_cls",
"self_or_cls",
".",
"_Dynamic_time_fn",
"=",
"time_fn",
"if",
"isinstance",
"(",
"self_or_cls",
",",
"type",
... | Set time_fn for all Dynamic Parameters of this class or
instance object that are currently being dynamically
generated.
Additionally, sets _Dynamic_time_fn=time_fn on this class or
instance object, so that any future changes to Dynamic
Parmeters can inherit time_fn (e.g. if a Nu... | [
"Set",
"time_fn",
"for",
"all",
"Dynamic",
"Parameters",
"of",
"this",
"class",
"or",
"instance",
"object",
"that",
"are",
"currently",
"being",
"dynamically",
"generated",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1412-L1451 |
11,865 | pyviz/param | param/parameterized.py | Parameters.get_param_values | def get_param_values(self_,onlychanged=False):
"""
Return a list of name,value pairs for all Parameters of this
object.
When called on an instance with onlychanged set to True, will
only return values that are not equal to the default value
(onlychanged has no effect whe... | python | def get_param_values(self_,onlychanged=False):
"""
Return a list of name,value pairs for all Parameters of this
object.
When called on an instance with onlychanged set to True, will
only return values that are not equal to the default value
(onlychanged has no effect whe... | [
"def",
"get_param_values",
"(",
"self_",
",",
"onlychanged",
"=",
"False",
")",
":",
"self_or_cls",
"=",
"self_",
".",
"self_or_cls",
"# CEB: we'd actually like to know whether a value has been",
"# explicitly set on the instance, but I'm not sure that's easy",
"# (would need to di... | Return a list of name,value pairs for all Parameters of this
object.
When called on an instance with onlychanged set to True, will
only return values that are not equal to the default value
(onlychanged has no effect when called on a class). | [
"Return",
"a",
"list",
"of",
"name",
"value",
"pairs",
"for",
"all",
"Parameters",
"of",
"this",
"object",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1453-L1475 |
11,866 | pyviz/param | param/parameterized.py | Parameters.force_new_dynamic_value | def force_new_dynamic_value(self_, name): # pylint: disable-msg=E0213
"""
Force a new value to be generated for the dynamic attribute
name, and return it.
If name is not dynamic, its current value is returned
(i.e. equivalent to getattr(name).
"""
cls_or_slf = se... | python | def force_new_dynamic_value(self_, name): # pylint: disable-msg=E0213
"""
Force a new value to be generated for the dynamic attribute
name, and return it.
If name is not dynamic, its current value is returned
(i.e. equivalent to getattr(name).
"""
cls_or_slf = se... | [
"def",
"force_new_dynamic_value",
"(",
"self_",
",",
"name",
")",
":",
"# pylint: disable-msg=E0213",
"cls_or_slf",
"=",
"self_",
".",
"self_or_cls",
"param_obj",
"=",
"cls_or_slf",
".",
"param",
".",
"objects",
"(",
"'existing'",
")",
".",
"get",
"(",
"name",
... | Force a new value to be generated for the dynamic attribute
name, and return it.
If name is not dynamic, its current value is returned
(i.e. equivalent to getattr(name). | [
"Force",
"a",
"new",
"value",
"to",
"be",
"generated",
"for",
"the",
"dynamic",
"attribute",
"name",
"and",
"return",
"it",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1478-L1501 |
11,867 | pyviz/param | param/parameterized.py | Parameters.get_value_generator | def get_value_generator(self_,name): # pylint: disable-msg=E0213
"""
Return the value or value-generating object of the named
attribute.
For most parameters, this is simply the parameter's value
(i.e. the same as getattr()), but Dynamic parameters have
their value-genera... | python | def get_value_generator(self_,name): # pylint: disable-msg=E0213
"""
Return the value or value-generating object of the named
attribute.
For most parameters, this is simply the parameter's value
(i.e. the same as getattr()), but Dynamic parameters have
their value-genera... | [
"def",
"get_value_generator",
"(",
"self_",
",",
"name",
")",
":",
"# pylint: disable-msg=E0213",
"cls_or_slf",
"=",
"self_",
".",
"self_or_cls",
"param_obj",
"=",
"cls_or_slf",
".",
"param",
".",
"objects",
"(",
"'existing'",
")",
".",
"get",
"(",
"name",
")"... | Return the value or value-generating object of the named
attribute.
For most parameters, this is simply the parameter's value
(i.e. the same as getattr()), but Dynamic parameters have
their value-generating object returned. | [
"Return",
"the",
"value",
"or",
"value",
"-",
"generating",
"object",
"of",
"the",
"named",
"attribute",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1504-L1537 |
11,868 | pyviz/param | param/parameterized.py | Parameters.inspect_value | def inspect_value(self_,name): # pylint: disable-msg=E0213
"""
Return the current value of the named attribute without modifying it.
Same as getattr() except for Dynamic parameters, which have their
last generated value returned.
"""
cls_or_slf = self_.self_or_cls
... | python | def inspect_value(self_,name): # pylint: disable-msg=E0213
"""
Return the current value of the named attribute without modifying it.
Same as getattr() except for Dynamic parameters, which have their
last generated value returned.
"""
cls_or_slf = self_.self_or_cls
... | [
"def",
"inspect_value",
"(",
"self_",
",",
"name",
")",
":",
"# pylint: disable-msg=E0213",
"cls_or_slf",
"=",
"self_",
".",
"self_or_cls",
"param_obj",
"=",
"cls_or_slf",
".",
"param",
".",
"objects",
"(",
"'existing'",
")",
".",
"get",
"(",
"name",
")",
"i... | Return the current value of the named attribute without modifying it.
Same as getattr() except for Dynamic parameters, which have their
last generated value returned. | [
"Return",
"the",
"current",
"value",
"of",
"the",
"named",
"attribute",
"without",
"modifying",
"it",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1539-L1561 |
11,869 | pyviz/param | param/parameterized.py | Parameters.outputs | def outputs(self_):
"""
Returns a mapping between any declared outputs and a tuple
of the declared Parameter type, the output method, and the
index into the output if multiple outputs are returned.
"""
outputs = {}
for cls in classlist(self_.cls):
for ... | python | def outputs(self_):
"""
Returns a mapping between any declared outputs and a tuple
of the declared Parameter type, the output method, and the
index into the output if multiple outputs are returned.
"""
outputs = {}
for cls in classlist(self_.cls):
for ... | [
"def",
"outputs",
"(",
"self_",
")",
":",
"outputs",
"=",
"{",
"}",
"for",
"cls",
"in",
"classlist",
"(",
"self_",
".",
"cls",
")",
":",
"for",
"name",
"in",
"dir",
"(",
"cls",
")",
":",
"method",
"=",
"getattr",
"(",
"self_",
".",
"self_or_cls",
... | Returns a mapping between any declared outputs and a tuple
of the declared Parameter type, the output method, and the
index into the output if multiple outputs are returned. | [
"Returns",
"a",
"mapping",
"between",
"any",
"declared",
"outputs",
"and",
"a",
"tuple",
"of",
"the",
"declared",
"Parameter",
"type",
"the",
"output",
"method",
"and",
"the",
"index",
"into",
"the",
"output",
"if",
"multiple",
"outputs",
"are",
"returned",
... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1568-L1585 |
11,870 | pyviz/param | param/parameterized.py | Parameters.unwatch | def unwatch(self_,watcher):
"""
Unwatch watchers set either with watch or watch_values.
"""
try:
self_._watch('remove',watcher)
except:
self_.warning('No such watcher {watcher} to remove.'.format(watcher=watcher)) | python | def unwatch(self_,watcher):
"""
Unwatch watchers set either with watch or watch_values.
"""
try:
self_._watch('remove',watcher)
except:
self_.warning('No such watcher {watcher} to remove.'.format(watcher=watcher)) | [
"def",
"unwatch",
"(",
"self_",
",",
"watcher",
")",
":",
"try",
":",
"self_",
".",
"_watch",
"(",
"'remove'",
",",
"watcher",
")",
"except",
":",
"self_",
".",
"warning",
"(",
"'No such watcher {watcher} to remove.'",
".",
"format",
"(",
"watcher",
"=",
"... | Unwatch watchers set either with watch or watch_values. | [
"Unwatch",
"watchers",
"set",
"either",
"with",
"watch",
"or",
"watch_values",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1645-L1652 |
11,871 | pyviz/param | param/parameterized.py | Parameters.print_param_values | def print_param_values(self_):
"""Print the values of all this object's Parameters."""
self = self_.self
for name,val in self.param.get_param_values():
print('%s.%s = %s' % (self.name,name,val)) | python | def print_param_values(self_):
"""Print the values of all this object's Parameters."""
self = self_.self
for name,val in self.param.get_param_values():
print('%s.%s = %s' % (self.name,name,val)) | [
"def",
"print_param_values",
"(",
"self_",
")",
":",
"self",
"=",
"self_",
".",
"self",
"for",
"name",
",",
"val",
"in",
"self",
".",
"param",
".",
"get_param_values",
"(",
")",
":",
"print",
"(",
"'%s.%s = %s'",
"%",
"(",
"self",
".",
"name",
",",
"... | Print the values of all this object's Parameters. | [
"Print",
"the",
"values",
"of",
"all",
"this",
"object",
"s",
"Parameters",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1706-L1710 |
11,872 | pyviz/param | param/parameterized.py | Parameters.warning | def warning(self_, msg,*args,**kw):
"""
Print msg merged with args as a warning, unless module variable
warnings_as_exceptions is True, then raise an Exception
containing the arguments.
See Python's logging module for details of message formatting.
"""
if not war... | python | def warning(self_, msg,*args,**kw):
"""
Print msg merged with args as a warning, unless module variable
warnings_as_exceptions is True, then raise an Exception
containing the arguments.
See Python's logging module for details of message formatting.
"""
if not war... | [
"def",
"warning",
"(",
"self_",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"if",
"not",
"warnings_as_exceptions",
":",
"global",
"warning_count",
"warning_count",
"+=",
"1",
"self_",
".",
"__db_print",
"(",
"WARNING",
",",
"msg",
",",
... | Print msg merged with args as a warning, unless module variable
warnings_as_exceptions is True, then raise an Exception
containing the arguments.
See Python's logging module for details of message formatting. | [
"Print",
"msg",
"merged",
"with",
"args",
"as",
"a",
"warning",
"unless",
"module",
"variable",
"warnings_as_exceptions",
"is",
"True",
"then",
"raise",
"an",
"Exception",
"containing",
"the",
"arguments",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1712-L1725 |
11,873 | pyviz/param | param/parameterized.py | Parameters.message | def message(self_,msg,*args,**kw):
"""
Print msg merged with args as a message.
See Python's logging module for details of message formatting.
"""
self_.__db_print(INFO,msg,*args,**kw) | python | def message(self_,msg,*args,**kw):
"""
Print msg merged with args as a message.
See Python's logging module for details of message formatting.
"""
self_.__db_print(INFO,msg,*args,**kw) | [
"def",
"message",
"(",
"self_",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"self_",
".",
"__db_print",
"(",
"INFO",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | Print msg merged with args as a message.
See Python's logging module for details of message formatting. | [
"Print",
"msg",
"merged",
"with",
"args",
"as",
"a",
"message",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1727-L1733 |
11,874 | pyviz/param | param/parameterized.py | Parameters.verbose | def verbose(self_,msg,*args,**kw):
"""
Print msg merged with args as a verbose message.
See Python's logging module for details of message formatting.
"""
self_.__db_print(VERBOSE,msg,*args,**kw) | python | def verbose(self_,msg,*args,**kw):
"""
Print msg merged with args as a verbose message.
See Python's logging module for details of message formatting.
"""
self_.__db_print(VERBOSE,msg,*args,**kw) | [
"def",
"verbose",
"(",
"self_",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"self_",
".",
"__db_print",
"(",
"VERBOSE",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | Print msg merged with args as a verbose message.
See Python's logging module for details of message formatting. | [
"Print",
"msg",
"merged",
"with",
"args",
"as",
"a",
"verbose",
"message",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1735-L1741 |
11,875 | pyviz/param | param/parameterized.py | Parameters.debug | def debug(self_,msg,*args,**kw):
"""
Print msg merged with args as a debugging statement.
See Python's logging module for details of message formatting.
"""
self_.__db_print(DEBUG,msg,*args,**kw) | python | def debug(self_,msg,*args,**kw):
"""
Print msg merged with args as a debugging statement.
See Python's logging module for details of message formatting.
"""
self_.__db_print(DEBUG,msg,*args,**kw) | [
"def",
"debug",
"(",
"self_",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"self_",
".",
"__db_print",
"(",
"DEBUG",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | Print msg merged with args as a debugging statement.
See Python's logging module for details of message formatting. | [
"Print",
"msg",
"merged",
"with",
"args",
"as",
"a",
"debugging",
"statement",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1743-L1749 |
11,876 | pyviz/param | param/parameterized.py | ParameterizedMetaclass.__class_docstring_signature | def __class_docstring_signature(mcs, max_repr_len=15):
"""
Autogenerate a keyword signature in the class docstring for
all available parameters. This is particularly useful in the
IPython Notebook as IPython will parse this signature to allow
tab-completion of keywords.
... | python | def __class_docstring_signature(mcs, max_repr_len=15):
"""
Autogenerate a keyword signature in the class docstring for
all available parameters. This is particularly useful in the
IPython Notebook as IPython will parse this signature to allow
tab-completion of keywords.
... | [
"def",
"__class_docstring_signature",
"(",
"mcs",
",",
"max_repr_len",
"=",
"15",
")",
":",
"processed_kws",
",",
"keyword_groups",
"=",
"set",
"(",
")",
",",
"[",
"]",
"for",
"cls",
"in",
"reversed",
"(",
"mcs",
".",
"mro",
"(",
")",
")",
":",
"keywor... | Autogenerate a keyword signature in the class docstring for
all available parameters. This is particularly useful in the
IPython Notebook as IPython will parse this signature to allow
tab-completion of keywords.
max_repr_len: Maximum length (in characters) of value reprs. | [
"Autogenerate",
"a",
"keyword",
"signature",
"in",
"the",
"class",
"docstring",
"for",
"all",
"available",
"parameters",
".",
"This",
"is",
"particularly",
"useful",
"in",
"the",
"IPython",
"Notebook",
"as",
"IPython",
"will",
"parse",
"this",
"signature",
"to",... | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1830-L1853 |
11,877 | pyviz/param | param/parameterized.py | ParameterizedMetaclass.__param_inheritance | def __param_inheritance(mcs,param_name,param):
"""
Look for Parameter values in superclasses of this
Parameterized class.
Ordinarily, when a Python object is instantiated, attributes
not given values in the constructor will inherit the value
given in the object's class, ... | python | def __param_inheritance(mcs,param_name,param):
"""
Look for Parameter values in superclasses of this
Parameterized class.
Ordinarily, when a Python object is instantiated, attributes
not given values in the constructor will inherit the value
given in the object's class, ... | [
"def",
"__param_inheritance",
"(",
"mcs",
",",
"param_name",
",",
"param",
")",
":",
"# get all relevant slots (i.e. slots defined in all",
"# superclasses of this parameter)",
"slots",
"=",
"{",
"}",
"for",
"p_class",
"in",
"classlist",
"(",
"type",
"(",
"param",
")"... | Look for Parameter values in superclasses of this
Parameterized class.
Ordinarily, when a Python object is instantiated, attributes
not given values in the constructor will inherit the value
given in the object's class, or in its superclasses. For
Parameters owned by Parameteri... | [
"Look",
"for",
"Parameter",
"values",
"in",
"superclasses",
"of",
"this",
"Parameterized",
"class",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1940-L2011 |
11,878 | pyviz/param | param/parameterized.py | ParamOverrides._check_params | def _check_params(self,params):
"""
Print a warning if params contains something that is not a
Parameter of the overridden object.
"""
overridden_object_params = list(self._overridden.param)
for item in params:
if item not in overridden_object_params:
... | python | def _check_params(self,params):
"""
Print a warning if params contains something that is not a
Parameter of the overridden object.
"""
overridden_object_params = list(self._overridden.param)
for item in params:
if item not in overridden_object_params:
... | [
"def",
"_check_params",
"(",
"self",
",",
"params",
")",
":",
"overridden_object_params",
"=",
"list",
"(",
"self",
".",
"_overridden",
".",
"param",
")",
"for",
"item",
"in",
"params",
":",
"if",
"item",
"not",
"in",
"overridden_object_params",
":",
"self",... | Print a warning if params contains something that is not a
Parameter of the overridden object. | [
"Print",
"a",
"warning",
"if",
"params",
"contains",
"something",
"that",
"is",
"not",
"a",
"Parameter",
"of",
"the",
"overridden",
"object",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L2653-L2661 |
11,879 | pyviz/param | param/parameterized.py | ParamOverrides._extract_extra_keywords | def _extract_extra_keywords(self,params):
"""
Return any items in params that are not also
parameters of the overridden object.
"""
extra_keywords = {}
overridden_object_params = list(self._overridden.param)
for name, val in params.items():
if name not... | python | def _extract_extra_keywords(self,params):
"""
Return any items in params that are not also
parameters of the overridden object.
"""
extra_keywords = {}
overridden_object_params = list(self._overridden.param)
for name, val in params.items():
if name not... | [
"def",
"_extract_extra_keywords",
"(",
"self",
",",
"params",
")",
":",
"extra_keywords",
"=",
"{",
"}",
"overridden_object_params",
"=",
"list",
"(",
"self",
".",
"_overridden",
".",
"param",
")",
"for",
"name",
",",
"val",
"in",
"params",
".",
"items",
"... | Return any items in params that are not also
parameters of the overridden object. | [
"Return",
"any",
"items",
"in",
"params",
"that",
"are",
"not",
"also",
"parameters",
"of",
"the",
"overridden",
"object",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L2663-L2676 |
11,880 | pyviz/param | param/parameterized.py | ParameterizedFunction.instance | def instance(self_or_cls,**params):
"""
Return an instance of this class, copying parameters from any
existing instance provided.
"""
if isinstance (self_or_cls,ParameterizedMetaclass):
cls = self_or_cls
else:
p = params
params = dict(... | python | def instance(self_or_cls,**params):
"""
Return an instance of this class, copying parameters from any
existing instance provided.
"""
if isinstance (self_or_cls,ParameterizedMetaclass):
cls = self_or_cls
else:
p = params
params = dict(... | [
"def",
"instance",
"(",
"self_or_cls",
",",
"*",
"*",
"params",
")",
":",
"if",
"isinstance",
"(",
"self_or_cls",
",",
"ParameterizedMetaclass",
")",
":",
"cls",
"=",
"self_or_cls",
"else",
":",
"p",
"=",
"params",
"params",
"=",
"dict",
"(",
"self_or_cls"... | Return an instance of this class, copying parameters from any
existing instance provided. | [
"Return",
"an",
"instance",
"of",
"this",
"class",
"copying",
"parameters",
"from",
"any",
"existing",
"instance",
"provided",
"."
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L2702-L2721 |
11,881 | pyviz/param | param/parameterized.py | ParameterizedFunction.script_repr | def script_repr(self,imports=[],prefix=" "):
"""
Same as Parameterized.script_repr, except that X.classname(Y
is replaced with X.classname.instance(Y
"""
return self.pprint(imports,prefix,unknown_value='',qualify=True,
separator="\n") | python | def script_repr(self,imports=[],prefix=" "):
"""
Same as Parameterized.script_repr, except that X.classname(Y
is replaced with X.classname.instance(Y
"""
return self.pprint(imports,prefix,unknown_value='',qualify=True,
separator="\n") | [
"def",
"script_repr",
"(",
"self",
",",
"imports",
"=",
"[",
"]",
",",
"prefix",
"=",
"\" \"",
")",
":",
"return",
"self",
".",
"pprint",
"(",
"imports",
",",
"prefix",
",",
"unknown_value",
"=",
"''",
",",
"qualify",
"=",
"True",
",",
"separator",
... | Same as Parameterized.script_repr, except that X.classname(Y
is replaced with X.classname.instance(Y | [
"Same",
"as",
"Parameterized",
".",
"script_repr",
"except",
"that",
"X",
".",
"classname",
"(",
"Y",
"is",
"replaced",
"with",
"X",
".",
"classname",
".",
"instance",
"(",
"Y"
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L2742-L2748 |
11,882 | pyviz/param | param/parameterized.py | ParameterizedFunction.pprint | def pprint(self, imports=None, prefix="\n ",unknown_value='<?>',
qualify=False, separator=""):
"""
Same as Parameterized.pprint, except that X.classname(Y
is replaced with X.classname.instance(Y
"""
r = Parameterized.pprint(self,imports,prefix,
... | python | def pprint(self, imports=None, prefix="\n ",unknown_value='<?>',
qualify=False, separator=""):
"""
Same as Parameterized.pprint, except that X.classname(Y
is replaced with X.classname.instance(Y
"""
r = Parameterized.pprint(self,imports,prefix,
... | [
"def",
"pprint",
"(",
"self",
",",
"imports",
"=",
"None",
",",
"prefix",
"=",
"\"\\n \"",
",",
"unknown_value",
"=",
"'<?>'",
",",
"qualify",
"=",
"False",
",",
"separator",
"=",
"\"\"",
")",
":",
"r",
"=",
"Parameterized",
".",
"pprint",
"(",
"sel... | Same as Parameterized.pprint, except that X.classname(Y
is replaced with X.classname.instance(Y | [
"Same",
"as",
"Parameterized",
".",
"pprint",
"except",
"that",
"X",
".",
"classname",
"(",
"Y",
"is",
"replaced",
"with",
"X",
".",
"classname",
".",
"instance",
"(",
"Y"
] | 8f0dafa78defa883247b40635f96cc6d5c1b3481 | https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L2751-L2761 |
11,883 | sass/libsass-python | sassutils/builder.py | Manifest.resolve_filename | def resolve_filename(self, package_dir, filename):
"""Gets a proper full relative path of Sass source and
CSS source that will be generated, according to ``package_dir``
and ``filename``.
:param package_dir: the path of package directory
:type package_dir: :class:`str`, :class:`... | python | def resolve_filename(self, package_dir, filename):
"""Gets a proper full relative path of Sass source and
CSS source that will be generated, according to ``package_dir``
and ``filename``.
:param package_dir: the path of package directory
:type package_dir: :class:`str`, :class:`... | [
"def",
"resolve_filename",
"(",
"self",
",",
"package_dir",
",",
"filename",
")",
":",
"sass_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"package_dir",
",",
"self",
".",
"sass_path",
",",
"filename",
")",
"if",
"self",
".",
"strip_extension",
":",
"... | Gets a proper full relative path of Sass source and
CSS source that will be generated, according to ``package_dir``
and ``filename``.
:param package_dir: the path of package directory
:type package_dir: :class:`str`, :class:`basestring`
:param filename: the filename of Sass/SCSS... | [
"Gets",
"a",
"proper",
"full",
"relative",
"path",
"of",
"Sass",
"source",
"and",
"CSS",
"source",
"that",
"will",
"be",
"generated",
"according",
"to",
"package_dir",
"and",
"filename",
"."
] | fde5b18bc761f0253e71685ee5489e4beb8a403e | https://github.com/sass/libsass-python/blob/fde5b18bc761f0253e71685ee5489e4beb8a403e/sassutils/builder.py#L181-L199 |
11,884 | sass/libsass-python | sassutils/builder.py | Manifest.unresolve_filename | def unresolve_filename(self, package_dir, filename):
"""Retrieves the probable source path from the output filename. Pass
in a .css path to get out a .scss path.
:param package_dir: the path of the package directory
:type package_dir: :class:`str`
:param filename: the css filen... | python | def unresolve_filename(self, package_dir, filename):
"""Retrieves the probable source path from the output filename. Pass
in a .css path to get out a .scss path.
:param package_dir: the path of the package directory
:type package_dir: :class:`str`
:param filename: the css filen... | [
"def",
"unresolve_filename",
"(",
"self",
",",
"package_dir",
",",
"filename",
")",
":",
"filename",
",",
"_",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"self",
".",
"strip_extension",
":",
"for",
"ext",
"in",
"(",
"'.scss'",
... | Retrieves the probable source path from the output filename. Pass
in a .css path to get out a .scss path.
:param package_dir: the path of the package directory
:type package_dir: :class:`str`
:param filename: the css filename
:type filename: :class:`str`
:returns: the s... | [
"Retrieves",
"the",
"probable",
"source",
"path",
"from",
"the",
"output",
"filename",
".",
"Pass",
"in",
"a",
".",
"css",
"path",
"to",
"get",
"out",
"a",
".",
"scss",
"path",
"."
] | fde5b18bc761f0253e71685ee5489e4beb8a403e | https://github.com/sass/libsass-python/blob/fde5b18bc761f0253e71685ee5489e4beb8a403e/sassutils/builder.py#L201-L223 |
11,885 | sass/libsass-python | sass.py | _validate_importers | def _validate_importers(importers):
"""Validates the importers and decorates the callables with our output
formatter.
"""
# They could have no importers, that's chill
if importers is None:
return None
def _to_importer(priority, func):
assert isinstance(priority, int), priority
... | python | def _validate_importers(importers):
"""Validates the importers and decorates the callables with our output
formatter.
"""
# They could have no importers, that's chill
if importers is None:
return None
def _to_importer(priority, func):
assert isinstance(priority, int), priority
... | [
"def",
"_validate_importers",
"(",
"importers",
")",
":",
"# They could have no importers, that's chill",
"if",
"importers",
"is",
"None",
":",
"return",
"None",
"def",
"_to_importer",
"(",
"priority",
",",
"func",
")",
":",
"assert",
"isinstance",
"(",
"priority",
... | Validates the importers and decorates the callables with our output
formatter. | [
"Validates",
"the",
"importers",
"and",
"decorates",
"the",
"callables",
"with",
"our",
"output",
"formatter",
"."
] | fde5b18bc761f0253e71685ee5489e4beb8a403e | https://github.com/sass/libsass-python/blob/fde5b18bc761f0253e71685ee5489e4beb8a403e/sass.py#L218-L232 |
11,886 | sass/libsass-python | sass.py | and_join | def and_join(strings):
"""Join the given ``strings`` by commas with last `' and '` conjuction.
>>> and_join(['Korea', 'Japan', 'China', 'Taiwan'])
'Korea, Japan, China, and Taiwan'
:param strings: a list of words to join
:type string: :class:`collections.abc.Sequence`
:returns: a joined string... | python | def and_join(strings):
"""Join the given ``strings`` by commas with last `' and '` conjuction.
>>> and_join(['Korea', 'Japan', 'China', 'Taiwan'])
'Korea, Japan, China, and Taiwan'
:param strings: a list of words to join
:type string: :class:`collections.abc.Sequence`
:returns: a joined string... | [
"def",
"and_join",
"(",
"strings",
")",
":",
"last",
"=",
"len",
"(",
"strings",
")",
"-",
"1",
"if",
"last",
"==",
"0",
":",
"return",
"strings",
"[",
"0",
"]",
"elif",
"last",
"<",
"0",
":",
"return",
"''",
"iterator",
"=",
"enumerate",
"(",
"s... | Join the given ``strings`` by commas with last `' and '` conjuction.
>>> and_join(['Korea', 'Japan', 'China', 'Taiwan'])
'Korea, Japan, China, and Taiwan'
:param strings: a list of words to join
:type string: :class:`collections.abc.Sequence`
:returns: a joined string
:rtype: :class:`str`, :cl... | [
"Join",
"the",
"given",
"strings",
"by",
"commas",
"with",
"last",
"and",
"conjuction",
"."
] | fde5b18bc761f0253e71685ee5489e4beb8a403e | https://github.com/sass/libsass-python/blob/fde5b18bc761f0253e71685ee5489e4beb8a403e/sass.py#L741-L759 |
11,887 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | allow_staff_or_superuser | def allow_staff_or_superuser(func):
"""
This decorator is used to abstract common is_staff and is_superuser functionality
out of permission checks. It determines which parameter is the request based on name.
"""
is_object_permission = "has_object" in func.__name__
@wraps(func)
def func_wrap... | python | def allow_staff_or_superuser(func):
"""
This decorator is used to abstract common is_staff and is_superuser functionality
out of permission checks. It determines which parameter is the request based on name.
"""
is_object_permission = "has_object" in func.__name__
@wraps(func)
def func_wrap... | [
"def",
"allow_staff_or_superuser",
"(",
"func",
")",
":",
"is_object_permission",
"=",
"\"has_object\"",
"in",
"func",
".",
"__name__",
"@",
"wraps",
"(",
"func",
")",
"def",
"func_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"request",
"... | This decorator is used to abstract common is_staff and is_superuser functionality
out of permission checks. It determines which parameter is the request based on name. | [
"This",
"decorator",
"is",
"used",
"to",
"abstract",
"common",
"is_staff",
"and",
"is_superuser",
"functionality",
"out",
"of",
"permission",
"checks",
".",
"It",
"determines",
"which",
"parameter",
"is",
"the",
"request",
"based",
"on",
"name",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L269-L288 |
11,888 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | authenticated_users | def authenticated_users(func):
"""
This decorator is used to abstract common authentication checking functionality
out of permission checks. It determines which parameter is the request based on name.
"""
is_object_permission = "has_object" in func.__name__
@wraps(func)
def func_wrapper(*ar... | python | def authenticated_users(func):
"""
This decorator is used to abstract common authentication checking functionality
out of permission checks. It determines which parameter is the request based on name.
"""
is_object_permission = "has_object" in func.__name__
@wraps(func)
def func_wrapper(*ar... | [
"def",
"authenticated_users",
"(",
"func",
")",
":",
"is_object_permission",
"=",
"\"has_object\"",
"in",
"func",
".",
"__name__",
"@",
"wraps",
"(",
"func",
")",
"def",
"func_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"request",
"=",
... | This decorator is used to abstract common authentication checking functionality
out of permission checks. It determines which parameter is the request based on name. | [
"This",
"decorator",
"is",
"used",
"to",
"abstract",
"common",
"authentication",
"checking",
"functionality",
"out",
"of",
"permission",
"checks",
".",
"It",
"determines",
"which",
"parameter",
"is",
"the",
"request",
"based",
"on",
"name",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L291-L310 |
11,889 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | DRYPermissionFiltersBase.filter_queryset | def filter_queryset(self, request, queryset, view):
"""
This method overrides the standard filter_queryset method.
This method will check to see if the view calling this is from
a list type action. This function will also route the filter
by action type if action_routing is set t... | python | def filter_queryset(self, request, queryset, view):
"""
This method overrides the standard filter_queryset method.
This method will check to see if the view calling this is from
a list type action. This function will also route the filter
by action type if action_routing is set t... | [
"def",
"filter_queryset",
"(",
"self",
",",
"request",
",",
"queryset",
",",
"view",
")",
":",
"# Check if this is a list type request",
"if",
"view",
".",
"lookup_field",
"not",
"in",
"view",
".",
"kwargs",
":",
"if",
"not",
"self",
".",
"action_routing",
":"... | This method overrides the standard filter_queryset method.
This method will check to see if the view calling this is from
a list type action. This function will also route the filter
by action type if action_routing is set to True. | [
"This",
"method",
"overrides",
"the",
"standard",
"filter_queryset",
"method",
".",
"This",
"method",
"will",
"check",
"to",
"see",
"if",
"the",
"view",
"calling",
"this",
"is",
"from",
"a",
"list",
"type",
"action",
".",
"This",
"function",
"will",
"also",
... | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L35-L49 |
11,890 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | DRYPermissions.has_permission | def has_permission(self, request, view):
"""
Overrides the standard function and figures out methods to call for global permissions.
"""
if not self.global_permissions:
return True
serializer_class = view.get_serializer_class()
assert serializer_class.Meta.m... | python | def has_permission(self, request, view):
"""
Overrides the standard function and figures out methods to call for global permissions.
"""
if not self.global_permissions:
return True
serializer_class = view.get_serializer_class()
assert serializer_class.Meta.m... | [
"def",
"has_permission",
"(",
"self",
",",
"request",
",",
"view",
")",
":",
"if",
"not",
"self",
".",
"global_permissions",
":",
"return",
"True",
"serializer_class",
"=",
"view",
".",
"get_serializer_class",
"(",
")",
"assert",
"serializer_class",
".",
"Meta... | Overrides the standard function and figures out methods to call for global permissions. | [
"Overrides",
"the",
"standard",
"function",
"and",
"figures",
"out",
"methods",
"to",
"call",
"for",
"global",
"permissions",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L97-L128 |
11,891 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | DRYPermissions.has_object_permission | def has_object_permission(self, request, view, obj):
"""
Overrides the standard function and figures out methods to call for object permissions.
"""
if not self.object_permissions:
return True
serializer_class = view.get_serializer_class()
model_class = seria... | python | def has_object_permission(self, request, view, obj):
"""
Overrides the standard function and figures out methods to call for object permissions.
"""
if not self.object_permissions:
return True
serializer_class = view.get_serializer_class()
model_class = seria... | [
"def",
"has_object_permission",
"(",
"self",
",",
"request",
",",
"view",
",",
"obj",
")",
":",
"if",
"not",
"self",
".",
"object_permissions",
":",
"return",
"True",
"serializer_class",
"=",
"view",
".",
"get_serializer_class",
"(",
")",
"model_class",
"=",
... | Overrides the standard function and figures out methods to call for object permissions. | [
"Overrides",
"the",
"standard",
"function",
"and",
"figures",
"out",
"methods",
"to",
"call",
"for",
"object",
"permissions",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L130-L154 |
11,892 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | DRYPermissions._get_action | def _get_action(self, action):
"""
Utility function that consolidates actions if necessary.
"""
return_action = action
if self.partial_update_is_update and action == 'partial_update':
return_action = 'update'
return return_action | python | def _get_action(self, action):
"""
Utility function that consolidates actions if necessary.
"""
return_action = action
if self.partial_update_is_update and action == 'partial_update':
return_action = 'update'
return return_action | [
"def",
"_get_action",
"(",
"self",
",",
"action",
")",
":",
"return_action",
"=",
"action",
"if",
"self",
".",
"partial_update_is_update",
"and",
"action",
"==",
"'partial_update'",
":",
"return_action",
"=",
"'update'",
"return",
"return_action"
] | Utility function that consolidates actions if necessary. | [
"Utility",
"function",
"that",
"consolidates",
"actions",
"if",
"necessary",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L156-L163 |
11,893 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | DRYPermissions._get_error_message | def _get_error_message(self, model_class, method_name, action_method_name):
"""
Get assertion error message depending if there are actions permissions methods defined.
"""
if action_method_name:
return "'{}' does not have '{}' or '{}' defined.".format(model_class, method_name... | python | def _get_error_message(self, model_class, method_name, action_method_name):
"""
Get assertion error message depending if there are actions permissions methods defined.
"""
if action_method_name:
return "'{}' does not have '{}' or '{}' defined.".format(model_class, method_name... | [
"def",
"_get_error_message",
"(",
"self",
",",
"model_class",
",",
"method_name",
",",
"action_method_name",
")",
":",
"if",
"action_method_name",
":",
"return",
"\"'{}' does not have '{}' or '{}' defined.\"",
".",
"format",
"(",
"model_class",
",",
"method_name",
",",
... | Get assertion error message depending if there are actions permissions methods defined. | [
"Get",
"assertion",
"error",
"message",
"depending",
"if",
"there",
"are",
"actions",
"permissions",
"methods",
"defined",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L165-L172 |
11,894 | dbkaplan/dry-rest-permissions | dry_rest_permissions/generics.py | DRYPermissionsField.bind | def bind(self, field_name, parent):
"""
Check the model attached to the serializer to see what methods are defined and save them.
"""
assert parent.Meta.model is not None, \
"DRYPermissions is used on '{}' without a model".format(parent.__class__.__name__)
for action... | python | def bind(self, field_name, parent):
"""
Check the model attached to the serializer to see what methods are defined and save them.
"""
assert parent.Meta.model is not None, \
"DRYPermissions is used on '{}' without a model".format(parent.__class__.__name__)
for action... | [
"def",
"bind",
"(",
"self",
",",
"field_name",
",",
"parent",
")",
":",
"assert",
"parent",
".",
"Meta",
".",
"model",
"is",
"not",
"None",
",",
"\"DRYPermissions is used on '{}' without a model\"",
".",
"format",
"(",
"parent",
".",
"__class__",
".",
"__name_... | Check the model attached to the serializer to see what methods are defined and save them. | [
"Check",
"the",
"model",
"attached",
"to",
"the",
"serializer",
"to",
"see",
"what",
"methods",
"are",
"defined",
"and",
"save",
"them",
"."
] | b2d4d3c76041f6c405e2537bea9639657b75b90e | https://github.com/dbkaplan/dry-rest-permissions/blob/b2d4d3c76041f6c405e2537bea9639657b75b90e/dry_rest_permissions/generics.py#L229-L250 |
11,895 | toastdriven/restless | restless/resources.py | skip_prepare | def skip_prepare(func):
"""
A convenience decorator for indicating the raw data should not be prepared.
"""
@wraps(func)
def _wrapper(self, *args, **kwargs):
value = func(self, *args, **kwargs)
return Data(value, should_prepare=False)
return _wrapper | python | def skip_prepare(func):
"""
A convenience decorator for indicating the raw data should not be prepared.
"""
@wraps(func)
def _wrapper(self, *args, **kwargs):
value = func(self, *args, **kwargs)
return Data(value, should_prepare=False)
return _wrapper | [
"def",
"skip_prepare",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"_wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"value",
"=",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"... | A convenience decorator for indicating the raw data should not be prepared. | [
"A",
"convenience",
"decorator",
"for",
"indicating",
"the",
"raw",
"data",
"should",
"not",
"be",
"prepared",
"."
] | 661593b7b43c42d1bc508dec795356297991255e | https://github.com/toastdriven/restless/blob/661593b7b43c42d1bc508dec795356297991255e/restless/resources.py#L12-L20 |
11,896 | toastdriven/restless | restless/resources.py | Resource.build_error | def build_error(self, err):
"""
When an exception is encountered, this generates a JSON error message
for display to the user.
:param err: The exception seen. The message is exposed to the user, so
beware of sensitive data leaking.
:type err: Exception
:retu... | python | def build_error(self, err):
"""
When an exception is encountered, this generates a JSON error message
for display to the user.
:param err: The exception seen. The message is exposed to the user, so
beware of sensitive data leaking.
:type err: Exception
:retu... | [
"def",
"build_error",
"(",
"self",
",",
"err",
")",
":",
"data",
"=",
"{",
"'error'",
":",
"err",
".",
"args",
"[",
"0",
"]",
",",
"}",
"if",
"self",
".",
"is_debug",
"(",
")",
":",
"# Add the traceback.",
"data",
"[",
"'traceback'",
"]",
"=",
"for... | When an exception is encountered, this generates a JSON error message
for display to the user.
:param err: The exception seen. The message is exposed to the user, so
beware of sensitive data leaking.
:type err: Exception
:returns: A response object | [
"When",
"an",
"exception",
"is",
"encountered",
"this",
"generates",
"a",
"JSON",
"error",
"message",
"for",
"display",
"to",
"the",
"user",
"."
] | 661593b7b43c42d1bc508dec795356297991255e | https://github.com/toastdriven/restless/blob/661593b7b43c42d1bc508dec795356297991255e/restless/resources.py#L192-L213 |
11,897 | toastdriven/restless | restless/resources.py | Resource.deserialize | def deserialize(self, method, endpoint, body):
"""
A convenience method for deserializing the body of a request.
If called on a list-style endpoint, this calls ``deserialize_list``.
Otherwise, it will call ``deserialize_detail``.
:param method: The HTTP method of the current re... | python | def deserialize(self, method, endpoint, body):
"""
A convenience method for deserializing the body of a request.
If called on a list-style endpoint, this calls ``deserialize_list``.
Otherwise, it will call ``deserialize_detail``.
:param method: The HTTP method of the current re... | [
"def",
"deserialize",
"(",
"self",
",",
"method",
",",
"endpoint",
",",
"body",
")",
":",
"if",
"endpoint",
"==",
"'list'",
":",
"return",
"self",
".",
"deserialize_list",
"(",
"body",
")",
"return",
"self",
".",
"deserialize_detail",
"(",
"body",
")"
] | A convenience method for deserializing the body of a request.
If called on a list-style endpoint, this calls ``deserialize_list``.
Otherwise, it will call ``deserialize_detail``.
:param method: The HTTP method of the current request
:type method: string
:param endpoint: The en... | [
"A",
"convenience",
"method",
"for",
"deserializing",
"the",
"body",
"of",
"a",
"request",
"."
] | 661593b7b43c42d1bc508dec795356297991255e | https://github.com/toastdriven/restless/blob/661593b7b43c42d1bc508dec795356297991255e/restless/resources.py#L310-L332 |
11,898 | toastdriven/restless | restless/resources.py | Resource.serialize | def serialize(self, method, endpoint, data):
"""
A convenience method for serializing data for a response.
If called on a list-style endpoint, this calls ``serialize_list``.
Otherwise, it will call ``serialize_detail``.
:param method: The HTTP method of the current request
... | python | def serialize(self, method, endpoint, data):
"""
A convenience method for serializing data for a response.
If called on a list-style endpoint, this calls ``serialize_list``.
Otherwise, it will call ``serialize_detail``.
:param method: The HTTP method of the current request
... | [
"def",
"serialize",
"(",
"self",
",",
"method",
",",
"endpoint",
",",
"data",
")",
":",
"if",
"endpoint",
"==",
"'list'",
":",
"# Create is a special-case, because you POST it to the collection,",
"# not to a detail.",
"if",
"method",
"==",
"'POST'",
":",
"return",
... | A convenience method for serializing data for a response.
If called on a list-style endpoint, this calls ``serialize_list``.
Otherwise, it will call ``serialize_detail``.
:param method: The HTTP method of the current request
:type method: string
:param endpoint: The endpoint s... | [
"A",
"convenience",
"method",
"for",
"serializing",
"data",
"for",
"a",
"response",
"."
] | 661593b7b43c42d1bc508dec795356297991255e | https://github.com/toastdriven/restless/blob/661593b7b43c42d1bc508dec795356297991255e/restless/resources.py#L362-L388 |
11,899 | toastdriven/restless | restless/tnd.py | _method | def _method(self, *args, **kwargs):
"""
the body of those http-methods used in tornado.web.RequestHandler
"""
yield self.resource_handler.handle(self.__resource_view_type__, *args, **kwargs) | python | def _method(self, *args, **kwargs):
"""
the body of those http-methods used in tornado.web.RequestHandler
"""
yield self.resource_handler.handle(self.__resource_view_type__, *args, **kwargs) | [
"def",
"_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"yield",
"self",
".",
"resource_handler",
".",
"handle",
"(",
"self",
".",
"__resource_view_type__",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | the body of those http-methods used in tornado.web.RequestHandler | [
"the",
"body",
"of",
"those",
"http",
"-",
"methods",
"used",
"in",
"tornado",
".",
"web",
".",
"RequestHandler"
] | 661593b7b43c42d1bc508dec795356297991255e | https://github.com/toastdriven/restless/blob/661593b7b43c42d1bc508dec795356297991255e/restless/tnd.py#L36-L40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.