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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
54,000 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAccountClient.get_identities | def get_identities(self, identity=None, attrs=None):
""" Get identities matching name and attrs
of the user, as a list
:param: zobjects.Identity or identity name (string)
:param: attrs dict of attributes to return only identities matching
:returns: list of zobjects.Identity
... | python | def get_identities(self, identity=None, attrs=None):
""" Get identities matching name and attrs
of the user, as a list
:param: zobjects.Identity or identity name (string)
:param: attrs dict of attributes to return only identities matching
:returns: list of zobjects.Identity
... | [
"def",
"get_identities",
"(",
"self",
",",
"identity",
"=",
"None",
",",
"attrs",
"=",
"None",
")",
":",
"resp",
"=",
"self",
".",
"request",
"(",
"'GetIdentities'",
")",
"if",
"'identity'",
"in",
"resp",
":",
"identities",
"=",
"resp",
"[",
"'identity'"... | Get identities matching name and attrs
of the user, as a list
:param: zobjects.Identity or identity name (string)
:param: attrs dict of attributes to return only identities matching
:returns: list of zobjects.Identity | [
"Get",
"identities",
"matching",
"name",
"and",
"attrs",
"of",
"the",
"user",
"as",
"a",
"list"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L480-L517 |
54,001 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAccountClient.modify_identity | def modify_identity(self, identity, **kwargs):
""" Modify some attributes of an identity or its name.
:param: identity a zobjects.Identity with `id` set (mandatory). Also
set items you want to modify/set and/or the `name` attribute to
rename the identity.
Ca... | python | def modify_identity(self, identity, **kwargs):
""" Modify some attributes of an identity or its name.
:param: identity a zobjects.Identity with `id` set (mandatory). Also
set items you want to modify/set and/or the `name` attribute to
rename the identity.
Ca... | [
"def",
"modify_identity",
"(",
"self",
",",
"identity",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"identity",
",",
"zobjects",
".",
"Identity",
")",
":",
"self",
".",
"request",
"(",
"'ModifyIdentity'",
",",
"{",
"'identity'",
":",
"ide... | Modify some attributes of an identity or its name.
:param: identity a zobjects.Identity with `id` set (mandatory). Also
set items you want to modify/set and/or the `name` attribute to
rename the identity.
Can also take the name in string and then attributes to modif... | [
"Modify",
"some",
"attributes",
"of",
"an",
"identity",
"or",
"its",
"name",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L519-L545 |
54,002 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAccountClient.delete_identity | def delete_identity(self, identity):
""" Delete an identity from its name or id
:param: a zobjects.Identity object with name or id defined or a string
of the identity's name
"""
if isinstance(identity, zobjects.Identity):
self.request(
'DeleteIdentity... | python | def delete_identity(self, identity):
""" Delete an identity from its name or id
:param: a zobjects.Identity object with name or id defined or a string
of the identity's name
"""
if isinstance(identity, zobjects.Identity):
self.request(
'DeleteIdentity... | [
"def",
"delete_identity",
"(",
"self",
",",
"identity",
")",
":",
"if",
"isinstance",
"(",
"identity",
",",
"zobjects",
".",
"Identity",
")",
":",
"self",
".",
"request",
"(",
"'DeleteIdentity'",
",",
"{",
"'identity'",
":",
"identity",
".",
"to_selector",
... | Delete an identity from its name or id
:param: a zobjects.Identity object with name or id defined or a string
of the identity's name | [
"Delete",
"an",
"identity",
"from",
"its",
"name",
"or",
"id"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L547-L557 |
54,003 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient._get_or_fetch_id | def _get_or_fetch_id(self, zobj, fetch_func):
""" Returns the ID of a Zobject wether it's already known or not
If zobj.id is not known (frequent if zobj is a selector), fetches first
the object and then returns its ID.
:type zobj: a zobject subclass
:type fetch_func: the ... | python | def _get_or_fetch_id(self, zobj, fetch_func):
""" Returns the ID of a Zobject wether it's already known or not
If zobj.id is not known (frequent if zobj is a selector), fetches first
the object and then returns its ID.
:type zobj: a zobject subclass
:type fetch_func: the ... | [
"def",
"_get_or_fetch_id",
"(",
"self",
",",
"zobj",
",",
"fetch_func",
")",
":",
"try",
":",
"return",
"zobj",
".",
"id",
"except",
"AttributeError",
":",
"try",
":",
"return",
"fetch_func",
"(",
"zobj",
")",
".",
"id",
"except",
"AttributeError",
":",
... | Returns the ID of a Zobject wether it's already known or not
If zobj.id is not known (frequent if zobj is a selector), fetches first
the object and then returns its ID.
:type zobj: a zobject subclass
:type fetch_func: the function to fetch the zobj from server if its id
... | [
"Returns",
"the",
"ID",
"of",
"a",
"Zobject",
"wether",
"it",
"s",
"already",
"known",
"or",
"not"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L665-L683 |
54,004 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.get_calendar_resource | def get_calendar_resource(self, cal_resource):
""" Fetches an calendar resource with all its attributes.
:param account: a CalendarResource, with either id or
name attribute set.
:returns: a CalendarResource object, filled.
"""
selector = cal_resource.to_... | python | def get_calendar_resource(self, cal_resource):
""" Fetches an calendar resource with all its attributes.
:param account: a CalendarResource, with either id or
name attribute set.
:returns: a CalendarResource object, filled.
"""
selector = cal_resource.to_... | [
"def",
"get_calendar_resource",
"(",
"self",
",",
"cal_resource",
")",
":",
"selector",
"=",
"cal_resource",
".",
"to_selector",
"(",
")",
"resp",
"=",
"self",
".",
"request_single",
"(",
"'GetCalendarResource'",
",",
"{",
"'calresource'",
":",
"selector",
"}",
... | Fetches an calendar resource with all its attributes.
:param account: a CalendarResource, with either id or
name attribute set.
:returns: a CalendarResource object, filled. | [
"Fetches",
"an",
"calendar",
"resource",
"with",
"all",
"its",
"attributes",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L732-L742 |
54,005 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.get_mailbox_stats | def get_mailbox_stats(self):
""" Get global stats about mailboxes
Parses <stats numMboxes="6" totalSize="141077"/>
:returns: dict with stats
"""
resp = self.request_single('GetMailboxStats')
ret = {}
for k, v in resp.items():
ret[k] = int(v)
... | python | def get_mailbox_stats(self):
""" Get global stats about mailboxes
Parses <stats numMboxes="6" totalSize="141077"/>
:returns: dict with stats
"""
resp = self.request_single('GetMailboxStats')
ret = {}
for k, v in resp.items():
ret[k] = int(v)
... | [
"def",
"get_mailbox_stats",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"request_single",
"(",
"'GetMailboxStats'",
")",
"ret",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"resp",
".",
"items",
"(",
")",
":",
"ret",
"[",
"k",
"]",
"=",
"int",
... | Get global stats about mailboxes
Parses <stats numMboxes="6" totalSize="141077"/>
:returns: dict with stats | [
"Get",
"global",
"stats",
"about",
"mailboxes"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L794-L806 |
54,006 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.count_account | def count_account(self, domain):
""" Count the number of accounts for a given domain, sorted by cos
:returns: a list of pairs <ClassOfService object>,count
"""
selector = domain.to_selector()
cos_list = self.request_list('CountAccount', {'domain': selector})
ret = []
... | python | def count_account(self, domain):
""" Count the number of accounts for a given domain, sorted by cos
:returns: a list of pairs <ClassOfService object>,count
"""
selector = domain.to_selector()
cos_list = self.request_list('CountAccount', {'domain': selector})
ret = []
... | [
"def",
"count_account",
"(",
"self",
",",
"domain",
")",
":",
"selector",
"=",
"domain",
".",
"to_selector",
"(",
")",
"cos_list",
"=",
"self",
".",
"request_list",
"(",
"'CountAccount'",
",",
"{",
"'domain'",
":",
"selector",
"}",
")",
"ret",
"=",
"[",
... | Count the number of accounts for a given domain, sorted by cos
:returns: a list of pairs <ClassOfService object>,count | [
"Count",
"the",
"number",
"of",
"accounts",
"for",
"a",
"given",
"domain",
"sorted",
"by",
"cos"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L808-L821 |
54,007 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.get_account_cos | def get_account_cos(self, account):
""" Fetch the cos for a given account
Quite different from the original request which returns COS + various
URL + COS + zimbraMailHost... But all other informations are accessible
through get_account.
:type account: zobjects.Account
:... | python | def get_account_cos(self, account):
""" Fetch the cos for a given account
Quite different from the original request which returns COS + various
URL + COS + zimbraMailHost... But all other informations are accessible
through get_account.
:type account: zobjects.Account
:... | [
"def",
"get_account_cos",
"(",
"self",
",",
"account",
")",
":",
"resp",
"=",
"self",
".",
"request",
"(",
"'GetAccountInfo'",
",",
"{",
"'account'",
":",
"account",
".",
"to_selector",
"(",
")",
"}",
")",
"return",
"zobjects",
".",
"COS",
".",
"from_dic... | Fetch the cos for a given account
Quite different from the original request which returns COS + various
URL + COS + zimbraMailHost... But all other informations are accessible
through get_account.
:type account: zobjects.Account
:rtype: zobjects.COS | [
"Fetch",
"the",
"cos",
"for",
"a",
"given",
"account"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L838-L850 |
54,008 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.add_distribution_list_member | def add_distribution_list_member(self, distribution_list, members):
""" Adds members to the distribution list
:type distribution_list: zobjects.DistributionList
:param members: list of email addresses you want to add
:type members: list of str
"""
memb... | python | def add_distribution_list_member(self, distribution_list, members):
""" Adds members to the distribution list
:type distribution_list: zobjects.DistributionList
:param members: list of email addresses you want to add
:type members: list of str
"""
memb... | [
"def",
"add_distribution_list_member",
"(",
"self",
",",
"distribution_list",
",",
"members",
")",
":",
"members",
"=",
"[",
"{",
"'_content'",
":",
"v",
"}",
"for",
"v",
"in",
"members",
"]",
"resp",
"=",
"self",
".",
"request_single",
"(",
"'AddDistributio... | Adds members to the distribution list
:type distribution_list: zobjects.DistributionList
:param members: list of email addresses you want to add
:type members: list of str | [
"Adds",
"members",
"to",
"the",
"distribution",
"list"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1013-L1026 |
54,009 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.get_account | def get_account(self, account):
""" Fetches an account with all its attributes.
:param account: an account object, with either id or name attribute set
:returns: a zobjects.Account object, filled.
"""
selector = account.to_selector()
resp = self.request_single('GetAccoun... | python | def get_account(self, account):
""" Fetches an account with all its attributes.
:param account: an account object, with either id or name attribute set
:returns: a zobjects.Account object, filled.
"""
selector = account.to_selector()
resp = self.request_single('GetAccoun... | [
"def",
"get_account",
"(",
"self",
",",
"account",
")",
":",
"selector",
"=",
"account",
".",
"to_selector",
"(",
")",
"resp",
"=",
"self",
".",
"request_single",
"(",
"'GetAccount'",
",",
"{",
"'account'",
":",
"selector",
"}",
")",
"return",
"zobjects",
... | Fetches an account with all its attributes.
:param account: an account object, with either id or name attribute set
:returns: a zobjects.Account object, filled. | [
"Fetches",
"an",
"account",
"with",
"all",
"its",
"attributes",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1043-L1051 |
54,010 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.rename_account | def rename_account(self, account, new_name):
""" Rename an account.
:param account: a zobjects.Account
:param new_name: a string of new account name
"""
self.request('RenameAccount', {
'id': self._get_or_fetch_id(account, self.get_account),
'newName': new... | python | def rename_account(self, account, new_name):
""" Rename an account.
:param account: a zobjects.Account
:param new_name: a string of new account name
"""
self.request('RenameAccount', {
'id': self._get_or_fetch_id(account, self.get_account),
'newName': new... | [
"def",
"rename_account",
"(",
"self",
",",
"account",
",",
"new_name",
")",
":",
"self",
".",
"request",
"(",
"'RenameAccount'",
",",
"{",
"'id'",
":",
"self",
".",
"_get_or_fetch_id",
"(",
"account",
",",
"self",
".",
"get_account",
")",
",",
"'newName'",... | Rename an account.
:param account: a zobjects.Account
:param new_name: a string of new account name | [
"Rename",
"an",
"account",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1053-L1062 |
54,011 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.mk_auth_token | def mk_auth_token(self, account, admin=False, duration=0):
""" Builds an authentification token, using preauth mechanism.
See http://wiki.zimbra.com/wiki/Preauth
:param duration: in seconds defaults to 0, which means "use account
default"
:param account: an account obje... | python | def mk_auth_token(self, account, admin=False, duration=0):
""" Builds an authentification token, using preauth mechanism.
See http://wiki.zimbra.com/wiki/Preauth
:param duration: in seconds defaults to 0, which means "use account
default"
:param account: an account obje... | [
"def",
"mk_auth_token",
"(",
"self",
",",
"account",
",",
"admin",
"=",
"False",
",",
"duration",
"=",
"0",
")",
":",
"domain",
"=",
"account",
".",
"get_domain",
"(",
")",
"try",
":",
"preauth_key",
"=",
"self",
".",
"get_domain",
"(",
"domain",
")",
... | Builds an authentification token, using preauth mechanism.
See http://wiki.zimbra.com/wiki/Preauth
:param duration: in seconds defaults to 0, which means "use account
default"
:param account: an account object to be used as a selector
:returns: the auth string | [
"Builds",
"an",
"authentification",
"token",
"using",
"preauth",
"mechanism",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1133-L1152 |
54,012 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.delegate_auth | def delegate_auth(self, account):
""" Uses the DelegateAuthRequest to provide a ZimbraAccountClient
already logged with the provided account.
It's the mechanism used with the "view email" button in admin console.
"""
warnings.warn("delegate_auth() on parent client is deprecated,... | python | def delegate_auth(self, account):
""" Uses the DelegateAuthRequest to provide a ZimbraAccountClient
already logged with the provided account.
It's the mechanism used with the "view email" button in admin console.
"""
warnings.warn("delegate_auth() on parent client is deprecated,... | [
"def",
"delegate_auth",
"(",
"self",
",",
"account",
")",
":",
"warnings",
".",
"warn",
"(",
"\"delegate_auth() on parent client is deprecated,\"",
"\" use delegated_login() on child client instead\"",
",",
"DeprecationWarning",
")",
"selector",
"=",
"account",
".",
"to_sel... | Uses the DelegateAuthRequest to provide a ZimbraAccountClient
already logged with the provided account.
It's the mechanism used with the "view email" button in admin console. | [
"Uses",
"the",
"DelegateAuthRequest",
"to",
"provide",
"a",
"ZimbraAccountClient",
"already",
"logged",
"with",
"the",
"provided",
"account",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1154-L1171 |
54,013 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.get_account_authToken | def get_account_authToken(self, account=None, account_name=''):
""" Use the DelegateAuthRequest to provide a token and his lifetime
for the provided account.
If account is provided we use it,
else we retreive the account from the provided account_name.
"""
if account is ... | python | def get_account_authToken(self, account=None, account_name=''):
""" Use the DelegateAuthRequest to provide a token and his lifetime
for the provided account.
If account is provided we use it,
else we retreive the account from the provided account_name.
"""
if account is ... | [
"def",
"get_account_authToken",
"(",
"self",
",",
"account",
"=",
"None",
",",
"account_name",
"=",
"''",
")",
":",
"if",
"account",
"is",
"None",
":",
"account",
"=",
"self",
".",
"get_account",
"(",
"zobjects",
".",
"Account",
"(",
"name",
"=",
"accoun... | Use the DelegateAuthRequest to provide a token and his lifetime
for the provided account.
If account is provided we use it,
else we retreive the account from the provided account_name. | [
"Use",
"the",
"DelegateAuthRequest",
"to",
"provide",
"a",
"token",
"and",
"his",
"lifetime",
"for",
"the",
"provided",
"account",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1173-L1189 |
54,014 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAdminClient.search_directory | def search_directory(self, **kwargs):
"""
SearchAccount is deprecated, using SearchDirectory
:param query: Query string - should be an LDAP-style filter
string (RFC 2254)
:param limit: The maximum number of accounts to return
(0 is default and means all)
:param o... | python | def search_directory(self, **kwargs):
"""
SearchAccount is deprecated, using SearchDirectory
:param query: Query string - should be an LDAP-style filter
string (RFC 2254)
:param limit: The maximum number of accounts to return
(0 is default and means all)
:param o... | [
"def",
"search_directory",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"search_response",
"=",
"self",
".",
"request",
"(",
"'SearchDirectory'",
",",
"kwargs",
")",
"result",
"=",
"{",
"}",
"items",
"=",
"{",
"\"account\"",
":",
"zobjects",
".",
"Acc... | SearchAccount is deprecated, using SearchDirectory
:param query: Query string - should be an LDAP-style filter
string (RFC 2254)
:param limit: The maximum number of accounts to return
(0 is default and means all)
:param offset: The starting offset (0, 25, etc)
:param dom... | [
"SearchAccount",
"is",
"deprecated",
"using",
"SearchDirectory"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1195-L1245 |
54,015 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.create_task | def create_task(self, subject, desc):
"""Create a task
:param subject: the task's subject
:param desc: the task's content in plain-text
:returns: the task's id
"""
task = zobjects.Task()
task_creator = task.to_creator(subject, desc)
resp = self.request('C... | python | def create_task(self, subject, desc):
"""Create a task
:param subject: the task's subject
:param desc: the task's content in plain-text
:returns: the task's id
"""
task = zobjects.Task()
task_creator = task.to_creator(subject, desc)
resp = self.request('C... | [
"def",
"create_task",
"(",
"self",
",",
"subject",
",",
"desc",
")",
":",
"task",
"=",
"zobjects",
".",
"Task",
"(",
")",
"task_creator",
"=",
"task",
".",
"to_creator",
"(",
"subject",
",",
"desc",
")",
"resp",
"=",
"self",
".",
"request",
"(",
"'Cr... | Create a task
:param subject: the task's subject
:param desc: the task's content in plain-text
:returns: the task's id | [
"Create",
"a",
"task"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1366-L1377 |
54,016 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.get_task | def get_task(self, task_id):
"""Retrieve one task, discriminated by id.
:param: task_id: the task id
:returns: a zobjects.Task object ;
if no task is matching, returns None.
"""
task = self.request_single('GetTask', {'id': task_id})
if task:
... | python | def get_task(self, task_id):
"""Retrieve one task, discriminated by id.
:param: task_id: the task id
:returns: a zobjects.Task object ;
if no task is matching, returns None.
"""
task = self.request_single('GetTask', {'id': task_id})
if task:
... | [
"def",
"get_task",
"(",
"self",
",",
"task_id",
")",
":",
"task",
"=",
"self",
".",
"request_single",
"(",
"'GetTask'",
",",
"{",
"'id'",
":",
"task_id",
"}",
")",
"if",
"task",
":",
"return",
"zobjects",
".",
"Task",
".",
"from_dict",
"(",
"task",
"... | Retrieve one task, discriminated by id.
:param: task_id: the task id
:returns: a zobjects.Task object ;
if no task is matching, returns None. | [
"Retrieve",
"one",
"task",
"discriminated",
"by",
"id",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1379-L1392 |
54,017 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.create_contact | def create_contact(self, attrs, members=None, folder_id=None, tags=None):
"""Create a contact
Does not include VCARD nor group membership yet
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
<a n="firstName">Pierre</a>
<a n="email">p... | python | def create_contact(self, attrs, members=None, folder_id=None, tags=None):
"""Create a contact
Does not include VCARD nor group membership yet
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
<a n="firstName">Pierre</a>
<a n="email">p... | [
"def",
"create_contact",
"(",
"self",
",",
"attrs",
",",
"members",
"=",
"None",
",",
"folder_id",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"cn",
"=",
"{",
"}",
"if",
"folder_id",
":",
"cn",
"[",
"'l'",
"]",
"=",
"str",
"(",
"folder_id",
... | Create a contact
Does not include VCARD nor group membership yet
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
<a n="firstName">Pierre</a>
<a n="email">pmartin@example.com</a>
</cn>
Which would be in zimsoap : attrs = { 'l... | [
"Create",
"a",
"contact"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1396-L1432 |
54,018 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.get_contacts | def get_contacts(self, ids=None, **kwargs):
""" Get all contacts for the current user
:param l: string of a folder id
:param ids: An coma separated list of contact's ID to look for
:returns: a list of zobjects.Contact
"""
params = {}
if ids:
ids = se... | python | def get_contacts(self, ids=None, **kwargs):
""" Get all contacts for the current user
:param l: string of a folder id
:param ids: An coma separated list of contact's ID to look for
:returns: a list of zobjects.Contact
"""
params = {}
if ids:
ids = se... | [
"def",
"get_contacts",
"(",
"self",
",",
"ids",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"{",
"}",
"if",
"ids",
":",
"ids",
"=",
"self",
".",
"_return_comma_list",
"(",
"ids",
")",
"params",
"[",
"'cn'",
"]",
"=",
"{",
"'id'... | Get all contacts for the current user
:param l: string of a folder id
:param ids: An coma separated list of contact's ID to look for
:returns: a list of zobjects.Contact | [
"Get",
"all",
"contacts",
"for",
"the",
"current",
"user"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1434-L1455 |
54,019 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.delete_contacts | def delete_contacts(self, ids):
""" Delete selected contacts for the current user
:param ids: list of ids
"""
str_ids = self._return_comma_list(ids)
self.request('ContactAction', {'action': {'op': 'delete',
'id': str_ids}}) | python | def delete_contacts(self, ids):
""" Delete selected contacts for the current user
:param ids: list of ids
"""
str_ids = self._return_comma_list(ids)
self.request('ContactAction', {'action': {'op': 'delete',
'id': str_ids}}) | [
"def",
"delete_contacts",
"(",
"self",
",",
"ids",
")",
":",
"str_ids",
"=",
"self",
".",
"_return_comma_list",
"(",
"ids",
")",
"self",
".",
"request",
"(",
"'ContactAction'",
",",
"{",
"'action'",
":",
"{",
"'op'",
":",
"'delete'",
",",
"'id'",
":",
... | Delete selected contacts for the current user
:param ids: list of ids | [
"Delete",
"selected",
"contacts",
"for",
"the",
"current",
"user"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1481-L1489 |
54,020 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.create_group | def create_group(self, attrs, members, folder_id=None, tags=None):
"""Create a contact group
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
<a n="firstName">Pierre</a>
<a n="email">pmartin@example.com</a>
</cn>
Which would b... | python | def create_group(self, attrs, members, folder_id=None, tags=None):
"""Create a contact group
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
<a n="firstName">Pierre</a>
<a n="email">pmartin@example.com</a>
</cn>
Which would b... | [
"def",
"create_group",
"(",
"self",
",",
"attrs",
",",
"members",
",",
"folder_id",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"cn",
"=",
"{",
"}",
"cn",
"[",
"'m'",
"]",
"=",
"members",
"if",
"folder_id",
":",
"cn",
"[",
"'l'",
"]",
"=",
... | Create a contact group
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
<a n="firstName">Pierre</a>
<a n="email">pmartin@example.com</a>
</cn>
Which would be in zimsoap : attrs = { 'lastname': 'MARTIN',
... | [
"Create",
"a",
"contact",
"group"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1491-L1527 |
54,021 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.delete_conversations | def delete_conversations(self, ids):
""" Delete selected conversations
:params ids: list of ids
"""
str_ids = self._return_comma_list(ids)
self.request('ConvAction', {'action': {'op': 'delete',
'id': str_ids
... | python | def delete_conversations(self, ids):
""" Delete selected conversations
:params ids: list of ids
"""
str_ids = self._return_comma_list(ids)
self.request('ConvAction', {'action': {'op': 'delete',
'id': str_ids
... | [
"def",
"delete_conversations",
"(",
"self",
",",
"ids",
")",
":",
"str_ids",
"=",
"self",
".",
"_return_comma_list",
"(",
"ids",
")",
"self",
".",
"request",
"(",
"'ConvAction'",
",",
"{",
"'action'",
":",
"{",
"'op'",
":",
"'delete'",
",",
"'id'",
":",
... | Delete selected conversations
:params ids: list of ids | [
"Delete",
"selected",
"conversations"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1683-L1692 |
54,022 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.move_conversations | def move_conversations(self, ids, folder):
""" Move selected conversations to an other folder
:params ids: list of ids
:params folder: folder id
"""
str_ids = self._return_comma_list(ids)
self.request('ConvAction', {'action': {'op': 'move',
... | python | def move_conversations(self, ids, folder):
""" Move selected conversations to an other folder
:params ids: list of ids
:params folder: folder id
"""
str_ids = self._return_comma_list(ids)
self.request('ConvAction', {'action': {'op': 'move',
... | [
"def",
"move_conversations",
"(",
"self",
",",
"ids",
",",
"folder",
")",
":",
"str_ids",
"=",
"self",
".",
"_return_comma_list",
"(",
"ids",
")",
"self",
".",
"request",
"(",
"'ConvAction'",
",",
"{",
"'action'",
":",
"{",
"'op'",
":",
"'move'",
",",
... | Move selected conversations to an other folder
:params ids: list of ids
:params folder: folder id | [
"Move",
"selected",
"conversations",
"to",
"an",
"other",
"folder"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1694-L1704 |
54,023 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.add_message | def add_message(self, msg_content, folder, **kwargs):
""" Inject a message
:params string msg_content: The entire message's content.
:params string folder: Folder pathname (starts with '/') or folder ID
"""
content = {'m': kwargs}
content['m']['l'] = str(folder)
... | python | def add_message(self, msg_content, folder, **kwargs):
""" Inject a message
:params string msg_content: The entire message's content.
:params string folder: Folder pathname (starts with '/') or folder ID
"""
content = {'m': kwargs}
content['m']['l'] = str(folder)
... | [
"def",
"add_message",
"(",
"self",
",",
"msg_content",
",",
"folder",
",",
"*",
"*",
"kwargs",
")",
":",
"content",
"=",
"{",
"'m'",
":",
"kwargs",
"}",
"content",
"[",
"'m'",
"]",
"[",
"'l'",
"]",
"=",
"str",
"(",
"folder",
")",
"content",
"[",
... | Inject a message
:params string msg_content: The entire message's content.
:params string folder: Folder pathname (starts with '/') or folder ID | [
"Inject",
"a",
"message"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1708-L1718 |
54,024 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.move_messages | def move_messages(self, ids, folder_id):
""" Move selected messages to an other folder
:param msg_ids: list of message's ids to move
:param folder_id: folder's id where to move messages
"""
str_ids = self._return_comma_list(ids)
params = {'action': {
'id': st... | python | def move_messages(self, ids, folder_id):
""" Move selected messages to an other folder
:param msg_ids: list of message's ids to move
:param folder_id: folder's id where to move messages
"""
str_ids = self._return_comma_list(ids)
params = {'action': {
'id': st... | [
"def",
"move_messages",
"(",
"self",
",",
"ids",
",",
"folder_id",
")",
":",
"str_ids",
"=",
"self",
".",
"_return_comma_list",
"(",
"ids",
")",
"params",
"=",
"{",
"'action'",
":",
"{",
"'id'",
":",
"str_ids",
",",
"'op'",
":",
"'move'",
",",
"'l'",
... | Move selected messages to an other folder
:param msg_ids: list of message's ids to move
:param folder_id: folder's id where to move messages | [
"Move",
"selected",
"messages",
"to",
"an",
"other",
"folder"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1726-L1739 |
54,025 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.delete_messages | def delete_messages(self, ids):
""" Delete selected messages for the current user
:param ids: list of ids
"""
str_ids = self._return_comma_list(ids)
return self.request('MsgAction', {'action': {'op': 'delete',
'id': str_ids}}) | python | def delete_messages(self, ids):
""" Delete selected messages for the current user
:param ids: list of ids
"""
str_ids = self._return_comma_list(ids)
return self.request('MsgAction', {'action': {'op': 'delete',
'id': str_ids}}) | [
"def",
"delete_messages",
"(",
"self",
",",
"ids",
")",
":",
"str_ids",
"=",
"self",
".",
"_return_comma_list",
"(",
"ids",
")",
"return",
"self",
".",
"request",
"(",
"'MsgAction'",
",",
"{",
"'action'",
":",
"{",
"'op'",
":",
"'delete'",
",",
"'id'",
... | Delete selected messages for the current user
:param ids: list of ids | [
"Delete",
"selected",
"messages",
"for",
"the",
"current",
"user"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1762-L1769 |
54,026 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.search | def search(self, query, **kwargs):
""" Search object in account
:returns: a dic where value c contains the list of results (if there
is any). Example : {
'more': '0',
'offset': '0',
'sortBy': 'dateDesc',
'c': [
{
... | python | def search(self, query, **kwargs):
""" Search object in account
:returns: a dic where value c contains the list of results (if there
is any). Example : {
'more': '0',
'offset': '0',
'sortBy': 'dateDesc',
'c': [
{
... | [
"def",
"search",
"(",
"self",
",",
"query",
",",
"*",
"*",
"kwargs",
")",
":",
"content",
"=",
"kwargs",
"content",
"[",
"'query'",
"]",
"=",
"{",
"'_content'",
":",
"query",
"}",
"return",
"self",
".",
"request",
"(",
"'Search'",
",",
"content",
")"... | Search object in account
:returns: a dic where value c contains the list of results (if there
is any). Example : {
'more': '0',
'offset': '0',
'sortBy': 'dateDesc',
'c': [
{
'id': '-261',
'm': {'id':... | [
"Search",
"object",
"in",
"account"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1772-L1801 |
54,027 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.get_filter_rule | def get_filter_rule(self, _filter, way='in'):
""" Return the filter rule
:param: _filter a zobjects.FilterRule or the filter name
:param: way string discribing if filter is for 'in' or 'out' messages
:returns: a zobjects.FilterRule"""
if isinstance(_filter, zobjects.FilterRule):... | python | def get_filter_rule(self, _filter, way='in'):
""" Return the filter rule
:param: _filter a zobjects.FilterRule or the filter name
:param: way string discribing if filter is for 'in' or 'out' messages
:returns: a zobjects.FilterRule"""
if isinstance(_filter, zobjects.FilterRule):... | [
"def",
"get_filter_rule",
"(",
"self",
",",
"_filter",
",",
"way",
"=",
"'in'",
")",
":",
"if",
"isinstance",
"(",
"_filter",
",",
"zobjects",
".",
"FilterRule",
")",
":",
"_filter",
"=",
"_filter",
".",
"name",
"for",
"f",
"in",
"self",
".",
"get_filt... | Return the filter rule
:param: _filter a zobjects.FilterRule or the filter name
:param: way string discribing if filter is for 'in' or 'out' messages
:returns: a zobjects.FilterRule | [
"Return",
"the",
"filter",
"rule"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1982-L1993 |
54,028 | oasiswork/zimsoap | zimsoap/client.py | ZimbraMailClient.delete_filter_rule | def delete_filter_rule(self, _filter, way='in'):
""" delete a filter rule
:param: _filter a zobjects.FilterRule or the filter name
:param: way string discribing if filter is for 'in' or 'out' messages
:returns: a list of zobjects.FilterRule
"""
updated_rules = []
... | python | def delete_filter_rule(self, _filter, way='in'):
""" delete a filter rule
:param: _filter a zobjects.FilterRule or the filter name
:param: way string discribing if filter is for 'in' or 'out' messages
:returns: a list of zobjects.FilterRule
"""
updated_rules = []
... | [
"def",
"delete_filter_rule",
"(",
"self",
",",
"_filter",
",",
"way",
"=",
"'in'",
")",
":",
"updated_rules",
"=",
"[",
"]",
"rules",
"=",
"self",
".",
"get_filter_rules",
"(",
"way",
"=",
"way",
")",
"if",
"isinstance",
"(",
"_filter",
",",
"zobjects",
... | delete a filter rule
:param: _filter a zobjects.FilterRule or the filter name
:param: way string discribing if filter is for 'in' or 'out' messages
:returns: a list of zobjects.FilterRule | [
"delete",
"a",
"filter",
"rule"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L2042-L2071 |
54,029 | oasiswork/zimsoap | zimsoap/client.py | ZimbraAPISession.set_end_date | def set_end_date(self, lifetime):
"""Computes and store an absolute end_date session according to the
lifetime of the session"""
self.end_date = (datetime.datetime.now() +
datetime.timedelta(0, lifetime)) | python | def set_end_date(self, lifetime):
"""Computes and store an absolute end_date session according to the
lifetime of the session"""
self.end_date = (datetime.datetime.now() +
datetime.timedelta(0, lifetime)) | [
"def",
"set_end_date",
"(",
"self",
",",
"lifetime",
")",
":",
"self",
".",
"end_date",
"=",
"(",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"+",
"datetime",
".",
"timedelta",
"(",
"0",
",",
"lifetime",
")",
")"
] | Computes and store an absolute end_date session according to the
lifetime of the session | [
"Computes",
"and",
"store",
"an",
"absolute",
"end_date",
"session",
"according",
"to",
"the",
"lifetime",
"of",
"the",
"session"
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L2082-L2086 |
54,030 | AntagonistHQ/openprovider.py | openprovider/modules/extension.py | ExtensionModule.search_extension | def search_extension(self, limit=100, offset=0, **kw):
"""Search the list of available extensions."""
response = self.request(E.searchExtensionRequest(
E.limit(limit),
E.offset(offset),
E.withDescription(int(kw.get('with_description', 0))),
E.withPrice(in... | python | def search_extension(self, limit=100, offset=0, **kw):
"""Search the list of available extensions."""
response = self.request(E.searchExtensionRequest(
E.limit(limit),
E.offset(offset),
E.withDescription(int(kw.get('with_description', 0))),
E.withPrice(in... | [
"def",
"search_extension",
"(",
"self",
",",
"limit",
"=",
"100",
",",
"offset",
"=",
"0",
",",
"*",
"*",
"kw",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"searchExtensionRequest",
"(",
"E",
".",
"limit",
"(",
"limit",
")",
"... | Search the list of available extensions. | [
"Search",
"the",
"list",
"of",
"available",
"extensions",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/extension.py#L10-L20 |
54,031 | AntagonistHQ/openprovider.py | openprovider/modules/extension.py | ExtensionModule.retrieve_extension | def retrieve_extension(self, name, **kw):
"""Retrieve details on a single extension."""
response = self.request(E.retrieveExtensionRequest(
E.name(name),
E.withDescription(int(kw.get('with_description', 0))),
E.withPrice(int(kw.get('with_price', 0))),
E.w... | python | def retrieve_extension(self, name, **kw):
"""Retrieve details on a single extension."""
response = self.request(E.retrieveExtensionRequest(
E.name(name),
E.withDescription(int(kw.get('with_description', 0))),
E.withPrice(int(kw.get('with_price', 0))),
E.w... | [
"def",
"retrieve_extension",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kw",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"retrieveExtensionRequest",
"(",
"E",
".",
"name",
"(",
"name",
")",
",",
"E",
".",
"withDescription",
"(",
... | Retrieve details on a single extension. | [
"Retrieve",
"details",
"on",
"a",
"single",
"extension",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/extension.py#L22-L32 |
54,032 | cslarsen/crianza | crianza/instructions.py | lookup | def lookup(instruction, instructions = None):
"""Looks up instruction, which can either be a function or a string.
If it's a string, returns the corresponding method.
If it's a function, returns the corresponding name.
"""
if instructions is None:
instructions = default_instructions
if ... | python | def lookup(instruction, instructions = None):
"""Looks up instruction, which can either be a function or a string.
If it's a string, returns the corresponding method.
If it's a function, returns the corresponding name.
"""
if instructions is None:
instructions = default_instructions
if ... | [
"def",
"lookup",
"(",
"instruction",
",",
"instructions",
"=",
"None",
")",
":",
"if",
"instructions",
"is",
"None",
":",
"instructions",
"=",
"default_instructions",
"if",
"isinstance",
"(",
"instruction",
",",
"str",
")",
":",
"return",
"instructions",
"[",
... | Looks up instruction, which can either be a function or a string.
If it's a string, returns the corresponding method.
If it's a function, returns the corresponding name. | [
"Looks",
"up",
"instruction",
"which",
"can",
"either",
"be",
"a",
"function",
"or",
"a",
"string",
".",
"If",
"it",
"s",
"a",
"string",
"returns",
"the",
"corresponding",
"method",
".",
"If",
"it",
"s",
"a",
"function",
"returns",
"the",
"corresponding",
... | fa044f9d491f37cc06892bad14b2c80b8ac5a7cd | https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/instructions.py#L294-L309 |
54,033 | AntagonistHQ/openprovider.py | openprovider/modules/reseller.py | ResellerModule.retrieve | def retrieve(self):
"""
Retrieve contact information on ourselves.
"""
response = self.request(E.retrieveResellerRequest())
return Reseller(response.data) | python | def retrieve(self):
"""
Retrieve contact information on ourselves.
"""
response = self.request(E.retrieveResellerRequest())
return Reseller(response.data) | [
"def",
"retrieve",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"retrieveResellerRequest",
"(",
")",
")",
"return",
"Reseller",
"(",
"response",
".",
"data",
")"
] | Retrieve contact information on ourselves. | [
"Retrieve",
"contact",
"information",
"on",
"ourselves",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/reseller.py#L10-L15 |
54,034 | Seeed-Studio/wio-cli | wio/commands/cmd_call.py | cli | def cli(wio, method, endpoint, token,):
'''
Request api, return json.
\b
DOES:
Call a api on your devices.
token: device_token
method: GET or POST
endpoint: device_path, such as: /v1/node/GroveTempHumProD0/temperature
wio call <device_token> <request_method> <dev... | python | def cli(wio, method, endpoint, token,):
'''
Request api, return json.
\b
DOES:
Call a api on your devices.
token: device_token
method: GET or POST
endpoint: device_path, such as: /v1/node/GroveTempHumProD0/temperature
wio call <device_token> <request_method> <dev... | [
"def",
"cli",
"(",
"wio",
",",
"method",
",",
"endpoint",
",",
"token",
",",
")",
":",
"user_token",
"=",
"wio",
".",
"config",
".",
"get",
"(",
"\"token\"",
",",
"None",
")",
"api_prefix",
"=",
"wio",
".",
"config",
".",
"get",
"(",
"\"mserver\"",
... | Request api, return json.
\b
DOES:
Call a api on your devices.
token: device_token
method: GET or POST
endpoint: device_path, such as: /v1/node/GroveTempHumProD0/temperature
wio call <device_token> <request_method> <device_path>
\b
EXAMPLE:
wio call 98dd... | [
"Request",
"api",
"return",
"json",
"."
] | ce83f4c2d30be7f72d1a128acd123dfc5effa563 | https://github.com/Seeed-Studio/wio-cli/blob/ce83f4c2d30be7f72d1a128acd123dfc5effa563/wio/commands/cmd_call.py#L14-L61 |
54,035 | gmr/tinman | tinman/decorators/whitelist.py | whitelisted | def whitelisted(argument=None):
"""Decorates a method requiring that the requesting IP address is
whitelisted. Requires a whitelist value as a list in the
Application.settings dictionary. IP addresses can be an individual IP
address or a subnet.
Examples:
['10.0.0.0/8','192.168.1.0/24', '1.... | python | def whitelisted(argument=None):
"""Decorates a method requiring that the requesting IP address is
whitelisted. Requires a whitelist value as a list in the
Application.settings dictionary. IP addresses can be an individual IP
address or a subnet.
Examples:
['10.0.0.0/8','192.168.1.0/24', '1.... | [
"def",
"whitelisted",
"(",
"argument",
"=",
"None",
")",
":",
"def",
"is_whitelisted",
"(",
"remote_ip",
",",
"whitelist",
")",
":",
"\"\"\"Check to see if an IP address is whitelisted.\n\n :param str ip_address: The IP address to check\n :param list whitelist: The whit... | Decorates a method requiring that the requesting IP address is
whitelisted. Requires a whitelist value as a list in the
Application.settings dictionary. IP addresses can be an individual IP
address or a subnet.
Examples:
['10.0.0.0/8','192.168.1.0/24', '1.2.3.4/32']
:param list argument: L... | [
"Decorates",
"a",
"method",
"requiring",
"that",
"the",
"requesting",
"IP",
"address",
"is",
"whitelisted",
".",
"Requires",
"a",
"whitelist",
"value",
"as",
"a",
"list",
"in",
"the",
"Application",
".",
"settings",
"dictionary",
".",
"IP",
"addresses",
"can",... | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/decorators/whitelist.py#L10-L108 |
54,036 | synw/dataswim | dataswim/data/stats.py | Stats.lreg | def lreg(self, xcol, ycol, name="Regression"):
"""
Add a column to the main dataframe populted with
the model's linear regression for a column
"""
try:
x = self.df[xcol].values.reshape(-1, 1)
y = self.df[ycol]
lm = linear_model.LinearRegression... | python | def lreg(self, xcol, ycol, name="Regression"):
"""
Add a column to the main dataframe populted with
the model's linear regression for a column
"""
try:
x = self.df[xcol].values.reshape(-1, 1)
y = self.df[ycol]
lm = linear_model.LinearRegression... | [
"def",
"lreg",
"(",
"self",
",",
"xcol",
",",
"ycol",
",",
"name",
"=",
"\"Regression\"",
")",
":",
"try",
":",
"x",
"=",
"self",
".",
"df",
"[",
"xcol",
"]",
".",
"values",
".",
"reshape",
"(",
"-",
"1",
",",
"1",
")",
"y",
"=",
"self",
".",... | Add a column to the main dataframe populted with
the model's linear regression for a column | [
"Add",
"a",
"column",
"to",
"the",
"main",
"dataframe",
"populted",
"with",
"the",
"model",
"s",
"linear",
"regression",
"for",
"a",
"column"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/stats.py#L8-L21 |
54,037 | synw/dataswim | dataswim/data/stats.py | Stats.cvar_ | def cvar_(self, col):
"""
Returns the coefficient of variance of a column
in percentage
"""
try:
v = (np.std(self.df[col]) / np.mean(self.df[col])) * 100
return v
except Exception as e:
self.err(e,
"Can not calculat... | python | def cvar_(self, col):
"""
Returns the coefficient of variance of a column
in percentage
"""
try:
v = (np.std(self.df[col]) / np.mean(self.df[col])) * 100
return v
except Exception as e:
self.err(e,
"Can not calculat... | [
"def",
"cvar_",
"(",
"self",
",",
"col",
")",
":",
"try",
":",
"v",
"=",
"(",
"np",
".",
"std",
"(",
"self",
".",
"df",
"[",
"col",
"]",
")",
"/",
"np",
".",
"mean",
"(",
"self",
".",
"df",
"[",
"col",
"]",
")",
")",
"*",
"100",
"return",... | Returns the coefficient of variance of a column
in percentage | [
"Returns",
"the",
"coefficient",
"of",
"variance",
"of",
"a",
"column",
"in",
"percentage"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/stats.py#L23-L33 |
54,038 | wummel/dosage | dosagelib/plugins/p.py | PennyArcade.starter | def starter(cls):
"""Get bounced start URL."""
data = cls.getPage(cls.url)
url1 = cls.fetchUrl(cls.url, data, cls.prevSearch)
data = cls.getPage(url1)
url2 = cls.fetchUrl(url1, data, cls.nextSearch)
return cls.prevUrlModifier(url2) | python | def starter(cls):
"""Get bounced start URL."""
data = cls.getPage(cls.url)
url1 = cls.fetchUrl(cls.url, data, cls.prevSearch)
data = cls.getPage(url1)
url2 = cls.fetchUrl(url1, data, cls.nextSearch)
return cls.prevUrlModifier(url2) | [
"def",
"starter",
"(",
"cls",
")",
":",
"data",
"=",
"cls",
".",
"getPage",
"(",
"cls",
".",
"url",
")",
"url1",
"=",
"cls",
".",
"fetchUrl",
"(",
"cls",
".",
"url",
",",
"data",
",",
"cls",
".",
"prevSearch",
")",
"data",
"=",
"cls",
".",
"get... | Get bounced start URL. | [
"Get",
"bounced",
"start",
"URL",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/p.py#L93-L99 |
54,039 | wummel/dosage | dosagelib/plugins/p.py | PokeyThePenguin.getPrevUrl | def getPrevUrl(self, url, data):
"""Decrease index.html number."""
mo = compile(r"index(\d+)\.html").search(url)
num = int(mo.group(1)) - 1
prefix = url.rsplit('/', 1)[0]
return "%s/index%d.html" % (prefix, num) | python | def getPrevUrl(self, url, data):
"""Decrease index.html number."""
mo = compile(r"index(\d+)\.html").search(url)
num = int(mo.group(1)) - 1
prefix = url.rsplit('/', 1)[0]
return "%s/index%d.html" % (prefix, num) | [
"def",
"getPrevUrl",
"(",
"self",
",",
"url",
",",
"data",
")",
":",
"mo",
"=",
"compile",
"(",
"r\"index(\\d+)\\.html\"",
")",
".",
"search",
"(",
"url",
")",
"num",
"=",
"int",
"(",
"mo",
".",
"group",
"(",
"1",
")",
")",
"-",
"1",
"prefix",
"=... | Decrease index.html number. | [
"Decrease",
"index",
".",
"html",
"number",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/p.py#L193-L198 |
54,040 | gmr/tinman | tinman/auth/digest.py | digest_auth | def digest_auth(realm, auth_func):
"""A decorator used to protect methods with HTTP Digest authentication.
"""
def digest_auth_decorator(func):
def func_replacement(self, *args, **kwargs):
# 'self' here is the RequestHandler object, which is inheriting
# from DigestAuthMixin... | python | def digest_auth(realm, auth_func):
"""A decorator used to protect methods with HTTP Digest authentication.
"""
def digest_auth_decorator(func):
def func_replacement(self, *args, **kwargs):
# 'self' here is the RequestHandler object, which is inheriting
# from DigestAuthMixin... | [
"def",
"digest_auth",
"(",
"realm",
",",
"auth_func",
")",
":",
"def",
"digest_auth_decorator",
"(",
"func",
")",
":",
"def",
"func_replacement",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# 'self' here is the RequestHandler object, which... | A decorator used to protect methods with HTTP Digest authentication. | [
"A",
"decorator",
"used",
"to",
"protect",
"methods",
"with",
"HTTP",
"Digest",
"authentication",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/auth/digest.py#L161-L172 |
54,041 | synw/dataswim | dataswim/charts/colors.py | Colors.color_ | def color_(self, i=None):
"""
Get a color from the palette
"""
global palette, color_num
if i is not None:
color_num = i
if color_num == len(palette) - 1:
color_num = 0
res = palette[color_num]
color_num += 1
return res | python | def color_(self, i=None):
"""
Get a color from the palette
"""
global palette, color_num
if i is not None:
color_num = i
if color_num == len(palette) - 1:
color_num = 0
res = palette[color_num]
color_num += 1
return res | [
"def",
"color_",
"(",
"self",
",",
"i",
"=",
"None",
")",
":",
"global",
"palette",
",",
"color_num",
"if",
"i",
"is",
"not",
"None",
":",
"color_num",
"=",
"i",
"if",
"color_num",
"==",
"len",
"(",
"palette",
")",
"-",
"1",
":",
"color_num",
"=",
... | Get a color from the palette | [
"Get",
"a",
"color",
"from",
"the",
"palette"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/colors.py#L19-L30 |
54,042 | synw/dataswim | dataswim/charts/colors.py | Colors.scolor | def scolor(self):
"""
Set a unique color from a serie
"""
global palette
color = palette[self.color_index]
if len(palette) - 1 == self.color_index:
self.color_index = 0
else:
self.color_index += 1
self.color(color) | python | def scolor(self):
"""
Set a unique color from a serie
"""
global palette
color = palette[self.color_index]
if len(palette) - 1 == self.color_index:
self.color_index = 0
else:
self.color_index += 1
self.color(color) | [
"def",
"scolor",
"(",
"self",
")",
":",
"global",
"palette",
"color",
"=",
"palette",
"[",
"self",
".",
"color_index",
"]",
"if",
"len",
"(",
"palette",
")",
"-",
"1",
"==",
"self",
".",
"color_index",
":",
"self",
".",
"color_index",
"=",
"0",
"else... | Set a unique color from a serie | [
"Set",
"a",
"unique",
"color",
"from",
"a",
"serie"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/colors.py#L32-L42 |
54,043 | Seeed-Studio/wio-cli | wio/commands/cmd_login.py | cli | def cli(wio):
'''
Login with your Wio account.
\b
DOES:
Login and save an access token for interacting with your account on the Wio.
\b
USE:
wio login
'''
mserver = wio.config.get("mserver", None)
if mserver:
click.echo(click.style('> ', fg='green') + "Curre... | python | def cli(wio):
'''
Login with your Wio account.
\b
DOES:
Login and save an access token for interacting with your account on the Wio.
\b
USE:
wio login
'''
mserver = wio.config.get("mserver", None)
if mserver:
click.echo(click.style('> ', fg='green') + "Curre... | [
"def",
"cli",
"(",
"wio",
")",
":",
"mserver",
"=",
"wio",
".",
"config",
".",
"get",
"(",
"\"mserver\"",
",",
"None",
")",
"if",
"mserver",
":",
"click",
".",
"echo",
"(",
"click",
".",
"style",
"(",
"'> '",
",",
"fg",
"=",
"'green'",
")",
"+",
... | Login with your Wio account.
\b
DOES:
Login and save an access token for interacting with your account on the Wio.
\b
USE:
wio login | [
"Login",
"with",
"your",
"Wio",
"account",
"."
] | ce83f4c2d30be7f72d1a128acd123dfc5effa563 | https://github.com/Seeed-Studio/wio-cli/blob/ce83f4c2d30be7f72d1a128acd123dfc5effa563/wio/commands/cmd_login.py#L17-L84 |
54,044 | Seeed-Studio/wio-cli | wio/commands/cmd_setup.py | get_new | def get_new(mserver_url, token, board):
'''get node sn and key'''
thread = termui.waiting_echo("Getting message from Server...")
thread.daemon = True
thread.start()
try:
params = {"name":"node000", "board":board, "access_token":token}
r = requests.post("%s%s" %(mserver_url, nodes_cre... | python | def get_new(mserver_url, token, board):
'''get node sn and key'''
thread = termui.waiting_echo("Getting message from Server...")
thread.daemon = True
thread.start()
try:
params = {"name":"node000", "board":board, "access_token":token}
r = requests.post("%s%s" %(mserver_url, nodes_cre... | [
"def",
"get_new",
"(",
"mserver_url",
",",
"token",
",",
"board",
")",
":",
"thread",
"=",
"termui",
".",
"waiting_echo",
"(",
"\"Getting message from Server...\"",
")",
"thread",
".",
"daemon",
"=",
"True",
"thread",
".",
"start",
"(",
")",
"try",
":",
"p... | get node sn and key | [
"get",
"node",
"sn",
"and",
"key"
] | ce83f4c2d30be7f72d1a128acd123dfc5effa563 | https://github.com/Seeed-Studio/wio-cli/blob/ce83f4c2d30be7f72d1a128acd123dfc5effa563/wio/commands/cmd_setup.py#L24-L52 |
54,045 | wummel/dosage | scripts/create-cbz.py | is_image | def is_image(filename):
"""Determine if given filename is an image."""
# note: isfile() also accepts symlinks
return os.path.isfile(filename) and filename.lower().endswith(ImageExts) | python | def is_image(filename):
"""Determine if given filename is an image."""
# note: isfile() also accepts symlinks
return os.path.isfile(filename) and filename.lower().endswith(ImageExts) | [
"def",
"is_image",
"(",
"filename",
")",
":",
"# note: isfile() also accepts symlinks",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
"and",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"ImageExts",
")"
] | Determine if given filename is an image. | [
"Determine",
"if",
"given",
"filename",
"is",
"an",
"image",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/create-cbz.py#L24-L27 |
54,046 | wummel/dosage | scripts/create-cbz.py | create_cbz | def create_cbz(directory):
"""Creates or updates a CBZ from files in the given comic directory."""
if not os.path.isdir(directory):
print("ERROR: Directory", directory, "not found.")
return
base = os.path.basename(directory.rstrip(os.path.sep))
zipname = '%s.cbz' % base
zipname = os.... | python | def create_cbz(directory):
"""Creates or updates a CBZ from files in the given comic directory."""
if not os.path.isdir(directory):
print("ERROR: Directory", directory, "not found.")
return
base = os.path.basename(directory.rstrip(os.path.sep))
zipname = '%s.cbz' % base
zipname = os.... | [
"def",
"create_cbz",
"(",
"directory",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"directory",
")",
":",
"print",
"(",
"\"ERROR: Directory\"",
",",
"directory",
",",
"\"not found.\"",
")",
"return",
"base",
"=",
"os",
".",
"path",
".",
... | Creates or updates a CBZ from files in the given comic directory. | [
"Creates",
"or",
"updates",
"a",
"CBZ",
"from",
"files",
"in",
"the",
"given",
"comic",
"directory",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/create-cbz.py#L37-L57 |
54,047 | ojii/django-multilingual-ng | multilingual/translation.py | translation_save_translated_fields | def translation_save_translated_fields(instance, **kwargs):
"""
Save all the translations of instance in post_save signal handler.
"""
if not hasattr(instance, '_translation_cache'):
return
for l_id, translation in instance._translation_cache.iteritems():
# set the translation ID jus... | python | def translation_save_translated_fields(instance, **kwargs):
"""
Save all the translations of instance in post_save signal handler.
"""
if not hasattr(instance, '_translation_cache'):
return
for l_id, translation in instance._translation_cache.iteritems():
# set the translation ID jus... | [
"def",
"translation_save_translated_fields",
"(",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"instance",
",",
"'_translation_cache'",
")",
":",
"return",
"for",
"l_id",
",",
"translation",
"in",
"instance",
".",
"_translation_cac... | Save all the translations of instance in post_save signal handler. | [
"Save",
"all",
"the",
"translations",
"of",
"instance",
"in",
"post_save",
"signal",
"handler",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L22-L36 |
54,048 | ojii/django-multilingual-ng | multilingual/translation.py | fill_translation_cache | def fill_translation_cache(instance):
"""
Fill the translation cache using information received in the
instance objects as extra fields.
You can not do this in post_init because the extra fields are
assigned by QuerySet.iterator after model initialization.
"""
if hasattr(instance, '_transl... | python | def fill_translation_cache(instance):
"""
Fill the translation cache using information received in the
instance objects as extra fields.
You can not do this in post_init because the extra fields are
assigned by QuerySet.iterator after model initialization.
"""
if hasattr(instance, '_transl... | [
"def",
"fill_translation_cache",
"(",
"instance",
")",
":",
"if",
"hasattr",
"(",
"instance",
",",
"'_translation_cache'",
")",
":",
"# do not refill the cache",
"return",
"instance",
".",
"_translation_cache",
"=",
"{",
"}",
"# unsafed instances cannot have translations"... | Fill the translation cache using information received in the
instance objects as extra fields.
You can not do this in post_init because the extra fields are
assigned by QuerySet.iterator after model initialization. | [
"Fill",
"the",
"translation",
"cache",
"using",
"information",
"received",
"in",
"the",
"instance",
"objects",
"as",
"extra",
"fields",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L38-L80 |
54,049 | ojii/django-multilingual-ng | multilingual/translation.py | getter_generator | def getter_generator(field_name, short_description):
"""
Generate get_'field name' method for field field_name.
"""
def get_translation_field(cls, language_code=None, fallback=False):
try:
return cls.get_translation(language_code,
fallback=fallb... | python | def getter_generator(field_name, short_description):
"""
Generate get_'field name' method for field field_name.
"""
def get_translation_field(cls, language_code=None, fallback=False):
try:
return cls.get_translation(language_code,
fallback=fallb... | [
"def",
"getter_generator",
"(",
"field_name",
",",
"short_description",
")",
":",
"def",
"get_translation_field",
"(",
"cls",
",",
"language_code",
"=",
"None",
",",
"fallback",
"=",
"False",
")",
":",
"try",
":",
"return",
"cls",
".",
"get_translation",
"(",
... | Generate get_'field name' method for field field_name. | [
"Generate",
"get_",
"field",
"name",
"method",
"for",
"field",
"field_name",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L118-L130 |
54,050 | ojii/django-multilingual-ng | multilingual/translation.py | setter_generator | def setter_generator(field_name):
"""
Generate set_'field name' method for field field_name.
"""
def set_translation_field(cls, value, language_code=None):
setattr(cls.get_translation(language_code, True),
field_name, value)
set_translation_field.short_description = "set " + ... | python | def setter_generator(field_name):
"""
Generate set_'field name' method for field field_name.
"""
def set_translation_field(cls, value, language_code=None):
setattr(cls.get_translation(language_code, True),
field_name, value)
set_translation_field.short_description = "set " + ... | [
"def",
"setter_generator",
"(",
"field_name",
")",
":",
"def",
"set_translation_field",
"(",
"cls",
",",
"value",
",",
"language_code",
"=",
"None",
")",
":",
"setattr",
"(",
"cls",
".",
"get_translation",
"(",
"language_code",
",",
"True",
")",
",",
"field_... | Generate set_'field name' method for field field_name. | [
"Generate",
"set_",
"field",
"name",
"method",
"for",
"field",
"field_name",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L132-L140 |
54,051 | ojii/django-multilingual-ng | multilingual/translation.py | get_translation | def get_translation(cls, language_code, create_if_necessary=False,
fallback=False, field=None):
"""
Get a translation instance for the given `language_id_or_code`.
If the translation does not exist:
1. if `create_if_necessary` is True, this function will create one
2. otherwise... | python | def get_translation(cls, language_code, create_if_necessary=False,
fallback=False, field=None):
"""
Get a translation instance for the given `language_id_or_code`.
If the translation does not exist:
1. if `create_if_necessary` is True, this function will create one
2. otherwise... | [
"def",
"get_translation",
"(",
"cls",
",",
"language_code",
",",
"create_if_necessary",
"=",
"False",
",",
"fallback",
"=",
"False",
",",
"field",
"=",
"None",
")",
":",
"# fill the cache if necessary",
"cls",
".",
"fill_translation_cache",
"(",
")",
"if",
"lang... | Get a translation instance for the given `language_id_or_code`.
If the translation does not exist:
1. if `create_if_necessary` is True, this function will create one
2. otherwise, if `fallback` is True, this function will search the
list of languages looking for the first existing translation
3... | [
"Get",
"a",
"translation",
"instance",
"for",
"the",
"given",
"language_id_or_code",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L142-L192 |
54,052 | ojii/django-multilingual-ng | multilingual/translation.py | TranslationModel.contribute_to_class | def contribute_to_class(cls, main_cls, name):
"""
Handle the inner 'Translation' class.
"""
# delay the creation of the *Translation until the master model is
# fully created
signals.class_prepared.connect(cls.finish_multilingual_class,
sender=main_cls, w... | python | def contribute_to_class(cls, main_cls, name):
"""
Handle the inner 'Translation' class.
"""
# delay the creation of the *Translation until the master model is
# fully created
signals.class_prepared.connect(cls.finish_multilingual_class,
sender=main_cls, w... | [
"def",
"contribute_to_class",
"(",
"cls",
",",
"main_cls",
",",
"name",
")",
":",
"# delay the creation of the *Translation until the master model is",
"# fully created",
"signals",
".",
"class_prepared",
".",
"connect",
"(",
"cls",
".",
"finish_multilingual_class",
",",
... | Handle the inner 'Translation' class. | [
"Handle",
"the",
"inner",
"Translation",
"class",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L199-L212 |
54,053 | ojii/django-multilingual-ng | multilingual/translation.py | TranslationModel.get_unique_fields | def get_unique_fields(cls):
"""
Return a list of fields with "unique" attribute, which needs to
be augmented by the language.
"""
unique_fields = []
for fname, field in cls.__dict__.items():
if isinstance(field, models.fields.Field):
if getatt... | python | def get_unique_fields(cls):
"""
Return a list of fields with "unique" attribute, which needs to
be augmented by the language.
"""
unique_fields = []
for fname, field in cls.__dict__.items():
if isinstance(field, models.fields.Field):
if getatt... | [
"def",
"get_unique_fields",
"(",
"cls",
")",
":",
"unique_fields",
"=",
"[",
"]",
"for",
"fname",
",",
"field",
"in",
"cls",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"field",
",",
"models",
".",
"fields",
".",
"Field",
"... | Return a list of fields with "unique" attribute, which needs to
be augmented by the language. | [
"Return",
"a",
"list",
"of",
"fields",
"with",
"unique",
"attribute",
"which",
"needs",
"to",
"be",
"augmented",
"by",
"the",
"language",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L268-L288 |
54,054 | ojii/django-multilingual-ng | multilingual/translation.py | TranslationModel.finish_multilingual_class | def finish_multilingual_class(cls, *args, **kwargs):
"""
Create a model with translations of a multilingual class.
"""
main_cls = kwargs['sender']
translation_model_name = main_cls.__name__ + "Translation"
# create the model with all the translatable fields
uniq... | python | def finish_multilingual_class(cls, *args, **kwargs):
"""
Create a model with translations of a multilingual class.
"""
main_cls = kwargs['sender']
translation_model_name = main_cls.__name__ + "Translation"
# create the model with all the translatable fields
uniq... | [
"def",
"finish_multilingual_class",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"main_cls",
"=",
"kwargs",
"[",
"'sender'",
"]",
"translation_model_name",
"=",
"main_cls",
".",
"__name__",
"+",
"\"Translation\"",
"# create the model with all t... | Create a model with translations of a multilingual class. | [
"Create",
"a",
"model",
"with",
"translations",
"of",
"a",
"multilingual",
"class",
"."
] | 0d320a0732ec59949380d4b5f21e153174d3ecf7 | https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L291-L356 |
54,055 | wummel/dosage | dosagelib/plugins/s.py | SabrinaOnline.starter | def starter(cls):
"""Pick last one in a list of archive pages."""
archive = cls.url + 'archive.html'
data = getPageContent(archive, cls.session)
search = compile(tagre("a", "href", r"(\d\d\d\d-\d\d.html)"))
archivepages = search.findall(data)
return cls.url + archivepages... | python | def starter(cls):
"""Pick last one in a list of archive pages."""
archive = cls.url + 'archive.html'
data = getPageContent(archive, cls.session)
search = compile(tagre("a", "href", r"(\d\d\d\d-\d\d.html)"))
archivepages = search.findall(data)
return cls.url + archivepages... | [
"def",
"starter",
"(",
"cls",
")",
":",
"archive",
"=",
"cls",
".",
"url",
"+",
"'archive.html'",
"data",
"=",
"getPageContent",
"(",
"archive",
",",
"cls",
".",
"session",
")",
"search",
"=",
"compile",
"(",
"tagre",
"(",
"\"a\"",
",",
"\"href\"",
","... | Pick last one in a list of archive pages. | [
"Pick",
"last",
"one",
"in",
"a",
"list",
"of",
"archive",
"pages",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/s.py#L23-L29 |
54,056 | wummel/dosage | dosagelib/plugins/s.py | SleeplessDomain.namer | def namer(cls, imageUrl, pageUrl):
"""Image file name is UNIX time stamp & something for most of the comics..."""
start = ''
tsmatch = compile(r'/(\d+)-').search(imageUrl)
if tsmatch:
start = datetime.utcfromtimestamp(int(tsmatch.group(1))).strftime("%Y-%m-%d")
else:
... | python | def namer(cls, imageUrl, pageUrl):
"""Image file name is UNIX time stamp & something for most of the comics..."""
start = ''
tsmatch = compile(r'/(\d+)-').search(imageUrl)
if tsmatch:
start = datetime.utcfromtimestamp(int(tsmatch.group(1))).strftime("%Y-%m-%d")
else:
... | [
"def",
"namer",
"(",
"cls",
",",
"imageUrl",
",",
"pageUrl",
")",
":",
"start",
"=",
"''",
"tsmatch",
"=",
"compile",
"(",
"r'/(\\d+)-'",
")",
".",
"search",
"(",
"imageUrl",
")",
"if",
"tsmatch",
":",
"start",
"=",
"datetime",
".",
"utcfromtimestamp",
... | Image file name is UNIX time stamp & something for most of the comics... | [
"Image",
"file",
"name",
"is",
"UNIX",
"time",
"stamp",
"&",
"something",
"for",
"most",
"of",
"the",
"comics",
"..."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/s.py#L259-L269 |
54,057 | wummel/dosage | dosagelib/plugins/s.py | SnowFlakes.namer | def namer(cls, imageUrl, pageUrl):
"""Use strip index number for image name."""
index = int(compile(r'id=(\d+)').search(pageUrl).group(1))
ext = imageUrl.rsplit('.', 1)[1]
return "SnowFlakes-%d.%s" % (index, ext) | python | def namer(cls, imageUrl, pageUrl):
"""Use strip index number for image name."""
index = int(compile(r'id=(\d+)').search(pageUrl).group(1))
ext = imageUrl.rsplit('.', 1)[1]
return "SnowFlakes-%d.%s" % (index, ext) | [
"def",
"namer",
"(",
"cls",
",",
"imageUrl",
",",
"pageUrl",
")",
":",
"index",
"=",
"int",
"(",
"compile",
"(",
"r'id=(\\d+)'",
")",
".",
"search",
"(",
"pageUrl",
")",
".",
"group",
"(",
"1",
")",
")",
"ext",
"=",
"imageUrl",
".",
"rsplit",
"(",
... | Use strip index number for image name. | [
"Use",
"strip",
"index",
"number",
"for",
"image",
"name",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/s.py#L332-L336 |
54,058 | wummel/dosage | dosagelib/plugins/s.py | StuffNoOneToldMe.namer | def namer(cls, imageUrl, pageUrl):
"""Use page URL to construct meaningful image name."""
parts, year, month, stripname = pageUrl.rsplit('/', 3)
stripname = stripname.rsplit('.', 1)[0]
parts, imagename = imageUrl.rsplit('/', 1)
return '%s-%s-%s-%s' % (year, month, stripname, imag... | python | def namer(cls, imageUrl, pageUrl):
"""Use page URL to construct meaningful image name."""
parts, year, month, stripname = pageUrl.rsplit('/', 3)
stripname = stripname.rsplit('.', 1)[0]
parts, imagename = imageUrl.rsplit('/', 1)
return '%s-%s-%s-%s' % (year, month, stripname, imag... | [
"def",
"namer",
"(",
"cls",
",",
"imageUrl",
",",
"pageUrl",
")",
":",
"parts",
",",
"year",
",",
"month",
",",
"stripname",
"=",
"pageUrl",
".",
"rsplit",
"(",
"'/'",
",",
"3",
")",
"stripname",
"=",
"stripname",
".",
"rsplit",
"(",
"'.'",
",",
"1... | Use page URL to construct meaningful image name. | [
"Use",
"page",
"URL",
"to",
"construct",
"meaningful",
"image",
"name",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/s.py#L481-L486 |
54,059 | matthiask/django-cte-forest | cte_forest/query.py | CTEQuery.get_compiler | def get_compiler(self, using=None, connection=None):
""" Overrides the Query method get_compiler in order to return
an instance of the above custom compiler.
"""
# Copy the body of this method from Django except the final
# return statement. We will ignore code coverage for t... | python | def get_compiler(self, using=None, connection=None):
""" Overrides the Query method get_compiler in order to return
an instance of the above custom compiler.
"""
# Copy the body of this method from Django except the final
# return statement. We will ignore code coverage for t... | [
"def",
"get_compiler",
"(",
"self",
",",
"using",
"=",
"None",
",",
"connection",
"=",
"None",
")",
":",
"# Copy the body of this method from Django except the final",
"# return statement. We will ignore code coverage for this.",
"if",
"using",
"is",
"None",
"and",
"connect... | Overrides the Query method get_compiler in order to return
an instance of the above custom compiler. | [
"Overrides",
"the",
"Query",
"method",
"get_compiler",
"in",
"order",
"to",
"return",
"an",
"instance",
"of",
"the",
"above",
"custom",
"compiler",
"."
] | 7bff29d69eddfcf214e9cf61647c91d28655619c | https://github.com/matthiask/django-cte-forest/blob/7bff29d69eddfcf214e9cf61647c91d28655619c/cte_forest/query.py#L227-L246 |
54,060 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._add_to_publish_stack | def _add_to_publish_stack(self, exchange, routing_key, message, properties):
"""Temporarily add the message to the stack to publish to RabbitMQ
:param str exchange: The exchange to publish to
:param str routing_key: The routing key to publish with
:param str message: The message body
... | python | def _add_to_publish_stack(self, exchange, routing_key, message, properties):
"""Temporarily add the message to the stack to publish to RabbitMQ
:param str exchange: The exchange to publish to
:param str routing_key: The routing key to publish with
:param str message: The message body
... | [
"def",
"_add_to_publish_stack",
"(",
"self",
",",
"exchange",
",",
"routing_key",
",",
"message",
",",
"properties",
")",
":",
"global",
"message_stack",
"message_stack",
".",
"append",
"(",
"(",
"exchange",
",",
"routing_key",
",",
"message",
",",
"properties",... | Temporarily add the message to the stack to publish to RabbitMQ
:param str exchange: The exchange to publish to
:param str routing_key: The routing key to publish with
:param str message: The message body
:param pika.BasicProperties: The message properties | [
"Temporarily",
"add",
"the",
"message",
"to",
"the",
"stack",
"to",
"publish",
"to",
"RabbitMQ"
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L59-L69 |
54,061 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._connect_to_rabbitmq | def _connect_to_rabbitmq(self):
"""Connect to RabbitMQ and assign a local attribute"""
global pending_rabbitmq_connection, rabbitmq_connection
if not rabbitmq_connection:
LOGGER.info('Creating a new RabbitMQ connection')
pending_rabbitmq_connection = self._new_rabbitmq_co... | python | def _connect_to_rabbitmq(self):
"""Connect to RabbitMQ and assign a local attribute"""
global pending_rabbitmq_connection, rabbitmq_connection
if not rabbitmq_connection:
LOGGER.info('Creating a new RabbitMQ connection')
pending_rabbitmq_connection = self._new_rabbitmq_co... | [
"def",
"_connect_to_rabbitmq",
"(",
"self",
")",
":",
"global",
"pending_rabbitmq_connection",
",",
"rabbitmq_connection",
"if",
"not",
"rabbitmq_connection",
":",
"LOGGER",
".",
"info",
"(",
"'Creating a new RabbitMQ connection'",
")",
"pending_rabbitmq_connection",
"=",
... | Connect to RabbitMQ and assign a local attribute | [
"Connect",
"to",
"RabbitMQ",
"and",
"assign",
"a",
"local",
"attribute"
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L71-L76 |
54,062 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._new_message_properties | def _new_message_properties(self, content_type=None, content_encoding=None,
headers=None, delivery_mode=None, priority=None,
correlation_id=None, reply_to=None,
expiration=None, message_id=None,
... | python | def _new_message_properties(self, content_type=None, content_encoding=None,
headers=None, delivery_mode=None, priority=None,
correlation_id=None, reply_to=None,
expiration=None, message_id=None,
... | [
"def",
"_new_message_properties",
"(",
"self",
",",
"content_type",
"=",
"None",
",",
"content_encoding",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"delivery_mode",
"=",
"None",
",",
"priority",
"=",
"None",
",",
"correlation_id",
"=",
"None",
",",
"rep... | Create a BasicProperties object, with the properties specified
:param str content_type: MIME content type
:param str content_encoding: MIME content encoding
:param dict headers: Message header field table
:param int delivery_mode: Non-persistent (1) or persistent (2)
:param int ... | [
"Create",
"a",
"BasicProperties",
"object",
"with",
"the",
"properties",
"specified"
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L78-L105 |
54,063 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._publish_deferred_messages | def _publish_deferred_messages(self):
"""Called when pika is connected and has a channel open to publish
any requests buffered.
"""
global message_stack
if not self._rabbitmq_is_closed and message_stack:
LOGGER.info('Publishing %i deferred message(s)', len(message_st... | python | def _publish_deferred_messages(self):
"""Called when pika is connected and has a channel open to publish
any requests buffered.
"""
global message_stack
if not self._rabbitmq_is_closed and message_stack:
LOGGER.info('Publishing %i deferred message(s)', len(message_st... | [
"def",
"_publish_deferred_messages",
"(",
"self",
")",
":",
"global",
"message_stack",
"if",
"not",
"self",
".",
"_rabbitmq_is_closed",
"and",
"message_stack",
":",
"LOGGER",
".",
"info",
"(",
"'Publishing %i deferred message(s)'",
",",
"len",
"(",
"message_stack",
... | Called when pika is connected and has a channel open to publish
any requests buffered. | [
"Called",
"when",
"pika",
"is",
"connected",
"and",
"has",
"a",
"channel",
"open",
"to",
"publish",
"any",
"requests",
"buffered",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L117-L126 |
54,064 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._publish_message | def _publish_message(self, exchange, routing_key, message, properties):
"""Publish the message to RabbitMQ
:param str exchange: The exchange to publish to
:param str routing_key: The routing key to publish with
:param str message: The message body
:param pika.BasicProperties: Th... | python | def _publish_message(self, exchange, routing_key, message, properties):
"""Publish the message to RabbitMQ
:param str exchange: The exchange to publish to
:param str routing_key: The routing key to publish with
:param str message: The message body
:param pika.BasicProperties: Th... | [
"def",
"_publish_message",
"(",
"self",
",",
"exchange",
",",
"routing_key",
",",
"message",
",",
"properties",
")",
":",
"if",
"self",
".",
"_rabbitmq_is_closed",
"or",
"not",
"self",
".",
"_rabbitmq_channel",
":",
"LOGGER",
".",
"warning",
"(",
"'Temporarily... | Publish the message to RabbitMQ
:param str exchange: The exchange to publish to
:param str routing_key: The routing key to publish with
:param str message: The message body
:param pika.BasicProperties: The message properties | [
"Publish",
"the",
"message",
"to",
"RabbitMQ"
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L128-L143 |
54,065 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._rabbitmq_config | def _rabbitmq_config(self):
"""Return the RabbitMQ configuration dictionary.
:rtype: dict
"""
config = self.application.settings.get('rabbitmq')
if not config:
raise exceptions.ConfigurationException('rabbitmq')
return config | python | def _rabbitmq_config(self):
"""Return the RabbitMQ configuration dictionary.
:rtype: dict
"""
config = self.application.settings.get('rabbitmq')
if not config:
raise exceptions.ConfigurationException('rabbitmq')
return config | [
"def",
"_rabbitmq_config",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"application",
".",
"settings",
".",
"get",
"(",
"'rabbitmq'",
")",
"if",
"not",
"config",
":",
"raise",
"exceptions",
".",
"ConfigurationException",
"(",
"'rabbitmq'",
")",
"retur... | Return the RabbitMQ configuration dictionary.
:rtype: dict | [
"Return",
"the",
"RabbitMQ",
"configuration",
"dictionary",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L146-L155 |
54,066 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._rabbitmq_parameters | def _rabbitmq_parameters(self):
"""Return a pika ConnectionParameters object using the configuration
from the configuration service. The configuration dictionary should
match the parameters for pika.connection.ConnectionParameters and
include an extra username and password variable.
... | python | def _rabbitmq_parameters(self):
"""Return a pika ConnectionParameters object using the configuration
from the configuration service. The configuration dictionary should
match the parameters for pika.connection.ConnectionParameters and
include an extra username and password variable.
... | [
"def",
"_rabbitmq_parameters",
"(",
"self",
")",
":",
"kwargs",
"=",
"dict",
"(",
"self",
".",
"_rabbitmq_config",
")",
"kwargs",
"[",
"'credentials'",
"]",
"=",
"pika",
".",
"PlainCredentials",
"(",
"kwargs",
"[",
"'username'",
"]",
",",
"kwargs",
"[",
"'... | Return a pika ConnectionParameters object using the configuration
from the configuration service. The configuration dictionary should
match the parameters for pika.connection.ConnectionParameters and
include an extra username and password variable.
:rtype: pika.ConnectionParameters | [
"Return",
"a",
"pika",
"ConnectionParameters",
"object",
"using",
"the",
"configuration",
"from",
"the",
"configuration",
"service",
".",
"The",
"configuration",
"dictionary",
"should",
"match",
"the",
"parameters",
"for",
"pika",
".",
"connection",
".",
"Connection... | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L177-L191 |
54,067 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler._set_rabbitmq_channel | def _set_rabbitmq_channel(self, channel):
"""Assign the channel object to the tinman global object.
:param pika.channel.Channel channel: The pika channel
"""
setattr(self.application.attributes, self.CHANNEL, channel) | python | def _set_rabbitmq_channel(self, channel):
"""Assign the channel object to the tinman global object.
:param pika.channel.Channel channel: The pika channel
"""
setattr(self.application.attributes, self.CHANNEL, channel) | [
"def",
"_set_rabbitmq_channel",
"(",
"self",
",",
"channel",
")",
":",
"setattr",
"(",
"self",
".",
"application",
".",
"attributes",
",",
"self",
".",
"CHANNEL",
",",
"channel",
")"
] | Assign the channel object to the tinman global object.
:param pika.channel.Channel channel: The pika channel | [
"Assign",
"the",
"channel",
"object",
"to",
"the",
"tinman",
"global",
"object",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L193-L199 |
54,068 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler.on_rabbitmq_channel_open | def on_rabbitmq_channel_open(self, channel):
"""Called when the RabbitMQ accepts the channel open request.
:param pika.channel.Channel channel: The channel opened with RabbitMQ
"""
LOGGER.info('Channel %i is opened for communication with RabbitMQ',
channel.channel_n... | python | def on_rabbitmq_channel_open(self, channel):
"""Called when the RabbitMQ accepts the channel open request.
:param pika.channel.Channel channel: The channel opened with RabbitMQ
"""
LOGGER.info('Channel %i is opened for communication with RabbitMQ',
channel.channel_n... | [
"def",
"on_rabbitmq_channel_open",
"(",
"self",
",",
"channel",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Channel %i is opened for communication with RabbitMQ'",
",",
"channel",
".",
"channel_number",
")",
"self",
".",
"_set_rabbitmq_channel",
"(",
"channel",
")",
"self... | Called when the RabbitMQ accepts the channel open request.
:param pika.channel.Channel channel: The channel opened with RabbitMQ | [
"Called",
"when",
"the",
"RabbitMQ",
"accepts",
"the",
"channel",
"open",
"request",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L228-L237 |
54,069 | gmr/tinman | tinman/handlers/rabbitmq.py | RabbitMQRequestHandler.prepare | def prepare(self):
"""Prepare the handler, ensuring RabbitMQ is connected or start a new
connection attempt.
"""
super(RabbitMQRequestHandler, self).prepare()
if self._rabbitmq_is_closed:
self._connect_to_rabbitmq() | python | def prepare(self):
"""Prepare the handler, ensuring RabbitMQ is connected or start a new
connection attempt.
"""
super(RabbitMQRequestHandler, self).prepare()
if self._rabbitmq_is_closed:
self._connect_to_rabbitmq() | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"RabbitMQRequestHandler",
",",
"self",
")",
".",
"prepare",
"(",
")",
"if",
"self",
".",
"_rabbitmq_is_closed",
":",
"self",
".",
"_connect_to_rabbitmq",
"(",
")"
] | Prepare the handler, ensuring RabbitMQ is connected or start a new
connection attempt. | [
"Prepare",
"the",
"handler",
"ensuring",
"RabbitMQ",
"is",
"connected",
"or",
"start",
"a",
"new",
"connection",
"attempt",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L240-L247 |
54,070 | wummel/dosage | dosagelib/plugins/h.py | HagarTheHorrible.starter | def starter(cls):
"""Return last gallery link."""
url = 'http://www.hagardunor.net/comics.php'
data = cls.getPage(url)
pattern = compile(tagre("a", "href", cls.prevUrl))
for starturl in cls.fetchUrls(url, data, pattern):
pass
return starturl | python | def starter(cls):
"""Return last gallery link."""
url = 'http://www.hagardunor.net/comics.php'
data = cls.getPage(url)
pattern = compile(tagre("a", "href", cls.prevUrl))
for starturl in cls.fetchUrls(url, data, pattern):
pass
return starturl | [
"def",
"starter",
"(",
"cls",
")",
":",
"url",
"=",
"'http://www.hagardunor.net/comics.php'",
"data",
"=",
"cls",
".",
"getPage",
"(",
"url",
")",
"pattern",
"=",
"compile",
"(",
"tagre",
"(",
"\"a\"",
",",
"\"href\"",
",",
"cls",
".",
"prevUrl",
")",
")... | Return last gallery link. | [
"Return",
"last",
"gallery",
"link",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/h.py#L21-L28 |
54,071 | gkbrk/JustIRC | JustIRC.py | IRCConnection.run_once | def run_once(self):
"""This function runs one iteration of the IRC client. This is called in a loop
by the run_loop function. It can be called separately, but most of the
time there is no need to do this.
"""
packet = _parse_irc_packet(next(self.lines)) #Get next line from gener... | python | def run_once(self):
"""This function runs one iteration of the IRC client. This is called in a loop
by the run_loop function. It can be called separately, but most of the
time there is no need to do this.
"""
packet = _parse_irc_packet(next(self.lines)) #Get next line from gener... | [
"def",
"run_once",
"(",
"self",
")",
":",
"packet",
"=",
"_parse_irc_packet",
"(",
"next",
"(",
"self",
".",
"lines",
")",
")",
"#Get next line from generator",
"for",
"event_handler",
"in",
"list",
"(",
"self",
".",
"on_packet_received",
")",
":",
"event_hand... | This function runs one iteration of the IRC client. This is called in a loop
by the run_loop function. It can be called separately, but most of the
time there is no need to do this. | [
"This",
"function",
"runs",
"one",
"iteration",
"of",
"the",
"IRC",
"client",
".",
"This",
"is",
"called",
"in",
"a",
"loop",
"by",
"the",
"run_loop",
"function",
".",
"It",
"can",
"be",
"called",
"separately",
"but",
"most",
"of",
"the",
"time",
"there"... | 135bc0a7b67d66b7b4cd13d62c46c7d9613d2163 | https://github.com/gkbrk/JustIRC/blob/135bc0a7b67d66b7b4cd13d62c46c7d9613d2163/JustIRC.py#L58-L94 |
54,072 | gkbrk/JustIRC | JustIRC.py | IRCConnection.connect | def connect(self, server, port=6667):
"""Connects to a given IRC server. After the connection is established, it calls
the on_connect event handler.
"""
self.socket.connect((server, port))
self.lines = self._read_lines()
for event_handler in list(self.on_connect):
... | python | def connect(self, server, port=6667):
"""Connects to a given IRC server. After the connection is established, it calls
the on_connect event handler.
"""
self.socket.connect((server, port))
self.lines = self._read_lines()
for event_handler in list(self.on_connect):
... | [
"def",
"connect",
"(",
"self",
",",
"server",
",",
"port",
"=",
"6667",
")",
":",
"self",
".",
"socket",
".",
"connect",
"(",
"(",
"server",
",",
"port",
")",
")",
"self",
".",
"lines",
"=",
"self",
".",
"_read_lines",
"(",
")",
"for",
"event_handl... | Connects to a given IRC server. After the connection is established, it calls
the on_connect event handler. | [
"Connects",
"to",
"a",
"given",
"IRC",
"server",
".",
"After",
"the",
"connection",
"is",
"established",
"it",
"calls",
"the",
"on_connect",
"event",
"handler",
"."
] | 135bc0a7b67d66b7b4cd13d62c46c7d9613d2163 | https://github.com/gkbrk/JustIRC/blob/135bc0a7b67d66b7b4cd13d62c46c7d9613d2163/JustIRC.py#L113-L121 |
54,073 | gkbrk/JustIRC | JustIRC.py | IRCConnection.set_nick | def set_nick(self, nick):
"""Sets or changes your link. This should be called before joining channels, but
can be called at any time afterwards. If the requested nickname is not
available, the library will keep adding an underscore until a suitable
nick is found.
"""
sel... | python | def set_nick(self, nick):
"""Sets or changes your link. This should be called before joining channels, but
can be called at any time afterwards. If the requested nickname is not
available, the library will keep adding an underscore until a suitable
nick is found.
"""
sel... | [
"def",
"set_nick",
"(",
"self",
",",
"nick",
")",
":",
"self",
".",
"nick",
"=",
"nick",
"self",
".",
"send_line",
"(",
"\"NICK {}\"",
".",
"format",
"(",
"nick",
")",
")"
] | Sets or changes your link. This should be called before joining channels, but
can be called at any time afterwards. If the requested nickname is not
available, the library will keep adding an underscore until a suitable
nick is found. | [
"Sets",
"or",
"changes",
"your",
"link",
".",
"This",
"should",
"be",
"called",
"before",
"joining",
"channels",
"but",
"can",
"be",
"called",
"at",
"any",
"time",
"afterwards",
".",
"If",
"the",
"requested",
"nickname",
"is",
"not",
"available",
"the",
"l... | 135bc0a7b67d66b7b4cd13d62c46c7d9613d2163 | https://github.com/gkbrk/JustIRC/blob/135bc0a7b67d66b7b4cd13d62c46c7d9613d2163/JustIRC.py#L160-L168 |
54,074 | dirko/pyhacrf | pyhacrf/pyhacrf.py | Hacrf.fit | def fit(self, X, y, verbosity=0):
"""Fit the model according to the given training data.
Parameters
----------
X : List of ndarrays, one for each training example.
Each training example's shape is (string1_len, string2_len, n_features), where
string1_len and stri... | python | def fit(self, X, y, verbosity=0):
"""Fit the model according to the given training data.
Parameters
----------
X : List of ndarrays, one for each training example.
Each training example's shape is (string1_len, string2_len, n_features), where
string1_len and stri... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"verbosity",
"=",
"0",
")",
":",
"self",
".",
"classes",
"=",
"list",
"(",
"set",
"(",
"y",
")",
")",
"n_points",
"=",
"len",
"(",
"y",
")",
"if",
"len",
"(",
"X",
")",
"!=",
"n_points",
"... | Fit the model according to the given training data.
Parameters
----------
X : List of ndarrays, one for each training example.
Each training example's shape is (string1_len, string2_len, n_features), where
string1_len and string2_len are the length of the two training st... | [
"Fit",
"the",
"model",
"according",
"to",
"the",
"given",
"training",
"data",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L64-L138 |
54,075 | dirko/pyhacrf | pyhacrf/pyhacrf.py | Hacrf.predict | def predict(self, X):
"""Predict the class for X.
The predicted class for each sample in X is returned.
Parameters
----------
X : List of ndarrays, one for each training example.
Each training example's shape is (string1_len,
string2_len, n_features), wh... | python | def predict(self, X):
"""Predict the class for X.
The predicted class for each sample in X is returned.
Parameters
----------
X : List of ndarrays, one for each training example.
Each training example's shape is (string1_len,
string2_len, n_features), wh... | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"return",
"[",
"self",
".",
"classes",
"[",
"prediction",
".",
"argmax",
"(",
")",
"]",
"for",
"prediction",
"in",
"self",
".",
"predict_proba",
"(",
"X",
")",
"]"
] | Predict the class for X.
The predicted class for each sample in X is returned.
Parameters
----------
X : List of ndarrays, one for each training example.
Each training example's shape is (string1_len,
string2_len, n_features), where string1_len and
s... | [
"Predict",
"the",
"class",
"for",
"X",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L170-L189 |
54,076 | dirko/pyhacrf | pyhacrf/pyhacrf.py | Hacrf._initialize_parameters | def _initialize_parameters(state_machine, n_features):
""" Helper to create initial parameter vector with the correct shape. """
return np.zeros((state_machine.n_states
+ state_machine.n_transitions,
n_features)) | python | def _initialize_parameters(state_machine, n_features):
""" Helper to create initial parameter vector with the correct shape. """
return np.zeros((state_machine.n_states
+ state_machine.n_transitions,
n_features)) | [
"def",
"_initialize_parameters",
"(",
"state_machine",
",",
"n_features",
")",
":",
"return",
"np",
".",
"zeros",
"(",
"(",
"state_machine",
".",
"n_states",
"+",
"state_machine",
".",
"n_transitions",
",",
"n_features",
")",
")"
] | Helper to create initial parameter vector with the correct shape. | [
"Helper",
"to",
"create",
"initial",
"parameter",
"vector",
"with",
"the",
"correct",
"shape",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L192-L196 |
54,077 | dirko/pyhacrf | pyhacrf/pyhacrf.py | _Model.forward_backward | def forward_backward(self, parameters):
""" Run the forward backward algorithm with the given parameters. """
# If the features are sparse, we can use an optimization.
# I'm not using scipy.sparse here because we want to avoid a scipy dependency and also scipy.sparse doesn't seem
# to ha... | python | def forward_backward(self, parameters):
""" Run the forward backward algorithm with the given parameters. """
# If the features are sparse, we can use an optimization.
# I'm not using scipy.sparse here because we want to avoid a scipy dependency and also scipy.sparse doesn't seem
# to ha... | [
"def",
"forward_backward",
"(",
"self",
",",
"parameters",
")",
":",
"# If the features are sparse, we can use an optimization.",
"# I'm not using scipy.sparse here because we want to avoid a scipy dependency and also scipy.sparse doesn't seem",
"# to handle arrays of shape higher than 2.",
"i... | Run the forward backward algorithm with the given parameters. | [
"Run",
"the",
"forward",
"backward",
"algorithm",
"with",
"the",
"given",
"parameters",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L239-L270 |
54,078 | dirko/pyhacrf | pyhacrf/pyhacrf.py | _Model.predict | def predict(self, parameters, viterbi):
""" Run forward algorithm to find the predicted distribution over classes. """
x_dot_parameters = np.einsum('ijk,kl->ijl', self.x, parameters)
if not viterbi:
alpha = forward_predict(self._lattice, x_dot_parameters,
... | python | def predict(self, parameters, viterbi):
""" Run forward algorithm to find the predicted distribution over classes. """
x_dot_parameters = np.einsum('ijk,kl->ijl', self.x, parameters)
if not viterbi:
alpha = forward_predict(self._lattice, x_dot_parameters,
... | [
"def",
"predict",
"(",
"self",
",",
"parameters",
",",
"viterbi",
")",
":",
"x_dot_parameters",
"=",
"np",
".",
"einsum",
"(",
"'ijk,kl->ijl'",
",",
"self",
".",
"x",
",",
"parameters",
")",
"if",
"not",
"viterbi",
":",
"alpha",
"=",
"forward_predict",
"... | Run forward algorithm to find the predicted distribution over classes. | [
"Run",
"forward",
"algorithm",
"to",
"find",
"the",
"predicted",
"distribution",
"over",
"classes",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L272-L293 |
54,079 | dirko/pyhacrf | pyhacrf/pyhacrf.py | _Model._forward | def _forward(self, x_dot_parameters):
""" Helper to calculate the forward weights. """
return forward(self._lattice, x_dot_parameters,
self.state_machine.n_states) | python | def _forward(self, x_dot_parameters):
""" Helper to calculate the forward weights. """
return forward(self._lattice, x_dot_parameters,
self.state_machine.n_states) | [
"def",
"_forward",
"(",
"self",
",",
"x_dot_parameters",
")",
":",
"return",
"forward",
"(",
"self",
".",
"_lattice",
",",
"x_dot_parameters",
",",
"self",
".",
"state_machine",
".",
"n_states",
")"
] | Helper to calculate the forward weights. | [
"Helper",
"to",
"calculate",
"the",
"forward",
"weights",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L295-L298 |
54,080 | dirko/pyhacrf | pyhacrf/pyhacrf.py | _Model._backward | def _backward(self, x_dot_parameters):
""" Helper to calculate the backward weights. """
I, J, _ = self.x.shape
return backward(self._lattice, x_dot_parameters, I, J,
self.state_machine.n_states) | python | def _backward(self, x_dot_parameters):
""" Helper to calculate the backward weights. """
I, J, _ = self.x.shape
return backward(self._lattice, x_dot_parameters, I, J,
self.state_machine.n_states) | [
"def",
"_backward",
"(",
"self",
",",
"x_dot_parameters",
")",
":",
"I",
",",
"J",
",",
"_",
"=",
"self",
".",
"x",
".",
"shape",
"return",
"backward",
"(",
"self",
".",
"_lattice",
",",
"x_dot_parameters",
",",
"I",
",",
"J",
",",
"self",
".",
"st... | Helper to calculate the backward weights. | [
"Helper",
"to",
"calculate",
"the",
"backward",
"weights",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L300-L304 |
54,081 | dirko/pyhacrf | pyhacrf/pyhacrf.py | _Model._construct_sparse_features | def _construct_sparse_features(self, x):
""" Helper to construct a sparse representation of the features. """
I, J, K = x.shape
new_array_height = (x != 0).sum(axis=2).max()
index_array = -np.ones((I, J, new_array_height), dtype='int64')
value_array = -np.ones((I, J, new_array_he... | python | def _construct_sparse_features(self, x):
""" Helper to construct a sparse representation of the features. """
I, J, K = x.shape
new_array_height = (x != 0).sum(axis=2).max()
index_array = -np.ones((I, J, new_array_height), dtype='int64')
value_array = -np.ones((I, J, new_array_he... | [
"def",
"_construct_sparse_features",
"(",
"self",
",",
"x",
")",
":",
"I",
",",
"J",
",",
"K",
"=",
"x",
".",
"shape",
"new_array_height",
"=",
"(",
"x",
"!=",
"0",
")",
".",
"sum",
"(",
"axis",
"=",
"2",
")",
".",
"max",
"(",
")",
"index_array",... | Helper to construct a sparse representation of the features. | [
"Helper",
"to",
"construct",
"a",
"sparse",
"representation",
"of",
"the",
"features",
"."
] | 51455681d4edf88e5323313fc0f6b85577ae185c | https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/pyhacrf.py#L306-L313 |
54,082 | synw/dataswim | dataswim/data/export.py | Export.to_html_ | def to_html_(self) -> str:
"""Convert the main dataframe to html
:return: html data
:rtype: str
:example: ``ds.to_html_()``
"""
try:
renderer = pytablewriter.HtmlTableWriter
data = self._build_export(renderer)
return data
exce... | python | def to_html_(self) -> str:
"""Convert the main dataframe to html
:return: html data
:rtype: str
:example: ``ds.to_html_()``
"""
try:
renderer = pytablewriter.HtmlTableWriter
data = self._build_export(renderer)
return data
exce... | [
"def",
"to_html_",
"(",
"self",
")",
"->",
"str",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"HtmlTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
")",
"return",
"data",
"except",
"Exception",
"as",
"e",
":",
"self",
... | Convert the main dataframe to html
:return: html data
:rtype: str
:example: ``ds.to_html_()`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"html"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L11-L24 |
54,083 | synw/dataswim | dataswim/data/export.py | Export.to_json_ | def to_json_(self) -> str:
"""Convert the main dataframe to json
:return: json data
:rtype: str
:example: ``ds.to_json_()``
"""
try:
renderer = pytablewriter.JsonTableWriter
data = self._build_export(renderer)
return data
exce... | python | def to_json_(self) -> str:
"""Convert the main dataframe to json
:return: json data
:rtype: str
:example: ``ds.to_json_()``
"""
try:
renderer = pytablewriter.JsonTableWriter
data = self._build_export(renderer)
return data
exce... | [
"def",
"to_json_",
"(",
"self",
")",
"->",
"str",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"JsonTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
")",
"return",
"data",
"except",
"Exception",
"as",
"e",
":",
"self",
... | Convert the main dataframe to json
:return: json data
:rtype: str
:example: ``ds.to_json_()`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"json"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L26-L39 |
54,084 | synw/dataswim | dataswim/data/export.py | Export.to_javascript_ | def to_javascript_(self, table_name: str="data") -> str:
"""Convert the main dataframe to javascript code
:param table_name: javascript variable name, defaults to "data"
:param table_name: str, optional
:return: a javascript constant with the data
:rtype: str
:example: ... | python | def to_javascript_(self, table_name: str="data") -> str:
"""Convert the main dataframe to javascript code
:param table_name: javascript variable name, defaults to "data"
:param table_name: str, optional
:return: a javascript constant with the data
:rtype: str
:example: ... | [
"def",
"to_javascript_",
"(",
"self",
",",
"table_name",
":",
"str",
"=",
"\"data\"",
")",
"->",
"str",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"JavaScriptTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
",",
"table_n... | Convert the main dataframe to javascript code
:param table_name: javascript variable name, defaults to "data"
:param table_name: str, optional
:return: a javascript constant with the data
:rtype: str
:example: ``ds.to_javastript_("myconst")`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"javascript",
"code"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L41-L56 |
54,085 | synw/dataswim | dataswim/data/export.py | Export.to_markdown_ | def to_markdown_(self) -> str:
"""Convert the main dataframe to markdown
:return: markdown data
:rtype: str
:example: ``ds.to_markdown_()``
"""
try:
renderer = pytablewriter.MarkdownTableWriter
data = self._build_export(renderer)
retu... | python | def to_markdown_(self) -> str:
"""Convert the main dataframe to markdown
:return: markdown data
:rtype: str
:example: ``ds.to_markdown_()``
"""
try:
renderer = pytablewriter.MarkdownTableWriter
data = self._build_export(renderer)
retu... | [
"def",
"to_markdown_",
"(",
"self",
")",
"->",
"str",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"MarkdownTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
")",
"return",
"data",
"except",
"Exception",
"as",
"e",
":",
"... | Convert the main dataframe to markdown
:return: markdown data
:rtype: str
:example: ``ds.to_markdown_()`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"markdown"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L58-L71 |
54,086 | synw/dataswim | dataswim/data/export.py | Export.to_rst_ | def to_rst_(self) -> str:
"""Convert the main dataframe to restructured text
:return: rst data
:rtype: str
:example: ``ds.to_rst_()``
"""
try:
renderer = pytablewriter.RstGridTableWriter
data = self._build_export(renderer)
return data... | python | def to_rst_(self) -> str:
"""Convert the main dataframe to restructured text
:return: rst data
:rtype: str
:example: ``ds.to_rst_()``
"""
try:
renderer = pytablewriter.RstGridTableWriter
data = self._build_export(renderer)
return data... | [
"def",
"to_rst_",
"(",
"self",
")",
"->",
"str",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"RstGridTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
")",
"return",
"data",
"except",
"Exception",
"as",
"e",
":",
"self",... | Convert the main dataframe to restructured text
:return: rst data
:rtype: str
:example: ``ds.to_rst_()`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"restructured",
"text"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L73-L86 |
54,087 | synw/dataswim | dataswim/data/export.py | Export.to_python_ | def to_python_(self, table_name: str="data") -> list:
"""Convert the main dataframe to python a python list
:param table_name: python variable name, defaults to "data"
:param table_name: str, optional
:return: a python list of lists with the data
:rtype: str
:example: `... | python | def to_python_(self, table_name: str="data") -> list:
"""Convert the main dataframe to python a python list
:param table_name: python variable name, defaults to "data"
:param table_name: str, optional
:return: a python list of lists with the data
:rtype: str
:example: `... | [
"def",
"to_python_",
"(",
"self",
",",
"table_name",
":",
"str",
"=",
"\"data\"",
")",
"->",
"list",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"PythonCodeTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
",",
"table_name... | Convert the main dataframe to python a python list
:param table_name: python variable name, defaults to "data"
:param table_name: str, optional
:return: a python list of lists with the data
:rtype: str
:example: ``ds.to_python_("myvar")`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"python",
"a",
"python",
"list"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L88-L103 |
54,088 | synw/dataswim | dataswim/data/export.py | Export.to_numpy_ | def to_numpy_(self, table_name: str="data") -> numpy.array:
"""Convert the main dataframe to a numpy array
:param table_name: name of the python variable, defaults to "data"
:param table_name: str, optional
:return: a numpy array
:rtype: np.array
:example: ``ds.to_numpy... | python | def to_numpy_(self, table_name: str="data") -> numpy.array:
"""Convert the main dataframe to a numpy array
:param table_name: name of the python variable, defaults to "data"
:param table_name: str, optional
:return: a numpy array
:rtype: np.array
:example: ``ds.to_numpy... | [
"def",
"to_numpy_",
"(",
"self",
",",
"table_name",
":",
"str",
"=",
"\"data\"",
")",
"->",
"numpy",
".",
"array",
":",
"try",
":",
"renderer",
"=",
"pytablewriter",
".",
"NumpyTableWriter",
"data",
"=",
"self",
".",
"_build_export",
"(",
"renderer",
",",
... | Convert the main dataframe to a numpy array
:param table_name: name of the python variable, defaults to "data"
:param table_name: str, optional
:return: a numpy array
:rtype: np.array
:example: ``ds.to_numpy_("myvar")`` | [
"Convert",
"the",
"main",
"dataframe",
"to",
"a",
"numpy",
"array"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L105-L120 |
54,089 | synw/dataswim | dataswim/data/export.py | Export.to_records_ | def to_records_(self) -> dict:
"""Returns a list of dictionary records from the main dataframe
:return: a python dictionnary with the data
:rtype: str
:example: ``ds.to_records_()``
"""
try:
dic = self.df.to_dict(orient="records")
return dic
... | python | def to_records_(self) -> dict:
"""Returns a list of dictionary records from the main dataframe
:return: a python dictionnary with the data
:rtype: str
:example: ``ds.to_records_()``
"""
try:
dic = self.df.to_dict(orient="records")
return dic
... | [
"def",
"to_records_",
"(",
"self",
")",
"->",
"dict",
":",
"try",
":",
"dic",
"=",
"self",
".",
"df",
".",
"to_dict",
"(",
"orient",
"=",
"\"records\"",
")",
"return",
"dic",
"except",
"Exception",
"as",
"e",
":",
"self",
".",
"err",
"(",
"e",
",",... | Returns a list of dictionary records from the main dataframe
:return: a python dictionnary with the data
:rtype: str
:example: ``ds.to_records_()`` | [
"Returns",
"a",
"list",
"of",
"dictionary",
"records",
"from",
"the",
"main",
"dataframe"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L122-L134 |
54,090 | synw/dataswim | dataswim/data/export.py | Export.to_csv | def to_csv(self, filepath: str, index: bool=False, **kwargs):
"""Write the main dataframe to a csv file
:param filepath: path of the file to save
:type filepath: str
:param index: [description], defaults to False
:param index: bool, optional
:param \*args: arguments to p... | python | def to_csv(self, filepath: str, index: bool=False, **kwargs):
"""Write the main dataframe to a csv file
:param filepath: path of the file to save
:type filepath: str
:param index: [description], defaults to False
:param index: bool, optional
:param \*args: arguments to p... | [
"def",
"to_csv",
"(",
"self",
",",
"filepath",
":",
"str",
",",
"index",
":",
"bool",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"start",
"(",
"\"Saving data to \"",
"+",
"filepath",
"+",
"\" ...\"",
")",
"if",
"self",
... | Write the main dataframe to a csv file
:param filepath: path of the file to save
:type filepath: str
:param index: [description], defaults to False
:param index: bool, optional
:param \*args: arguments to pass to ``pd.to_csv``
:example: ``ds.to_csv_("myfile.csv", header... | [
"Write",
"the",
"main",
"dataframe",
"to",
"a",
"csv",
"file"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L136-L156 |
54,091 | synw/dataswim | dataswim/data/export.py | Export.to_excel | def to_excel(self, filepath: str, title: str):
"""Write the main dataframe to an Excell file
:param filepath: path of the Excel file to write
:type filepath: str
:param title: Title of the stylesheet
:type title: str
:example: ``ds.to_excel_("./myfile.xlsx", "My data")`... | python | def to_excel(self, filepath: str, title: str):
"""Write the main dataframe to an Excell file
:param filepath: path of the Excel file to write
:type filepath: str
:param title: Title of the stylesheet
:type title: str
:example: ``ds.to_excel_("./myfile.xlsx", "My data")`... | [
"def",
"to_excel",
"(",
"self",
",",
"filepath",
":",
"str",
",",
"title",
":",
"str",
")",
":",
"try",
":",
"self",
".",
"start",
"(",
"\"Saving data to Excell file: \"",
"+",
"filepath",
"+",
"\" ...\"",
")",
"writer",
"=",
"pytablewriter",
".",
"ExcelXl... | Write the main dataframe to an Excell file
:param filepath: path of the Excel file to write
:type filepath: str
:param title: Title of the stylesheet
:type title: str
:example: ``ds.to_excel_("./myfile.xlsx", "My data")`` | [
"Write",
"the",
"main",
"dataframe",
"to",
"an",
"Excell",
"file"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L158-L178 |
54,092 | synw/dataswim | dataswim/data/export.py | Export.to_hdf5 | def to_hdf5(self, filepath: str):
"""Write the main dataframe to Hdf5 file
:param filepath: path where to save the file
:type filepath: str
:example: ``ds.to_hdf5_("./myfile.hdf5")``
"""
try:
self.start("Saving data to Hdf5...")
dd.io.save(filepa... | python | def to_hdf5(self, filepath: str):
"""Write the main dataframe to Hdf5 file
:param filepath: path where to save the file
:type filepath: str
:example: ``ds.to_hdf5_("./myfile.hdf5")``
"""
try:
self.start("Saving data to Hdf5...")
dd.io.save(filepa... | [
"def",
"to_hdf5",
"(",
"self",
",",
"filepath",
":",
"str",
")",
":",
"try",
":",
"self",
".",
"start",
"(",
"\"Saving data to Hdf5...\"",
")",
"dd",
".",
"io",
".",
"save",
"(",
"filepath",
",",
"self",
".",
"df",
")",
"self",
".",
"end",
"(",
"\"... | Write the main dataframe to Hdf5 file
:param filepath: path where to save the file
:type filepath: str
:example: ``ds.to_hdf5_("./myfile.hdf5")`` | [
"Write",
"the",
"main",
"dataframe",
"to",
"Hdf5",
"file"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L180-L193 |
54,093 | misli/django-cms-articles | cms_articles/api.py | create_article | def create_article(tree, template, title, language, slug=None, description=None,
page_title=None, menu_title=None, meta_description=None,
created_by=None, image=None, publication_date=None, publication_end_date=None,
published=False, login_required=False, creatio... | python | def create_article(tree, template, title, language, slug=None, description=None,
page_title=None, menu_title=None, meta_description=None,
created_by=None, image=None, publication_date=None, publication_end_date=None,
published=False, login_required=False, creatio... | [
"def",
"create_article",
"(",
"tree",
",",
"template",
",",
"title",
",",
"language",
",",
"slug",
"=",
"None",
",",
"description",
"=",
"None",
",",
"page_title",
"=",
"None",
",",
"menu_title",
"=",
"None",
",",
"meta_description",
"=",
"None",
",",
"c... | Create a CMS Article and it's title for the given language | [
"Create",
"a",
"CMS",
"Article",
"and",
"it",
"s",
"title",
"for",
"the",
"given",
"language"
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/api.py#L26-L100 |
54,094 | misli/django-cms-articles | cms_articles/api.py | create_title | def create_title(article, language, title, slug=None, description=None,
page_title=None, menu_title=None, meta_description=None,
creation_date=None, image=None):
"""
Create an article title.
"""
# validate article
assert isinstance(article, Article)
# validate ... | python | def create_title(article, language, title, slug=None, description=None,
page_title=None, menu_title=None, meta_description=None,
creation_date=None, image=None):
"""
Create an article title.
"""
# validate article
assert isinstance(article, Article)
# validate ... | [
"def",
"create_title",
"(",
"article",
",",
"language",
",",
"title",
",",
"slug",
"=",
"None",
",",
"description",
"=",
"None",
",",
"page_title",
"=",
"None",
",",
"menu_title",
"=",
"None",
",",
"meta_description",
"=",
"None",
",",
"creation_date",
"="... | Create an article title. | [
"Create",
"an",
"article",
"title",
"."
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/api.py#L103-L148 |
54,095 | misli/django-cms-articles | cms_articles/api.py | add_content | def add_content(obj, language, slot, content):
"""
Adds a TextPlugin with given content to given slot
"""
placeholder = obj.placeholders.get(slot=slot)
add_plugin(placeholder, TextPlugin, language, body=content) | python | def add_content(obj, language, slot, content):
"""
Adds a TextPlugin with given content to given slot
"""
placeholder = obj.placeholders.get(slot=slot)
add_plugin(placeholder, TextPlugin, language, body=content) | [
"def",
"add_content",
"(",
"obj",
",",
"language",
",",
"slot",
",",
"content",
")",
":",
"placeholder",
"=",
"obj",
".",
"placeholders",
".",
"get",
"(",
"slot",
"=",
"slot",
")",
"add_plugin",
"(",
"placeholder",
",",
"TextPlugin",
",",
"language",
","... | Adds a TextPlugin with given content to given slot | [
"Adds",
"a",
"TextPlugin",
"with",
"given",
"content",
"to",
"given",
"slot"
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/api.py#L151-L156 |
54,096 | AntagonistHQ/openprovider.py | openprovider/api.py | _get_module_name | def _get_module_name(module):
"""
Return the module name.
>>> from openprovider.modules import CustomerModule
>>> _get_module_name(CustomerModule)
'customer'
>>> _get_module_name(OpenProvider)
'openprovider'
"""
name = module.__name__[:-6] if module.__name__.endswith('Module') else... | python | def _get_module_name(module):
"""
Return the module name.
>>> from openprovider.modules import CustomerModule
>>> _get_module_name(CustomerModule)
'customer'
>>> _get_module_name(OpenProvider)
'openprovider'
"""
name = module.__name__[:-6] if module.__name__.endswith('Module') else... | [
"def",
"_get_module_name",
"(",
"module",
")",
":",
"name",
"=",
"module",
".",
"__name__",
"[",
":",
"-",
"6",
"]",
"if",
"module",
".",
"__name__",
".",
"endswith",
"(",
"'Module'",
")",
"else",
"module",
".",
"__name__",
"return",
"name",
".",
"lowe... | Return the module name.
>>> from openprovider.modules import CustomerModule
>>> _get_module_name(CustomerModule)
'customer'
>>> _get_module_name(OpenProvider)
'openprovider' | [
"Return",
"the",
"module",
"name",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/api.py#L19-L31 |
54,097 | AntagonistHQ/openprovider.py | openprovider/api.py | OpenProvider.request | def request(self, tree, **kwargs):
"""
Construct a new request with the given tree as its contents, then ship
it to the OpenProvider API.
"""
apirequest = lxml.etree.tostring(
E.openXML(
E.credentials(
E.username(self.username),
... | python | def request(self, tree, **kwargs):
"""
Construct a new request with the given tree as its contents, then ship
it to the OpenProvider API.
"""
apirequest = lxml.etree.tostring(
E.openXML(
E.credentials(
E.username(self.username),
... | [
"def",
"request",
"(",
"self",
",",
"tree",
",",
"*",
"*",
"kwargs",
")",
":",
"apirequest",
"=",
"lxml",
".",
"etree",
".",
"tostring",
"(",
"E",
".",
"openXML",
"(",
"E",
".",
"credentials",
"(",
"E",
".",
"username",
"(",
"self",
".",
"username"... | Construct a new request with the given tree as its contents, then ship
it to the OpenProvider API. | [
"Construct",
"a",
"new",
"request",
"with",
"the",
"given",
"tree",
"as",
"its",
"contents",
"then",
"ship",
"it",
"to",
"the",
"OpenProvider",
"API",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/api.py#L62-L96 |
54,098 | haikuginger/beekeeper | beekeeper/hive.py | Hive.from_file | def from_file(cls, fname, version=None, require_https=True):
"""
Create a Hive object based on JSON located in a local file.
"""
if os.path.exists(fname):
with open(fname) as hive_file:
return cls(**json.load(hive_file)).from_version(version, require_https=req... | python | def from_file(cls, fname, version=None, require_https=True):
"""
Create a Hive object based on JSON located in a local file.
"""
if os.path.exists(fname):
with open(fname) as hive_file:
return cls(**json.load(hive_file)).from_version(version, require_https=req... | [
"def",
"from_file",
"(",
"cls",
",",
"fname",
",",
"version",
"=",
"None",
",",
"require_https",
"=",
"True",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"hive_file",
":",
"retu... | Create a Hive object based on JSON located in a local file. | [
"Create",
"a",
"Hive",
"object",
"based",
"on",
"JSON",
"located",
"in",
"a",
"local",
"file",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/hive.py#L32-L40 |
54,099 | haikuginger/beekeeper | beekeeper/hive.py | Hive.from_url | def from_url(cls, url, version=None, require_https=False):
"""
Create a Hive object based on JSON located at a remote URL.
"""
if "https://" in url:
require_https = True
if "http://" in url and require_https:
try:
hive = cls.from_url(url, v... | python | def from_url(cls, url, version=None, require_https=False):
"""
Create a Hive object based on JSON located at a remote URL.
"""
if "https://" in url:
require_https = True
if "http://" in url and require_https:
try:
hive = cls.from_url(url, v... | [
"def",
"from_url",
"(",
"cls",
",",
"url",
",",
"version",
"=",
"None",
",",
"require_https",
"=",
"False",
")",
":",
"if",
"\"https://\"",
"in",
"url",
":",
"require_https",
"=",
"True",
"if",
"\"http://\"",
"in",
"url",
"and",
"require_https",
":",
"tr... | Create a Hive object based on JSON located at a remote URL. | [
"Create",
"a",
"Hive",
"object",
"based",
"on",
"JSON",
"located",
"at",
"a",
"remote",
"URL",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/hive.py#L43-L59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.