repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_identity_make_primary | def user_identity_make_primary(self, user_id, id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#make-identity-primary"
api_path = "/api/v2/users/{user_id}/identities/{id}/make_primary"
api_path = api_path.format(user_id=user_id, id=id)
return self.cal... | python | def user_identity_make_primary(self, user_id, id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#make-identity-primary"
api_path = "/api/v2/users/{user_id}/identities/{id}/make_primary"
api_path = api_path.format(user_id=user_id, id=id)
return self.cal... | [
"def",
"user_identity_make_primary",
"(",
"self",
",",
"user_id",
",",
"id",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/identities/{id}/make_primary\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=... | https://developer.zendesk.com/rest_api/docs/core/user_identities#make-identity-primary | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"user_identities#make",
"-",
"identity",
"-",
"primary"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3942-L3946 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_identity_show | def user_identity_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#show-identity"
api_path = "/api/v2/users/{user_id}/identities/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | python | def user_identity_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#show-identity"
api_path = "/api/v2/users/{user_id}/identities/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | [
"def",
"user_identity_show",
"(",
"self",
",",
"user_id",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/identities/{id}.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
",",
"id",
... | https://developer.zendesk.com/rest_api/docs/core/user_identities#show-identity | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"user_identities#show",
"-",
"identity"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3954-L3958 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_organization_membership_create | def user_organization_membership_create(self, user_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#create-membership"
api_path = "/api/v2/users/{user_id}/organization_memberships.json"
api_path = api_path.format(user_id=user_id)
return self... | python | def user_organization_membership_create(self, user_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#create-membership"
api_path = "/api/v2/users/{user_id}/organization_memberships.json"
api_path = api_path.format(user_id=user_id)
return self... | [
"def",
"user_organization_membership_create",
"(",
"self",
",",
"user_id",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/organization_memberships.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
... | https://developer.zendesk.com/rest_api/docs/core/organization_memberships#create-membership | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"organization_memberships#create",
"-",
"membership"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3978-L3982 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_organization_membership_make_default | def user_organization_membership_make_default(self, id, membership_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#set-membership-as-default"
api_path = "/api/v2/users/{id}/organization_memberships/{membership_id}/make_default.json"
api_path = api_... | python | def user_organization_membership_make_default(self, id, membership_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#set-membership-as-default"
api_path = "/api/v2/users/{id}/organization_memberships/{membership_id}/make_default.json"
api_path = api_... | [
"def",
"user_organization_membership_make_default",
"(",
"self",
",",
"id",
",",
"membership_id",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{id}/organization_memberships/{membership_id}/make_default.json\"",
"api_path",
"=",
"api_path... | https://developer.zendesk.com/rest_api/docs/core/organization_memberships#set-membership-as-default | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"organization_memberships#set",
"-",
"membership",
"-",
"as",
"-",
"default"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3990-L3994 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_organization_membership_show | def user_organization_membership_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#show-membership"
api_path = "/api/v2/users/{user_id}/organization_memberships/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
retur... | python | def user_organization_membership_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#show-membership"
api_path = "/api/v2/users/{user_id}/organization_memberships/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
retur... | [
"def",
"user_organization_membership_show",
"(",
"self",
",",
"user_id",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/organization_memberships/{id}.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
... | https://developer.zendesk.com/rest_api/docs/core/organization_memberships#show-membership | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"organization_memberships#show",
"-",
"membership"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3996-L4000 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_organization_memberships | def user_organization_memberships(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#list-memberships"
api_path = "/api/v2/users/{user_id}/organization_memberships.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_pat... | python | def user_organization_memberships(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#list-memberships"
api_path = "/api/v2/users/{user_id}/organization_memberships.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_pat... | [
"def",
"user_organization_memberships",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/organization_memberships.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
"re... | https://developer.zendesk.com/rest_api/docs/core/organization_memberships#list-memberships | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"organization_memberships#list",
"-",
"memberships"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4002-L4006 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_organization_subscriptions | def user_organization_subscriptions(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_subscriptions#list-organization-subscriptions"
api_path = "/api/v2/users/{user_id}/organization_subscriptions.json"
api_path = api_path.format(user_id=user_id)
ret... | python | def user_organization_subscriptions(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_subscriptions#list-organization-subscriptions"
api_path = "/api/v2/users/{user_id}/organization_subscriptions.json"
api_path = api_path.format(user_id=user_id)
ret... | [
"def",
"user_organization_subscriptions",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/organization_subscriptions.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
... | https://developer.zendesk.com/rest_api/docs/core/organization_subscriptions#list-organization-subscriptions | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"organization_subscriptions#list",
"-",
"organization",
"-",
"subscriptions"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4008-L4012 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_organizations | def user_organizations(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organizations#list-organizations"
api_path = "/api/v2/users/{user_id}/organizations.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | python | def user_organizations(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organizations#list-organizations"
api_path = "/api/v2/users/{user_id}/organizations.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [
"def",
"user_organizations",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/organizations.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
"return",
"self",
"."... | https://developer.zendesk.com/rest_api/docs/core/organizations#list-organizations | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"organizations#list",
"-",
"organizations"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4014-L4018 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_password_requirements | def user_password_requirements(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#get-a-list-of-password-requirements"
api_path = "/api/v2/users/{user_id}/password/requirements.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **k... | python | def user_password_requirements(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#get-a-list-of-password-requirements"
api_path = "/api/v2/users/{user_id}/password/requirements.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **k... | [
"def",
"user_password_requirements",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/password/requirements.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
"return",... | https://developer.zendesk.com/rest_api/docs/core/users#get-a-list-of-password-requirements | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#get",
"-",
"a",
"-",
"list",
"-",
"of",
"-",
"password",
"-",
"requirements"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4026-L4030 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_related | def user_related(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#user-related-information"
api_path = "/api/v2/users/{id}/related.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def user_related(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#user-related-information"
api_path = "/api/v2/users/{id}/related.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"user_related",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{id}/related.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",... | https://developer.zendesk.com/rest_api/docs/core/users#user-related-information | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#user",
"-",
"related",
"-",
"information"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4038-L4042 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_requests | def user_requests(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/requests#list-requests"
api_path = "/api/v2/users/{id}/requests.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def user_requests(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/requests#list-requests"
api_path = "/api/v2/users/{id}/requests.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"user_requests",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{id}/requests.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path... | https://developer.zendesk.com/rest_api/docs/core/requests#list-requests | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"requests#list",
"-",
"requests"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4044-L4048 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_session_show | def user_session_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#show-session"
api_path = "/api/v2/users/{user_id}/sessions/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | python | def user_session_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#show-session"
api_path = "/api/v2/users/{user_id}/sessions/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | [
"def",
"user_session_show",
"(",
"self",
",",
"user_id",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/sessions/{id}.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
",",
"id",
"="... | https://developer.zendesk.com/rest_api/docs/core/sessions#show-session | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"sessions#show",
"-",
"session"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4056-L4060 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_sessions | def user_sessions(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#list-sessions"
api_path = "/api/v2/users/{user_id}/sessions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | python | def user_sessions(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#list-sessions"
api_path = "/api/v2/users/{user_id}/sessions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [
"def",
"user_sessions",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/sessions.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
"return",
"self",
".",
"call"... | https://developer.zendesk.com/rest_api/docs/core/sessions#list-sessions | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"sessions#list",
"-",
"sessions"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4062-L4066 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_sessions_delete | def user_sessions_delete(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#bulk-deleting-sessions"
api_path = "/api/v2/users/{user_id}/sessions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, method="DELETE", **kwargs) | python | def user_sessions_delete(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#bulk-deleting-sessions"
api_path = "/api/v2/users/{user_id}/sessions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, method="DELETE", **kwargs) | [
"def",
"user_sessions_delete",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/sessions.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
"return",
"self",
".",
... | https://developer.zendesk.com/rest_api/docs/core/sessions#bulk-deleting-sessions | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"sessions#bulk",
"-",
"deleting",
"-",
"sessions"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4068-L4072 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_show | def user_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-user"
api_path = "/api/v2/users/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def user_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-user"
api_path = "/api/v2/users/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"user_show",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{id}.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"... | https://developer.zendesk.com/rest_api/docs/core/users#show-user | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#show",
"-",
"user"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4074-L4078 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_skips | def user_skips(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_skips#list-skips-for-the-current-account"
api_path = "/api/v2/users/{user_id}/skips.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | python | def user_skips(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_skips#list-skips-for-the-current-account"
api_path = "/api/v2/users/{user_id}/skips.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [
"def",
"user_skips",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/skips.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
"return",
"self",
".",
"call",
"(... | https://developer.zendesk.com/rest_api/docs/core/ticket_skips#list-skips-for-the-current-account | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"ticket_skips#list",
"-",
"skips",
"-",
"for",
"-",
"the",
"-",
"current",
"-",
"account"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4080-L4084 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_tags | def user_tags(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#show-tags"
api_path = "/api/v2/users/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def user_tags(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#show-tags"
api_path = "/api/v2/users/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"user_tags",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{id}/tags.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",
","... | https://developer.zendesk.com/rest_api/docs/core/tags#show-tags | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"tags#show",
"-",
"tags"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4092-L4096 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_tags_delete | def user_tags_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#remove-tags"
api_path = "/api/v2/users/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | python | def user_tags_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#remove-tags"
api_path = "/api/v2/users/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [
"def",
"user_tags_delete",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{id}/tags.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path"... | https://developer.zendesk.com/rest_api/docs/core/tags#remove-tags | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"tags#remove",
"-",
"tags"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4098-L4102 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.user_tickets_assigned | def user_tickets_assigned(self, user_id, external_id=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#allowed-for"
api_path = "/api/v2/users/{user_id}/tickets/assigned.json"
api_path = api_path.format(user_id=user_id)
api_query = {}
if "query" in kwargs.... | python | def user_tickets_assigned(self, user_id, external_id=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#allowed-for"
api_path = "/api/v2/users/{user_id}/tickets/assigned.json"
api_path = api_path.format(user_id=user_id)
api_query = {}
if "query" in kwargs.... | [
"def",
"user_tickets_assigned",
"(",
"self",
",",
"user_id",
",",
"external_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/{user_id}/tickets/assigned.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"user_id",
"=",
... | https://developer.zendesk.com/rest_api/docs/core/tickets#allowed-for | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"tickets#allowed",
"-",
"for"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4110-L4122 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_autocomplete | def users_autocomplete(self, name=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#autocomplete-users"
api_path = "/api/v2/users/autocomplete.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["qu... | python | def users_autocomplete(self, name=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#autocomplete-users"
api_path = "/api/v2/users/autocomplete.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["qu... | [
"def",
"users_autocomplete",
"(",
"self",
",",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/autocomplete.json\"",
"api_query",
"=",
"{",
"}",
"if",
"\"query\"",
"in",
"kwargs",
".",
"keys",
"(",
")",
":",
"api_q... | https://developer.zendesk.com/rest_api/docs/core/users#autocomplete-users | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#autocomplete",
"-",
"users"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4158-L4169 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_create_many | def users_create_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-many-users"
api_path = "/api/v2/users/create_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def users_create_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-many-users"
api_path = "/api/v2/users/create_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"users_create_many",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/create_many.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
",",
"... | https://developer.zendesk.com/rest_api/docs/core/users#create-many-users | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#create",
"-",
"many",
"-",
"users"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4171-L4174 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_create_or_update | def users_create_or_update(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-user"
api_path = "/api/v2/users/create_or_update.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def users_create_or_update(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-user"
api_path = "/api/v2/users/create_or_update.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"users_create_or_update",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/create_or_update.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
... | https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-user | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#create",
"-",
"or",
"-",
"update",
"-",
"user"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4176-L4179 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_create_or_update_many | def users_create_or_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-many-users"
api_path = "/api/v2/users/create_or_update_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def users_create_or_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-many-users"
api_path = "/api/v2/users/create_or_update_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"users_create_or_update_many",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/create_or_update_many.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
... | https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-many-users | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#create",
"-",
"or",
"-",
"update",
"-",
"many",
"-",
"users"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4181-L4184 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_destroy_many | def users_destroy_many(self, external_ids=None, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#bulk-deleting-users"
api_path = "/api/v2/users/destroy_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
... | python | def users_destroy_many(self, external_ids=None, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#bulk-deleting-users"
api_path = "/api/v2/users/destroy_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
... | [
"def",
"users_destroy_many",
"(",
"self",
",",
"external_ids",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/destroy_many.json\"",
"api_query",
"=",
"{",
"}",
"if",
"\"query\"",
"in",
"kwargs",
"."... | https://developer.zendesk.com/rest_api/docs/core/users#bulk-deleting-users | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#bulk",
"-",
"deleting",
"-",
"users"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4186-L4201 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_list | def users_list(self, permission_set=None, role=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#list-users"
api_path = "/api/v2/users.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
... | python | def users_list(self, permission_set=None, role=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#list-users"
api_path = "/api/v2/users.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
... | [
"def",
"users_list",
"(",
"self",
",",
"permission_set",
"=",
"None",
",",
"role",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users.json\"",
"api_query",
"=",
"{",
"}",
"if",
"\"query\"",
"in",
"kwargs",
".",
"keys",
"(",... | https://developer.zendesk.com/rest_api/docs/core/users#list-users | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#list",
"-",
"users"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4203-L4218 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_me | def users_me(self, include=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-the-currently-authenticated-user"
api_path = "/api/v2/users/me.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["... | python | def users_me(self, include=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-the-currently-authenticated-user"
api_path = "/api/v2/users/me.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["... | [
"def",
"users_me",
"(",
"self",
",",
"include",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/me.json\"",
"api_query",
"=",
"{",
"}",
"if",
"\"query\"",
"in",
"kwargs",
".",
"keys",
"(",
")",
":",
"api_query",
".",
"... | https://developer.zendesk.com/rest_api/docs/core/users#show-the-currently-authenticated-user | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#show",
"-",
"the",
"-",
"currently",
"-",
"authenticated",
"-",
"user"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4220-L4231 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_me_merge | def users_me_merge(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#merge-self-with-another-user"
api_path = "/api/v2/users/me/merge.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | python | def users_me_merge(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#merge-self-with-another-user"
api_path = "/api/v2/users/me/merge.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [
"def",
"users_me_merge",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/me/merge.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"PUT\"",
",",
"data",
"=",
"data",
",",
"*",
"... | https://developer.zendesk.com/rest_api/docs/core/users#merge-self-with-another-user | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#merge",
"-",
"self",
"-",
"with",
"-",
"another",
"-",
"user"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4238-L4241 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_request_create | def users_request_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#request-user-create"
api_path = "/api/v2/users/request_create.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def users_request_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#request-user-create"
api_path = "/api/v2/users/request_create.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"users_request_create",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/request_create.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
",... | https://developer.zendesk.com/rest_api/docs/core/users#request-user-create | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#request",
"-",
"user",
"-",
"create"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4258-L4261 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.users_update_many | def users_update_many(self, data, external_ids=None, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#update-many-users"
api_path = "/api/v2/users/update_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
... | python | def users_update_many(self, data, external_ids=None, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#update-many-users"
api_path = "/api/v2/users/update_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
... | [
"def",
"users_update_many",
"(",
"self",
",",
"data",
",",
"external_ids",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/users/update_many.json\"",
"api_query",
"=",
"{",
"}",
"if",
"\"query\"",
"in",
... | https://developer.zendesk.com/rest_api/docs/core/users#update-many-users | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"users#update",
"-",
"many",
"-",
"users"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4297-L4312 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_count | def view_count(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#get-view-count"
api_path = "/api/v2/views/{id}/count.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def view_count(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#get-view-count"
api_path = "/api/v2/views/{id}/count.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"view_count",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/{id}/count.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",
"... | https://developer.zendesk.com/rest_api/docs/core/views#get-view-count | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#get",
"-",
"view",
"-",
"count"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4314-L4318 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_create | def view_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#create-view"
api_path = "/api/v2/views.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def view_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#create-view"
api_path = "/api/v2/views.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"view_create",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwar... | https://developer.zendesk.com/rest_api/docs/core/views#create-view | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#create",
"-",
"view"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4320-L4323 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_delete | def view_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#delete-view"
api_path = "/api/v2/views/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | python | def view_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#delete-view"
api_path = "/api/v2/views/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [
"def",
"view_delete",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/{id}.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
... | https://developer.zendesk.com/rest_api/docs/core/views#delete-view | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#delete",
"-",
"view"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4325-L4329 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_execute | def view_execute(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#execute-view"
api_path = "/api/v2/views/{id}/execute.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def view_execute(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#execute-view"
api_path = "/api/v2/views/{id}/execute.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"view_execute",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/{id}/execute.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",... | https://developer.zendesk.com/rest_api/docs/core/views#execute-view | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#execute",
"-",
"view"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4331-L4335 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_export | def view_export(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#export-view"
api_path = "/api/v2/views/{id}/export.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def view_export(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#export-view"
api_path = "/api/v2/views/{id}/export.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"view_export",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/{id}/export.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",
... | https://developer.zendesk.com/rest_api/docs/core/views#export-view | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#export",
"-",
"view"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4337-L4341 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_show | def view_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#show-view"
api_path = "/api/v2/views/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def view_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#show-view"
api_path = "/api/v2/views/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"view_show",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/{id}.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"... | https://developer.zendesk.com/rest_api/docs/core/views#show-view | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#show",
"-",
"view"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4343-L4347 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.view_tickets | def view_tickets(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#list-tickets-from-a-view"
api_path = "/api/v2/views/{id}/tickets.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | python | def view_tickets(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#list-tickets-from-a-view"
api_path = "/api/v2/views/{id}/tickets.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [
"def",
"view_tickets",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/{id}/tickets.json\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"id",
"=",
"id",
")",
"return",
"self",
".",
"call",
"(",
"api_path",... | https://developer.zendesk.com/rest_api/docs/core/views#list-tickets-from-a-view | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#list",
"-",
"tickets",
"-",
"from",
"-",
"a",
"-",
"view"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4349-L4353 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.views_preview | def views_preview(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#previewing-views"
api_path = "/api/v2/views/preview.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def views_preview(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#previewing-views"
api_path = "/api/v2/views/preview.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"views_preview",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/preview.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
",",
"*",
"*... | https://developer.zendesk.com/rest_api/docs/core/views#previewing-views | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#previewing",
"-",
"views"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4394-L4397 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.views_preview_count | def views_preview_count(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#preview-count"
api_path = "/api/v2/views/preview/count.json"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def views_preview_count(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#preview-count"
api_path = "/api/v2/views/preview/count.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"views_preview_count",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/preview/count.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
",",... | https://developer.zendesk.com/rest_api/docs/core/views#preview-count | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#preview",
"-",
"count"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4399-L4402 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.views_show_many | def views_show_many(self, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#list-views-by-id"
api_path = "/api/v2/views/show_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
... | python | def views_show_many(self, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#list-views-by-id"
api_path = "/api/v2/views/show_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
... | [
"def",
"views_show_many",
"(",
"self",
",",
"ids",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/show_many.json\"",
"api_query",
"=",
"{",
"}",
"if",
"\"query\"",
"in",
"kwargs",
".",
"keys",
"(",
")",
":",
"api_query",
... | https://developer.zendesk.com/rest_api/docs/core/views#list-views-by-id | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#list",
"-",
"views",
"-",
"by",
"-",
"id"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4409-L4420 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.views_update_many | def views_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#update-many-views"
api_path = "/api/v2/views/update_many.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | python | def views_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#update-many-views"
api_path = "/api/v2/views/update_many.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [
"def",
"views_update_many",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/views/update_many.json\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"PUT\"",
",",
"data",
"=",
"data",
",",
"*... | https://developer.zendesk.com/rest_api/docs/core/views#update-many-views | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"core",
"/",
"views#update",
"-",
"many",
"-",
"views"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4422-L4425 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.visitor_create | def visitor_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#create-visitor"
api_path = "/api/v2/visitors"
return self.call(api_path, method="POST", data=data, **kwargs) | python | def visitor_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#create-visitor"
api_path = "/api/v2/visitors"
return self.call(api_path, method="POST", data=data, **kwargs) | [
"def",
"visitor_create",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/visitors\"",
"return",
"self",
".",
"call",
"(",
"api_path",
",",
"method",
"=",
"\"POST\"",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwa... | https://developer.zendesk.com/rest_api/docs/chat/visitors#create-visitor | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"chat",
"/",
"visitors#create",
"-",
"visitor"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4427-L4430 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.visitor_show | def visitor_show(self, visitor_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#get-a-visitor"
api_path = "/api/v2/visitors/{visitor_id}"
api_path = api_path.format(visitor_id=visitor_id)
return self.call(api_path, **kwargs) | python | def visitor_show(self, visitor_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#get-a-visitor"
api_path = "/api/v2/visitors/{visitor_id}"
api_path = api_path.format(visitor_id=visitor_id)
return self.call(api_path, **kwargs) | [
"def",
"visitor_show",
"(",
"self",
",",
"visitor_id",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/visitors/{visitor_id}\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"visitor_id",
"=",
"visitor_id",
")",
"return",
"self",
".",
"call"... | https://developer.zendesk.com/rest_api/docs/chat/visitors#get-a-visitor | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"chat",
"/",
"visitors#get",
"-",
"a",
"-",
"visitor"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4432-L4436 |
fprimex/zdesk | zdesk/zdesk_api.py | ZendeskAPI.visitor_update | def visitor_update(self, visitor_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#update-visitor"
api_path = "/api/v2/visitors/{visitor_id}"
api_path = api_path.format(visitor_id=visitor_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | python | def visitor_update(self, visitor_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#update-visitor"
api_path = "/api/v2/visitors/{visitor_id}"
api_path = api_path.format(visitor_id=visitor_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | [
"def",
"visitor_update",
"(",
"self",
",",
"visitor_id",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"api_path",
"=",
"\"/api/v2/visitors/{visitor_id}\"",
"api_path",
"=",
"api_path",
".",
"format",
"(",
"visitor_id",
"=",
"visitor_id",
")",
"return",
"sel... | https://developer.zendesk.com/rest_api/docs/chat/visitors#update-visitor | [
"https",
":",
"//",
"developer",
".",
"zendesk",
".",
"com",
"/",
"rest_api",
"/",
"docs",
"/",
"chat",
"/",
"visitors#update",
"-",
"visitor"
] | train | https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4438-L4442 |
v1k45/django-notify-x | notify/templatetags/notification_tags.py | include_notify_js_variables | def include_notify_js_variables(context):
"""
Inclusion template tag to include all JS variables required by the
notify.js file on the HTML page around <script> tags.
Example::
{% include_notify_js_variables %}
:return: Prepares context for rendering in the inclusion file.
"""
ctx ... | python | def include_notify_js_variables(context):
"""
Inclusion template tag to include all JS variables required by the
notify.js file on the HTML page around <script> tags.
Example::
{% include_notify_js_variables %}
:return: Prepares context for rendering in the inclusion file.
"""
ctx ... | [
"def",
"include_notify_js_variables",
"(",
"context",
")",
":",
"ctx",
"=",
"{",
"'user'",
":",
"context",
"[",
"'request'",
"]",
".",
"user",
",",
"'update_notification'",
":",
"reverse",
"(",
"'notifications:update'",
")",
",",
"'mark_notification'",
":",
"rev... | Inclusion template tag to include all JS variables required by the
notify.js file on the HTML page around <script> tags.
Example::
{% include_notify_js_variables %}
:return: Prepares context for rendering in the inclusion file. | [
"Inclusion",
"template",
"tag",
"to",
"include",
"all",
"JS",
"variables",
"required",
"by",
"the",
"notify",
".",
"js",
"file",
"on",
"the",
"HTML",
"page",
"around",
"<script",
">",
"tags",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/templatetags/notification_tags.py#L92-L123 |
v1k45/django-notify-x | notify/templatetags/notification_tags.py | RenderNotificationsNode.generate_html | def generate_html(self, notifications):
"""
Generates rendered HTML content using supplied notifications.
:param notifications: Notification QuerySet Object
:return: Rendered HTML.
"""
html_chunks = []
for nf in notifications:
extra = nf.as_json() if s... | python | def generate_html(self, notifications):
"""
Generates rendered HTML content using supplied notifications.
:param notifications: Notification QuerySet Object
:return: Rendered HTML.
"""
html_chunks = []
for nf in notifications:
extra = nf.as_json() if s... | [
"def",
"generate_html",
"(",
"self",
",",
"notifications",
")",
":",
"html_chunks",
"=",
"[",
"]",
"for",
"nf",
"in",
"notifications",
":",
"extra",
"=",
"nf",
".",
"as_json",
"(",
")",
"if",
"self",
".",
"target",
"==",
"'box'",
"else",
"{",
"}",
"h... | Generates rendered HTML content using supplied notifications.
:param notifications: Notification QuerySet Object
:return: Rendered HTML. | [
"Generates",
"rendered",
"HTML",
"content",
"using",
"supplied",
"notifications",
".",
":",
"param",
"notifications",
":",
"Notification",
"QuerySet",
"Object",
":",
"return",
":",
"Rendered",
"HTML",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/templatetags/notification_tags.py#L46-L60 |
v1k45/django-notify-x | notify/templatetags/notification_tags.py | RenderNotificationsNode.render | def render(self, context):
"""
Render method of the template tag, returns generated html content to
the parent template where it was called.
:param context: Template context.
:return: Generated HTML content using notification queryset object.
"""
notifications = s... | python | def render(self, context):
"""
Render method of the template tag, returns generated html content to
the parent template where it was called.
:param context: Template context.
:return: Generated HTML content using notification queryset object.
"""
notifications = s... | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"notifications",
"=",
"self",
".",
"obj",
".",
"resolve",
"(",
"context",
")",
"return",
"self",
".",
"generate_html",
"(",
"notifications",
")"
] | Render method of the template tag, returns generated html content to
the parent template where it was called.
:param context: Template context.
:return: Generated HTML content using notification queryset object. | [
"Render",
"method",
"of",
"the",
"template",
"tag",
"returns",
"generated",
"html",
"content",
"to",
"the",
"parent",
"template",
"where",
"it",
"was",
"called",
".",
":",
"param",
"context",
":",
"Template",
"context",
".",
":",
"return",
":",
"Generated",
... | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/templatetags/notification_tags.py#L62-L70 |
v1k45/django-notify-x | notify/models.py | NotificationQueryset.unread_all | def unread_all(self, user=None):
"""
Marks all notifications as unread for a user (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as unread.
"""
qs = self.read()
if user:
qs = qs.filter(recipient=user)
qs.update(r... | python | def unread_all(self, user=None):
"""
Marks all notifications as unread for a user (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as unread.
"""
qs = self.read()
if user:
qs = qs.filter(recipient=user)
qs.update(r... | [
"def",
"unread_all",
"(",
"self",
",",
"user",
"=",
"None",
")",
":",
"qs",
"=",
"self",
".",
"read",
"(",
")",
"if",
"user",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"recipient",
"=",
"user",
")",
"qs",
".",
"update",
"(",
"read",
"=",
"False... | Marks all notifications as unread for a user (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as unread. | [
"Marks",
"all",
"notifications",
"as",
"unread",
"for",
"a",
"user",
"(",
"if",
"supplied",
")"
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/models.py#L71-L82 |
v1k45/django-notify-x | notify/models.py | NotificationQueryset.read_all | def read_all(self, user=None):
"""
Marks all notifications as read for a user (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as read.
"""
qs = self.unread()
if user:
qs = qs.filter(recipient=user)
qs.update(read=... | python | def read_all(self, user=None):
"""
Marks all notifications as read for a user (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as read.
"""
qs = self.unread()
if user:
qs = qs.filter(recipient=user)
qs.update(read=... | [
"def",
"read_all",
"(",
"self",
",",
"user",
"=",
"None",
")",
":",
"qs",
"=",
"self",
".",
"unread",
"(",
")",
"if",
"user",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"recipient",
"=",
"user",
")",
"qs",
".",
"update",
"(",
"read",
"=",
"True"... | Marks all notifications as read for a user (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as read. | [
"Marks",
"all",
"notifications",
"as",
"read",
"for",
"a",
"user",
"(",
"if",
"supplied",
")"
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/models.py#L84-L95 |
v1k45/django-notify-x | notify/models.py | NotificationQueryset.delete_all | def delete_all(self, user=None):
"""
Method to soft-delete all notifications of a User (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as soft-deleted.
"""
qs = self.active()
if user:
qs = qs.filter(recipient=user)
... | python | def delete_all(self, user=None):
"""
Method to soft-delete all notifications of a User (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as soft-deleted.
"""
qs = self.active()
if user:
qs = qs.filter(recipient=user)
... | [
"def",
"delete_all",
"(",
"self",
",",
"user",
"=",
"None",
")",
":",
"qs",
"=",
"self",
".",
"active",
"(",
")",
"if",
"user",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"recipient",
"=",
"user",
")",
"soft_delete",
"=",
"getattr",
"(",
"settings",... | Method to soft-delete all notifications of a User (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as soft-deleted. | [
"Method",
"to",
"soft",
"-",
"delete",
"all",
"notifications",
"of",
"a",
"User",
"(",
"if",
"supplied",
")"
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/models.py#L97-L114 |
v1k45/django-notify-x | notify/models.py | NotificationQueryset.active_all | def active_all(self, user=None):
"""
Method to soft-delete all notifications of a User (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as soft-deleted.
"""
qs = self.deleted()
if user:
qs = qs.filter(recipient=user)
... | python | def active_all(self, user=None):
"""
Method to soft-delete all notifications of a User (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as soft-deleted.
"""
qs = self.deleted()
if user:
qs = qs.filter(recipient=user)
... | [
"def",
"active_all",
"(",
"self",
",",
"user",
"=",
"None",
")",
":",
"qs",
"=",
"self",
".",
"deleted",
"(",
")",
"if",
"user",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"recipient",
"=",
"user",
")",
"qs",
".",
"update",
"(",
"deleted",
"=",
... | Method to soft-delete all notifications of a User (if supplied)
:param user: Notification recipient.
:return: Updates QuerySet as soft-deleted. | [
"Method",
"to",
"soft",
"-",
"delete",
"all",
"notifications",
"of",
"a",
"User",
"(",
"if",
"supplied",
")"
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/models.py#L116-L127 |
v1k45/django-notify-x | notify/utils.py | prefetch_relations | def prefetch_relations(weak_queryset):
"""
FROM: https://djangosnippets.org/snippets/2492/
Consider such a model class::
class Action(models.Model):
actor_content_type = models.ForeignKey(ContentType,related_name='actor')
actor_object_id = models.PositiveIntegerField()
... | python | def prefetch_relations(weak_queryset):
"""
FROM: https://djangosnippets.org/snippets/2492/
Consider such a model class::
class Action(models.Model):
actor_content_type = models.ForeignKey(ContentType,related_name='actor')
actor_object_id = models.PositiveIntegerField()
... | [
"def",
"prefetch_relations",
"(",
"weak_queryset",
")",
":",
"from",
"django",
".",
"contrib",
".",
"contenttypes",
".",
"models",
"import",
"ContentType",
"from",
"django",
".",
"contrib",
".",
"contenttypes",
".",
"fields",
"import",
"GenericForeignKey",
"# reve... | FROM: https://djangosnippets.org/snippets/2492/
Consider such a model class::
class Action(models.Model):
actor_content_type = models.ForeignKey(ContentType,related_name='actor')
actor_object_id = models.PositiveIntegerField()
actor = GenericForeignKey('actor_content_ty... | [
"FROM",
":",
"https",
":",
"//",
"djangosnippets",
".",
"org",
"/",
"snippets",
"/",
"2492",
"/"
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/utils.py#L22-L121 |
v1k45/django-notify-x | notify/views.py | notification_redirect | def notification_redirect(request, ctx):
"""
Helper to handle HTTP response after an action is performed on notification
:param request: HTTP request context of the notification
:param ctx: context to be returned when a AJAX call is made.
:returns: Either JSON for AJAX or redirects to the calcula... | python | def notification_redirect(request, ctx):
"""
Helper to handle HTTP response after an action is performed on notification
:param request: HTTP request context of the notification
:param ctx: context to be returned when a AJAX call is made.
:returns: Either JSON for AJAX or redirects to the calcula... | [
"def",
"notification_redirect",
"(",
"request",
",",
"ctx",
")",
":",
"if",
"request",
".",
"is_ajax",
"(",
")",
":",
"return",
"JsonResponse",
"(",
"ctx",
")",
"else",
":",
"next_page",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'next'",
",",
"rev... | Helper to handle HTTP response after an action is performed on notification
:param request: HTTP request context of the notification
:param ctx: context to be returned when a AJAX call is made.
:returns: Either JSON for AJAX or redirects to the calculated next page. | [
"Helper",
"to",
"handle",
"HTTP",
"response",
"after",
"an",
"action",
"is",
"performed",
"on",
"notification"
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L20-L39 |
v1k45/django-notify-x | notify/views.py | notifications | def notifications(request):
"""
Returns a rendered page of all notifications for the logged-in user.
Uses ``notification.nf_type`` as the template for individual notification.
Each notification type is expected to have a render template
at ``notifications/includes/NOTIFICATION_TYPE.html``.
:par... | python | def notifications(request):
"""
Returns a rendered page of all notifications for the logged-in user.
Uses ``notification.nf_type`` as the template for individual notification.
Each notification type is expected to have a render template
at ``notifications/includes/NOTIFICATION_TYPE.html``.
:par... | [
"def",
"notifications",
"(",
"request",
")",
":",
"notification_list",
"=",
"request",
".",
"user",
".",
"notifications",
".",
"active",
"(",
")",
".",
"prefetch",
"(",
")",
"return",
"render",
"(",
"request",
",",
"'notifications/all.html'",
",",
"{",
"'not... | Returns a rendered page of all notifications for the logged-in user.
Uses ``notification.nf_type`` as the template for individual notification.
Each notification type is expected to have a render template
at ``notifications/includes/NOTIFICATION_TYPE.html``.
:param request: HTTP request context.
:... | [
"Returns",
"a",
"rendered",
"page",
"of",
"all",
"notifications",
"for",
"the",
"logged",
"-",
"in",
"user",
".",
"Uses",
"notification",
".",
"nf_type",
"as",
"the",
"template",
"for",
"individual",
"notification",
".",
"Each",
"notification",
"type",
"is",
... | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L43-L56 |
v1k45/django-notify-x | notify/views.py | mark | def mark(request):
"""
Handles marking of individual notifications as read or unread.
Takes ``notification id`` and mark ``action`` as POST data.
:param request: HTTP request context.
:returns: Response to mark action of supplied notification ID.
"""
notification_id = request.POST.get('id'... | python | def mark(request):
"""
Handles marking of individual notifications as read or unread.
Takes ``notification id`` and mark ``action`` as POST data.
:param request: HTTP request context.
:returns: Response to mark action of supplied notification ID.
"""
notification_id = request.POST.get('id'... | [
"def",
"mark",
"(",
"request",
")",
":",
"notification_id",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'id'",
",",
"None",
")",
"action",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'action'",
",",
"None",
")",
"success",
"=",
"True",
"if",
... | Handles marking of individual notifications as read or unread.
Takes ``notification id`` and mark ``action`` as POST data.
:param request: HTTP request context.
:returns: Response to mark action of supplied notification ID. | [
"Handles",
"marking",
"of",
"individual",
"notifications",
"as",
"read",
"or",
"unread",
".",
"Takes",
"notification",
"id",
"and",
"mark",
"action",
"as",
"POST",
"data",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L61-L96 |
v1k45/django-notify-x | notify/views.py | mark_all | def mark_all(request):
"""
Marks notifications as either read or unread depending of POST parameters.
Takes ``action`` as POST data, it can either be ``read`` or ``unread``.
:param request: HTTP Request context.
:return: Response to mark_all action.
"""
action = request.POST.get('action', ... | python | def mark_all(request):
"""
Marks notifications as either read or unread depending of POST parameters.
Takes ``action`` as POST data, it can either be ``read`` or ``unread``.
:param request: HTTP Request context.
:return: Response to mark_all action.
"""
action = request.POST.get('action', ... | [
"def",
"mark_all",
"(",
"request",
")",
":",
"action",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'action'",
",",
"None",
")",
"success",
"=",
"True",
"if",
"action",
"==",
"'read'",
":",
"request",
".",
"user",
".",
"notifications",
".",
"read_all... | Marks notifications as either read or unread depending of POST parameters.
Takes ``action`` as POST data, it can either be ``read`` or ``unread``.
:param request: HTTP Request context.
:return: Response to mark_all action. | [
"Marks",
"notifications",
"as",
"either",
"read",
"or",
"unread",
"depending",
"of",
"POST",
"parameters",
".",
"Takes",
"action",
"as",
"POST",
"data",
"it",
"can",
"either",
"be",
"read",
"or",
"unread",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L101-L125 |
v1k45/django-notify-x | notify/views.py | delete | def delete(request):
"""
Deletes notification of supplied notification ID.
Depending on project settings, if ``NOTIFICATIONS_SOFT_DELETE``
is set to ``False``, the notifications will be deleted from DB.
If not, a soft delete will be performed.
By default, notifications are deleted softly.
... | python | def delete(request):
"""
Deletes notification of supplied notification ID.
Depending on project settings, if ``NOTIFICATIONS_SOFT_DELETE``
is set to ``False``, the notifications will be deleted from DB.
If not, a soft delete will be performed.
By default, notifications are deleted softly.
... | [
"def",
"delete",
"(",
"request",
")",
":",
"notification_id",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'id'",
",",
"None",
")",
"success",
"=",
"True",
"if",
"notification_id",
":",
"try",
":",
"notification",
"=",
"Notification",
".",
"objects",
"... | Deletes notification of supplied notification ID.
Depending on project settings, if ``NOTIFICATIONS_SOFT_DELETE``
is set to ``False``, the notifications will be deleted from DB.
If not, a soft delete will be performed.
By default, notifications are deleted softly.
:param request: HTTP request con... | [
"Deletes",
"notification",
"of",
"supplied",
"notification",
"ID",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L130-L167 |
v1k45/django-notify-x | notify/views.py | notification_update | def notification_update(request):
"""
Handles live updating of notifications, follows ajax-polling approach.
Read more: http://stackoverflow.com/a/12855533/4726598
Required URL parameters: ``flag``.
Explanation:
- The ``flag`` parameter carries the last notification ID \
received... | python | def notification_update(request):
"""
Handles live updating of notifications, follows ajax-polling approach.
Read more: http://stackoverflow.com/a/12855533/4726598
Required URL parameters: ``flag``.
Explanation:
- The ``flag`` parameter carries the last notification ID \
received... | [
"def",
"notification_update",
"(",
"request",
")",
":",
"flag",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'flag'",
",",
"None",
")",
"target",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'target'",
",",
"'box'",
")",
"last_notification",
"=",
"in... | Handles live updating of notifications, follows ajax-polling approach.
Read more: http://stackoverflow.com/a/12855533/4726598
Required URL parameters: ``flag``.
Explanation:
- The ``flag`` parameter carries the last notification ID \
received by the user's browser.
- This ``flag... | [
"Handles",
"live",
"updating",
"of",
"notifications",
"follows",
"ajax",
"-",
"polling",
"approach",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L171-L264 |
v1k45/django-notify-x | notify/views.py | read_and_redirect | def read_and_redirect(request, notification_id):
"""
Marks the supplied notification as read and then redirects
to the supplied URL from the ``next`` URL parameter.
**IMPORTANT**: This is CSRF - unsafe method.
Only use it if its okay for you to mark notifications \
as read without a robust chec... | python | def read_and_redirect(request, notification_id):
"""
Marks the supplied notification as read and then redirects
to the supplied URL from the ``next`` URL parameter.
**IMPORTANT**: This is CSRF - unsafe method.
Only use it if its okay for you to mark notifications \
as read without a robust chec... | [
"def",
"read_and_redirect",
"(",
"request",
",",
"notification_id",
")",
":",
"notification_page",
"=",
"reverse",
"(",
"'notifications:all'",
")",
"next_page",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'next'",
",",
"notification_page",
")",
"if",
"is_safe_... | Marks the supplied notification as read and then redirects
to the supplied URL from the ``next`` URL parameter.
**IMPORTANT**: This is CSRF - unsafe method.
Only use it if its okay for you to mark notifications \
as read without a robust check.
:param request: HTTP request context.
:param noti... | [
"Marks",
"the",
"supplied",
"notification",
"as",
"read",
"and",
"then",
"redirects",
"to",
"the",
"supplied",
"URL",
"from",
"the",
"next",
"URL",
"parameter",
"."
] | train | https://github.com/v1k45/django-notify-x/blob/b4aa03039759126889666a59117e83dcd4cdb374/notify/views.py#L268-L296 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.get_motion_detection | def get_motion_detection(self):
"""Fetch current motion state from camera"""
url = ('%s/ISAPI/System/Video/inputs/'
'channels/1/motionDetection') % self.root_url
try:
response = self.hik_request.get(url, timeout=CONNECT_TIMEOUT)
except (requests.exceptions.Req... | python | def get_motion_detection(self):
"""Fetch current motion state from camera"""
url = ('%s/ISAPI/System/Video/inputs/'
'channels/1/motionDetection') % self.root_url
try:
response = self.hik_request.get(url, timeout=CONNECT_TIMEOUT)
except (requests.exceptions.Req... | [
"def",
"get_motion_detection",
"(",
"self",
")",
":",
"url",
"=",
"(",
"'%s/ISAPI/System/Video/inputs/'",
"'channels/1/motionDetection'",
")",
"%",
"self",
".",
"root_url",
"try",
":",
"response",
"=",
"self",
".",
"hik_request",
".",
"get",
"(",
"url",
",",
"... | Fetch current motion state from camera | [
"Fetch",
"current",
"motion",
"state",
"from",
"camera"
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L141-L179 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera._set_motion_detection | def _set_motion_detection(self, enable):
"""Set desired motion detection state on camera"""
url = ('%s/ISAPI/System/Video/inputs/'
'channels/1/motionDetection') % self.root_url
enabled = self._motion_detection_xml.find(self.element_query('enabled'))
if enabled is None:
... | python | def _set_motion_detection(self, enable):
"""Set desired motion detection state on camera"""
url = ('%s/ISAPI/System/Video/inputs/'
'channels/1/motionDetection') % self.root_url
enabled = self._motion_detection_xml.find(self.element_query('enabled'))
if enabled is None:
... | [
"def",
"_set_motion_detection",
"(",
"self",
",",
"enable",
")",
":",
"url",
"=",
"(",
"'%s/ISAPI/System/Video/inputs/'",
"'channels/1/motionDetection'",
")",
"%",
"self",
".",
"root_url",
"enabled",
"=",
"self",
".",
"_motion_detection_xml",
".",
"find",
"(",
"se... | Set desired motion detection state on camera | [
"Set",
"desired",
"motion",
"detection",
"state",
"on",
"camera"
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L189-L218 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.add_update_callback | def add_update_callback(self, callback, sensor):
"""Register as callback for when a matching device sensor changes."""
self._updateCallbacks.append([callback, sensor])
_LOGGING.debug('Added update callback to %s on %s', callback, sensor) | python | def add_update_callback(self, callback, sensor):
"""Register as callback for when a matching device sensor changes."""
self._updateCallbacks.append([callback, sensor])
_LOGGING.debug('Added update callback to %s on %s', callback, sensor) | [
"def",
"add_update_callback",
"(",
"self",
",",
"callback",
",",
"sensor",
")",
":",
"self",
".",
"_updateCallbacks",
".",
"append",
"(",
"[",
"callback",
",",
"sensor",
"]",
")",
"_LOGGING",
".",
"debug",
"(",
"'Added update callback to %s on %s'",
",",
"call... | Register as callback for when a matching device sensor changes. | [
"Register",
"as",
"callback",
"for",
"when",
"a",
"matching",
"device",
"sensor",
"changes",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L220-L223 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera._do_update_callback | def _do_update_callback(self, msg):
"""Call registered callback functions."""
for callback, sensor in self._updateCallbacks:
if sensor == msg:
_LOGGING.debug('Update callback %s for sensor %s',
callback, sensor)
callback(msg) | python | def _do_update_callback(self, msg):
"""Call registered callback functions."""
for callback, sensor in self._updateCallbacks:
if sensor == msg:
_LOGGING.debug('Update callback %s for sensor %s',
callback, sensor)
callback(msg) | [
"def",
"_do_update_callback",
"(",
"self",
",",
"msg",
")",
":",
"for",
"callback",
",",
"sensor",
"in",
"self",
".",
"_updateCallbacks",
":",
"if",
"sensor",
"==",
"msg",
":",
"_LOGGING",
".",
"debug",
"(",
"'Update callback %s for sensor %s'",
",",
"callback... | Call registered callback functions. | [
"Call",
"registered",
"callback",
"functions",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L225-L231 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.initialize | def initialize(self):
"""Initialize deviceInfo and available events."""
device_info = self.get_device_info()
if device_info is None:
self.name = None
self.cam_id = None
self.event_states = None
return
for key in device_info:
i... | python | def initialize(self):
"""Initialize deviceInfo and available events."""
device_info = self.get_device_info()
if device_info is None:
self.name = None
self.cam_id = None
self.event_states = None
return
for key in device_info:
i... | [
"def",
"initialize",
"(",
"self",
")",
":",
"device_info",
"=",
"self",
".",
"get_device_info",
"(",
")",
"if",
"device_info",
"is",
"None",
":",
"self",
".",
"name",
"=",
"None",
"self",
".",
"cam_id",
"=",
"None",
"self",
".",
"event_states",
"=",
"N... | Initialize deviceInfo and available events. | [
"Initialize",
"deviceInfo",
"and",
"available",
"events",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L237-L274 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.get_event_triggers | def get_event_triggers(self):
"""
Returns dict of supported events.
Key = Event Type
List = Channels that have that event activated
"""
events = {}
nvrflag = False
event_xml = []
url = '%s/ISAPI/Event/triggers' % self.root_url
try:
... | python | def get_event_triggers(self):
"""
Returns dict of supported events.
Key = Event Type
List = Channels that have that event activated
"""
events = {}
nvrflag = False
event_xml = []
url = '%s/ISAPI/Event/triggers' % self.root_url
try:
... | [
"def",
"get_event_triggers",
"(",
"self",
")",
":",
"events",
"=",
"{",
"}",
"nvrflag",
"=",
"False",
"event_xml",
"=",
"[",
"]",
"url",
"=",
"'%s/ISAPI/Event/triggers'",
"%",
"self",
".",
"root_url",
"try",
":",
"response",
"=",
"self",
".",
"hik_request"... | Returns dict of supported events.
Key = Event Type
List = Channels that have that event activated | [
"Returns",
"dict",
"of",
"supported",
"events",
".",
"Key",
"=",
"Event",
"Type",
"List",
"=",
"Channels",
"that",
"have",
"that",
"event",
"activated"
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L276-L369 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.get_device_info | def get_device_info(self):
"""Parse deviceInfo into dictionary."""
device_info = {}
url = '%s/ISAPI/System/deviceInfo' % self.root_url
using_digest = False
try:
response = self.hik_request.get(url, timeout=CONNECT_TIMEOUT)
if response.status_code == reque... | python | def get_device_info(self):
"""Parse deviceInfo into dictionary."""
device_info = {}
url = '%s/ISAPI/System/deviceInfo' % self.root_url
using_digest = False
try:
response = self.hik_request.get(url, timeout=CONNECT_TIMEOUT)
if response.status_code == reque... | [
"def",
"get_device_info",
"(",
"self",
")",
":",
"device_info",
"=",
"{",
"}",
"url",
"=",
"'%s/ISAPI/System/deviceInfo'",
"%",
"self",
".",
"root_url",
"using_digest",
"=",
"False",
"try",
":",
"response",
"=",
"self",
".",
"hik_request",
".",
"get",
"(",
... | Parse deviceInfo into dictionary. | [
"Parse",
"deviceInfo",
"into",
"dictionary",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L371-L428 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.watchdog_handler | def watchdog_handler(self):
"""Take care of threads if wachdog expires."""
_LOGGING.debug('%s Watchdog expired. Resetting connection.', self.name)
self.watchdog.stop()
self.reset_thrd.set() | python | def watchdog_handler(self):
"""Take care of threads if wachdog expires."""
_LOGGING.debug('%s Watchdog expired. Resetting connection.', self.name)
self.watchdog.stop()
self.reset_thrd.set() | [
"def",
"watchdog_handler",
"(",
"self",
")",
":",
"_LOGGING",
".",
"debug",
"(",
"'%s Watchdog expired. Resetting connection.'",
",",
"self",
".",
"name",
")",
"self",
".",
"watchdog",
".",
"stop",
"(",
")",
"self",
".",
"reset_thrd",
".",
"set",
"(",
")"
] | Take care of threads if wachdog expires. | [
"Take",
"care",
"of",
"threads",
"if",
"wachdog",
"expires",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L430-L434 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.disconnect | def disconnect(self):
"""Disconnect from event stream."""
_LOGGING.debug('Disconnecting from stream: %s', self.name)
self.kill_thrd.set()
self.thrd.join()
_LOGGING.debug('Event stream thread for %s is stopped', self.name)
self.kill_thrd.clear() | python | def disconnect(self):
"""Disconnect from event stream."""
_LOGGING.debug('Disconnecting from stream: %s', self.name)
self.kill_thrd.set()
self.thrd.join()
_LOGGING.debug('Event stream thread for %s is stopped', self.name)
self.kill_thrd.clear() | [
"def",
"disconnect",
"(",
"self",
")",
":",
"_LOGGING",
".",
"debug",
"(",
"'Disconnecting from stream: %s'",
",",
"self",
".",
"name",
")",
"self",
".",
"kill_thrd",
".",
"set",
"(",
")",
"self",
".",
"thrd",
".",
"join",
"(",
")",
"_LOGGING",
".",
"d... | Disconnect from event stream. | [
"Disconnect",
"from",
"event",
"stream",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L436-L442 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.alert_stream | def alert_stream(self, reset_event, kill_event):
"""Open event stream."""
_LOGGING.debug('Stream Thread Started: %s, %s', self.name, self.cam_id)
start_event = False
parse_string = ""
fail_count = 0
url = '%s/ISAPI/Event/notification/alertStream' % self.root_url
... | python | def alert_stream(self, reset_event, kill_event):
"""Open event stream."""
_LOGGING.debug('Stream Thread Started: %s, %s', self.name, self.cam_id)
start_event = False
parse_string = ""
fail_count = 0
url = '%s/ISAPI/Event/notification/alertStream' % self.root_url
... | [
"def",
"alert_stream",
"(",
"self",
",",
"reset_event",
",",
"kill_event",
")",
":",
"_LOGGING",
".",
"debug",
"(",
"'Stream Thread Started: %s, %s'",
",",
"self",
".",
"name",
",",
"self",
".",
"cam_id",
")",
"start_event",
"=",
"False",
"parse_string",
"=",
... | Open event stream. | [
"Open",
"event",
"stream",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L449-L531 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.process_stream | def process_stream(self, tree):
"""Process incoming event stream packets."""
try:
etype = SENSOR_MAP[tree.find(
self.element_query('eventType')).text.lower()]
estate = tree.find(
self.element_query('eventState')).text
echid = tree.find(... | python | def process_stream(self, tree):
"""Process incoming event stream packets."""
try:
etype = SENSOR_MAP[tree.find(
self.element_query('eventType')).text.lower()]
estate = tree.find(
self.element_query('eventState')).text
echid = tree.find(... | [
"def",
"process_stream",
"(",
"self",
",",
"tree",
")",
":",
"try",
":",
"etype",
"=",
"SENSOR_MAP",
"[",
"tree",
".",
"find",
"(",
"self",
".",
"element_query",
"(",
"'eventType'",
")",
")",
".",
"text",
".",
"lower",
"(",
")",
"]",
"estate",
"=",
... | Process incoming event stream packets. | [
"Process",
"incoming",
"event",
"stream",
"packets",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L533-L571 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.update_stale | def update_stale(self):
"""Update stale active statuses"""
# Some events don't post an inactive XML, only active.
# If we don't get an active update for 5 seconds we can
# assume the event is no longer active and update accordingly.
for etype, echannels in self.event_states.items... | python | def update_stale(self):
"""Update stale active statuses"""
# Some events don't post an inactive XML, only active.
# If we don't get an active update for 5 seconds we can
# assume the event is no longer active and update accordingly.
for etype, echannels in self.event_states.items... | [
"def",
"update_stale",
"(",
"self",
")",
":",
"# Some events don't post an inactive XML, only active.",
"# If we don't get an active update for 5 seconds we can",
"# assume the event is no longer active and update accordingly.",
"for",
"etype",
",",
"echannels",
"in",
"self",
".",
"e... | Update stale active statuses | [
"Update",
"stale",
"active",
"statuses"
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L573-L590 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.publish_changes | def publish_changes(self, etype, echid):
"""Post updates for specified event type."""
_LOGGING.debug('%s Update: %s, %s',
self.name, etype, self.fetch_attributes(etype, echid))
signal = 'ValueChanged.{}'.format(self.cam_id)
sender = '{}.{}'.format(etype, echid)
... | python | def publish_changes(self, etype, echid):
"""Post updates for specified event type."""
_LOGGING.debug('%s Update: %s, %s',
self.name, etype, self.fetch_attributes(etype, echid))
signal = 'ValueChanged.{}'.format(self.cam_id)
sender = '{}.{}'.format(etype, echid)
... | [
"def",
"publish_changes",
"(",
"self",
",",
"etype",
",",
"echid",
")",
":",
"_LOGGING",
".",
"debug",
"(",
"'%s Update: %s, %s'",
",",
"self",
".",
"name",
",",
"etype",
",",
"self",
".",
"fetch_attributes",
"(",
"etype",
",",
"echid",
")",
")",
"signal... | Post updates for specified event type. | [
"Post",
"updates",
"for",
"specified",
"event",
"type",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L592-L601 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.fetch_attributes | def fetch_attributes(self, event, channel):
"""Returns attribute list for a given event/channel."""
try:
for sensor in self.event_states[event]:
if sensor[1] == int(channel):
return sensor
except KeyError:
return None | python | def fetch_attributes(self, event, channel):
"""Returns attribute list for a given event/channel."""
try:
for sensor in self.event_states[event]:
if sensor[1] == int(channel):
return sensor
except KeyError:
return None | [
"def",
"fetch_attributes",
"(",
"self",
",",
"event",
",",
"channel",
")",
":",
"try",
":",
"for",
"sensor",
"in",
"self",
".",
"event_states",
"[",
"event",
"]",
":",
"if",
"sensor",
"[",
"1",
"]",
"==",
"int",
"(",
"channel",
")",
":",
"return",
... | Returns attribute list for a given event/channel. | [
"Returns",
"attribute",
"list",
"for",
"a",
"given",
"event",
"/",
"channel",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L603-L610 |
mezz64/pyHik | pyhik/hikvision.py | HikCamera.update_attributes | def update_attributes(self, event, channel, attr):
"""Update attribute list for current event/channel."""
try:
for i, sensor in enumerate(self.event_states[event]):
if sensor[1] == int(channel):
self.event_states[event][i] = attr
except KeyError:
... | python | def update_attributes(self, event, channel, attr):
"""Update attribute list for current event/channel."""
try:
for i, sensor in enumerate(self.event_states[event]):
if sensor[1] == int(channel):
self.event_states[event][i] = attr
except KeyError:
... | [
"def",
"update_attributes",
"(",
"self",
",",
"event",
",",
"channel",
",",
"attr",
")",
":",
"try",
":",
"for",
"i",
",",
"sensor",
"in",
"enumerate",
"(",
"self",
".",
"event_states",
"[",
"event",
"]",
")",
":",
"if",
"sensor",
"[",
"1",
"]",
"=... | Update attribute list for current event/channel. | [
"Update",
"attribute",
"list",
"for",
"current",
"event",
"/",
"channel",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/hikvision.py#L612-L620 |
mezz64/pyHik | pyhik/watchdog.py | Watchdog.start | def start(self):
""" Starts the watchdog timer. """
self._timer = Timer(self.time, self.handler)
self._timer.daemon = True
self._timer.start()
return | python | def start(self):
""" Starts the watchdog timer. """
self._timer = Timer(self.time, self.handler)
self._timer.daemon = True
self._timer.start()
return | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_timer",
"=",
"Timer",
"(",
"self",
".",
"time",
",",
"self",
".",
"handler",
")",
"self",
".",
"_timer",
".",
"daemon",
"=",
"True",
"self",
".",
"_timer",
".",
"start",
"(",
")",
"return"
] | Starts the watchdog timer. | [
"Starts",
"the",
"watchdog",
"timer",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/pyhik/watchdog.py#L21-L26 |
mezz64/pyHik | examples/basic_usage.py | main | def main():
"""Main function"""
cam = HikCamObject('http://XXX.XXX.XXX.XXX', 80, 'user', 'password')
entities = []
for sensor, channel_list in cam.sensors.items():
for channel in channel_list:
entities.append(HikSensor(sensor, channel[1], cam)) | python | def main():
"""Main function"""
cam = HikCamObject('http://XXX.XXX.XXX.XXX', 80, 'user', 'password')
entities = []
for sensor, channel_list in cam.sensors.items():
for channel in channel_list:
entities.append(HikSensor(sensor, channel[1], cam)) | [
"def",
"main",
"(",
")",
":",
"cam",
"=",
"HikCamObject",
"(",
"'http://XXX.XXX.XXX.XXX'",
",",
"80",
",",
"'user'",
",",
"'password'",
")",
"entities",
"=",
"[",
"]",
"for",
"sensor",
",",
"channel_list",
"in",
"cam",
".",
"sensors",
".",
"items",
"(",
... | Main function | [
"Main",
"function"
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/examples/basic_usage.py#L97-L105 |
mezz64/pyHik | examples/basic_usage.py | HikCamObject.flip_motion | def flip_motion(self, value):
"""Toggle motion detection"""
if value:
self.cam.enable_motion_detection()
else:
self.cam.disable_motion_detection() | python | def flip_motion(self, value):
"""Toggle motion detection"""
if value:
self.cam.enable_motion_detection()
else:
self.cam.disable_motion_detection() | [
"def",
"flip_motion",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
":",
"self",
".",
"cam",
".",
"enable_motion_detection",
"(",
")",
"else",
":",
"self",
".",
"cam",
".",
"disable_motion_detection",
"(",
")"
] | Toggle motion detection | [
"Toggle",
"motion",
"detection"
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/examples/basic_usage.py#L47-L52 |
mezz64/pyHik | examples/basic_usage.py | HikSensor.update_callback | def update_callback(self, msg):
""" get updates. """
print('Callback: {}'.format(msg))
print('{}:{} @ {}'.format(self.name, self._sensor_state(), self._sensor_last_update())) | python | def update_callback(self, msg):
""" get updates. """
print('Callback: {}'.format(msg))
print('{}:{} @ {}'.format(self.name, self._sensor_state(), self._sensor_last_update())) | [
"def",
"update_callback",
"(",
"self",
",",
"msg",
")",
":",
"print",
"(",
"'Callback: {}'",
".",
"format",
"(",
"msg",
")",
")",
"print",
"(",
"'{}:{} @ {}'",
".",
"format",
"(",
"self",
".",
"name",
",",
"self",
".",
"_sensor_state",
"(",
")",
",",
... | get updates. | [
"get",
"updates",
"."
] | train | https://github.com/mezz64/pyHik/blob/1e7afca926e2b045257a43cbf8b1236a435493c2/examples/basic_usage.py#L91-L94 |
mbr/flask-nav | flask_nav/elements.py | NavigationItem.render | def render(self, renderer=None, **kwargs):
"""Render the navigational item using a renderer.
:param renderer: An object implementing the :class:`~.Renderer`
interface.
:return: A markupsafe string with the rendered result.
"""
return Markup(get_renderer(... | python | def render(self, renderer=None, **kwargs):
"""Render the navigational item using a renderer.
:param renderer: An object implementing the :class:`~.Renderer`
interface.
:return: A markupsafe string with the rendered result.
"""
return Markup(get_renderer(... | [
"def",
"render",
"(",
"self",
",",
"renderer",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Markup",
"(",
"get_renderer",
"(",
"current_app",
",",
"renderer",
")",
"(",
"*",
"*",
"kwargs",
")",
".",
"visit",
"(",
"self",
")",
")"
] | Render the navigational item using a renderer.
:param renderer: An object implementing the :class:`~.Renderer`
interface.
:return: A markupsafe string with the rendered result. | [
"Render",
"the",
"navigational",
"item",
"using",
"a",
"renderer",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/elements.py#L16-L24 |
mbr/flask-nav | flask_nav/renderers.py | Renderer.visit_object | def visit_object(self, node):
"""Fallback rendering for objects.
If the current application is in debug-mode
(``flask.current_app.debug`` is ``True``), an ``<!-- HTML comment
-->`` will be rendered, indicating which class is missing a visitation
function.
Outside of deb... | python | def visit_object(self, node):
"""Fallback rendering for objects.
If the current application is in debug-mode
(``flask.current_app.debug`` is ``True``), an ``<!-- HTML comment
-->`` will be rendered, indicating which class is missing a visitation
function.
Outside of deb... | [
"def",
"visit_object",
"(",
"self",
",",
"node",
")",
":",
"if",
"current_app",
".",
"debug",
":",
"return",
"tags",
".",
"comment",
"(",
"'no implementation in {} to render {}'",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"node",
".... | Fallback rendering for objects.
If the current application is in debug-mode
(``flask.current_app.debug`` is ``True``), an ``<!-- HTML comment
-->`` will be rendered, indicating which class is missing a visitation
function.
Outside of debug-mode, returns an empty string. | [
"Fallback",
"rendering",
"for",
"objects",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/renderers.py#L13-L27 |
mbr/flask-nav | flask_nav/__init__.py | register_renderer | def register_renderer(app, id, renderer, force=True):
"""Registers a renderer on the application.
:param app: The :class:`~flask.Flask` application to register the renderer
on
:param id: Internal id-string for the renderer
:param renderer: Renderer to register
:param force: Whether ... | python | def register_renderer(app, id, renderer, force=True):
"""Registers a renderer on the application.
:param app: The :class:`~flask.Flask` application to register the renderer
on
:param id: Internal id-string for the renderer
:param renderer: Renderer to register
:param force: Whether ... | [
"def",
"register_renderer",
"(",
"app",
",",
"id",
",",
"renderer",
",",
"force",
"=",
"True",
")",
":",
"renderers",
"=",
"app",
".",
"extensions",
".",
"setdefault",
"(",
"'nav_renderers'",
",",
"{",
"}",
")",
"if",
"force",
":",
"renderers",
"[",
"i... | Registers a renderer on the application.
:param app: The :class:`~flask.Flask` application to register the renderer
on
:param id: Internal id-string for the renderer
:param renderer: Renderer to register
:param force: Whether or not to overwrite the renderer if a different one
... | [
"Registers",
"a",
"renderer",
"on",
"the",
"application",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/__init__.py#L6-L21 |
mbr/flask-nav | flask_nav/__init__.py | get_renderer | def get_renderer(app, id):
"""Retrieve a renderer.
:param app: :class:`~flask.Flask` application to look ``id`` up on
:param id: Internal renderer id-string to look up
"""
renderer = app.extensions.get('nav_renderers', {})[id]
if isinstance(renderer, tuple):
mod_name, cls_name = render... | python | def get_renderer(app, id):
"""Retrieve a renderer.
:param app: :class:`~flask.Flask` application to look ``id`` up on
:param id: Internal renderer id-string to look up
"""
renderer = app.extensions.get('nav_renderers', {})[id]
if isinstance(renderer, tuple):
mod_name, cls_name = render... | [
"def",
"get_renderer",
"(",
"app",
",",
"id",
")",
":",
"renderer",
"=",
"app",
".",
"extensions",
".",
"get",
"(",
"'nav_renderers'",
",",
"{",
"}",
")",
"[",
"id",
"]",
"if",
"isinstance",
"(",
"renderer",
",",
"tuple",
")",
":",
"mod_name",
",",
... | Retrieve a renderer.
:param app: :class:`~flask.Flask` application to look ``id`` up on
:param id: Internal renderer id-string to look up | [
"Retrieve",
"a",
"renderer",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/__init__.py#L24-L42 |
mbr/flask-nav | flask_nav/__init__.py | Nav.init_app | def init_app(self, app):
"""Initialize an application.
:param app: A :class:`~flask.Flask` app.
"""
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['nav'] = self
app.add_template_global(self.elems, 'nav')
# register some render... | python | def init_app(self, app):
"""Initialize an application.
:param app: A :class:`~flask.Flask` app.
"""
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['nav'] = self
app.add_template_global(self.elems, 'nav')
# register some render... | [
"def",
"init_app",
"(",
"self",
",",
"app",
")",
":",
"if",
"not",
"hasattr",
"(",
"app",
",",
"'extensions'",
")",
":",
"app",
".",
"extensions",
"=",
"{",
"}",
"app",
".",
"extensions",
"[",
"'nav'",
"]",
"=",
"self",
"app",
".",
"add_template_glob... | Initialize an application.
:param app: A :class:`~flask.Flask` app. | [
"Initialize",
"an",
"application",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/__init__.py#L99-L112 |
mbr/flask-nav | flask_nav/__init__.py | Nav.navigation | def navigation(self, id=None):
"""Function decorator for navbar registration.
Convenience function, calls :meth:`.register_element` with ``id`` and
the decorated function as ``elem``.
:param id: ID to pass on. If ``None``, uses the decorated functions
name.
"... | python | def navigation(self, id=None):
"""Function decorator for navbar registration.
Convenience function, calls :meth:`.register_element` with ``id`` and
the decorated function as ``elem``.
:param id: ID to pass on. If ``None``, uses the decorated functions
name.
"... | [
"def",
"navigation",
"(",
"self",
",",
"id",
"=",
"None",
")",
":",
"def",
"wrapper",
"(",
"f",
")",
":",
"self",
".",
"register_element",
"(",
"id",
"or",
"f",
".",
"__name__",
",",
"f",
")",
"return",
"f",
"return",
"wrapper"
] | Function decorator for navbar registration.
Convenience function, calls :meth:`.register_element` with ``id`` and
the decorated function as ``elem``.
:param id: ID to pass on. If ``None``, uses the decorated functions
name. | [
"Function",
"decorator",
"for",
"navbar",
"registration",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/__init__.py#L114-L128 |
mbr/flask-nav | flask_nav/__init__.py | Nav.renderer | def renderer(self, id=None, force=True):
"""Class decorator for Renderers.
The decorated class will be added to the list of renderers kept by this
instance that will be registered on the app upon app initialization.
:param id: Id for the renderer, defaults to the class name in snake
... | python | def renderer(self, id=None, force=True):
"""Class decorator for Renderers.
The decorated class will be added to the list of renderers kept by this
instance that will be registered on the app upon app initialization.
:param id: Id for the renderer, defaults to the class name in snake
... | [
"def",
"renderer",
"(",
"self",
",",
"id",
"=",
"None",
",",
"force",
"=",
"True",
")",
":",
"def",
"_",
"(",
"cls",
")",
":",
"name",
"=",
"cls",
".",
"__name__",
"sn",
"=",
"name",
"[",
"0",
"]",
"+",
"re",
".",
"sub",
"(",
"r'([A-Z])'",
",... | Class decorator for Renderers.
The decorated class will be added to the list of renderers kept by this
instance that will be registered on the app upon app initialization.
:param id: Id for the renderer, defaults to the class name in snake
case.
:param force: Whether... | [
"Class",
"decorator",
"for",
"Renderers",
"."
] | train | https://github.com/mbr/flask-nav/blob/06f3b5b2addad29c2fc531a7e8e74958e9e4b793/flask_nav/__init__.py#L148-L166 |
tonyseek/openvpn-status | openvpn_status/utils.py | parse_time | def parse_time(time):
"""Parses date and time from input string in OpenVPN logging format."""
if isinstance(time, datetime.datetime):
return time
return datetime.datetime.strptime(time, DATETIME_FORMAT_OPENVPN) | python | def parse_time(time):
"""Parses date and time from input string in OpenVPN logging format."""
if isinstance(time, datetime.datetime):
return time
return datetime.datetime.strptime(time, DATETIME_FORMAT_OPENVPN) | [
"def",
"parse_time",
"(",
"time",
")",
":",
"if",
"isinstance",
"(",
"time",
",",
"datetime",
".",
"datetime",
")",
":",
"return",
"time",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"time",
",",
"DATETIME_FORMAT_OPENVPN",
")"
] | Parses date and time from input string in OpenVPN logging format. | [
"Parses",
"date",
"and",
"time",
"from",
"input",
"string",
"in",
"OpenVPN",
"logging",
"format",
"."
] | train | https://github.com/tonyseek/openvpn-status/blob/b8f5ec5f79933605af2301c42e4e7ec230334237/openvpn_status/utils.py#L19-L23 |
jieter/python-lora | lora/payload.py | LoRaPayload.decrypt | def decrypt(self, key, dev_addr):
"""
Decrypt the actual payload in this LoraPayload.
key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEEFFAABBCCDDEEFFAABBCCDD)
dev_addr: 4-byte hex-encoded DevAddr (i.e. AABBCCDD)
"""
sequence_counter = int(self.FCntUp)
return lo... | python | def decrypt(self, key, dev_addr):
"""
Decrypt the actual payload in this LoraPayload.
key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEEFFAABBCCDDEEFFAABBCCDD)
dev_addr: 4-byte hex-encoded DevAddr (i.e. AABBCCDD)
"""
sequence_counter = int(self.FCntUp)
return lo... | [
"def",
"decrypt",
"(",
"self",
",",
"key",
",",
"dev_addr",
")",
":",
"sequence_counter",
"=",
"int",
"(",
"self",
".",
"FCntUp",
")",
"return",
"loramac_decrypt",
"(",
"self",
".",
"payload_hex",
",",
"sequence_counter",
",",
"key",
",",
"dev_addr",
")"
] | Decrypt the actual payload in this LoraPayload.
key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEEFFAABBCCDDEEFFAABBCCDD)
dev_addr: 4-byte hex-encoded DevAddr (i.e. AABBCCDD) | [
"Decrypt",
"the",
"actual",
"payload",
"in",
"this",
"LoraPayload",
"."
] | train | https://github.com/jieter/python-lora/blob/0edb8dbad771da1e2b455571c7a9b064ba67fbcd/lora/payload.py#L38-L47 |
jieter/python-lora | lora/payload.py | LoRaPayload.Lrr_location | def Lrr_location(self):
"""
Return the location of the LRR (Wireless base station/Gateway)
"""
return WKT_POINT_FMT.format(lng=float(self.LrrLON), lat=float(self.LrrLAT)) | python | def Lrr_location(self):
"""
Return the location of the LRR (Wireless base station/Gateway)
"""
return WKT_POINT_FMT.format(lng=float(self.LrrLON), lat=float(self.LrrLAT)) | [
"def",
"Lrr_location",
"(",
"self",
")",
":",
"return",
"WKT_POINT_FMT",
".",
"format",
"(",
"lng",
"=",
"float",
"(",
"self",
".",
"LrrLON",
")",
",",
"lat",
"=",
"float",
"(",
"self",
".",
"LrrLAT",
")",
")"
] | Return the location of the LRR (Wireless base station/Gateway) | [
"Return",
"the",
"location",
"of",
"the",
"LRR",
"(",
"Wireless",
"base",
"station",
"/",
"Gateway",
")"
] | train | https://github.com/jieter/python-lora/blob/0edb8dbad771da1e2b455571c7a9b064ba67fbcd/lora/payload.py#L49-L53 |
jieter/python-lora | lora/crypto.py | to_bytes | def to_bytes(s):
"""
PY2/PY3 compatible way to convert to something cryptography understands
"""
if sys.version_info < (3,):
return "".join(map(chr, s))
else:
return bytes(s) | python | def to_bytes(s):
"""
PY2/PY3 compatible way to convert to something cryptography understands
"""
if sys.version_info < (3,):
return "".join(map(chr, s))
else:
return bytes(s) | [
"def",
"to_bytes",
"(",
"s",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"map",
"(",
"chr",
",",
"s",
")",
")",
"else",
":",
"return",
"bytes",
"(",
"s",
")"
] | PY2/PY3 compatible way to convert to something cryptography understands | [
"PY2",
"/",
"PY3",
"compatible",
"way",
"to",
"convert",
"to",
"something",
"cryptography",
"understands"
] | train | https://github.com/jieter/python-lora/blob/0edb8dbad771da1e2b455571c7a9b064ba67fbcd/lora/crypto.py#L12-L19 |
jieter/python-lora | lora/crypto.py | loramac_decrypt | def loramac_decrypt(payload_hex, sequence_counter, key, dev_addr, direction=UP_LINK):
"""
LoraMac decrypt
Which is actually encrypting a predefined 16-byte block (ref LoraWAN
specification 4.3.3.1) and XORing that with each block of data.
payload_hex: hex-encoded payload (FRMPayload)
sequence_... | python | def loramac_decrypt(payload_hex, sequence_counter, key, dev_addr, direction=UP_LINK):
"""
LoraMac decrypt
Which is actually encrypting a predefined 16-byte block (ref LoraWAN
specification 4.3.3.1) and XORing that with each block of data.
payload_hex: hex-encoded payload (FRMPayload)
sequence_... | [
"def",
"loramac_decrypt",
"(",
"payload_hex",
",",
"sequence_counter",
",",
"key",
",",
"dev_addr",
",",
"direction",
"=",
"UP_LINK",
")",
":",
"key",
"=",
"unhexlify",
"(",
"key",
")",
"dev_addr",
"=",
"unhexlify",
"(",
"dev_addr",
")",
"buffer",
"=",
"by... | LoraMac decrypt
Which is actually encrypting a predefined 16-byte block (ref LoraWAN
specification 4.3.3.1) and XORing that with each block of data.
payload_hex: hex-encoded payload (FRMPayload)
sequence_counter: integer, sequence counter (FCntUp)
key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEE... | [
"LoraMac",
"decrypt"
] | train | https://github.com/jieter/python-lora/blob/0edb8dbad771da1e2b455571c7a9b064ba67fbcd/lora/crypto.py#L22-L105 |
tonyseek/openvpn-status | openvpn_status/parser.py | LogParser.parse | def parse(self):
"""Parses the status log.
:raises ParsingError: if syntax error found in the log.
:return: The :class:`.models.Status` with filled data.
"""
status = Status()
self.expect_line(Status.client_list.label)
status.updated_at = self.expect_tuple(Statu... | python | def parse(self):
"""Parses the status log.
:raises ParsingError: if syntax error found in the log.
:return: The :class:`.models.Status` with filled data.
"""
status = Status()
self.expect_line(Status.client_list.label)
status.updated_at = self.expect_tuple(Statu... | [
"def",
"parse",
"(",
"self",
")",
":",
"status",
"=",
"Status",
"(",
")",
"self",
".",
"expect_line",
"(",
"Status",
".",
"client_list",
".",
"label",
")",
"status",
".",
"updated_at",
"=",
"self",
".",
"expect_tuple",
"(",
"Status",
".",
"updated_at",
... | Parses the status log.
:raises ParsingError: if syntax error found in the log.
:return: The :class:`.models.Status` with filled data. | [
"Parses",
"the",
"status",
"log",
"."
] | train | https://github.com/tonyseek/openvpn-status/blob/b8f5ec5f79933605af2301c42e4e7ec230334237/openvpn_status/parser.py#L77-L98 |
tonyseek/openvpn-status | openvpn_status/shortcuts.py | parse_status | def parse_status(status_log, encoding='utf-8'):
"""Parses the status log of OpenVPN.
:param status_log: The content of status log.
:type status_log: :class:`str`
:param encoding: Optional. The encoding of status log.
:type encoding: :class:`str`
:return: The instance of :class:`.models.Status`
... | python | def parse_status(status_log, encoding='utf-8'):
"""Parses the status log of OpenVPN.
:param status_log: The content of status log.
:type status_log: :class:`str`
:param encoding: Optional. The encoding of status log.
:type encoding: :class:`str`
:return: The instance of :class:`.models.Status`
... | [
"def",
"parse_status",
"(",
"status_log",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"isinstance",
"(",
"status_log",
",",
"bytes",
")",
":",
"status_log",
"=",
"status_log",
".",
"decode",
"(",
"encoding",
")",
"parser",
"=",
"LogParser",
".",
"from... | Parses the status log of OpenVPN.
:param status_log: The content of status log.
:type status_log: :class:`str`
:param encoding: Optional. The encoding of status log.
:type encoding: :class:`str`
:return: The instance of :class:`.models.Status` | [
"Parses",
"the",
"status",
"log",
"of",
"OpenVPN",
"."
] | train | https://github.com/tonyseek/openvpn-status/blob/b8f5ec5f79933605af2301c42e4e7ec230334237/openvpn_status/shortcuts.py#L6-L18 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.version | def version(self):
"""Return version of the TR DWE."""
res = self.client.service.Version()
return '.'.join([ustr(x) for x in res[0]]) | python | def version(self):
"""Return version of the TR DWE."""
res = self.client.service.Version()
return '.'.join([ustr(x) for x in res[0]]) | [
"def",
"version",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"client",
".",
"service",
".",
"Version",
"(",
")",
"return",
"'.'",
".",
"join",
"(",
"[",
"ustr",
"(",
"x",
")",
"for",
"x",
"in",
"res",
"[",
"0",
"]",
"]",
")"
] | Return version of the TR DWE. | [
"Return",
"version",
"of",
"the",
"TR",
"DWE",
"."
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L119-L122 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.system_info | def system_info(self):
"""Return system information."""
res = self.client.service.SystemInfo()
res = {ustr(x[0]): x[1] for x in res[0]}
to_str = lambda arr: '.'.join([ustr(x) for x in arr[0]])
res['OSVersion'] = to_str(res['OSVersion'])
res['RuntimeVersion'] = to_str(res... | python | def system_info(self):
"""Return system information."""
res = self.client.service.SystemInfo()
res = {ustr(x[0]): x[1] for x in res[0]}
to_str = lambda arr: '.'.join([ustr(x) for x in arr[0]])
res['OSVersion'] = to_str(res['OSVersion'])
res['RuntimeVersion'] = to_str(res... | [
"def",
"system_info",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"client",
".",
"service",
".",
"SystemInfo",
"(",
")",
"res",
"=",
"{",
"ustr",
"(",
"x",
"[",
"0",
"]",
")",
":",
"x",
"[",
"1",
"]",
"for",
"x",
"in",
"res",
"[",
"0",
... | Return system information. | [
"Return",
"system",
"information",
"."
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L124-L139 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.sources | def sources(self):
"""Return available sources of data."""
res = self.client.service.Sources(self.userdata, 0)
return [ustr(x[0]) for x in res[0]] | python | def sources(self):
"""Return available sources of data."""
res = self.client.service.Sources(self.userdata, 0)
return [ustr(x[0]) for x in res[0]] | [
"def",
"sources",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"client",
".",
"service",
".",
"Sources",
"(",
"self",
".",
"userdata",
",",
"0",
")",
"return",
"[",
"ustr",
"(",
"x",
"[",
"0",
"]",
")",
"for",
"x",
"in",
"res",
"[",
"0",
"... | Return available sources of data. | [
"Return",
"available",
"sources",
"of",
"data",
"."
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L141-L144 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.request | def request(self, query, source='Datastream',
fields=None, options=None, symbol_set=None, tag=None):
"""General function to retrieve one record in raw format.
query - query string for DWE system. This may be a simple instrument name
or more complicated request. Ref... | python | def request(self, query, source='Datastream',
fields=None, options=None, symbol_set=None, tag=None):
"""General function to retrieve one record in raw format.
query - query string for DWE system. This may be a simple instrument name
or more complicated request. Ref... | [
"def",
"request",
"(",
"self",
",",
"query",
",",
"source",
"=",
"'Datastream'",
",",
"fields",
"=",
"None",
",",
"options",
"=",
"None",
",",
"symbol_set",
"=",
"None",
",",
"tag",
"=",
"None",
")",
":",
"if",
"self",
".",
"show_request",
":",
"try"... | General function to retrieve one record in raw format.
query - query string for DWE system. This may be a simple instrument name
or more complicated request. Refer to the documentation for the
format.
source - The name of datasource (default: "Datastream")
... | [
"General",
"function",
"to",
"retrieve",
"one",
"record",
"in",
"raw",
"format",
"."
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L146-L184 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.request_many | def request_many(self, queries, source='Datastream',
fields=None, options=None, symbol_set=None, tag=None):
"""General function to retrieve one record in raw format.
query - list of query strings for DWE system.
source - The name of datasource (default: "Datastream")
... | python | def request_many(self, queries, source='Datastream',
fields=None, options=None, symbol_set=None, tag=None):
"""General function to retrieve one record in raw format.
query - list of query strings for DWE system.
source - The name of datasource (default: "Datastream")
... | [
"def",
"request_many",
"(",
"self",
",",
"queries",
",",
"source",
"=",
"'Datastream'",
",",
"fields",
"=",
"None",
",",
"options",
"=",
"None",
",",
"symbol_set",
"=",
"None",
",",
"tag",
"=",
"None",
")",
":",
"if",
"self",
".",
"show_request",
":",
... | General function to retrieve one record in raw format.
query - list of query strings for DWE system.
source - The name of datasource (default: "Datastream")
fields - Fields to be retrieved (used when the requester does not want all
fields to be delivered).
... | [
"General",
"function",
"to",
"retrieve",
"one",
"record",
"in",
"raw",
"format",
"."
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L186-L227 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.status | def status(self, record=None):
"""Extract status from the retrieved data and save it as a property of an object.
If record with data is not specified then the status of previous operation is
returned.
status - dictionary with data source, string with request and status type,
... | python | def status(self, record=None):
"""Extract status from the retrieved data and save it as a property of an object.
If record with data is not specified then the status of previous operation is
returned.
status - dictionary with data source, string with request and status type,
... | [
"def",
"status",
"(",
"self",
",",
"record",
"=",
"None",
")",
":",
"if",
"record",
"is",
"not",
"None",
":",
"self",
".",
"last_status",
"=",
"{",
"'Source'",
":",
"ustr",
"(",
"record",
"[",
"'Source'",
"]",
")",
",",
"'StatusType'",
":",
"ustr",
... | Extract status from the retrieved data and save it as a property of an object.
If record with data is not specified then the status of previous operation is
returned.
status - dictionary with data source, string with request and status type,
code and message.
... | [
"Extract",
"status",
"from",
"the",
"retrieved",
"data",
"and",
"save",
"it",
"as",
"a",
"property",
"of",
"an",
"object",
".",
"If",
"record",
"with",
"data",
"is",
"not",
"specified",
"then",
"the",
"status",
"of",
"previous",
"operation",
"is",
"returne... | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L230-L259 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.parse_record | def parse_record(self, raw, indx=0):
"""Parse raw data (that is retrieved by "request") and return pandas.DataFrame.
Returns tuple (data, metadata)
data - pandas.DataFrame with retrieved data.
metadata - pandas.DataFrame with info about symbol, currency, frequency,
... | python | def parse_record(self, raw, indx=0):
"""Parse raw data (that is retrieved by "request") and return pandas.DataFrame.
Returns tuple (data, metadata)
data - pandas.DataFrame with retrieved data.
metadata - pandas.DataFrame with info about symbol, currency, frequency,
... | [
"def",
"parse_record",
"(",
"self",
",",
"raw",
",",
"indx",
"=",
"0",
")",
":",
"suffix",
"=",
"''",
"if",
"indx",
"==",
"0",
"else",
"'_%i'",
"%",
"(",
"indx",
"+",
"1",
")",
"# Parsing status",
"status",
"=",
"self",
".",
"status",
"(",
"raw",
... | Parse raw data (that is retrieved by "request") and return pandas.DataFrame.
Returns tuple (data, metadata)
data - pandas.DataFrame with retrieved data.
metadata - pandas.DataFrame with info about symbol, currency, frequency,
displayname and status of given reques... | [
"Parse",
"raw",
"data",
"(",
"that",
"is",
"retrieved",
"by",
"request",
")",
"and",
"return",
"pandas",
".",
"DataFrame",
".",
"Returns",
"tuple",
"(",
"data",
"metadata",
")"
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L277-L354 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.parse_record_static | def parse_record_static(self, raw):
"""Parse raw data (that is retrieved by static request) and return pandas.DataFrame.
Returns tuple (data, metadata)
data - pandas.DataFrame with retrieved data.
metadata - pandas.DataFrame with info about symbol, currency, frequency,
... | python | def parse_record_static(self, raw):
"""Parse raw data (that is retrieved by static request) and return pandas.DataFrame.
Returns tuple (data, metadata)
data - pandas.DataFrame with retrieved data.
metadata - pandas.DataFrame with info about symbol, currency, frequency,
... | [
"def",
"parse_record_static",
"(",
"self",
",",
"raw",
")",
":",
"# Parsing status",
"status",
"=",
"self",
".",
"status",
"(",
"raw",
")",
"# Testing if no errors",
"if",
"status",
"[",
"'StatusType'",
"]",
"!=",
"'Connected'",
":",
"if",
"self",
".",
"rais... | Parse raw data (that is retrieved by static request) and return pandas.DataFrame.
Returns tuple (data, metadata)
data - pandas.DataFrame with retrieved data.
metadata - pandas.DataFrame with info about symbol, currency, frequency,
displayname and status of given r... | [
"Parse",
"raw",
"data",
"(",
"that",
"is",
"retrieved",
"by",
"static",
"request",
")",
"and",
"return",
"pandas",
".",
"DataFrame",
".",
"Returns",
"tuple",
"(",
"data",
"metadata",
")"
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L356-L409 |
vfilimonov/pydatastream | pydatastream/pydatastream.py | Datastream.construct_request | def construct_request(ticker, fields=None, date=None,
date_from=None, date_to=None, freq=None):
"""Construct a request string for querying TR DWE.
tickers - ticker or symbol
fields - list of fields.
date - date for a single-date query
da... | python | def construct_request(ticker, fields=None, date=None,
date_from=None, date_to=None, freq=None):
"""Construct a request string for querying TR DWE.
tickers - ticker or symbol
fields - list of fields.
date - date for a single-date query
da... | [
"def",
"construct_request",
"(",
"ticker",
",",
"fields",
"=",
"None",
",",
"date",
"=",
"None",
",",
"date_from",
"=",
"None",
",",
"date_to",
"=",
"None",
",",
"freq",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"ticker",
",",
"basestring",
")",
... | Construct a request string for querying TR DWE.
tickers - ticker or symbol
fields - list of fields.
date - date for a single-date query
date_from, date_to - date range (used only if "date" is not specified)
freq - frequency of data: daily('D'), weekly('W') ... | [
"Construct",
"a",
"request",
"string",
"for",
"querying",
"TR",
"DWE",
"."
] | train | https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L413-L462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.