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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
49,100 | alorence/pysvg-py3 | pysvg/core.py | BaseElement.quote_attrib | def quote_attrib(self, inStr):
"""
Transforms characters between xml notation and python notation.
"""
s1 = (isinstance(inStr, str) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&')
s1 = s1.replace('<', '<')
s1 = s1.replace('>', '>')
... | python | def quote_attrib(self, inStr):
"""
Transforms characters between xml notation and python notation.
"""
s1 = (isinstance(inStr, str) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&')
s1 = s1.replace('<', '<')
s1 = s1.replace('>', '>')
... | [
"def",
"quote_attrib",
"(",
"self",
",",
"inStr",
")",
":",
"s1",
"=",
"(",
"isinstance",
"(",
"inStr",
",",
"str",
")",
"and",
"inStr",
"or",
"'%s'",
"%",
"inStr",
")",
"s1",
"=",
"s1",
".",
"replace",
"(",
"'&'",
",",
"'&'",
")",
"s1",
"=",... | Transforms characters between xml notation and python notation. | [
"Transforms",
"characters",
"between",
"xml",
"notation",
"and",
"python",
"notation",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/core.py#L154-L170 |
49,101 | inveniosoftware/invenio-pidstore | invenio_pidstore/cli.py | process_status | def process_status(ctx, param, value):
"""Return status value."""
from .models import PIDStatus
# Allow empty status
if value is None:
return None
if not hasattr(PIDStatus, value):
raise click.BadParameter('Status needs to be one of {0}.'.format(
', '.join([s.name for s... | python | def process_status(ctx, param, value):
"""Return status value."""
from .models import PIDStatus
# Allow empty status
if value is None:
return None
if not hasattr(PIDStatus, value):
raise click.BadParameter('Status needs to be one of {0}.'.format(
', '.join([s.name for s... | [
"def",
"process_status",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"from",
".",
"models",
"import",
"PIDStatus",
"# Allow empty status",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"not",
"hasattr",
"(",
"PIDStatus",
",",
"value",
")"... | Return status value. | [
"Return",
"status",
"value",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/cli.py#L20-L32 |
49,102 | inveniosoftware/invenio-pidstore | invenio_pidstore/cli.py | create | def create(pid_type, pid_value, status, object_type, object_uuid):
"""Create new persistent identifier."""
from .models import PersistentIdentifier
if bool(object_type) ^ bool(object_uuid):
raise click.BadParameter('Speficy both or any of --type and --uuid.')
new_pid = PersistentIdentifier.cre... | python | def create(pid_type, pid_value, status, object_type, object_uuid):
"""Create new persistent identifier."""
from .models import PersistentIdentifier
if bool(object_type) ^ bool(object_uuid):
raise click.BadParameter('Speficy both or any of --type and --uuid.')
new_pid = PersistentIdentifier.cre... | [
"def",
"create",
"(",
"pid_type",
",",
"pid_value",
",",
"status",
",",
"object_type",
",",
"object_uuid",
")",
":",
"from",
".",
"models",
"import",
"PersistentIdentifier",
"if",
"bool",
"(",
"object_type",
")",
"^",
"bool",
"(",
"object_uuid",
")",
":",
... | Create new persistent identifier. | [
"Create",
"new",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/cli.py#L51-L68 |
49,103 | inveniosoftware/invenio-pidstore | invenio_pidstore/cli.py | assign | def assign(pid_type, pid_value, status, object_type, object_uuid, overwrite):
"""Assign persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
if status is not None:
obj.status = status
obj.assign(object_type, object_uuid, overw... | python | def assign(pid_type, pid_value, status, object_type, object_uuid, overwrite):
"""Assign persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
if status is not None:
obj.status = status
obj.assign(object_type, object_uuid, overw... | [
"def",
"assign",
"(",
"pid_type",
",",
"pid_value",
",",
"status",
",",
"object_type",
",",
"object_uuid",
",",
"overwrite",
")",
":",
"from",
".",
"models",
"import",
"PersistentIdentifier",
"obj",
"=",
"PersistentIdentifier",
".",
"get",
"(",
"pid_type",
","... | Assign persistent identifier. | [
"Assign",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/cli.py#L79-L87 |
49,104 | inveniosoftware/invenio-pidstore | invenio_pidstore/cli.py | unassign | def unassign(pid_type, pid_value):
"""Unassign persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
obj.unassign()
db.session.commit()
click.echo(obj.status) | python | def unassign(pid_type, pid_value):
"""Unassign persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
obj.unassign()
db.session.commit()
click.echo(obj.status) | [
"def",
"unassign",
"(",
"pid_type",
",",
"pid_value",
")",
":",
"from",
".",
"models",
"import",
"PersistentIdentifier",
"obj",
"=",
"PersistentIdentifier",
".",
"get",
"(",
"pid_type",
",",
"pid_value",
")",
"obj",
".",
"unassign",
"(",
")",
"db",
".",
"s... | Unassign persistent identifier. | [
"Unassign",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/cli.py#L94-L101 |
49,105 | inveniosoftware/invenio-pidstore | invenio_pidstore/cli.py | get_object | def get_object(pid_type, pid_value):
"""Get an object behind persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
if obj.has_object():
click.echo('{0.object_type} {0.object_uuid} {0.status}'.format(obj)) | python | def get_object(pid_type, pid_value):
"""Get an object behind persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
if obj.has_object():
click.echo('{0.object_type} {0.object_uuid} {0.status}'.format(obj)) | [
"def",
"get_object",
"(",
"pid_type",
",",
"pid_value",
")",
":",
"from",
".",
"models",
"import",
"PersistentIdentifier",
"obj",
"=",
"PersistentIdentifier",
".",
"get",
"(",
"pid_type",
",",
"pid_value",
")",
"if",
"obj",
".",
"has_object",
"(",
")",
":",
... | Get an object behind persistent identifier. | [
"Get",
"an",
"object",
"behind",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/cli.py#L108-L114 |
49,106 | praekelt/django-export | export/serializers/csv_serializer.py | Deserializer | def Deserializer(stream_or_string, **options):
"""
Deserialize a stream or string of CSV data.
"""
def process_item(item):
m = _LIST_RE.match(item)
if m:
contents = m.group(1)
if not contents:
item = []
else:
item = proc... | python | def Deserializer(stream_or_string, **options):
"""
Deserialize a stream or string of CSV data.
"""
def process_item(item):
m = _LIST_RE.match(item)
if m:
contents = m.group(1)
if not contents:
item = []
else:
item = proc... | [
"def",
"Deserializer",
"(",
"stream_or_string",
",",
"*",
"*",
"options",
")",
":",
"def",
"process_item",
"(",
"item",
")",
":",
"m",
"=",
"_LIST_RE",
".",
"match",
"(",
"item",
")",
"if",
"m",
":",
"contents",
"=",
"m",
".",
"group",
"(",
"1",
")... | Deserialize a stream or string of CSV data. | [
"Deserialize",
"a",
"stream",
"or",
"string",
"of",
"CSV",
"data",
"."
] | e2facdd53c9cbfa84d1409c7f0efe5d638812946 | https://github.com/praekelt/django-export/blob/e2facdd53c9cbfa84d1409c7f0efe5d638812946/export/serializers/csv_serializer.py#L118-L173 |
49,107 | inveniosoftware/invenio-pidstore | invenio_pidstore/admin.py | object_formatter | def object_formatter(v, c, m, p):
"""Format object view link."""
endpoint = current_app.config['PIDSTORE_OBJECT_ENDPOINTS'].get(
m.object_type)
if endpoint and m.object_uuid:
return Markup('<a href="{0}">{1}</a>'.format(
url_for(endpoint, id=m.object_uuid),
_('View')... | python | def object_formatter(v, c, m, p):
"""Format object view link."""
endpoint = current_app.config['PIDSTORE_OBJECT_ENDPOINTS'].get(
m.object_type)
if endpoint and m.object_uuid:
return Markup('<a href="{0}">{1}</a>'.format(
url_for(endpoint, id=m.object_uuid),
_('View')... | [
"def",
"object_formatter",
"(",
"v",
",",
"c",
",",
"m",
",",
"p",
")",
":",
"endpoint",
"=",
"current_app",
".",
"config",
"[",
"'PIDSTORE_OBJECT_ENDPOINTS'",
"]",
".",
"get",
"(",
"m",
".",
"object_type",
")",
"if",
"endpoint",
"and",
"m",
".",
"obje... | Format object view link. | [
"Format",
"object",
"view",
"link",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/admin.py#L26-L35 |
49,108 | ascribe/transactions | transactions/transactions.py | Transactions.decode | def decode(self, tx):
"""
Decodes the given transaction.
Args:
tx: hex of transaction
Returns:
decoded transaction
.. note:: Only supported for blockr.io at the moment.
"""
if not isinstance(self._service, BitcoinBlockrService):
... | python | def decode(self, tx):
"""
Decodes the given transaction.
Args:
tx: hex of transaction
Returns:
decoded transaction
.. note:: Only supported for blockr.io at the moment.
"""
if not isinstance(self._service, BitcoinBlockrService):
... | [
"def",
"decode",
"(",
"self",
",",
"tx",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"_service",
",",
"BitcoinBlockrService",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Currently only supported for \"blockr.io\"'",
")",
"return",
"self",
".",
"_... | Decodes the given transaction.
Args:
tx: hex of transaction
Returns:
decoded transaction
.. note:: Only supported for blockr.io at the moment. | [
"Decodes",
"the",
"given",
"transaction",
"."
] | 08f344ce1879152d2a0ba51dda76f11e73c83867 | https://github.com/ascribe/transactions/blob/08f344ce1879152d2a0ba51dda76f11e73c83867/transactions/transactions.py#L209-L223 |
49,109 | inveniosoftware/invenio-pidstore | invenio_pidstore/providers/datacite.py | DataCiteProvider.register | def register(self, url, doc):
"""Register a DOI via the DataCite API.
:param url: Specify the URL for the API.
:param doc: Set metadata for DOI.
:returns: `True` if is registered successfully.
"""
try:
self.pid.register()
# Set metadata for DOI
... | python | def register(self, url, doc):
"""Register a DOI via the DataCite API.
:param url: Specify the URL for the API.
:param doc: Set metadata for DOI.
:returns: `True` if is registered successfully.
"""
try:
self.pid.register()
# Set metadata for DOI
... | [
"def",
"register",
"(",
"self",
",",
"url",
",",
"doc",
")",
":",
"try",
":",
"self",
".",
"pid",
".",
"register",
"(",
")",
"# Set metadata for DOI",
"self",
".",
"api",
".",
"metadata_post",
"(",
"doc",
")",
"# Mint DOI",
"self",
".",
"api",
".",
"... | Register a DOI via the DataCite API.
:param url: Specify the URL for the API.
:param doc: Set metadata for DOI.
:returns: `True` if is registered successfully. | [
"Register",
"a",
"DOI",
"via",
"the",
"DataCite",
"API",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/datacite.py#L101-L120 |
49,110 | inveniosoftware/invenio-pidstore | invenio_pidstore/providers/datacite.py | DataCiteProvider.update | def update(self, url, doc):
"""Update metadata associated with a DOI.
This can be called before/after a DOI is registered.
:param doc: Set metadata for DOI.
:returns: `True` if is updated successfully.
"""
if self.pid.is_deleted():
logger.info("Reactivate in... | python | def update(self, url, doc):
"""Update metadata associated with a DOI.
This can be called before/after a DOI is registered.
:param doc: Set metadata for DOI.
:returns: `True` if is updated successfully.
"""
if self.pid.is_deleted():
logger.info("Reactivate in... | [
"def",
"update",
"(",
"self",
",",
"url",
",",
"doc",
")",
":",
"if",
"self",
".",
"pid",
".",
"is_deleted",
"(",
")",
":",
"logger",
".",
"info",
"(",
"\"Reactivate in DataCite\"",
",",
"extra",
"=",
"dict",
"(",
"pid",
"=",
"self",
".",
"pid",
")... | Update metadata associated with a DOI.
This can be called before/after a DOI is registered.
:param doc: Set metadata for DOI.
:returns: `True` if is updated successfully. | [
"Update",
"metadata",
"associated",
"with",
"a",
"DOI",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/datacite.py#L122-L147 |
49,111 | inveniosoftware/invenio-pidstore | invenio_pidstore/providers/datacite.py | DataCiteProvider.delete | def delete(self):
"""Delete a registered DOI.
If the PID is new then it's deleted only locally.
Otherwise, also it's deleted also remotely.
:returns: `True` if is deleted successfully.
"""
try:
if self.pid.is_new():
self.pid.delete()
... | python | def delete(self):
"""Delete a registered DOI.
If the PID is new then it's deleted only locally.
Otherwise, also it's deleted also remotely.
:returns: `True` if is deleted successfully.
"""
try:
if self.pid.is_new():
self.pid.delete()
... | [
"def",
"delete",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"pid",
".",
"is_new",
"(",
")",
":",
"self",
".",
"pid",
".",
"delete",
"(",
")",
"else",
":",
"self",
".",
"pid",
".",
"delete",
"(",
")",
"self",
".",
"api",
".",
"metad... | Delete a registered DOI.
If the PID is new then it's deleted only locally.
Otherwise, also it's deleted also remotely.
:returns: `True` if is deleted successfully. | [
"Delete",
"a",
"registered",
"DOI",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/datacite.py#L149-L169 |
49,112 | inveniosoftware/invenio-pidstore | invenio_pidstore/providers/datacite.py | DataCiteProvider.sync_status | def sync_status(self):
"""Synchronize DOI status DataCite MDS.
:returns: `True` if is sync successfully.
"""
status = None
try:
try:
self.api.doi_get(self.pid.pid_value)
status = PIDStatus.REGISTERED
except DataCiteGoneErr... | python | def sync_status(self):
"""Synchronize DOI status DataCite MDS.
:returns: `True` if is sync successfully.
"""
status = None
try:
try:
self.api.doi_get(self.pid.pid_value)
status = PIDStatus.REGISTERED
except DataCiteGoneErr... | [
"def",
"sync_status",
"(",
"self",
")",
":",
"status",
"=",
"None",
"try",
":",
"try",
":",
"self",
".",
"api",
".",
"doi_get",
"(",
"self",
".",
"pid",
".",
"pid_value",
")",
"status",
"=",
"PIDStatus",
".",
"REGISTERED",
"except",
"DataCiteGoneError",
... | Synchronize DOI status DataCite MDS.
:returns: `True` if is sync successfully. | [
"Synchronize",
"DOI",
"status",
"DataCite",
"MDS",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/datacite.py#L171-L211 |
49,113 | inveniosoftware/invenio-pidstore | invenio_pidstore/providers/base.py | BaseProvider.create | def create(cls, pid_type=None, pid_value=None, object_type=None,
object_uuid=None, status=None, **kwargs):
"""Create a new instance for the given type and pid.
:param pid_type: Persistent identifier type. (Default: None).
:param pid_value: Persistent identifier value. (Default: N... | python | def create(cls, pid_type=None, pid_value=None, object_type=None,
object_uuid=None, status=None, **kwargs):
"""Create a new instance for the given type and pid.
:param pid_type: Persistent identifier type. (Default: None).
:param pid_value: Persistent identifier value. (Default: N... | [
"def",
"create",
"(",
"cls",
",",
"pid_type",
"=",
"None",
",",
"pid_value",
"=",
"None",
",",
"object_type",
"=",
"None",
",",
"object_uuid",
"=",
"None",
",",
"status",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"pid_value",
"assert",
... | Create a new instance for the given type and pid.
:param pid_type: Persistent identifier type. (Default: None).
:param pid_value: Persistent identifier value. (Default: None).
:param status: Current PID status.
(Default: :attr:`invenio_pidstore.models.PIDStatus.NEW`)
:param ... | [
"Create",
"a",
"new",
"instance",
"for",
"the",
"given",
"type",
"and",
"pid",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/base.py#L29-L54 |
49,114 | inveniosoftware/invenio-pidstore | invenio_pidstore/providers/base.py | BaseProvider.get | def get(cls, pid_value, pid_type=None, **kwargs):
"""Get a persistent identifier for this provider.
:param pid_type: Persistent identifier type. (Default: configured
:attr:`invenio_pidstore.providers.base.BaseProvider.pid_type`)
:param pid_value: Persistent identifier value.
... | python | def get(cls, pid_value, pid_type=None, **kwargs):
"""Get a persistent identifier for this provider.
:param pid_type: Persistent identifier type. (Default: configured
:attr:`invenio_pidstore.providers.base.BaseProvider.pid_type`)
:param pid_value: Persistent identifier value.
... | [
"def",
"get",
"(",
"cls",
",",
"pid_value",
",",
"pid_type",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"cls",
"(",
"PersistentIdentifier",
".",
"get",
"(",
"pid_type",
"or",
"cls",
".",
"pid_type",
",",
"pid_value",
",",
"pid_provider",
... | Get a persistent identifier for this provider.
:param pid_type: Persistent identifier type. (Default: configured
:attr:`invenio_pidstore.providers.base.BaseProvider.pid_type`)
:param pid_value: Persistent identifier value.
:param kwargs: See
:meth:`invenio_pidstore.provi... | [
"Get",
"a",
"persistent",
"identifier",
"for",
"this",
"provider",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/base.py#L57-L72 |
49,115 | Rackspace-DOT/flask_keystone | flask_keystone/__init__.py | FlaskKeystone.init_app | def init_app(self, app, config_group="flask_keystone"):
"""
Iniitialize the Flask_Keystone module in an application factory.
:param app: `flask.Flask` application to which to connect.
:type app: `flask.Flask`
:param str config_group: :class:`oslo_config.cfg.OptGroup` to which
... | python | def init_app(self, app, config_group="flask_keystone"):
"""
Iniitialize the Flask_Keystone module in an application factory.
:param app: `flask.Flask` application to which to connect.
:type app: `flask.Flask`
:param str config_group: :class:`oslo_config.cfg.OptGroup` to which
... | [
"def",
"init_app",
"(",
"self",
",",
"app",
",",
"config_group",
"=",
"\"flask_keystone\"",
")",
":",
"cfg",
".",
"CONF",
".",
"register_opts",
"(",
"RAX_OPTS",
",",
"group",
"=",
"config_group",
")",
"self",
".",
"logger",
"=",
"logging",
".",
"getLogger"... | Iniitialize the Flask_Keystone module in an application factory.
:param app: `flask.Flask` application to which to connect.
:type app: `flask.Flask`
:param str config_group: :class:`oslo_config.cfg.OptGroup` to which
to attach.
When initialized, the ext... | [
"Iniitialize",
"the",
"Flask_Keystone",
"module",
"in",
"an",
"application",
"factory",
"."
] | 6f6d630e9e66a3beca6607b0b786510ec2a79747 | https://github.com/Rackspace-DOT/flask_keystone/blob/6f6d630e9e66a3beca6607b0b786510ec2a79747/flask_keystone/__init__.py#L86-L123 |
49,116 | Rackspace-DOT/flask_keystone | flask_keystone/__init__.py | FlaskKeystone._parse_roles | def _parse_roles(self):
"""
Generate a dictionary for configured roles from oslo_config.
Due to limitations in ini format, it's necessary to specify
roles in a flatter format than a standard dictionary. This
function serves to transform these roles into a standard
python... | python | def _parse_roles(self):
"""
Generate a dictionary for configured roles from oslo_config.
Due to limitations in ini format, it's necessary to specify
roles in a flatter format than a standard dictionary. This
function serves to transform these roles into a standard
python... | [
"def",
"_parse_roles",
"(",
"self",
")",
":",
"roles",
"=",
"{",
"}",
"for",
"keystone_role",
",",
"flask_role",
"in",
"self",
".",
"config",
".",
"roles",
".",
"items",
"(",
")",
":",
"roles",
".",
"setdefault",
"(",
"flask_role",
",",
"set",
"(",
"... | Generate a dictionary for configured roles from oslo_config.
Due to limitations in ini format, it's necessary to specify
roles in a flatter format than a standard dictionary. This
function serves to transform these roles into a standard
python dictionary. | [
"Generate",
"a",
"dictionary",
"for",
"configured",
"roles",
"from",
"oslo_config",
"."
] | 6f6d630e9e66a3beca6607b0b786510ec2a79747 | https://github.com/Rackspace-DOT/flask_keystone/blob/6f6d630e9e66a3beca6607b0b786510ec2a79747/flask_keystone/__init__.py#L147-L159 |
49,117 | Rackspace-DOT/flask_keystone | flask_keystone/__init__.py | FlaskKeystone._make_before_request | def _make_before_request(self):
"""
Generate the before_request function to be added to the app.
Currently this function is static, however it is very likely we will
need to programmatically generate this function in the future.
"""
def before_request():
"""
... | python | def _make_before_request(self):
"""
Generate the before_request function to be added to the app.
Currently this function is static, however it is very likely we will
need to programmatically generate this function in the future.
"""
def before_request():
"""
... | [
"def",
"_make_before_request",
"(",
"self",
")",
":",
"def",
"before_request",
"(",
")",
":",
"\"\"\"\n Process invalid identity statuses and attach user to request.\n\n :raises: :exception:`exceptions.FlaskKeystoneUnauthorized`\n\n This function guarantees tha... | Generate the before_request function to be added to the app.
Currently this function is static, however it is very likely we will
need to programmatically generate this function in the future. | [
"Generate",
"the",
"before_request",
"function",
"to",
"be",
"added",
"to",
"the",
"app",
"."
] | 6f6d630e9e66a3beca6607b0b786510ec2a79747 | https://github.com/Rackspace-DOT/flask_keystone/blob/6f6d630e9e66a3beca6607b0b786510ec2a79747/flask_keystone/__init__.py#L161-L203 |
49,118 | Rackspace-DOT/flask_keystone | flask_keystone/__init__.py | FlaskKeystone._make_user_model | def _make_user_model(self):
"""
Dynamically generate a User class for use with FlaskKeystone.
:returns: a generated User class, inherited from
:class:`flask_keystone.UserBase`.
:rtype: class
This User model is intended to work somewhat similarly to the User
... | python | def _make_user_model(self):
"""
Dynamically generate a User class for use with FlaskKeystone.
:returns: a generated User class, inherited from
:class:`flask_keystone.UserBase`.
:rtype: class
This User model is intended to work somewhat similarly to the User
... | [
"def",
"_make_user_model",
"(",
"self",
")",
":",
"class",
"User",
"(",
"UserBase",
")",
":",
"\"\"\"\n A User as defined by the response from Keystone.\n\n Note: This class is dynamically generated by :class:`FlaskKeystone`\n from the :class:`flask_keystone.... | Dynamically generate a User class for use with FlaskKeystone.
:returns: a generated User class, inherited from
:class:`flask_keystone.UserBase`.
:rtype: class
This User model is intended to work somewhat similarly to the User
class that is created for Flask-Login, how... | [
"Dynamically",
"generate",
"a",
"User",
"class",
"for",
"use",
"with",
"FlaskKeystone",
"."
] | 6f6d630e9e66a3beca6607b0b786510ec2a79747 | https://github.com/Rackspace-DOT/flask_keystone/blob/6f6d630e9e66a3beca6607b0b786510ec2a79747/flask_keystone/__init__.py#L205-L239 |
49,119 | Rackspace-DOT/flask_keystone | flask_keystone/__init__.py | FlaskKeystone.login_required | def login_required(self, f):
"""
Require a user to be validated by Identity to access an endpoint.
:raises: FlaskKeystoneUnauthorized
This method will gate a particular endpoint to only be accessed by
:class:`FlaskKeystone.User`'s. This means that a valid token will need
... | python | def login_required(self, f):
"""
Require a user to be validated by Identity to access an endpoint.
:raises: FlaskKeystoneUnauthorized
This method will gate a particular endpoint to only be accessed by
:class:`FlaskKeystone.User`'s. This means that a valid token will need
... | [
"def",
"login_required",
"(",
"self",
",",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapped_f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"current_user",
".",
"anonymous",
":",
"msg",
"=",
"(",
"\"Rejected User '%s access to... | Require a user to be validated by Identity to access an endpoint.
:raises: FlaskKeystoneUnauthorized
This method will gate a particular endpoint to only be accessed by
:class:`FlaskKeystone.User`'s. This means that a valid token will need
to be passed to grant access. If a User is not ... | [
"Require",
"a",
"user",
"to",
"be",
"validated",
"by",
"Identity",
"to",
"access",
"an",
"endpoint",
"."
] | 6f6d630e9e66a3beca6607b0b786510ec2a79747 | https://github.com/Rackspace-DOT/flask_keystone/blob/6f6d630e9e66a3beca6607b0b786510ec2a79747/flask_keystone/__init__.py#L316-L339 |
49,120 | inveniosoftware/invenio-pidstore | invenio_pidstore/ext.py | pid_exists | def pid_exists(value, pidtype=None):
"""Check if a persistent identifier exists.
:param value: The PID value.
:param pidtype: The pid value (Default: None).
:returns: `True` if the PID exists.
"""
try:
PersistentIdentifier.get(pidtype, value)
return True
except PIDDoesNotExi... | python | def pid_exists(value, pidtype=None):
"""Check if a persistent identifier exists.
:param value: The PID value.
:param pidtype: The pid value (Default: None).
:returns: `True` if the PID exists.
"""
try:
PersistentIdentifier.get(pidtype, value)
return True
except PIDDoesNotExi... | [
"def",
"pid_exists",
"(",
"value",
",",
"pidtype",
"=",
"None",
")",
":",
"try",
":",
"PersistentIdentifier",
".",
"get",
"(",
"pidtype",
",",
"value",
")",
"return",
"True",
"except",
"PIDDoesNotExistError",
":",
"return",
"False"
] | Check if a persistent identifier exists.
:param value: The PID value.
:param pidtype: The pid value (Default: None).
:returns: `True` if the PID exists. | [
"Check",
"if",
"a",
"persistent",
"identifier",
"exists",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/ext.py#L21-L32 |
49,121 | inveniosoftware/invenio-pidstore | invenio_pidstore/ext.py | _PIDStoreState.register_minter | def register_minter(self, name, minter):
"""Register a minter.
:param name: Minter name.
:param minter: The new minter.
"""
assert name not in self.minters
self.minters[name] = minter | python | def register_minter(self, name, minter):
"""Register a minter.
:param name: Minter name.
:param minter: The new minter.
"""
assert name not in self.minters
self.minters[name] = minter | [
"def",
"register_minter",
"(",
"self",
",",
"name",
",",
"minter",
")",
":",
"assert",
"name",
"not",
"in",
"self",
".",
"minters",
"self",
".",
"minters",
"[",
"name",
"]",
"=",
"minter"
] | Register a minter.
:param name: Minter name.
:param minter: The new minter. | [
"Register",
"a",
"minter",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/ext.py#L49-L56 |
49,122 | inveniosoftware/invenio-pidstore | invenio_pidstore/ext.py | _PIDStoreState.register_fetcher | def register_fetcher(self, name, fetcher):
"""Register a fetcher.
:param name: Fetcher name.
:param fetcher: The new fetcher.
"""
assert name not in self.fetchers
self.fetchers[name] = fetcher | python | def register_fetcher(self, name, fetcher):
"""Register a fetcher.
:param name: Fetcher name.
:param fetcher: The new fetcher.
"""
assert name not in self.fetchers
self.fetchers[name] = fetcher | [
"def",
"register_fetcher",
"(",
"self",
",",
"name",
",",
"fetcher",
")",
":",
"assert",
"name",
"not",
"in",
"self",
".",
"fetchers",
"self",
".",
"fetchers",
"[",
"name",
"]",
"=",
"fetcher"
] | Register a fetcher.
:param name: Fetcher name.
:param fetcher: The new fetcher. | [
"Register",
"a",
"fetcher",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/ext.py#L58-L65 |
49,123 | inveniosoftware/invenio-pidstore | invenio_pidstore/ext.py | _PIDStoreState.load_minters_entry_point_group | def load_minters_entry_point_group(self, entry_point_group):
"""Load minters from an entry point group.
:param entry_point_group: The entrypoint group.
"""
for ep in pkg_resources.iter_entry_points(group=entry_point_group):
self.register_minter(ep.name, ep.load()) | python | def load_minters_entry_point_group(self, entry_point_group):
"""Load minters from an entry point group.
:param entry_point_group: The entrypoint group.
"""
for ep in pkg_resources.iter_entry_points(group=entry_point_group):
self.register_minter(ep.name, ep.load()) | [
"def",
"load_minters_entry_point_group",
"(",
"self",
",",
"entry_point_group",
")",
":",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"group",
"=",
"entry_point_group",
")",
":",
"self",
".",
"register_minter",
"(",
"ep",
".",
"name",
",",... | Load minters from an entry point group.
:param entry_point_group: The entrypoint group. | [
"Load",
"minters",
"from",
"an",
"entry",
"point",
"group",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/ext.py#L67-L73 |
49,124 | inveniosoftware/invenio-pidstore | invenio_pidstore/ext.py | _PIDStoreState.load_fetchers_entry_point_group | def load_fetchers_entry_point_group(self, entry_point_group):
"""Load fetchers from an entry point group.
:param entry_point_group: The entrypoint group.
"""
for ep in pkg_resources.iter_entry_points(group=entry_point_group):
self.register_fetcher(ep.name, ep.load()) | python | def load_fetchers_entry_point_group(self, entry_point_group):
"""Load fetchers from an entry point group.
:param entry_point_group: The entrypoint group.
"""
for ep in pkg_resources.iter_entry_points(group=entry_point_group):
self.register_fetcher(ep.name, ep.load()) | [
"def",
"load_fetchers_entry_point_group",
"(",
"self",
",",
"entry_point_group",
")",
":",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"group",
"=",
"entry_point_group",
")",
":",
"self",
".",
"register_fetcher",
"(",
"ep",
".",
"name",
",... | Load fetchers from an entry point group.
:param entry_point_group: The entrypoint group. | [
"Load",
"fetchers",
"from",
"an",
"entry",
"point",
"group",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/ext.py#L75-L81 |
49,125 | ascribe/transactions | transactions/services/daemonservice.py | BitcoinDaemonService.import_address | def import_address(self, address, account="*", rescan=False):
"""
param address = address to import
param label= account name to use
"""
response = self.make_request("importaddress", [address, account, rescan])
error = response.get('error')
if error is not None:
... | python | def import_address(self, address, account="*", rescan=False):
"""
param address = address to import
param label= account name to use
"""
response = self.make_request("importaddress", [address, account, rescan])
error = response.get('error')
if error is not None:
... | [
"def",
"import_address",
"(",
"self",
",",
"address",
",",
"account",
"=",
"\"*\"",
",",
"rescan",
"=",
"False",
")",
":",
"response",
"=",
"self",
".",
"make_request",
"(",
"\"importaddress\"",
",",
"[",
"address",
",",
"account",
",",
"rescan",
"]",
")... | param address = address to import
param label= account name to use | [
"param",
"address",
"=",
"address",
"to",
"import",
"param",
"label",
"=",
"account",
"name",
"to",
"use"
] | 08f344ce1879152d2a0ba51dda76f11e73c83867 | https://github.com/ascribe/transactions/blob/08f344ce1879152d2a0ba51dda76f11e73c83867/transactions/services/daemonservice.py#L93-L102 |
49,126 | alorence/pysvg-py3 | pysvg/shape.py | Rect.getBottomRight | def getBottomRight(self):
"""
Retrieves a tuple with the x,y coordinates of the lower right point of the rect.
Requires the coordinates, width, height to be numbers
"""
return (float(self.get_x()) + float(self.get_width()), float(self.get_y())) | python | def getBottomRight(self):
"""
Retrieves a tuple with the x,y coordinates of the lower right point of the rect.
Requires the coordinates, width, height to be numbers
"""
return (float(self.get_x()) + float(self.get_width()), float(self.get_y())) | [
"def",
"getBottomRight",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_x",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_width",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_y",
"(",
")",
")",
")"
] | Retrieves a tuple with the x,y coordinates of the lower right point of the rect.
Requires the coordinates, width, height to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"lower",
"right",
"point",
"of",
"the",
"rect",
".",
"Requires",
"the",
"coordinates",
"width",
"height",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L70-L75 |
49,127 | alorence/pysvg-py3 | pysvg/shape.py | Rect.getTopLeft | def getTopLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the upper left point of the rect.
Requires the coordinates, width, height to be numbers
"""
return (float(self.get_x()), float(self.get_y())+ float(self.get_height())) | python | def getTopLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the upper left point of the rect.
Requires the coordinates, width, height to be numbers
"""
return (float(self.get_x()), float(self.get_y())+ float(self.get_height())) | [
"def",
"getTopLeft",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_x",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_y",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_height",
"(",
")",
")",
")"
] | Retrieves a tuple with the x,y coordinates of the upper left point of the rect.
Requires the coordinates, width, height to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"upper",
"left",
"point",
"of",
"the",
"rect",
".",
"Requires",
"the",
"coordinates",
"width",
"height",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L77-L82 |
49,128 | alorence/pysvg-py3 | pysvg/shape.py | Rect.getTopRight | def getTopRight(self):
"""
Retrieves a tuple with the x,y coordinates of the upper right point of the rect.
Requires the coordinates, width, height to be numbers
"""
return (float(self.get_x()) + float(self.get_width()), float(self.get_y()) + float(self.get_height())) | python | def getTopRight(self):
"""
Retrieves a tuple with the x,y coordinates of the upper right point of the rect.
Requires the coordinates, width, height to be numbers
"""
return (float(self.get_x()) + float(self.get_width()), float(self.get_y()) + float(self.get_height())) | [
"def",
"getTopRight",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_x",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_width",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_y",
"(",
")",
")",
"+",
"float",
"("... | Retrieves a tuple with the x,y coordinates of the upper right point of the rect.
Requires the coordinates, width, height to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"upper",
"right",
"point",
"of",
"the",
"rect",
".",
"Requires",
"the",
"coordinates",
"width",
"height",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L84-L89 |
49,129 | alorence/pysvg-py3 | pysvg/shape.py | Rect.moveToPoint | def moveToPoint(self, xxx_todo_changeme):
"""
Moves the rect to the point x,y
"""
(x,y) = xxx_todo_changeme
self.set_x(float(self.get_x()) + float(x))
self.set_y(float(self.get_y()) + float(y)) | python | def moveToPoint(self, xxx_todo_changeme):
"""
Moves the rect to the point x,y
"""
(x,y) = xxx_todo_changeme
self.set_x(float(self.get_x()) + float(x))
self.set_y(float(self.get_y()) + float(y)) | [
"def",
"moveToPoint",
"(",
"self",
",",
"xxx_todo_changeme",
")",
":",
"(",
"x",
",",
"y",
")",
"=",
"xxx_todo_changeme",
"self",
".",
"set_x",
"(",
"float",
"(",
"self",
".",
"get_x",
"(",
")",
")",
"+",
"float",
"(",
"x",
")",
")",
"self",
".",
... | Moves the rect to the point x,y | [
"Moves",
"the",
"rect",
"to",
"the",
"point",
"x",
"y"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L91-L97 |
49,130 | alorence/pysvg-py3 | pysvg/shape.py | Circle.getBottomLeft | def getBottomLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the lower left point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_r()), float(self.get_cy()) - float(self.get_r())) | python | def getBottomLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the lower left point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_r()), float(self.get_cy()) - float(self.get_r())) | [
"def",
"getBottomLeft",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"-",
"float",
"(",
"self",
".",
"get_r",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"-",
"float",
"("... | Retrieves a tuple with the x,y coordinates of the lower left point of the circle.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"lower",
"left",
"point",
"of",
"the",
"circle",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L145-L150 |
49,131 | alorence/pysvg-py3 | pysvg/shape.py | Circle.getBottomRight | def getBottomRight(self):
"""
Retrieves a tuple with the x,y coordinates of the lower right point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_r()), float(self.get_cy()) - float(self.get_r())) | python | def getBottomRight(self):
"""
Retrieves a tuple with the x,y coordinates of the lower right point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_r()), float(self.get_cy()) - float(self.get_r())) | [
"def",
"getBottomRight",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_r",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"-",
"float",
"(... | Retrieves a tuple with the x,y coordinates of the lower right point of the circle.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"lower",
"right",
"point",
"of",
"the",
"circle",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L152-L157 |
49,132 | alorence/pysvg-py3 | pysvg/shape.py | Circle.getTopLeft | def getTopLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the upper left point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_r()), float(self.get_cy()) + float(self.get_r())) | python | def getTopLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the upper left point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_r()), float(self.get_cy()) + float(self.get_r())) | [
"def",
"getTopLeft",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"-",
"float",
"(",
"self",
".",
"get_r",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"+",
"float",
"(",
... | Retrieves a tuple with the x,y coordinates of the upper left point of the circle.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"upper",
"left",
"point",
"of",
"the",
"circle",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L159-L164 |
49,133 | alorence/pysvg-py3 | pysvg/shape.py | Circle.getTopRight | def getTopRight(self):
"""
Retrieves a tuple with the x,y coordinates of the upper right point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_r()), float(self.get_cy()) + float(self.get_r())) | python | def getTopRight(self):
"""
Retrieves a tuple with the x,y coordinates of the upper right point of the circle.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_r()), float(self.get_cy()) + float(self.get_r())) | [
"def",
"getTopRight",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_r",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"+",
"float",
"(",
... | Retrieves a tuple with the x,y coordinates of the upper right point of the circle.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"upper",
"right",
"point",
"of",
"the",
"circle",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L166-L171 |
49,134 | alorence/pysvg-py3 | pysvg/shape.py | Circle.moveToPoint | def moveToPoint(self, xxx_todo_changeme1):
"""
Moves the circle to the point x,y
"""
(x,y) = xxx_todo_changeme1
self.set_cx(float(self.get_cx()) + float(x))
self.set_cy(float(self.get_cy()) + float(y)) | python | def moveToPoint(self, xxx_todo_changeme1):
"""
Moves the circle to the point x,y
"""
(x,y) = xxx_todo_changeme1
self.set_cx(float(self.get_cx()) + float(x))
self.set_cy(float(self.get_cy()) + float(y)) | [
"def",
"moveToPoint",
"(",
"self",
",",
"xxx_todo_changeme1",
")",
":",
"(",
"x",
",",
"y",
")",
"=",
"xxx_todo_changeme1",
"self",
".",
"set_cx",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"+",
"float",
"(",
"x",
")",
")",
"self",
".... | Moves the circle to the point x,y | [
"Moves",
"the",
"circle",
"to",
"the",
"point",
"x",
"y"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L173-L179 |
49,135 | alorence/pysvg-py3 | pysvg/shape.py | Ellipse.getBottomLeft | def getBottomLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the lower left point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_rx()), float(self.get_cy()) - float(self.get_ry())) | python | def getBottomLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the lower left point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_rx()), float(self.get_cy()) - float(self.get_ry())) | [
"def",
"getBottomLeft",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"-",
"float",
"(",
"self",
".",
"get_rx",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"-",
"float",
"(... | Retrieves a tuple with the x,y coordinates of the lower left point of the ellipse.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"lower",
"left",
"point",
"of",
"the",
"ellipse",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L220-L225 |
49,136 | alorence/pysvg-py3 | pysvg/shape.py | Ellipse.getBottomRight | def getBottomRight(self):
"""
Retrieves a tuple with the x,y coordinates of the lower right point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_rx()), float(self.get_cy()) - float(self.get_ry())) | python | def getBottomRight(self):
"""
Retrieves a tuple with the x,y coordinates of the lower right point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_rx()), float(self.get_cy()) - float(self.get_ry())) | [
"def",
"getBottomRight",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_rx",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"-",
"float",
"... | Retrieves a tuple with the x,y coordinates of the lower right point of the ellipse.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"lower",
"right",
"point",
"of",
"the",
"ellipse",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L227-L232 |
49,137 | alorence/pysvg-py3 | pysvg/shape.py | Ellipse.getTopLeft | def getTopLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the upper left point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_rx()), float(self.get_cy()) + float(self.get_ry())) | python | def getTopLeft(self):
"""
Retrieves a tuple with the x,y coordinates of the upper left point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) - float(self.get_rx()), float(self.get_cy()) + float(self.get_ry())) | [
"def",
"getTopLeft",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"-",
"float",
"(",
"self",
".",
"get_rx",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"+",
"float",
"(",
... | Retrieves a tuple with the x,y coordinates of the upper left point of the ellipse.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"upper",
"left",
"point",
"of",
"the",
"ellipse",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L234-L239 |
49,138 | alorence/pysvg-py3 | pysvg/shape.py | Ellipse.getTopRight | def getTopRight(self):
"""
Retrieves a tuple with the x,y coordinates of the upper right point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_rx()), float(self.get_cy()) + float(self.get_ry())) | python | def getTopRight(self):
"""
Retrieves a tuple with the x,y coordinates of the upper right point of the ellipse.
Requires the radius and the coordinates to be numbers
"""
return (float(self.get_cx()) + float(self.get_rx()), float(self.get_cy()) + float(self.get_ry())) | [
"def",
"getTopRight",
"(",
"self",
")",
":",
"return",
"(",
"float",
"(",
"self",
".",
"get_cx",
"(",
")",
")",
"+",
"float",
"(",
"self",
".",
"get_rx",
"(",
")",
")",
",",
"float",
"(",
"self",
".",
"get_cy",
"(",
")",
")",
"+",
"float",
"(",... | Retrieves a tuple with the x,y coordinates of the upper right point of the ellipse.
Requires the radius and the coordinates to be numbers | [
"Retrieves",
"a",
"tuple",
"with",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"upper",
"right",
"point",
"of",
"the",
"ellipse",
".",
"Requires",
"the",
"radius",
"and",
"the",
"coordinates",
"to",
"be",
"numbers"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L241-L246 |
49,139 | alorence/pysvg-py3 | pysvg/shape.py | Line.getBottomLeft | def getBottomLeft(self):
"""
Retrieves the the bottom left coordinate of the line as tuple.
Coordinates must be numbers.
"""
x1 = float(self.get_x1())
x2 = float(self.get_x2())
y1 = float(self.get_y1())
y2 = float(self.get_y2())
if x1 < x2:
... | python | def getBottomLeft(self):
"""
Retrieves the the bottom left coordinate of the line as tuple.
Coordinates must be numbers.
"""
x1 = float(self.get_x1())
x2 = float(self.get_x2())
y1 = float(self.get_y1())
y2 = float(self.get_y2())
if x1 < x2:
... | [
"def",
"getBottomLeft",
"(",
"self",
")",
":",
"x1",
"=",
"float",
"(",
"self",
".",
"get_x1",
"(",
")",
")",
"x2",
"=",
"float",
"(",
"self",
".",
"get_x2",
"(",
")",
")",
"y1",
"=",
"float",
"(",
"self",
".",
"get_y1",
"(",
")",
")",
"y2",
... | Retrieves the the bottom left coordinate of the line as tuple.
Coordinates must be numbers. | [
"Retrieves",
"the",
"the",
"bottom",
"left",
"coordinate",
"of",
"the",
"line",
"as",
"tuple",
".",
"Coordinates",
"must",
"be",
"numbers",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L308-L326 |
49,140 | alorence/pysvg-py3 | pysvg/shape.py | Line.moveToPoint | def moveToPoint(self, xxx_todo_changeme2):
"""
Moves the line to the point x,y
"""
(x,y) = xxx_todo_changeme2
self.set_x1(float(self.get_x1()) + float(x))
self.set_x2(float(self.get_x2()) + float(x))
self.set_y1(float(self.get_y1()) + float(y))
self.set_y2... | python | def moveToPoint(self, xxx_todo_changeme2):
"""
Moves the line to the point x,y
"""
(x,y) = xxx_todo_changeme2
self.set_x1(float(self.get_x1()) + float(x))
self.set_x2(float(self.get_x2()) + float(x))
self.set_y1(float(self.get_y1()) + float(y))
self.set_y2... | [
"def",
"moveToPoint",
"(",
"self",
",",
"xxx_todo_changeme2",
")",
":",
"(",
"x",
",",
"y",
")",
"=",
"xxx_todo_changeme2",
"self",
".",
"set_x1",
"(",
"float",
"(",
"self",
".",
"get_x1",
"(",
")",
")",
"+",
"float",
"(",
"x",
")",
")",
"self",
".... | Moves the line to the point x,y | [
"Moves",
"the",
"line",
"to",
"the",
"point",
"x",
"y"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/shape.py#L388-L396 |
49,141 | alorence/pysvg-py3 | pysvg/builders.py | ShapeBuilder.createCircle | def createCircle(self, cx, cy, r, strokewidth=1, stroke='black', fill='none'):
"""
Creates a circle
@type cx: string or int
@param cx: starting x-coordinate
@type cy: string or int
@param cy: starting y-coordinate
@type r: string or int
@param r: ... | python | def createCircle(self, cx, cy, r, strokewidth=1, stroke='black', fill='none'):
"""
Creates a circle
@type cx: string or int
@param cx: starting x-coordinate
@type cy: string or int
@param cy: starting y-coordinate
@type r: string or int
@param r: ... | [
"def",
"createCircle",
"(",
"self",
",",
"cx",
",",
"cy",
",",
"r",
",",
"strokewidth",
"=",
"1",
",",
"stroke",
"=",
"'black'",
",",
"fill",
"=",
"'none'",
")",
":",
"style_dict",
"=",
"{",
"'fill'",
":",
"fill",
",",
"'stroke-width'",
":",
"strokew... | Creates a circle
@type cx: string or int
@param cx: starting x-coordinate
@type cy: string or int
@param cy: starting y-coordinate
@type r: string or int
@param r: radius
@type strokewidth: string or int
@param strokewidth: width of the pen use... | [
"Creates",
"a",
"circle"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/builders.py#L23-L44 |
49,142 | alorence/pysvg-py3 | pysvg/builders.py | ShapeBuilder.createEllipse | def createEllipse(self, cx, cy, rx, ry, strokewidth=1, stroke='black', fill='none'):
"""
Creates an ellipse
@type cx: string or int
@param cx: starting x-coordinate
@type cy: string or int
@param cy: starting y-coordinate
@type rx: string or int
@p... | python | def createEllipse(self, cx, cy, rx, ry, strokewidth=1, stroke='black', fill='none'):
"""
Creates an ellipse
@type cx: string or int
@param cx: starting x-coordinate
@type cy: string or int
@param cy: starting y-coordinate
@type rx: string or int
@p... | [
"def",
"createEllipse",
"(",
"self",
",",
"cx",
",",
"cy",
",",
"rx",
",",
"ry",
",",
"strokewidth",
"=",
"1",
",",
"stroke",
"=",
"'black'",
",",
"fill",
"=",
"'none'",
")",
":",
"style_dict",
"=",
"{",
"'fill'",
":",
"fill",
",",
"'stroke-width'",
... | Creates an ellipse
@type cx: string or int
@param cx: starting x-coordinate
@type cy: string or int
@param cy: starting y-coordinate
@type rx: string or int
@param rx: radius in x direction
@type ry: string or int
@param ry: radius in y directi... | [
"Creates",
"an",
"ellipse"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/builders.py#L46-L69 |
49,143 | alorence/pysvg-py3 | pysvg/builders.py | ShapeBuilder.createRect | def createRect(self, x, y, width, height, rx=None, ry=None, strokewidth=1, stroke='black', fill='none'):
"""
Creates a Rectangle
@type x: string or int
@param x: starting x-coordinate
@type y: string or int
@param y: starting y-coordinate
@type width: stri... | python | def createRect(self, x, y, width, height, rx=None, ry=None, strokewidth=1, stroke='black', fill='none'):
"""
Creates a Rectangle
@type x: string or int
@param x: starting x-coordinate
@type y: string or int
@param y: starting y-coordinate
@type width: stri... | [
"def",
"createRect",
"(",
"self",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"rx",
"=",
"None",
",",
"ry",
"=",
"None",
",",
"strokewidth",
"=",
"1",
",",
"stroke",
"=",
"'black'",
",",
"fill",
"=",
"'none'",
")",
":",
"style_dict",
"=... | Creates a Rectangle
@type x: string or int
@param x: starting x-coordinate
@type y: string or int
@param y: starting y-coordinate
@type width: string or int
@param width: width of the rectangle
@type height: string or int
@param height: height... | [
"Creates",
"a",
"Rectangle"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/builders.py#L71-L98 |
49,144 | alorence/pysvg-py3 | pysvg/builders.py | ShapeBuilder.createPolygon | def createPolygon(self, points, strokewidth=1, stroke='black', fill='none'):
"""
Creates a Polygon
@type points: string in the form "x1,y1 x2,y2 x3,y3"
@param points: all points relevant to the polygon
@type strokewidth: string or int
@param strokewidth: width of the ... | python | def createPolygon(self, points, strokewidth=1, stroke='black', fill='none'):
"""
Creates a Polygon
@type points: string in the form "x1,y1 x2,y2 x3,y3"
@param points: all points relevant to the polygon
@type strokewidth: string or int
@param strokewidth: width of the ... | [
"def",
"createPolygon",
"(",
"self",
",",
"points",
",",
"strokewidth",
"=",
"1",
",",
"stroke",
"=",
"'black'",
",",
"fill",
"=",
"'none'",
")",
":",
"style_dict",
"=",
"{",
"'fill'",
":",
"fill",
",",
"'stroke-width'",
":",
"strokewidth",
",",
"'stroke... | Creates a Polygon
@type points: string in the form "x1,y1 x2,y2 x3,y3"
@param points: all points relevant to the polygon
@type strokewidth: string or int
@param strokewidth: width of the pen used to draw
@type stroke: string (either css constants like "black" or numerical va... | [
"Creates",
"a",
"Polygon"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/builders.py#L100-L117 |
49,145 | alorence/pysvg-py3 | pysvg/builders.py | ShapeBuilder.createPolyline | def createPolyline(self, points, strokewidth=1, stroke='black'):
"""
Creates a Polyline
@type points: string in the form "x1,y1 x2,y2 x3,y3"
@param points: all points relevant to the polygon
@type strokewidth: string or int
@param strokewidth: width of the pen used to... | python | def createPolyline(self, points, strokewidth=1, stroke='black'):
"""
Creates a Polyline
@type points: string in the form "x1,y1 x2,y2 x3,y3"
@param points: all points relevant to the polygon
@type strokewidth: string or int
@param strokewidth: width of the pen used to... | [
"def",
"createPolyline",
"(",
"self",
",",
"points",
",",
"strokewidth",
"=",
"1",
",",
"stroke",
"=",
"'black'",
")",
":",
"style_dict",
"=",
"{",
"'fill'",
":",
"'none'",
",",
"'stroke-width'",
":",
"strokewidth",
",",
"'stroke'",
":",
"stroke",
"}",
"... | Creates a Polyline
@type points: string in the form "x1,y1 x2,y2 x3,y3"
@param points: all points relevant to the polygon
@type strokewidth: string or int
@param strokewidth: width of the pen used to draw
@type stroke: string (either css constants like "black" or numerical v... | [
"Creates",
"a",
"Polyline"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/builders.py#L119-L134 |
49,146 | alorence/pysvg-py3 | pysvg/builders.py | ShapeBuilder.createLine | def createLine(self, x1, y1, x2, y2, strokewidth=1, stroke="black"):
"""
Creates a line
@type x1: string or int
@param x1: starting x-coordinate
@type y1: string or int
@param y1: starting y-coordinate
@type x2: string or int
@param x2: ending x-coor... | python | def createLine(self, x1, y1, x2, y2, strokewidth=1, stroke="black"):
"""
Creates a line
@type x1: string or int
@param x1: starting x-coordinate
@type y1: string or int
@param y1: starting y-coordinate
@type x2: string or int
@param x2: ending x-coor... | [
"def",
"createLine",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"strokewidth",
"=",
"1",
",",
"stroke",
"=",
"\"black\"",
")",
":",
"style_dict",
"=",
"{",
"'stroke-width'",
":",
"strokewidth",
",",
"'stroke'",
":",
"stroke",
"}",
... | Creates a line
@type x1: string or int
@param x1: starting x-coordinate
@type y1: string or int
@param y1: starting y-coordinate
@type x2: string or int
@param x2: ending x-coordinate
@type y2: string or int
@param y2: ending y-coordinate
@... | [
"Creates",
"a",
"line"
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/builders.py#L137-L158 |
49,147 | Arachnid/pyqrencode | qrencode/__init__.py | encode_scaled | def encode_scaled(data, size, version=0, level=QR_ECLEVEL_L, hint=QR_MODE_8,
case_sensitive=True):
"""Creates a QR-code from string data, resized to the specified dimensions.
Args:
data: string: The data to encode in a QR-code. If a unicode string is
supplied, it will be encod... | python | def encode_scaled(data, size, version=0, level=QR_ECLEVEL_L, hint=QR_MODE_8,
case_sensitive=True):
"""Creates a QR-code from string data, resized to the specified dimensions.
Args:
data: string: The data to encode in a QR-code. If a unicode string is
supplied, it will be encod... | [
"def",
"encode_scaled",
"(",
"data",
",",
"size",
",",
"version",
"=",
"0",
",",
"level",
"=",
"QR_ECLEVEL_L",
",",
"hint",
"=",
"QR_MODE_8",
",",
"case_sensitive",
"=",
"True",
")",
":",
"version",
",",
"src_size",
",",
"im",
"=",
"encode",
"(",
"data... | Creates a QR-code from string data, resized to the specified dimensions.
Args:
data: string: The data to encode in a QR-code. If a unicode string is
supplied, it will be encoded in UTF-8.
size: int: Output size. If this is not an exact multiple of the QR-code's
dimensions, padding w... | [
"Creates",
"a",
"QR",
"-",
"code",
"from",
"string",
"data",
"resized",
"to",
"the",
"specified",
"dimensions",
"."
] | b75219e878f9913514d2f6c0438aaa3e37433382 | https://github.com/Arachnid/pyqrencode/blob/b75219e878f9913514d2f6c0438aaa3e37433382/qrencode/__init__.py#L54-L82 |
49,148 | alorence/pysvg-py3 | pysvg/turtle.py | Turtle.moveTo | def moveTo(self, vector):
""" Moves the turtle to the new position. Orientation is kept as it is.
If the pen is lowered it will also add to the currently drawn polyline.
"""
self._position = vector
if self.isPenDown():
self._pointsOfPolyline.append(self._position) | python | def moveTo(self, vector):
""" Moves the turtle to the new position. Orientation is kept as it is.
If the pen is lowered it will also add to the currently drawn polyline.
"""
self._position = vector
if self.isPenDown():
self._pointsOfPolyline.append(self._position) | [
"def",
"moveTo",
"(",
"self",
",",
"vector",
")",
":",
"self",
".",
"_position",
"=",
"vector",
"if",
"self",
".",
"isPenDown",
"(",
")",
":",
"self",
".",
"_pointsOfPolyline",
".",
"append",
"(",
"self",
".",
"_position",
")"
] | Moves the turtle to the new position. Orientation is kept as it is.
If the pen is lowered it will also add to the currently drawn polyline. | [
"Moves",
"the",
"turtle",
"to",
"the",
"new",
"position",
".",
"Orientation",
"is",
"kept",
"as",
"it",
"is",
".",
"If",
"the",
"pen",
"is",
"lowered",
"it",
"will",
"also",
"add",
"to",
"the",
"currently",
"drawn",
"polyline",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/turtle.py#L110-L116 |
49,149 | alorence/pysvg-py3 | pysvg/turtle.py | Turtle.penUp | def penUp(self):
""" Raises the pen. Any movement will not draw lines till pen is lowered again.
"""
if self._penDown==True:
self._penDown = False
self._addPolylineToElements() | python | def penUp(self):
""" Raises the pen. Any movement will not draw lines till pen is lowered again.
"""
if self._penDown==True:
self._penDown = False
self._addPolylineToElements() | [
"def",
"penUp",
"(",
"self",
")",
":",
"if",
"self",
".",
"_penDown",
"==",
"True",
":",
"self",
".",
"_penDown",
"=",
"False",
"self",
".",
"_addPolylineToElements",
"(",
")"
] | Raises the pen. Any movement will not draw lines till pen is lowered again. | [
"Raises",
"the",
"pen",
".",
"Any",
"movement",
"will",
"not",
"draw",
"lines",
"till",
"pen",
"is",
"lowered",
"again",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/turtle.py#L118-L123 |
49,150 | alorence/pysvg-py3 | pysvg/turtle.py | Turtle._move | def _move(self, distance):
""" Moves the turtle by distance in the direction it is facing.
If the pen is lowered it will also add to the currently drawn polyline.
"""
self._position = self._position + self._orient * distance
if self.isPenDown():
x = round(self._po... | python | def _move(self, distance):
""" Moves the turtle by distance in the direction it is facing.
If the pen is lowered it will also add to the currently drawn polyline.
"""
self._position = self._position + self._orient * distance
if self.isPenDown():
x = round(self._po... | [
"def",
"_move",
"(",
"self",
",",
"distance",
")",
":",
"self",
".",
"_position",
"=",
"self",
".",
"_position",
"+",
"self",
".",
"_orient",
"*",
"distance",
"if",
"self",
".",
"isPenDown",
"(",
")",
":",
"x",
"=",
"round",
"(",
"self",
".",
"_pos... | Moves the turtle by distance in the direction it is facing.
If the pen is lowered it will also add to the currently drawn polyline. | [
"Moves",
"the",
"turtle",
"by",
"distance",
"in",
"the",
"direction",
"it",
"is",
"facing",
".",
"If",
"the",
"pen",
"is",
"lowered",
"it",
"will",
"also",
"add",
"to",
"the",
"currently",
"drawn",
"polyline",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/turtle.py#L158-L166 |
49,151 | alorence/pysvg-py3 | pysvg/turtle.py | Turtle.getXML | def getXML(self):
"""Retrieves the pysvg elements that make up the turtles path and returns them as String in an xml representation.
"""
s = ''
for element in self._svgElements:
s += element.getXML()
return s | python | def getXML(self):
"""Retrieves the pysvg elements that make up the turtles path and returns them as String in an xml representation.
"""
s = ''
for element in self._svgElements:
s += element.getXML()
return s | [
"def",
"getXML",
"(",
"self",
")",
":",
"s",
"=",
"''",
"for",
"element",
"in",
"self",
".",
"_svgElements",
":",
"s",
"+=",
"element",
".",
"getXML",
"(",
")",
"return",
"s"
] | Retrieves the pysvg elements that make up the turtles path and returns them as String in an xml representation. | [
"Retrieves",
"the",
"pysvg",
"elements",
"that",
"make",
"up",
"the",
"turtles",
"path",
"and",
"returns",
"them",
"as",
"String",
"in",
"an",
"xml",
"representation",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/turtle.py#L187-L193 |
49,152 | alorence/pysvg-py3 | pysvg/turtle.py | Turtle.addTurtlePathToSVG | def addTurtlePathToSVG(self, svgContainer):
"""Adds the paths of the turtle to an existing svg container.
"""
for element in self.getSVGElements():
svgContainer.addElement(element)
return svgContainer | python | def addTurtlePathToSVG(self, svgContainer):
"""Adds the paths of the turtle to an existing svg container.
"""
for element in self.getSVGElements():
svgContainer.addElement(element)
return svgContainer | [
"def",
"addTurtlePathToSVG",
"(",
"self",
",",
"svgContainer",
")",
":",
"for",
"element",
"in",
"self",
".",
"getSVGElements",
"(",
")",
":",
"svgContainer",
".",
"addElement",
"(",
"element",
")",
"return",
"svgContainer"
] | Adds the paths of the turtle to an existing svg container. | [
"Adds",
"the",
"paths",
"of",
"the",
"turtle",
"to",
"an",
"existing",
"svg",
"container",
"."
] | ce217a4da3ada44a71d3e2f391d37c67d95c724e | https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/turtle.py#L200-L205 |
49,153 | surycat/django-modalview | django_modalview/generic/base.py | ModalTemplateMixin._get_content | def _get_content(self, context):
"""
Add the csrf_token_value because the mixin use render_to_string
and not render.
"""
self._valid_template()
context.update({
"csrf_token_value": get_token(self.request)
})
return render_to_str... | python | def _get_content(self, context):
"""
Add the csrf_token_value because the mixin use render_to_string
and not render.
"""
self._valid_template()
context.update({
"csrf_token_value": get_token(self.request)
})
return render_to_str... | [
"def",
"_get_content",
"(",
"self",
",",
"context",
")",
":",
"self",
".",
"_valid_template",
"(",
")",
"context",
".",
"update",
"(",
"{",
"\"csrf_token_value\"",
":",
"get_token",
"(",
"self",
".",
"request",
")",
"}",
")",
"return",
"render_to_string",
... | Add the csrf_token_value because the mixin use render_to_string
and not render. | [
"Add",
"the",
"csrf_token_value",
"because",
"the",
"mixin",
"use",
"render_to_string",
"and",
"not",
"render",
"."
] | 85157778b07e934c4c5715fbcf371ad97137b645 | https://github.com/surycat/django-modalview/blob/85157778b07e934c4c5715fbcf371ad97137b645/django_modalview/generic/base.py#L96-L105 |
49,154 | yahoo/Zake | zake/utils.py | normpath | def normpath(path, keep_trailing=False):
"""Really normalize the path by adding a missing leading slash."""
new_path = k_paths.normpath(path)
if keep_trailing and path.endswith("/") and not new_path.endswith("/"):
new_path = new_path + "/"
if not new_path.startswith('/'):
return '/' + ne... | python | def normpath(path, keep_trailing=False):
"""Really normalize the path by adding a missing leading slash."""
new_path = k_paths.normpath(path)
if keep_trailing and path.endswith("/") and not new_path.endswith("/"):
new_path = new_path + "/"
if not new_path.startswith('/'):
return '/' + ne... | [
"def",
"normpath",
"(",
"path",
",",
"keep_trailing",
"=",
"False",
")",
":",
"new_path",
"=",
"k_paths",
".",
"normpath",
"(",
"path",
")",
"if",
"keep_trailing",
"and",
"path",
".",
"endswith",
"(",
"\"/\"",
")",
"and",
"not",
"new_path",
".",
"endswit... | Really normalize the path by adding a missing leading slash. | [
"Really",
"normalize",
"the",
"path",
"by",
"adding",
"a",
"missing",
"leading",
"slash",
"."
] | 5947970bfec16826c8b362e1a23e55fc0b883748 | https://github.com/yahoo/Zake/blob/5947970bfec16826c8b362e1a23e55fc0b883748/zake/utils.py#L31-L38 |
49,155 | Rackspace-DOT/flask_keystone | setup.py | read | def read(*filenames, **kwargs):
"""
Read file contents into string.
Used by setup.py to concatenate long_description.
:param string filenames: Files to be read and concatenated.
:rtype: string
"""
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
... | python | def read(*filenames, **kwargs):
"""
Read file contents into string.
Used by setup.py to concatenate long_description.
:param string filenames: Files to be read and concatenated.
:rtype: string
"""
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
... | [
"def",
"read",
"(",
"*",
"filenames",
",",
"*",
"*",
"kwargs",
")",
":",
"encoding",
"=",
"kwargs",
".",
"get",
"(",
"'encoding'",
",",
"'utf-8'",
")",
"sep",
"=",
"kwargs",
".",
"get",
"(",
"'sep'",
",",
"'\\n'",
")",
"buf",
"=",
"[",
"]",
"for"... | Read file contents into string.
Used by setup.py to concatenate long_description.
:param string filenames: Files to be read and concatenated.
:rtype: string | [
"Read",
"file",
"contents",
"into",
"string",
"."
] | 6f6d630e9e66a3beca6607b0b786510ec2a79747 | https://github.com/Rackspace-DOT/flask_keystone/blob/6f6d630e9e66a3beca6607b0b786510ec2a79747/setup.py#L120-L144 |
49,156 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.create | def create(cls, pid_type, pid_value, pid_provider=None,
status=PIDStatus.NEW, object_type=None, object_uuid=None,):
"""Create a new persistent identifier with specific type and value.
:param pid_type: Persistent identifier type.
:param pid_value: Persistent identifier value.
... | python | def create(cls, pid_type, pid_value, pid_provider=None,
status=PIDStatus.NEW, object_type=None, object_uuid=None,):
"""Create a new persistent identifier with specific type and value.
:param pid_type: Persistent identifier type.
:param pid_value: Persistent identifier value.
... | [
"def",
"create",
"(",
"cls",
",",
"pid_type",
",",
"pid_value",
",",
"pid_provider",
"=",
"None",
",",
"status",
"=",
"PIDStatus",
".",
"NEW",
",",
"object_type",
"=",
"None",
",",
"object_uuid",
"=",
"None",
",",
")",
":",
"try",
":",
"with",
"db",
... | Create a new persistent identifier with specific type and value.
:param pid_type: Persistent identifier type.
:param pid_value: Persistent identifier value.
:param pid_provider: Persistent identifier provider. (default: None).
:param status: Current PID status.
(Default: :at... | [
"Create",
"a",
"new",
"persistent",
"identifier",
"with",
"specific",
"type",
"and",
"value",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L126-L176 |
49,157 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.get | def get(cls, pid_type, pid_value, pid_provider=None):
"""Get persistent identifier.
:param pid_type: Persistent identifier type.
:param pid_value: Persistent identifier value.
:param pid_provider: Persistent identifier provider. (default: None).
:raises: :exc:`invenio_pidstore.e... | python | def get(cls, pid_type, pid_value, pid_provider=None):
"""Get persistent identifier.
:param pid_type: Persistent identifier type.
:param pid_value: Persistent identifier value.
:param pid_provider: Persistent identifier provider. (default: None).
:raises: :exc:`invenio_pidstore.e... | [
"def",
"get",
"(",
"cls",
",",
"pid_type",
",",
"pid_value",
",",
"pid_provider",
"=",
"None",
")",
":",
"try",
":",
"args",
"=",
"dict",
"(",
"pid_type",
"=",
"pid_type",
",",
"pid_value",
"=",
"six",
".",
"text_type",
"(",
"pid_value",
")",
")",
"i... | Get persistent identifier.
:param pid_type: Persistent identifier type.
:param pid_value: Persistent identifier value.
:param pid_provider: Persistent identifier provider. (default: None).
:raises: :exc:`invenio_pidstore.errors.PIDDoesNotExistError` if no
PID is found.
... | [
"Get",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L179-L196 |
49,158 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.get_by_object | def get_by_object(cls, pid_type, object_type, object_uuid):
"""Get a persistent identifier for a given object.
:param pid_type: Persistent identifier type.
:param object_type: The object type is a string that identify its type.
:param object_uuid: The object UUID.
:raises inveni... | python | def get_by_object(cls, pid_type, object_type, object_uuid):
"""Get a persistent identifier for a given object.
:param pid_type: Persistent identifier type.
:param object_type: The object type is a string that identify its type.
:param object_uuid: The object UUID.
:raises inveni... | [
"def",
"get_by_object",
"(",
"cls",
",",
"pid_type",
",",
"object_type",
",",
"object_uuid",
")",
":",
"try",
":",
"return",
"cls",
".",
"query",
".",
"filter_by",
"(",
"pid_type",
"=",
"pid_type",
",",
"object_type",
"=",
"object_type",
",",
"object_uuid",
... | Get a persistent identifier for a given object.
:param pid_type: Persistent identifier type.
:param object_type: The object type is a string that identify its type.
:param object_uuid: The object UUID.
:raises invenio_pidstore.errors.PIDDoesNotExistError: If no PID is
found.... | [
"Get",
"a",
"persistent",
"identifier",
"for",
"a",
"given",
"object",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L199-L217 |
49,159 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.get_assigned_object | def get_assigned_object(self, object_type=None):
"""Return the current assigned object UUID.
:param object_type: If it's specified, returns only if the PID
object_type is the same, otherwise returns None. (default: None).
:returns: The object UUID.
"""
if object_type... | python | def get_assigned_object(self, object_type=None):
"""Return the current assigned object UUID.
:param object_type: If it's specified, returns only if the PID
object_type is the same, otherwise returns None. (default: None).
:returns: The object UUID.
"""
if object_type... | [
"def",
"get_assigned_object",
"(",
"self",
",",
"object_type",
"=",
"None",
")",
":",
"if",
"object_type",
"is",
"not",
"None",
":",
"if",
"self",
".",
"object_type",
"==",
"object_type",
":",
"return",
"self",
".",
"object_uuid",
"else",
":",
"return",
"N... | Return the current assigned object UUID.
:param object_type: If it's specified, returns only if the PID
object_type is the same, otherwise returns None. (default: None).
:returns: The object UUID. | [
"Return",
"the",
"current",
"assigned",
"object",
"UUID",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L229-L241 |
49,160 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.assign | def assign(self, object_type, object_uuid, overwrite=False):
"""Assign this persistent identifier to a given object.
Note, the persistent identifier must first have been reserved. Also,
if an existing object is already assigned to the pid, it will raise an
exception unless overwrite=Tru... | python | def assign(self, object_type, object_uuid, overwrite=False):
"""Assign this persistent identifier to a given object.
Note, the persistent identifier must first have been reserved. Also,
if an existing object is already assigned to the pid, it will raise an
exception unless overwrite=Tru... | [
"def",
"assign",
"(",
"self",
",",
"object_type",
",",
"object_uuid",
",",
"overwrite",
"=",
"False",
")",
":",
"if",
"self",
".",
"is_deleted",
"(",
")",
":",
"raise",
"PIDInvalidAction",
"(",
"\"You cannot assign objects to a deleted/redirected persistent\"",
"\" ... | Assign this persistent identifier to a given object.
Note, the persistent identifier must first have been reserved. Also,
if an existing object is already assigned to the pid, it will raise an
exception unless overwrite=True.
:param object_type: The object type is a string that identif... | [
"Assign",
"this",
"persistent",
"identifier",
"to",
"a",
"given",
"object",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L243-L289 |
49,161 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.unassign | def unassign(self):
"""Unassign the registered object.
Note:
Only registered PIDs can be redirected so we set it back to registered.
:returns: `True` if the PID is successfully unassigned.
"""
if self.object_uuid is None and self.object_type is None:
return ... | python | def unassign(self):
"""Unassign the registered object.
Note:
Only registered PIDs can be redirected so we set it back to registered.
:returns: `True` if the PID is successfully unassigned.
"""
if self.object_uuid is None and self.object_type is None:
return ... | [
"def",
"unassign",
"(",
"self",
")",
":",
"if",
"self",
".",
"object_uuid",
"is",
"None",
"and",
"self",
".",
"object_type",
"is",
"None",
":",
"return",
"True",
"try",
":",
"with",
"db",
".",
"session",
".",
"begin_nested",
"(",
")",
":",
"if",
"sel... | Unassign the registered object.
Note:
Only registered PIDs can be redirected so we set it back to registered.
:returns: `True` if the PID is successfully unassigned. | [
"Unassign",
"the",
"registered",
"object",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L291-L318 |
49,162 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.redirect | def redirect(self, pid):
"""Redirect persistent identifier to another persistent identifier.
:param pid: The :class:`invenio_pidstore.models.PersistentIdentifier`
where redirect the PID.
:raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not
registered or is... | python | def redirect(self, pid):
"""Redirect persistent identifier to another persistent identifier.
:param pid: The :class:`invenio_pidstore.models.PersistentIdentifier`
where redirect the PID.
:raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not
registered or is... | [
"def",
"redirect",
"(",
"self",
",",
"pid",
")",
":",
"if",
"not",
"(",
"self",
".",
"is_registered",
"(",
")",
"or",
"self",
".",
"is_redirected",
"(",
")",
")",
":",
"raise",
"PIDInvalidAction",
"(",
"\"Persistent identifier is not registered.\"",
")",
"tr... | Redirect persistent identifier to another persistent identifier.
:param pid: The :class:`invenio_pidstore.models.PersistentIdentifier`
where redirect the PID.
:raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not
registered or is not already redirecting to another ... | [
"Redirect",
"persistent",
"identifier",
"to",
"another",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L331-L366 |
49,163 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.reserve | def reserve(self):
"""Reserve the persistent identifier.
Note, the reserve method may be called multiple times, even if it was
already reserved.
:raises: :exc:`invenio_pidstore.errors.PIDInvalidAction` if the PID is
not new or is not already reserved a PID.
:returns... | python | def reserve(self):
"""Reserve the persistent identifier.
Note, the reserve method may be called multiple times, even if it was
already reserved.
:raises: :exc:`invenio_pidstore.errors.PIDInvalidAction` if the PID is
not new or is not already reserved a PID.
:returns... | [
"def",
"reserve",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"is_new",
"(",
")",
"or",
"self",
".",
"is_reserved",
"(",
")",
")",
":",
"raise",
"PIDInvalidAction",
"(",
"\"Persistent identifier is not new or reserved.\"",
")",
"try",
":",
"with",
... | Reserve the persistent identifier.
Note, the reserve method may be called multiple times, even if it was
already reserved.
:raises: :exc:`invenio_pidstore.errors.PIDInvalidAction` if the PID is
not new or is not already reserved a PID.
:returns: `True` if the PID is success... | [
"Reserve",
"the",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L368-L390 |
49,164 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.register | def register(self):
"""Register the persistent identifier with the provider.
:raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not
already registered or is deleted or is a redirection to another
PID.
:returns: `True` if the PID is successfully register.
... | python | def register(self):
"""Register the persistent identifier with the provider.
:raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not
already registered or is deleted or is a redirection to another
PID.
:returns: `True` if the PID is successfully register.
... | [
"def",
"register",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_registered",
"(",
")",
"or",
"self",
".",
"is_deleted",
"(",
")",
"or",
"self",
".",
"is_redirected",
"(",
")",
":",
"raise",
"PIDInvalidAction",
"(",
"\"Persistent identifier has already been re... | Register the persistent identifier with the provider.
:raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not
already registered or is deleted or is a redirection to another
PID.
:returns: `True` if the PID is successfully register. | [
"Register",
"the",
"persistent",
"identifier",
"with",
"the",
"provider",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L392-L413 |
49,165 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.delete | def delete(self):
"""Delete the persistent identifier.
If the persistent identifier haven't been registered yet, it is
removed from the database. Otherwise, it's marked as
:attr:`invenio_pidstore.models.PIDStatus.DELETED`.
:returns: `True` if the PID is successfully removed.
... | python | def delete(self):
"""Delete the persistent identifier.
If the persistent identifier haven't been registered yet, it is
removed from the database. Otherwise, it's marked as
:attr:`invenio_pidstore.models.PIDStatus.DELETED`.
:returns: `True` if the PID is successfully removed.
... | [
"def",
"delete",
"(",
"self",
")",
":",
"removed",
"=",
"False",
"try",
":",
"with",
"db",
".",
"session",
".",
"begin_nested",
"(",
")",
":",
"if",
"self",
".",
"is_new",
"(",
")",
":",
"# New persistent identifier which haven't been registered",
"# yet.",
... | Delete the persistent identifier.
If the persistent identifier haven't been registered yet, it is
removed from the database. Otherwise, it's marked as
:attr:`invenio_pidstore.models.PIDStatus.DELETED`.
:returns: `True` if the PID is successfully removed. | [
"Delete",
"the",
"persistent",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L415-L443 |
49,166 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | PersistentIdentifier.sync_status | def sync_status(self, status):
"""Synchronize persistent identifier status.
Used when the provider uses an external service, which might have been
modified outside of our system.
:param status: The new status to set.
:returns: `True` if the PID is successfully sync.
"""... | python | def sync_status(self, status):
"""Synchronize persistent identifier status.
Used when the provider uses an external service, which might have been
modified outside of our system.
:param status: The new status to set.
:returns: `True` if the PID is successfully sync.
"""... | [
"def",
"sync_status",
"(",
"self",
",",
"status",
")",
":",
"if",
"self",
".",
"status",
"==",
"status",
":",
"return",
"True",
"try",
":",
"with",
"db",
".",
"session",
".",
"begin_nested",
"(",
")",
":",
"self",
".",
"status",
"=",
"status",
"db",
... | Synchronize persistent identifier status.
Used when the provider uses an external service, which might have been
modified outside of our system.
:param status: The new status to set.
:returns: `True` if the PID is successfully sync. | [
"Synchronize",
"persistent",
"identifier",
"status",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L445-L467 |
49,167 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | RecordIdentifier.next | def next(cls):
"""Return next available record identifier."""
try:
with db.session.begin_nested():
obj = cls()
db.session.add(obj)
except IntegrityError: # pragma: no cover
with db.session.begin_nested():
# Someone has like... | python | def next(cls):
"""Return next available record identifier."""
try:
with db.session.begin_nested():
obj = cls()
db.session.add(obj)
except IntegrityError: # pragma: no cover
with db.session.begin_nested():
# Someone has like... | [
"def",
"next",
"(",
"cls",
")",
":",
"try",
":",
"with",
"db",
".",
"session",
".",
"begin_nested",
"(",
")",
":",
"obj",
"=",
"cls",
"(",
")",
"db",
".",
"session",
".",
"add",
"(",
"obj",
")",
"except",
"IntegrityError",
":",
"# pragma: no cover",
... | Return next available record identifier. | [
"Return",
"next",
"available",
"record",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L558-L571 |
49,168 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | RecordIdentifier.max | def max(cls):
"""Get max record identifier."""
max_recid = db.session.query(func.max(cls.recid)).scalar()
return max_recid if max_recid else 0 | python | def max(cls):
"""Get max record identifier."""
max_recid = db.session.query(func.max(cls.recid)).scalar()
return max_recid if max_recid else 0 | [
"def",
"max",
"(",
"cls",
")",
":",
"max_recid",
"=",
"db",
".",
"session",
".",
"query",
"(",
"func",
".",
"max",
"(",
"cls",
".",
"recid",
")",
")",
".",
"scalar",
"(",
")",
"return",
"max_recid",
"if",
"max_recid",
"else",
"0"
] | Get max record identifier. | [
"Get",
"max",
"record",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L574-L577 |
49,169 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | RecordIdentifier._set_sequence | def _set_sequence(cls, val):
"""Internal function to reset sequence to specific value.
Note: this function is for PostgreSQL compatibility.
:param val: The value to be set.
"""
if db.engine.dialect.name == 'postgresql': # pragma: no cover
db.session.execute(
... | python | def _set_sequence(cls, val):
"""Internal function to reset sequence to specific value.
Note: this function is for PostgreSQL compatibility.
:param val: The value to be set.
"""
if db.engine.dialect.name == 'postgresql': # pragma: no cover
db.session.execute(
... | [
"def",
"_set_sequence",
"(",
"cls",
",",
"val",
")",
":",
"if",
"db",
".",
"engine",
".",
"dialect",
".",
"name",
"==",
"'postgresql'",
":",
"# pragma: no cover",
"db",
".",
"session",
".",
"execute",
"(",
"\"SELECT setval(pg_get_serial_sequence(\"",
"\"'{0}', '... | Internal function to reset sequence to specific value.
Note: this function is for PostgreSQL compatibility.
:param val: The value to be set. | [
"Internal",
"function",
"to",
"reset",
"sequence",
"to",
"specific",
"value",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L580-L591 |
49,170 | inveniosoftware/invenio-pidstore | invenio_pidstore/models.py | RecordIdentifier.insert | def insert(cls, val):
"""Insert a record identifier.
:param val: The `recid` column value to insert.
"""
with db.session.begin_nested():
obj = cls(recid=val)
db.session.add(obj)
cls._set_sequence(cls.max()) | python | def insert(cls, val):
"""Insert a record identifier.
:param val: The `recid` column value to insert.
"""
with db.session.begin_nested():
obj = cls(recid=val)
db.session.add(obj)
cls._set_sequence(cls.max()) | [
"def",
"insert",
"(",
"cls",
",",
"val",
")",
":",
"with",
"db",
".",
"session",
".",
"begin_nested",
"(",
")",
":",
"obj",
"=",
"cls",
"(",
"recid",
"=",
"val",
")",
"db",
".",
"session",
".",
"add",
"(",
"obj",
")",
"cls",
".",
"_set_sequence",... | Insert a record identifier.
:param val: The `recid` column value to insert. | [
"Insert",
"a",
"record",
"identifier",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/models.py#L594-L602 |
49,171 | inveniosoftware/invenio-pidstore | invenio_pidstore/resolver.py | Resolver.resolve | def resolve(self, pid_value):
"""Resolve a persistent identifier to an internal object.
:param pid_value: Persistent identifier.
:returns: A tuple containing (pid, object).
"""
pid = PersistentIdentifier.get(self.pid_type, pid_value)
if pid.is_new() or pid.is_reserved()... | python | def resolve(self, pid_value):
"""Resolve a persistent identifier to an internal object.
:param pid_value: Persistent identifier.
:returns: A tuple containing (pid, object).
"""
pid = PersistentIdentifier.get(self.pid_type, pid_value)
if pid.is_new() or pid.is_reserved()... | [
"def",
"resolve",
"(",
"self",
",",
"pid_value",
")",
":",
"pid",
"=",
"PersistentIdentifier",
".",
"get",
"(",
"self",
".",
"pid_type",
",",
"pid_value",
")",
"if",
"pid",
".",
"is_new",
"(",
")",
"or",
"pid",
".",
"is_reserved",
"(",
")",
":",
"rai... | Resolve a persistent identifier to an internal object.
:param pid_value: Persistent identifier.
:returns: A tuple containing (pid, object). | [
"Resolve",
"a",
"persistent",
"identifier",
"to",
"an",
"internal",
"object",
"."
] | 8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78 | https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/resolver.py#L39-L65 |
49,172 | pudo/googlesheets | googlesheets/spreadsheet.py | Spreadsheet.create_sheet | def create_sheet(self, title):
""" Create a sheet with the given title. This does not check if
another sheet by the same name already exists. """
ws = self.conn.sheets_service.AddWorksheet(title, 10, 10, self.id)
self._wsf = None
return Sheet(self, ws) | python | def create_sheet(self, title):
""" Create a sheet with the given title. This does not check if
another sheet by the same name already exists. """
ws = self.conn.sheets_service.AddWorksheet(title, 10, 10, self.id)
self._wsf = None
return Sheet(self, ws) | [
"def",
"create_sheet",
"(",
"self",
",",
"title",
")",
":",
"ws",
"=",
"self",
".",
"conn",
".",
"sheets_service",
".",
"AddWorksheet",
"(",
"title",
",",
"10",
",",
"10",
",",
"self",
".",
"id",
")",
"self",
".",
"_wsf",
"=",
"None",
"return",
"Sh... | Create a sheet with the given title. This does not check if
another sheet by the same name already exists. | [
"Create",
"a",
"sheet",
"with",
"the",
"given",
"title",
".",
"This",
"does",
"not",
"check",
"if",
"another",
"sheet",
"by",
"the",
"same",
"name",
"already",
"exists",
"."
] | c38725d79bfe048c0519a674019ba313dfc5bfb0 | https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/spreadsheet.py#L48-L53 |
49,173 | pudo/googlesheets | googlesheets/spreadsheet.py | Spreadsheet.open | def open(cls, title, conn=None, google_user=None,
google_password=None):
""" Open the spreadsheet named ``title``. If no spreadsheet with
that name exists, a new one will be created. """
spreadsheet = cls.by_title(title, conn=conn, google_user=google_user,
... | python | def open(cls, title, conn=None, google_user=None,
google_password=None):
""" Open the spreadsheet named ``title``. If no spreadsheet with
that name exists, a new one will be created. """
spreadsheet = cls.by_title(title, conn=conn, google_user=google_user,
... | [
"def",
"open",
"(",
"cls",
",",
"title",
",",
"conn",
"=",
"None",
",",
"google_user",
"=",
"None",
",",
"google_password",
"=",
"None",
")",
":",
"spreadsheet",
"=",
"cls",
".",
"by_title",
"(",
"title",
",",
"conn",
"=",
"conn",
",",
"google_user",
... | Open the spreadsheet named ``title``. If no spreadsheet with
that name exists, a new one will be created. | [
"Open",
"the",
"spreadsheet",
"named",
"title",
".",
"If",
"no",
"spreadsheet",
"with",
"that",
"name",
"exists",
"a",
"new",
"one",
"will",
"be",
"created",
"."
] | c38725d79bfe048c0519a674019ba313dfc5bfb0 | https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/spreadsheet.py#L69-L78 |
49,174 | pudo/googlesheets | googlesheets/spreadsheet.py | Spreadsheet.create | def create(cls, title, conn=None, google_user=None,
google_password=None):
""" Create a new spreadsheet with the given ``title``. """
conn = Connection.connect(conn=conn, google_user=google_user,
google_password=google_password)
res = Resource(typ... | python | def create(cls, title, conn=None, google_user=None,
google_password=None):
""" Create a new spreadsheet with the given ``title``. """
conn = Connection.connect(conn=conn, google_user=google_user,
google_password=google_password)
res = Resource(typ... | [
"def",
"create",
"(",
"cls",
",",
"title",
",",
"conn",
"=",
"None",
",",
"google_user",
"=",
"None",
",",
"google_password",
"=",
"None",
")",
":",
"conn",
"=",
"Connection",
".",
"connect",
"(",
"conn",
"=",
"conn",
",",
"google_user",
"=",
"google_u... | Create a new spreadsheet with the given ``title``. | [
"Create",
"a",
"new",
"spreadsheet",
"with",
"the",
"given",
"title",
"."
] | c38725d79bfe048c0519a674019ba313dfc5bfb0 | https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/spreadsheet.py#L81-L89 |
49,175 | pudo/googlesheets | googlesheets/spreadsheet.py | Spreadsheet.by_id | def by_id(cls, id, conn=None, google_user=None,
google_password=None):
""" Open a spreadsheet via its resource ID. This is more precise
than opening a document by title, and should be used with
preference. """
conn = Connection.connect(conn=conn, google_user=google_user,
... | python | def by_id(cls, id, conn=None, google_user=None,
google_password=None):
""" Open a spreadsheet via its resource ID. This is more precise
than opening a document by title, and should be used with
preference. """
conn = Connection.connect(conn=conn, google_user=google_user,
... | [
"def",
"by_id",
"(",
"cls",
",",
"id",
",",
"conn",
"=",
"None",
",",
"google_user",
"=",
"None",
",",
"google_password",
"=",
"None",
")",
":",
"conn",
"=",
"Connection",
".",
"connect",
"(",
"conn",
"=",
"conn",
",",
"google_user",
"=",
"google_user"... | Open a spreadsheet via its resource ID. This is more precise
than opening a document by title, and should be used with
preference. | [
"Open",
"a",
"spreadsheet",
"via",
"its",
"resource",
"ID",
".",
"This",
"is",
"more",
"precise",
"than",
"opening",
"a",
"document",
"by",
"title",
"and",
"should",
"be",
"used",
"with",
"preference",
"."
] | c38725d79bfe048c0519a674019ba313dfc5bfb0 | https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/spreadsheet.py#L92-L99 |
49,176 | pudo/googlesheets | googlesheets/spreadsheet.py | Spreadsheet.by_title | def by_title(cls, title, conn=None, google_user=None,
google_password=None):
""" Open the first document with the given ``title`` that is
returned by document search. """
conn = Connection.connect(conn=conn, google_user=google_user,
google_passw... | python | def by_title(cls, title, conn=None, google_user=None,
google_password=None):
""" Open the first document with the given ``title`` that is
returned by document search. """
conn = Connection.connect(conn=conn, google_user=google_user,
google_passw... | [
"def",
"by_title",
"(",
"cls",
",",
"title",
",",
"conn",
"=",
"None",
",",
"google_user",
"=",
"None",
",",
"google_password",
"=",
"None",
")",
":",
"conn",
"=",
"Connection",
".",
"connect",
"(",
"conn",
"=",
"conn",
",",
"google_user",
"=",
"google... | Open the first document with the given ``title`` that is
returned by document search. | [
"Open",
"the",
"first",
"document",
"with",
"the",
"given",
"title",
"that",
"is",
"returned",
"by",
"document",
"search",
"."
] | c38725d79bfe048c0519a674019ba313dfc5bfb0 | https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/spreadsheet.py#L102-L113 |
49,177 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/views.py | init_common | def init_common(app):
"""Post initialization."""
if app.config['USERPROFILES_EXTEND_SECURITY_FORMS']:
security_ext = app.extensions['security']
security_ext.confirm_register_form = confirm_register_form_factory(
security_ext.confirm_register_form)
security_ext.register_form =... | python | def init_common(app):
"""Post initialization."""
if app.config['USERPROFILES_EXTEND_SECURITY_FORMS']:
security_ext = app.extensions['security']
security_ext.confirm_register_form = confirm_register_form_factory(
security_ext.confirm_register_form)
security_ext.register_form =... | [
"def",
"init_common",
"(",
"app",
")",
":",
"if",
"app",
".",
"config",
"[",
"'USERPROFILES_EXTEND_SECURITY_FORMS'",
"]",
":",
"security_ext",
"=",
"app",
".",
"extensions",
"[",
"'security'",
"]",
"security_ext",
".",
"confirm_register_form",
"=",
"confirm_regist... | Post initialization. | [
"Post",
"initialization",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/views.py#L44-L51 |
49,178 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/views.py | init_ui | def init_ui(state):
"""Post initialization for UI application."""
app = state.app
init_common(app)
# Register blueprint for templates
app.register_blueprint(
blueprint, url_prefix=app.config['USERPROFILES_PROFILE_URL']) | python | def init_ui(state):
"""Post initialization for UI application."""
app = state.app
init_common(app)
# Register blueprint for templates
app.register_blueprint(
blueprint, url_prefix=app.config['USERPROFILES_PROFILE_URL']) | [
"def",
"init_ui",
"(",
"state",
")",
":",
"app",
"=",
"state",
".",
"app",
"init_common",
"(",
"app",
")",
"# Register blueprint for templates",
"app",
".",
"register_blueprint",
"(",
"blueprint",
",",
"url_prefix",
"=",
"app",
".",
"config",
"[",
"'USERPROFIL... | Post initialization for UI application. | [
"Post",
"initialization",
"for",
"UI",
"application",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/views.py#L55-L62 |
49,179 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/views.py | profile | def profile():
"""View for editing a profile."""
# Create forms
verification_form = VerificationForm(formdata=None, prefix="verification")
profile_form = profile_form_factory()
# Process forms
form = request.form.get('submit', None)
if form == 'profile':
handle_profile_form(profile_... | python | def profile():
"""View for editing a profile."""
# Create forms
verification_form = VerificationForm(formdata=None, prefix="verification")
profile_form = profile_form_factory()
# Process forms
form = request.form.get('submit', None)
if form == 'profile':
handle_profile_form(profile_... | [
"def",
"profile",
"(",
")",
":",
"# Create forms",
"verification_form",
"=",
"VerificationForm",
"(",
"formdata",
"=",
"None",
",",
"prefix",
"=",
"\"verification\"",
")",
"profile_form",
"=",
"profile_form_factory",
"(",
")",
"# Process forms",
"form",
"=",
"requ... | View for editing a profile. | [
"View",
"for",
"editing",
"a",
"profile",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/views.py#L87-L103 |
49,180 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/views.py | profile_form_factory | def profile_form_factory():
"""Create a profile form."""
if current_app.config['USERPROFILES_EMAIL_ENABLED']:
return EmailProfileForm(
formdata=None,
username=current_userprofile.username,
full_name=current_userprofile.full_name,
email=current_user.email,
... | python | def profile_form_factory():
"""Create a profile form."""
if current_app.config['USERPROFILES_EMAIL_ENABLED']:
return EmailProfileForm(
formdata=None,
username=current_userprofile.username,
full_name=current_userprofile.full_name,
email=current_user.email,
... | [
"def",
"profile_form_factory",
"(",
")",
":",
"if",
"current_app",
".",
"config",
"[",
"'USERPROFILES_EMAIL_ENABLED'",
"]",
":",
"return",
"EmailProfileForm",
"(",
"formdata",
"=",
"None",
",",
"username",
"=",
"current_userprofile",
".",
"username",
",",
"full_na... | Create a profile form. | [
"Create",
"a",
"profile",
"form",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/views.py#L106-L120 |
49,181 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/views.py | handle_verification_form | def handle_verification_form(form):
"""Handle email sending verification form."""
form.process(formdata=request.form)
if form.validate_on_submit():
send_confirmation_instructions(current_user)
# NOTE: Flash message.
flash(_("Verification email sent."), category="success") | python | def handle_verification_form(form):
"""Handle email sending verification form."""
form.process(formdata=request.form)
if form.validate_on_submit():
send_confirmation_instructions(current_user)
# NOTE: Flash message.
flash(_("Verification email sent."), category="success") | [
"def",
"handle_verification_form",
"(",
"form",
")",
":",
"form",
".",
"process",
"(",
"formdata",
"=",
"request",
".",
"form",
")",
"if",
"form",
".",
"validate_on_submit",
"(",
")",
":",
"send_confirmation_instructions",
"(",
"current_user",
")",
"# NOTE: Flas... | Handle email sending verification form. | [
"Handle",
"email",
"sending",
"verification",
"form",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/views.py#L123-L130 |
49,182 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/views.py | handle_profile_form | def handle_profile_form(form):
"""Handle profile update form."""
form.process(formdata=request.form)
if form.validate_on_submit():
email_changed = False
with db.session.begin_nested():
# Update profile.
current_userprofile.username = form.username.data
cu... | python | def handle_profile_form(form):
"""Handle profile update form."""
form.process(formdata=request.form)
if form.validate_on_submit():
email_changed = False
with db.session.begin_nested():
# Update profile.
current_userprofile.username = form.username.data
cu... | [
"def",
"handle_profile_form",
"(",
"form",
")",
":",
"form",
".",
"process",
"(",
"formdata",
"=",
"request",
".",
"form",
")",
"if",
"form",
".",
"validate_on_submit",
"(",
")",
":",
"email_changed",
"=",
"False",
"with",
"db",
".",
"session",
".",
"beg... | Handle profile update form. | [
"Handle",
"profile",
"update",
"form",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/views.py#L133-L163 |
49,183 | Scifabric/enki | enki/task_run_loaders.py | ServerTaskRunsLoader.check_errors | def check_errors(self, data):
"""Check for errors on data payload."""
if (type(data) == dict and 'status' in data.keys()
and data['status'] == 'failed'):
if data.get('exception_msg') and 'last_id' in data.get('exception_msg'):
raise PyBossaServerNoKeysetPaginatio... | python | def check_errors(self, data):
"""Check for errors on data payload."""
if (type(data) == dict and 'status' in data.keys()
and data['status'] == 'failed'):
if data.get('exception_msg') and 'last_id' in data.get('exception_msg'):
raise PyBossaServerNoKeysetPaginatio... | [
"def",
"check_errors",
"(",
"self",
",",
"data",
")",
":",
"if",
"(",
"type",
"(",
"data",
")",
"==",
"dict",
"and",
"'status'",
"in",
"data",
".",
"keys",
"(",
")",
"and",
"data",
"[",
"'status'",
"]",
"==",
"'failed'",
")",
":",
"if",
"data",
"... | Check for errors on data payload. | [
"Check",
"for",
"errors",
"on",
"data",
"payload",
"."
] | eae8d000276704abe6535ae45ecb6d8067986f9f | https://github.com/Scifabric/enki/blob/eae8d000276704abe6535ae45ecb6d8067986f9f/enki/task_run_loaders.py#L30-L39 |
49,184 | daskol/telepyth | telepyth/client.py | TelePythClient.send_text | def send_text(self, text):
"""Send text message to telegram user. Text message should be markdown
formatted.
:param text: markdown formatted text.
:return: status code on error.
"""
if not self.is_token_set:
raise ValueError('TelepythClient: Access token is n... | python | def send_text(self, text):
"""Send text message to telegram user. Text message should be markdown
formatted.
:param text: markdown formatted text.
:return: status code on error.
"""
if not self.is_token_set:
raise ValueError('TelepythClient: Access token is n... | [
"def",
"send_text",
"(",
"self",
",",
"text",
")",
":",
"if",
"not",
"self",
".",
"is_token_set",
":",
"raise",
"ValueError",
"(",
"'TelepythClient: Access token is not set!'",
")",
"stream",
"=",
"StringIO",
"(",
")",
"stream",
".",
"write",
"(",
"text",
")... | Send text message to telegram user. Text message should be markdown
formatted.
:param text: markdown formatted text.
:return: status code on error. | [
"Send",
"text",
"message",
"to",
"telegram",
"user",
".",
"Text",
"message",
"should",
"be",
"markdown",
"formatted",
"."
] | dd38abe6f7a5a3c88c7fd2163e24e45d61cd6e07 | https://github.com/daskol/telepyth/blob/dd38abe6f7a5a3c88c7fd2163e24e45d61cd6e07/telepyth/client.py#L105-L119 |
49,185 | daskol/telepyth | telepyth/client.py | TelePythClient.send_figure | def send_figure(self, fig, caption=''):
"""Render matplotlib figure into temporary bytes buffer and then send
it to telegram user.
:param fig: matplotlib figure object.
:param caption: text caption of picture.
:return: status code on error.
"""
if not self.is_tok... | python | def send_figure(self, fig, caption=''):
"""Render matplotlib figure into temporary bytes buffer and then send
it to telegram user.
:param fig: matplotlib figure object.
:param caption: text caption of picture.
:return: status code on error.
"""
if not self.is_tok... | [
"def",
"send_figure",
"(",
"self",
",",
"fig",
",",
"caption",
"=",
"''",
")",
":",
"if",
"not",
"self",
".",
"is_token_set",
":",
"raise",
"ValueError",
"(",
"'TelepythClient: Access token is not set!'",
")",
"figure",
"=",
"BytesIO",
"(",
")",
"fig",
".",
... | Render matplotlib figure into temporary bytes buffer and then send
it to telegram user.
:param fig: matplotlib figure object.
:param caption: text caption of picture.
:return: status code on error. | [
"Render",
"matplotlib",
"figure",
"into",
"temporary",
"bytes",
"buffer",
"and",
"then",
"send",
"it",
"to",
"telegram",
"user",
"."
] | dd38abe6f7a5a3c88c7fd2163e24e45d61cd6e07 | https://github.com/daskol/telepyth/blob/dd38abe6f7a5a3c88c7fd2163e24e45d61cd6e07/telepyth/client.py#L121-L151 |
49,186 | tapilab/sclust | sclust/sclust.py | prune_clusters | def prune_clusters(clusters, index, n=3):
"""
Delete clusters with fewer than n elements.
"""
torem = set(c for c in clusters if c.size < n)
pruned_clusters = [c for c in clusters if c.size >= n]
terms_torem = []
for term, clusters in index.items():
index[term] = clusters - torem
... | python | def prune_clusters(clusters, index, n=3):
"""
Delete clusters with fewer than n elements.
"""
torem = set(c for c in clusters if c.size < n)
pruned_clusters = [c for c in clusters if c.size >= n]
terms_torem = []
for term, clusters in index.items():
index[term] = clusters - torem
... | [
"def",
"prune_clusters",
"(",
"clusters",
",",
"index",
",",
"n",
"=",
"3",
")",
":",
"torem",
"=",
"set",
"(",
"c",
"for",
"c",
"in",
"clusters",
"if",
"c",
".",
"size",
"<",
"n",
")",
"pruned_clusters",
"=",
"[",
"c",
"for",
"c",
"in",
"cluster... | Delete clusters with fewer than n elements. | [
"Delete",
"clusters",
"with",
"fewer",
"than",
"n",
"elements",
"."
] | 6263204bb55e586a618f326b9ec16eb18b238aeb | https://github.com/tapilab/sclust/blob/6263204bb55e586a618f326b9ec16eb18b238aeb/sclust/sclust.py#L73-L86 |
49,187 | adamcharnock/python-hue-client | hueclient/monitor.py | MonitorMixin.monitor | def monitor(self, field, callback, poll_interval=None):
""" Monitor `field` for change
Will monitor ``field`` for change and execute ``callback`` when
change is detected.
Example usage::
def handle(resource, field, previous, current):
print "Change from {} ... | python | def monitor(self, field, callback, poll_interval=None):
""" Monitor `field` for change
Will monitor ``field`` for change and execute ``callback`` when
change is detected.
Example usage::
def handle(resource, field, previous, current):
print "Change from {} ... | [
"def",
"monitor",
"(",
"self",
",",
"field",
",",
"callback",
",",
"poll_interval",
"=",
"None",
")",
":",
"poll_interval",
"=",
"poll_interval",
"or",
"self",
".",
"api",
".",
"poll_interval",
"monitor",
"=",
"self",
".",
"monitor_class",
"(",
"resource",
... | Monitor `field` for change
Will monitor ``field`` for change and execute ``callback`` when
change is detected.
Example usage::
def handle(resource, field, previous, current):
print "Change from {} to {}".format(previous, current)
switch = TapSwitch.obj... | [
"Monitor",
"field",
"for",
"change"
] | b934d8eab29ad301ff4e43462e37f0f2d4e682e5 | https://github.com/adamcharnock/python-hue-client/blob/b934d8eab29ad301ff4e43462e37f0f2d4e682e5/hueclient/monitor.py#L112-L165 |
49,188 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/forms.py | register_form_factory | def register_form_factory(Form):
"""Factory for creating an extended user registration form."""
class CsrfDisabledProfileForm(ProfileForm):
"""Subclass of ProfileForm to disable CSRF token in the inner form.
This class will always be a inner form field of the parent class
`Form`. The pa... | python | def register_form_factory(Form):
"""Factory for creating an extended user registration form."""
class CsrfDisabledProfileForm(ProfileForm):
"""Subclass of ProfileForm to disable CSRF token in the inner form.
This class will always be a inner form field of the parent class
`Form`. The pa... | [
"def",
"register_form_factory",
"(",
"Form",
")",
":",
"class",
"CsrfDisabledProfileForm",
"(",
"ProfileForm",
")",
":",
"\"\"\"Subclass of ProfileForm to disable CSRF token in the inner form.\n\n This class will always be a inner form field of the parent class\n `Form`. The pa... | Factory for creating an extended user registration form. | [
"Factory",
"for",
"creating",
"an",
"extended",
"user",
"registration",
"form",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/forms.py#L114-L133 |
49,189 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/forms.py | confirm_register_form_factory | def confirm_register_form_factory(Form):
"""Factory for creating a confirm register form."""
class CsrfDisabledProfileForm(ProfileForm):
"""Subclass of ProfileForm to disable CSRF token in the inner form.
This class will always be a inner form field of the parent class
`Form`. The paren... | python | def confirm_register_form_factory(Form):
"""Factory for creating a confirm register form."""
class CsrfDisabledProfileForm(ProfileForm):
"""Subclass of ProfileForm to disable CSRF token in the inner form.
This class will always be a inner form field of the parent class
`Form`. The paren... | [
"def",
"confirm_register_form_factory",
"(",
"Form",
")",
":",
"class",
"CsrfDisabledProfileForm",
"(",
"ProfileForm",
")",
":",
"\"\"\"Subclass of ProfileForm to disable CSRF token in the inner form.\n\n This class will always be a inner form field of the parent class\n `Form`... | Factory for creating a confirm register form. | [
"Factory",
"for",
"creating",
"a",
"confirm",
"register",
"form",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/forms.py#L136-L155 |
49,190 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/forms.py | _update_with_csrf_disabled | def _update_with_csrf_disabled(d=None):
"""Update the input dict with CSRF disabled depending on WTF-Form version.
From Flask-WTF 0.14.0, `csrf_enabled` param has been deprecated in favor of
`meta={csrf: True/False}`.
"""
if d is None:
d = {}
import flask_wtf
from pkg_resources imp... | python | def _update_with_csrf_disabled(d=None):
"""Update the input dict with CSRF disabled depending on WTF-Form version.
From Flask-WTF 0.14.0, `csrf_enabled` param has been deprecated in favor of
`meta={csrf: True/False}`.
"""
if d is None:
d = {}
import flask_wtf
from pkg_resources imp... | [
"def",
"_update_with_csrf_disabled",
"(",
"d",
"=",
"None",
")",
":",
"if",
"d",
"is",
"None",
":",
"d",
"=",
"{",
"}",
"import",
"flask_wtf",
"from",
"pkg_resources",
"import",
"parse_version",
"supports_meta",
"=",
"parse_version",
"(",
"flask_wtf",
".",
"... | Update the input dict with CSRF disabled depending on WTF-Form version.
From Flask-WTF 0.14.0, `csrf_enabled` param has been deprecated in favor of
`meta={csrf: True/False}`. | [
"Update",
"the",
"input",
"dict",
"with",
"CSRF",
"disabled",
"depending",
"on",
"WTF",
"-",
"Form",
"version",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/forms.py#L158-L176 |
49,191 | inveniosoftware/invenio-userprofiles | invenio_userprofiles/forms.py | ProfileForm.validate_username | def validate_username(form, field):
"""Wrap username validator for WTForms."""
try:
validate_username(field.data)
except ValueError as e:
raise ValidationError(e)
try:
user_profile = UserProfile.get_by_username(field.data)
if current_userp... | python | def validate_username(form, field):
"""Wrap username validator for WTForms."""
try:
validate_username(field.data)
except ValueError as e:
raise ValidationError(e)
try:
user_profile = UserProfile.get_by_username(field.data)
if current_userp... | [
"def",
"validate_username",
"(",
"form",
",",
"field",
")",
":",
"try",
":",
"validate_username",
"(",
"field",
".",
"data",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"ValidationError",
"(",
"e",
")",
"try",
":",
"user_profile",
"=",
"UserProfi... | Wrap username validator for WTForms. | [
"Wrap",
"username",
"validator",
"for",
"WTForms",
"."
] | 4c682e7d67a4cab8dc38472a31fa1c34cbba03dd | https://github.com/inveniosoftware/invenio-userprofiles/blob/4c682e7d67a4cab8dc38472a31fa1c34cbba03dd/invenio_userprofiles/forms.py#L60-L75 |
49,192 | visio2img/visio2img | visio2img/visio2img.py | filter_pages | def filter_pages(pages, pagenum, pagename):
""" Choices pages by pagenum and pagename """
if pagenum:
try:
pages = [list(pages)[pagenum - 1]]
except IndexError:
raise IndexError('Invalid page number: %d' % pagenum)
if pagename:
pages = [page for page in pages... | python | def filter_pages(pages, pagenum, pagename):
""" Choices pages by pagenum and pagename """
if pagenum:
try:
pages = [list(pages)[pagenum - 1]]
except IndexError:
raise IndexError('Invalid page number: %d' % pagenum)
if pagename:
pages = [page for page in pages... | [
"def",
"filter_pages",
"(",
"pages",
",",
"pagenum",
",",
"pagename",
")",
":",
"if",
"pagenum",
":",
"try",
":",
"pages",
"=",
"[",
"list",
"(",
"pages",
")",
"[",
"pagenum",
"-",
"1",
"]",
"]",
"except",
"IndexError",
":",
"raise",
"IndexError",
"(... | Choices pages by pagenum and pagename | [
"Choices",
"pages",
"by",
"pagenum",
"and",
"pagename"
] | 60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac | https://github.com/visio2img/visio2img/blob/60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac/visio2img/visio2img.py#L31-L44 |
49,193 | visio2img/visio2img | visio2img/visio2img.py | export_img | def export_img(visio_filename, image_filename, pagenum=None, pagename=None):
""" Exports images from visio file """
# visio requires absolute path
image_pathname = os.path.abspath(image_filename)
if not os.path.isdir(os.path.dirname(image_pathname)):
msg = 'Could not write image file: %s' % ima... | python | def export_img(visio_filename, image_filename, pagenum=None, pagename=None):
""" Exports images from visio file """
# visio requires absolute path
image_pathname = os.path.abspath(image_filename)
if not os.path.isdir(os.path.dirname(image_pathname)):
msg = 'Could not write image file: %s' % ima... | [
"def",
"export_img",
"(",
"visio_filename",
",",
"image_filename",
",",
"pagenum",
"=",
"None",
",",
"pagename",
"=",
"None",
")",
":",
"# visio requires absolute path",
"image_pathname",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"image_filename",
")",
"if",
... | Exports images from visio file | [
"Exports",
"images",
"from",
"visio",
"file"
] | 60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac | https://github.com/visio2img/visio2img/blob/60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac/visio2img/visio2img.py#L107-L130 |
49,194 | visio2img/visio2img | visio2img/visio2img.py | parse_options | def parse_options(args):
""" Parses command line options """
usage = 'usage: %prog [options] visio_filename image_filename'
parser = OptionParser(usage=usage)
parser.add_option('-p', '--page', action='store',
type='int', dest='pagenum',
help='pick a page by pa... | python | def parse_options(args):
""" Parses command line options """
usage = 'usage: %prog [options] visio_filename image_filename'
parser = OptionParser(usage=usage)
parser.add_option('-p', '--page', action='store',
type='int', dest='pagenum',
help='pick a page by pa... | [
"def",
"parse_options",
"(",
"args",
")",
":",
"usage",
"=",
"'usage: %prog [options] visio_filename image_filename'",
"parser",
"=",
"OptionParser",
"(",
"usage",
"=",
"usage",
")",
"parser",
".",
"add_option",
"(",
"'-p'",
",",
"'--page'",
",",
"action",
"=",
... | Parses command line options | [
"Parses",
"command",
"line",
"options"
] | 60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac | https://github.com/visio2img/visio2img/blob/60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac/visio2img/visio2img.py#L133-L156 |
49,195 | visio2img/visio2img | visio2img/visio2img.py | main | def main(args=sys.argv[1:]):
""" main funcion of visio2img """
if not is_pywin32_available():
sys.stderr.write('win32com module not found')
return -1
try:
options, argv = parse_options(args)
export_img(argv[0], argv[1], options.pagenum, options.pagename)
return 0
... | python | def main(args=sys.argv[1:]):
""" main funcion of visio2img """
if not is_pywin32_available():
sys.stderr.write('win32com module not found')
return -1
try:
options, argv = parse_options(args)
export_img(argv[0], argv[1], options.pagenum, options.pagename)
return 0
... | [
"def",
"main",
"(",
"args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
")",
":",
"if",
"not",
"is_pywin32_available",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'win32com module not found'",
")",
"return",
"-",
"1",
"try",
":",
"optio... | main funcion of visio2img | [
"main",
"funcion",
"of",
"visio2img"
] | 60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac | https://github.com/visio2img/visio2img/blob/60a1359abd2e8cf0d7dfa340fc7c9ace5572b7ac/visio2img/visio2img.py#L159-L171 |
49,196 | idlesign/django-sitemetrics | sitemetrics/providers.py | get_custom_providers | def get_custom_providers():
"""Imports providers classes by paths given in SITEMETRICS_PROVIDERS setting."""
providers = getattr(settings, 'SITEMETRICS_PROVIDERS', False)
if not providers:
return []
p_clss = []
for provider_path in providers:
path_splitted = provider_path.split('.... | python | def get_custom_providers():
"""Imports providers classes by paths given in SITEMETRICS_PROVIDERS setting."""
providers = getattr(settings, 'SITEMETRICS_PROVIDERS', False)
if not providers:
return []
p_clss = []
for provider_path in providers:
path_splitted = provider_path.split('.... | [
"def",
"get_custom_providers",
"(",
")",
":",
"providers",
"=",
"getattr",
"(",
"settings",
",",
"'SITEMETRICS_PROVIDERS'",
",",
"False",
")",
"if",
"not",
"providers",
":",
"return",
"[",
"]",
"p_clss",
"=",
"[",
"]",
"for",
"provider_path",
"in",
"provider... | Imports providers classes by paths given in SITEMETRICS_PROVIDERS setting. | [
"Imports",
"providers",
"classes",
"by",
"paths",
"given",
"in",
"SITEMETRICS_PROVIDERS",
"setting",
"."
] | be5d6b8a607d9662e91c5919dca971cd3eb665ff | https://github.com/idlesign/django-sitemetrics/blob/be5d6b8a607d9662e91c5919dca971cd3eb665ff/sitemetrics/providers.py#L71-L85 |
49,197 | mperlet/PyDect200 | PyDect200/PyDect200.py | PyDect200.__query | def __query(cls, url):
"""Reads a URL"""
try:
return urllib2.urlopen(url).read().decode('utf-8').replace('\n', '')
except urllib2.HTTPError:
_, exception, _ = sys.exc_info()
if cls.__debug:
print('HTTPError = ' + str(exception.code))
ex... | python | def __query(cls, url):
"""Reads a URL"""
try:
return urllib2.urlopen(url).read().decode('utf-8').replace('\n', '')
except urllib2.HTTPError:
_, exception, _ = sys.exc_info()
if cls.__debug:
print('HTTPError = ' + str(exception.code))
ex... | [
"def",
"__query",
"(",
"cls",
",",
"url",
")",
":",
"try",
":",
"return",
"urllib2",
".",
"urlopen",
"(",
"url",
")",
".",
"read",
"(",
")",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"replace",
"(",
"'\\n'",
",",
"''",
")",
"except",
"urllib2",
".... | Reads a URL | [
"Reads",
"a",
"URL"
] | 4758d80c663324a612c2772e6442db1472016913 | https://github.com/mperlet/PyDect200/blob/4758d80c663324a612c2772e6442db1472016913/PyDect200/PyDect200.py#L56-L74 |
49,198 | mperlet/PyDect200 | PyDect200/PyDect200.py | PyDect200.__query_cmd | def __query_cmd(self, command, device=None):
"""Calls a command"""
base_url = u'%s&switchcmd=%s' % (self.__homeauto_url_with_sid(), command)
if device is None:
url = base_url
else:
url = '%s&ain=%s' % (base_url, device)
if self.__debug:
print... | python | def __query_cmd(self, command, device=None):
"""Calls a command"""
base_url = u'%s&switchcmd=%s' % (self.__homeauto_url_with_sid(), command)
if device is None:
url = base_url
else:
url = '%s&ain=%s' % (base_url, device)
if self.__debug:
print... | [
"def",
"__query_cmd",
"(",
"self",
",",
"command",
",",
"device",
"=",
"None",
")",
":",
"base_url",
"=",
"u'%s&switchcmd=%s'",
"%",
"(",
"self",
".",
"__homeauto_url_with_sid",
"(",
")",
",",
"command",
")",
"if",
"device",
"is",
"None",
":",
"url",
"="... | Calls a command | [
"Calls",
"a",
"command"
] | 4758d80c663324a612c2772e6442db1472016913 | https://github.com/mperlet/PyDect200/blob/4758d80c663324a612c2772e6442db1472016913/PyDect200/PyDect200.py#L78-L90 |
49,199 | mperlet/PyDect200 | PyDect200/PyDect200.py | PyDect200.get_sid | def get_sid(self):
"""Returns a valid SID"""
base_url = u'%s/login_sid.lua' % self.__fritz_url
get_challenge = None
try:
get_challenge = urllib2.urlopen(base_url).read().decode('ascii')
except urllib2.HTTPError as exception:
print('HTTPError = ' + str(exce... | python | def get_sid(self):
"""Returns a valid SID"""
base_url = u'%s/login_sid.lua' % self.__fritz_url
get_challenge = None
try:
get_challenge = urllib2.urlopen(base_url).read().decode('ascii')
except urllib2.HTTPError as exception:
print('HTTPError = ' + str(exce... | [
"def",
"get_sid",
"(",
"self",
")",
":",
"base_url",
"=",
"u'%s/login_sid.lua'",
"%",
"self",
".",
"__fritz_url",
"get_challenge",
"=",
"None",
"try",
":",
"get_challenge",
"=",
"urllib2",
".",
"urlopen",
"(",
"base_url",
")",
".",
"read",
"(",
")",
".",
... | Returns a valid SID | [
"Returns",
"a",
"valid",
"SID"
] | 4758d80c663324a612c2772e6442db1472016913 | https://github.com/mperlet/PyDect200/blob/4758d80c663324a612c2772e6442db1472016913/PyDect200/PyDect200.py#L92-L117 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.