partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Resource.delete
Deletes the resource.
contentful_management/resource.py
def delete(self): """ Deletes the resource. """ return self._client._delete( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environment_id ) )
def delete(self): """ Deletes the resource. """ return self._client._delete( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environment_id ) )
[ "Deletes", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L89-L100
[ "def", "delete", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "_delete", "(", "self", ".", "__class__", ".", "base_url", "(", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "sys", "[", "'id'", "]", ",", "en...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Resource.update
Updates the resource with attributes.
contentful_management/resource.py
def update(self, attributes=None): """ Updates the resource with attributes. """ if attributes is None: attributes = {} headers = self.__class__.create_headers(attributes) headers.update(self._update_headers()) result = self._client._put( ...
def update(self, attributes=None): """ Updates the resource with attributes. """ if attributes is None: attributes = {} headers = self.__class__.create_headers(attributes) headers.update(self._update_headers()) result = self._client._put( ...
[ "Updates", "the", "resource", "with", "attributes", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L102-L121
[ "def", "update", "(", "self", ",", "attributes", "=", "None", ")", ":", "if", "attributes", "is", "None", ":", "attributes", "=", "{", "}", "headers", "=", "self", ".", "__class__", ".", "create_headers", "(", "attributes", ")", "headers", ".", "update",...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Resource.reload
Reloads the resource.
contentful_management/resource.py
def reload(self, result=None): """ Reloads the resource. """ if result is None: result = self._client._get( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environ...
def reload(self, result=None): """ Reloads the resource. """ if result is None: result = self._client._get( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environ...
[ "Reloads", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L130-L146
[ "def", "reload", "(", "self", ",", "result", "=", "None", ")", ":", "if", "result", "is", "None", ":", "result", "=", "self", ".", "_client", ".", "_get", "(", "self", ".", "__class__", ".", "base_url", "(", "self", ".", "sys", "[", "'space'", "]",...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Resource.to_link
Returns a link for the resource.
contentful_management/resource.py
def to_link(self): """ Returns a link for the resource. """ link_type = self.link_type if self.type == 'Link' else self.type return Link({'sys': {'linkType': link_type, 'id': self.sys.get('id')}}, client=self._client)
def to_link(self): """ Returns a link for the resource. """ link_type = self.link_type if self.type == 'Link' else self.type return Link({'sys': {'linkType': link_type, 'id': self.sys.get('id')}}, client=self._client)
[ "Returns", "a", "link", "for", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L148-L155
[ "def", "to_link", "(", "self", ")", ":", "link_type", "=", "self", ".", "link_type", "if", "self", ".", "type", "==", "'Link'", "else", "self", ".", "type", "return", "Link", "(", "{", "'sys'", ":", "{", "'linkType'", ":", "link_type", ",", "'id'", "...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Resource.to_json
Returns the JSON representation of the resource.
contentful_management/resource.py
def to_json(self): """ Returns the JSON representation of the resource. """ result = { 'sys': {} } for k, v in self.sys.items(): if k in ['space', 'content_type', 'created_by', 'updated_by', 'published_by']: v ...
def to_json(self): """ Returns the JSON representation of the resource. """ result = { 'sys': {} } for k, v in self.sys.items(): if k in ['space', 'content_type', 'created_by', 'updated_by', 'published_by']: v ...
[ "Returns", "the", "JSON", "representation", "of", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L157-L174
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "{", "'sys'", ":", "{", "}", "}", "for", "k", ",", "v", "in", "self", ".", "sys", ".", "items", "(", ")", ":", "if", "k", "in", "[", "'space'", ",", "'content_type'", ",", "'created_by'", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
FieldsResource.create_attributes
Attributes for resource creation.
contentful_management/resource.py
def create_attributes(klass, attributes, previous_object=None): """ Attributes for resource creation. """ if 'fields' not in attributes: if previous_object is None: attributes['fields'] = {} else: attributes['fields'] = previous_ob...
def create_attributes(klass, attributes, previous_object=None): """ Attributes for resource creation. """ if 'fields' not in attributes: if previous_object is None: attributes['fields'] = {} else: attributes['fields'] = previous_ob...
[ "Attributes", "for", "resource", "creation", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L249-L259
[ "def", "create_attributes", "(", "klass", ",", "attributes", ",", "previous_object", "=", "None", ")", ":", "if", "'fields'", "not", "in", "attributes", ":", "if", "previous_object", "is", "None", ":", "attributes", "[", "'fields'", "]", "=", "{", "}", "el...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
FieldsResource.fields_with_locales
Get fields with locales per field.
contentful_management/resource.py
def fields_with_locales(self): """ Get fields with locales per field. """ result = {} for locale, fields in self._fields.items(): for k, v in fields.items(): real_field_id = self._real_field_id_for(k) if real_field_id not in result: ...
def fields_with_locales(self): """ Get fields with locales per field. """ result = {} for locale, fields in self._fields.items(): for k, v in fields.items(): real_field_id = self._real_field_id_for(k) if real_field_id not in result: ...
[ "Get", "fields", "with", "locales", "per", "field", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L276-L288
[ "def", "fields_with_locales", "(", "self", ")", ":", "result", "=", "{", "}", "for", "locale", ",", "fields", "in", "self", ".", "_fields", ".", "items", "(", ")", ":", "for", "k", ",", "v", "in", "fields", ".", "items", "(", ")", ":", "real_field_...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
FieldsResource.to_json
Returns the JSON Representation of the resource.
contentful_management/resource.py
def to_json(self): """ Returns the JSON Representation of the resource. """ result = super(FieldsResource, self).to_json() result['fields'] = self.fields_with_locales() return result
def to_json(self): """ Returns the JSON Representation of the resource. """ result = super(FieldsResource, self).to_json() result['fields'] = self.fields_with_locales() return result
[ "Returns", "the", "JSON", "Representation", "of", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L290-L297
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "FieldsResource", ",", "self", ")", ".", "to_json", "(", ")", "result", "[", "'fields'", "]", "=", "self", ".", "fields_with_locales", "(", ")", "return", "result" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
PublishResource.is_updated
Checks if a resource has been updated since last publish. Returns False if resource has not been published before.
contentful_management/resource.py
def is_updated(self): """ Checks if a resource has been updated since last publish. Returns False if resource has not been published before. """ if not self.is_published: return False return sanitize_date(self.sys['published_at']) < sanitize_date(self.sys['u...
def is_updated(self): """ Checks if a resource has been updated since last publish. Returns False if resource has not been published before. """ if not self.is_published: return False return sanitize_date(self.sys['published_at']) < sanitize_date(self.sys['u...
[ "Checks", "if", "a", "resource", "has", "been", "updated", "since", "last", "publish", ".", "Returns", "False", "if", "resource", "has", "not", "been", "published", "before", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L392-L401
[ "def", "is_updated", "(", "self", ")", ":", "if", "not", "self", ".", "is_published", ":", "return", "False", "return", "sanitize_date", "(", "self", ".", "sys", "[", "'published_at'", "]", ")", "<", "sanitize_date", "(", "self", ".", "sys", "[", "'updat...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
PublishResource.unpublish
Unpublishes the resource.
contentful_management/resource.py
def unpublish(self): """ Unpublishes the resource. """ self._client._delete( "{0}/published".format( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environment_id...
def unpublish(self): """ Unpublishes the resource. """ self._client._delete( "{0}/published".format( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environment_id...
[ "Unpublishes", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L422-L438
[ "def", "unpublish", "(", "self", ")", ":", "self", ".", "_client", ".", "_delete", "(", "\"{0}/published\"", ".", "format", "(", "self", ".", "__class__", ".", "base_url", "(", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "sy...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ArchiveResource.archive
Archives the resource.
contentful_management/resource.py
def archive(self): """ Archives the resource. """ self._client._put( "{0}/archived".format( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environment_id ...
def archive(self): """ Archives the resource. """ self._client._put( "{0}/archived".format( self.__class__.base_url( self.sys['space'].id, self.sys['id'], environment_id=self._environment_id ...
[ "Archives", "the", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L454-L471
[ "def", "archive", "(", "self", ")", ":", "self", ".", "_client", ".", "_put", "(", "\"{0}/archived\"", ".", "format", "(", "self", ".", "__class__", ".", "base_url", "(", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "sys", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Link.resolve
Resolves link to a specific resource.
contentful_management/resource.py
def resolve(self, space_id=None, environment_id=None): """ Resolves link to a specific resource. """ proxy_method = getattr( self._client, base_path_for(self.link_type) ) if self.link_type == 'Space': return proxy_method().find(self.id...
def resolve(self, space_id=None, environment_id=None): """ Resolves link to a specific resource. """ proxy_method = getattr( self._client, base_path_for(self.link_type) ) if self.link_type == 'Space': return proxy_method().find(self.id...
[ "Resolves", "link", "to", "a", "specific", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L517-L531
[ "def", "resolve", "(", "self", ",", "space_id", "=", "None", ",", "environment_id", "=", "None", ")", ":", "proxy_method", "=", "getattr", "(", "self", ".", "_client", ",", "base_path_for", "(", "self", ".", "link_type", ")", ")", "if", "self", ".", "l...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Asset.url
Returns a formatted URL for the asset's File with serialized parameters. Usage: >>> my_asset.url() "//images.contentful.com/spaces/foobar/..." >>> my_asset.url(w=120, h=160) "//images.contentful.com/spaces/foobar/...?w=120&h=160"
contentful_management/asset.py
def url(self, **kwargs): """ Returns a formatted URL for the asset's File with serialized parameters. Usage: >>> my_asset.url() "//images.contentful.com/spaces/foobar/..." >>> my_asset.url(w=120, h=160) "//images.contentful.com/spaces/foob...
def url(self, **kwargs): """ Returns a formatted URL for the asset's File with serialized parameters. Usage: >>> my_asset.url() "//images.contentful.com/spaces/foobar/..." >>> my_asset.url(w=120, h=160) "//images.contentful.com/spaces/foob...
[ "Returns", "a", "formatted", "URL", "for", "the", "asset", "s", "File", "with", "serialized", "parameters", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/asset.py#L22-L40
[ "def", "url", "(", "self", ",", "*", "*", "kwargs", ")", ":", "url", "=", "self", ".", "fields", "(", "self", ".", "_locale", "(", ")", ")", ".", "get", "(", "'file'", ",", "{", "}", ")", ".", "get", "(", "'url'", ",", "''", ")", "args", "=...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Asset.process
Calls the process endpoint for all locales of the asset. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset-processing
contentful_management/asset.py
def process(self): """ Calls the process endpoint for all locales of the asset. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset-processing """ for locale in self._fields.keys(): self._client._put( ...
def process(self): """ Calls the process endpoint for all locales of the asset. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset-processing """ for locale in self._fields.keys(): self._client._put( ...
[ "Calls", "the", "process", "endpoint", "for", "all", "locales", "of", "the", "asset", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/asset.py#L42-L62
[ "def", "process", "(", "self", ")", ":", "for", "locale", "in", "self", ".", "_fields", ".", "keys", "(", ")", ":", "self", ".", "_client", ".", "_put", "(", "\"{0}/files/{1}/process\"", ".", "format", "(", "self", ".", "__class__", ".", "base_url", "(...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
UIExtension.to_json
Returns the JSON Representation of the UI extension.
contentful_management/ui_extension.py
def to_json(self): """ Returns the JSON Representation of the UI extension. """ result = super(UIExtension, self).to_json() result.update({ 'extension': self.extension }) return result
def to_json(self): """ Returns the JSON Representation of the UI extension. """ result = super(UIExtension, self).to_json() result.update({ 'extension': self.extension }) return result
[ "Returns", "the", "JSON", "Representation", "of", "the", "UI", "extension", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/ui_extension.py#L78-L88
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "UIExtension", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'extension'", ":", "self", ".", "extension", "}", ")", "return", "result" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ApiKey.create_attributes
Attributes for resource creation.
contentful_management/api_key.py
def create_attributes(klass, attributes, previous_object=None): """ Attributes for resource creation. """ return { 'name': attributes.get( 'name', previous_object.name if previous_object is not None else '' ), 'descript...
def create_attributes(klass, attributes, previous_object=None): """ Attributes for resource creation. """ return { 'name': attributes.get( 'name', previous_object.name if previous_object is not None else '' ), 'descript...
[ "Attributes", "for", "resource", "creation", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/api_key.py#L34-L52
[ "def", "create_attributes", "(", "klass", ",", "attributes", ",", "previous_object", "=", "None", ")", ":", "return", "{", "'name'", ":", "attributes", ".", "get", "(", "'name'", ",", "previous_object", ".", "name", "if", "previous_object", "is", "not", "Non...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ApiKey.to_json
Returns the JSON representation of the API key.
contentful_management/api_key.py
def to_json(self): """ Returns the JSON representation of the API key. """ result = super(ApiKey, self).to_json() result.update({ 'name': self.name, 'description': self.description, 'accessToken': self.access_token, 'environments':...
def to_json(self): """ Returns the JSON representation of the API key. """ result = super(ApiKey, self).to_json() result.update({ 'name': self.name, 'description': self.description, 'accessToken': self.access_token, 'environments':...
[ "Returns", "the", "JSON", "representation", "of", "the", "API", "key", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/api_key.py#L70-L82
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "ApiKey", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'name'", ":", "self", ".", "name", ",", "'description'", ":", "self", ".", "description", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ApiUsagesProxy.all
Gets all api usages by type for a given period an api.
contentful_management/api_usages_proxy.py
def all(self, usage_type, usage_period_id, api, query=None, *args, **kwargs): """ Gets all api usages by type for a given period an api. """ if query is None: query = {} mandatory_query = { 'filters[usagePeriod]': usage_period_id, 'filters[me...
def all(self, usage_type, usage_period_id, api, query=None, *args, **kwargs): """ Gets all api usages by type for a given period an api. """ if query is None: query = {} mandatory_query = { 'filters[usagePeriod]': usage_period_id, 'filters[me...
[ "Gets", "all", "api", "usages", "by", "type", "for", "a", "given", "period", "an", "api", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/api_usages_proxy.py#L31-L52
[ "def", "all", "(", "self", ",", "usage_type", ",", "usage_period_id", ",", "api", ",", "query", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "query", "is", "None", ":", "query", "=", "{", "}", "mandatory_query", "=", "{",...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentType.base_url
Returns the URI for the content type.
contentful_management/content_type.py
def base_url(klass, space_id, resource_id=None, public=False, environment_id=None, **kwargs): """ Returns the URI for the content type. """ if public: environment_slug = "" if environment_id is not None: environment_slug = "/environments/{0}".form...
def base_url(klass, space_id, resource_id=None, public=False, environment_id=None, **kwargs): """ Returns the URI for the content type. """ if public: environment_slug = "" if environment_id is not None: environment_slug = "/environments/{0}".form...
[ "Returns", "the", "URI", "for", "the", "content", "type", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L35-L50
[ "def", "base_url", "(", "klass", ",", "space_id", ",", "resource_id", "=", "None", ",", "public", "=", "False", ",", "environment_id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "public", ":", "environment_slug", "=", "\"\"", "if", "environmen...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentType.create_attributes
Attributes for content type creation.
contentful_management/content_type.py
def create_attributes(klass, attributes, previous_object=None): """ Attributes for content type creation. """ result = super(ContentType, klass).create_attributes(attributes, previous_object) if 'fields' not in result: result['fields'] = [] return result
def create_attributes(klass, attributes, previous_object=None): """ Attributes for content type creation. """ result = super(ContentType, klass).create_attributes(attributes, previous_object) if 'fields' not in result: result['fields'] = [] return result
[ "Attributes", "for", "content", "type", "creation", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L53-L62
[ "def", "create_attributes", "(", "klass", ",", "attributes", ",", "previous_object", "=", "None", ")", ":", "result", "=", "super", "(", "ContentType", ",", "klass", ")", ".", "create_attributes", "(", "attributes", ",", "previous_object", ")", "if", "'fields'...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentType.to_json
Returns the JSON representation of the content type.
contentful_management/content_type.py
def to_json(self): """ Returns the JSON representation of the content type. """ result = super(ContentType, self).to_json() result.update({ 'name': self.name, 'description': self.description, 'displayField': self.display_field, 'fi...
def to_json(self): """ Returns the JSON representation of the content type. """ result = super(ContentType, self).to_json() result.update({ 'name': self.name, 'description': self.description, 'displayField': self.display_field, 'fi...
[ "Returns", "the", "JSON", "representation", "of", "the", "content", "type", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L77-L89
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "ContentType", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'name'", ":", "self", ".", "name", ",", "'description'", ":", "self", ".", "descripti...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentType.entries
Provides access to entry management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries :return: :class:`ContentTypeEntriesProxy <contentful_management.content_type_entries_proxy.ContentTypeEntriesProxy>` o...
contentful_management/content_type.py
def entries(self): """ Provides access to entry management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries :return: :class:`ContentTypeEntriesProxy <contentful_management.content_type_en...
def entries(self): """ Provides access to entry management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries :return: :class:`ContentTypeEntriesProxy <contentful_management.content_type_en...
[ "Provides", "access", "to", "entry", "management", "methods", "for", "the", "given", "content", "type", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L91-L105
[ "def", "entries", "(", "self", ")", ":", "return", "ContentTypeEntriesProxy", "(", "self", ".", "_client", ",", "self", ".", "space", ".", "id", ",", "self", ".", "_environment_id", ",", "self", ".", "id", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentType.editor_interfaces
Provides access to editor interface management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface :return: :class:`ContentTypeEditorInterfacesProxy <contentful_management.content_type_editor_inter...
contentful_management/content_type.py
def editor_interfaces(self): """ Provides access to editor interface management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface :return: :class:`ContentTypeEditorInterfacesProxy...
def editor_interfaces(self): """ Provides access to editor interface management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface :return: :class:`ContentTypeEditorInterfacesProxy...
[ "Provides", "access", "to", "editor", "interface", "management", "methods", "for", "the", "given", "content", "type", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L107-L121
[ "def", "editor_interfaces", "(", "self", ")", ":", "return", "ContentTypeEditorInterfacesProxy", "(", "self", ".", "_client", ",", "self", ".", "space", ".", "id", ",", "self", ".", "_environment_id", ",", "self", ".", "id", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentType.snapshots
Provides access to snapshot management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection :return: :class:`ContentTypeSnapshotsProxy <contentful_management.content_type_...
contentful_management/content_type.py
def snapshots(self): """ Provides access to snapshot management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection :return: :class:`ContentTypeSnapshotsP...
def snapshots(self): """ Provides access to snapshot management methods for the given content type. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection :return: :class:`ContentTypeSnapshotsP...
[ "Provides", "access", "to", "snapshot", "management", "methods", "for", "the", "given", "content", "type", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L123-L137
[ "def", "snapshots", "(", "self", ")", ":", "return", "ContentTypeSnapshotsProxy", "(", "self", ".", "_client", ",", "self", ".", "space", ".", "id", ",", "self", ".", "_environment_id", ",", "self", ".", "id", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
OrganizationsProxy.all
Gets all organizations.
contentful_management/organizations_proxy.py
def all(self, query=None, **kwargs): """ Gets all organizations. """ return super(OrganizationsProxy, self).all(query=query)
def all(self, query=None, **kwargs): """ Gets all organizations. """ return super(OrganizationsProxy, self).all(query=query)
[ "Gets", "all", "organizations", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/organizations_proxy.py#L33-L38
[ "def", "all", "(", "self", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "OrganizationsProxy", ",", "self", ")", ".", "all", "(", "query", "=", "query", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
WebhookCall.base_url
Returns the URI for the webhook call.
contentful_management/webhook_call.py
def base_url(klass, space_id, webhook_id, resource_id=None): """ Returns the URI for the webhook call. """ return "spaces/{0}/webhooks/{1}/calls/{2}".format( space_id, webhook_id, resource_id if resource_id is not None else '' )
def base_url(klass, space_id, webhook_id, resource_id=None): """ Returns the URI for the webhook call. """ return "spaces/{0}/webhooks/{1}/calls/{2}".format( space_id, webhook_id, resource_id if resource_id is not None else '' )
[ "Returns", "the", "URI", "for", "the", "webhook", "call", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook_call.py#L42-L51
[ "def", "base_url", "(", "klass", ",", "space_id", ",", "webhook_id", ",", "resource_id", "=", "None", ")", ":", "return", "\"spaces/{0}/webhooks/{1}/calls/{2}\"", ".", "format", "(", "space_id", ",", "webhook_id", ",", "resource_id", "if", "resource_id", "is", "...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Space.create_attributes
Attributes for space creation.
contentful_management/space.py
def create_attributes(klass, attributes, previous_object=None): """Attributes for space creation.""" if previous_object is not None: return {'name': attributes.get('name', previous_object.name)} return { 'name': attributes.get('name', ''), 'defaultLocale': at...
def create_attributes(klass, attributes, previous_object=None): """Attributes for space creation.""" if previous_object is not None: return {'name': attributes.get('name', previous_object.name)} return { 'name': attributes.get('name', ''), 'defaultLocale': at...
[ "Attributes", "for", "space", "creation", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L54-L62
[ "def", "create_attributes", "(", "klass", ",", "attributes", ",", "previous_object", "=", "None", ")", ":", "if", "previous_object", "is", "not", "None", ":", "return", "{", "'name'", ":", "attributes", ".", "get", "(", "'name'", ",", "previous_object", ".",...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Space.reload
Reloads the space.
contentful_management/space.py
def reload(self): """ Reloads the space. """ result = self._client._get( self.__class__.base_url( self.sys['id'] ) ) self._update_from_resource(result) return self
def reload(self): """ Reloads the space. """ result = self._client._get( self.__class__.base_url( self.sys['id'] ) ) self._update_from_resource(result) return self
[ "Reloads", "the", "space", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L96-L109
[ "def", "reload", "(", "self", ")", ":", "result", "=", "self", ".", "_client", ".", "_get", "(", "self", ".", "__class__", ".", "base_url", "(", "self", ".", "sys", "[", "'id'", "]", ")", ")", "self", ".", "_update_from_resource", "(", "result", ")",...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Space.delete
Deletes the space
contentful_management/space.py
def delete(self): """ Deletes the space """ return self._client._delete( self.__class__.base_url( self.sys['id'] ) )
def delete(self): """ Deletes the space """ return self._client._delete( self.__class__.base_url( self.sys['id'] ) )
[ "Deletes", "the", "space" ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L111-L120
[ "def", "delete", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "_delete", "(", "self", ".", "__class__", ".", "base_url", "(", "self", ".", "sys", "[", "'id'", "]", ")", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Space.to_json
Returns the JSON representation of the space.
contentful_management/space.py
def to_json(self): """ Returns the JSON representation of the space. """ result = super(Space, self).to_json() result.update({'name': self.name}) return result
def to_json(self): """ Returns the JSON representation of the space. """ result = super(Space, self).to_json() result.update({'name': self.name}) return result
[ "Returns", "the", "JSON", "representation", "of", "the", "space", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L122-L129
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "Space", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'name'", ":", "self", ".", "name", "}", ")", "return", "result" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SpacesProxy.all
Gets all spaces.
contentful_management/spaces_proxy.py
def all(self, query=None, **kwargs): """ Gets all spaces. """ return super(SpacesProxy, self).all(query=query)
def all(self, query=None, **kwargs): """ Gets all spaces. """ return super(SpacesProxy, self).all(query=query)
[ "Gets", "all", "spaces", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L33-L38
[ "def", "all", "(", "self", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "SpacesProxy", ",", "self", ")", ".", "all", "(", "query", "=", "query", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SpacesProxy.find
Gets a space by ID.
contentful_management/spaces_proxy.py
def find(self, space_id, query=None, **kwargs): """ Gets a space by ID. """ try: self.space_id = space_id return super(SpacesProxy, self).find(space_id, query=query) finally: self.space_id = None
def find(self, space_id, query=None, **kwargs): """ Gets a space by ID. """ try: self.space_id = space_id return super(SpacesProxy, self).find(space_id, query=query) finally: self.space_id = None
[ "Gets", "a", "space", "by", "ID", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L40-L49
[ "def", "find", "(", "self", ",", "space_id", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "space_id", "=", "space_id", "return", "super", "(", "SpacesProxy", ",", "self", ")", ".", "find", "(", "space_id", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SpacesProxy.create
Creates a space with given attributes.
contentful_management/spaces_proxy.py
def create(self, attributes=None, **kwargs): """ Creates a space with given attributes. """ if attributes is None: attributes = {} if 'default_locale' not in attributes: attributes['default_locale'] = self.client.default_locale return super(Space...
def create(self, attributes=None, **kwargs): """ Creates a space with given attributes. """ if attributes is None: attributes = {} if 'default_locale' not in attributes: attributes['default_locale'] = self.client.default_locale return super(Space...
[ "Creates", "a", "space", "with", "given", "attributes", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L51-L61
[ "def", "create", "(", "self", ",", "attributes", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "attributes", "is", "None", ":", "attributes", "=", "{", "}", "if", "'default_locale'", "not", "in", "attributes", ":", "attributes", "[", "'default_lo...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SpacesProxy.delete
Deletes a space by ID.
contentful_management/spaces_proxy.py
def delete(self, space_id): """ Deletes a space by ID. """ try: self.space_id = space_id return super(SpacesProxy, self).delete(space_id) finally: self.space_id = None
def delete(self, space_id): """ Deletes a space by ID. """ try: self.space_id = space_id return super(SpacesProxy, self).delete(space_id) finally: self.space_id = None
[ "Deletes", "a", "space", "by", "ID", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L63-L72
[ "def", "delete", "(", "self", ",", "space_id", ")", ":", "try", ":", "self", ".", "space_id", "=", "space_id", "return", "super", "(", "SpacesProxy", ",", "self", ")", ".", "delete", "(", "space_id", ")", "finally", ":", "self", ".", "space_id", "=", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client.editor_interfaces
Provides access to editor interfaces management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface :return: :class:`EditorInterfacesProxy <contentful_management.editor_interfaces_proxy.EditorInterfacesProxy>` object. ...
contentful_management/client.py
def editor_interfaces(self, space_id, environment_id, content_type_id): """ Provides access to editor interfaces management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface :return: :class:`EditorInterface...
def editor_interfaces(self, space_id, environment_id, content_type_id): """ Provides access to editor interfaces management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface :return: :class:`EditorInterface...
[ "Provides", "access", "to", "editor", "interfaces", "management", "methods", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L444-L459
[ "def", "editor_interfaces", "(", "self", ",", "space_id", ",", "environment_id", ",", "content_type_id", ")", ":", "return", "EditorInterfacesProxy", "(", "self", ",", "space_id", ",", "environment_id", ",", "content_type_id", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client.snapshots
Provides access to snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <contentful_management.snapshots_proxy.SnapshotsProxy>` object. :rtype: contentful.snapshots_proxy.S...
contentful_management/client.py
def snapshots(self, space_id, environment_id, resource_id, resource_kind='entries'): """ Provides access to snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <co...
def snapshots(self, space_id, environment_id, resource_id, resource_kind='entries'): """ Provides access to snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <co...
[ "Provides", "access", "to", "snapshot", "management", "methods", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L461-L479
[ "def", "snapshots", "(", "self", ",", "space_id", ",", "environment_id", ",", "resource_id", ",", "resource_kind", "=", "'entries'", ")", ":", "return", "SnapshotsProxy", "(", "self", ",", "space_id", ",", "environment_id", ",", "resource_id", ",", "resource_kin...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client.entry_snapshots
Provides access to entry snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <contentful_management.snapshots_proxy.SnapshotsProxy>` object. :rtype: contentful.snapshots_p...
contentful_management/client.py
def entry_snapshots(self, space_id, environment_id, entry_id): """ Provides access to entry snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <contentful_managem...
def entry_snapshots(self, space_id, environment_id, entry_id): """ Provides access to entry snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <contentful_managem...
[ "Provides", "access", "to", "entry", "snapshot", "management", "methods", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L481-L496
[ "def", "entry_snapshots", "(", "self", ",", "space_id", ",", "environment_id", ",", "entry_id", ")", ":", "return", "SnapshotsProxy", "(", "self", ",", "space_id", ",", "environment_id", ",", "entry_id", ",", "'entries'", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client.content_type_snapshots
Provides access to content type snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProxy <contentful_management.snapshots_proxy.SnapshotsProxy>` object. :rtype: contentful.snap...
contentful_management/client.py
def content_type_snapshots(self, space_id, environment_id, content_type_id): """ Provides access to content type snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProx...
def content_type_snapshots(self, space_id, environment_id, content_type_id): """ Provides access to content type snapshot management methods. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`SnapshotsProx...
[ "Provides", "access", "to", "content", "type", "snapshot", "management", "methods", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L498-L513
[ "def", "content_type_snapshots", "(", "self", ",", "space_id", ",", "environment_id", ",", "content_type_id", ")", ":", "return", "SnapshotsProxy", "(", "self", ",", "space_id", ",", "environment_id", ",", "content_type_id", ",", "'content_types'", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._validate_configuration
Validates that required parameters are present.
contentful_management/client.py
def _validate_configuration(self): """ Validates that required parameters are present. """ if not self.access_token: raise ConfigurationException( 'You will need to initialize a client with an Access Token' ) if not self.api_url: ...
def _validate_configuration(self): """ Validates that required parameters are present. """ if not self.access_token: raise ConfigurationException( 'You will need to initialize a client with an Access Token' ) if not self.api_url: ...
[ "Validates", "that", "required", "parameters", "are", "present", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L549-L569
[ "def", "_validate_configuration", "(", "self", ")", ":", "if", "not", "self", ".", "access_token", ":", "raise", "ConfigurationException", "(", "'You will need to initialize a client with an Access Token'", ")", "if", "not", "self", ".", "api_url", ":", "raise", "Conf...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._contentful_user_agent
Sets the X-Contentful-User-Agent header.
contentful_management/client.py
def _contentful_user_agent(self): """ Sets the X-Contentful-User-Agent header. """ header = {} from . import __version__ header['sdk'] = { 'name': 'contentful-management.py', 'version': __version__ } header['app'] = { 'n...
def _contentful_user_agent(self): """ Sets the X-Contentful-User-Agent header. """ header = {} from . import __version__ header['sdk'] = { 'name': 'contentful-management.py', 'version': __version__ } header['app'] = { 'n...
[ "Sets", "the", "X", "-", "Contentful", "-", "User", "-", "Agent", "header", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L571-L618
[ "def", "_contentful_user_agent", "(", "self", ")", ":", "header", "=", "{", "}", "from", ".", "import", "__version__", "header", "[", "'sdk'", "]", "=", "{", "'name'", ":", "'contentful-management.py'", ",", "'version'", ":", "__version__", "}", "header", "[...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._url
Creates the request URL.
contentful_management/client.py
def _url(self, url, file_upload=False): """ Creates the request URL. """ host = self.api_url if file_upload: host = self.uploads_api_url protocol = 'https' if self.https else 'http' if url.endswith('/'): url = url[:-1] return '{0}...
def _url(self, url, file_upload=False): """ Creates the request URL. """ host = self.api_url if file_upload: host = self.uploads_api_url protocol = 'https' if self.https else 'http' if url.endswith('/'): url = url[:-1] return '{0}...
[ "Creates", "the", "request", "URL", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L641-L657
[ "def", "_url", "(", "self", ",", "url", ",", "file_upload", "=", "False", ")", ":", "host", "=", "self", ".", "api_url", "if", "file_upload", ":", "host", "=", "self", ".", "uploads_api_url", "protocol", "=", "'https'", "if", "self", ".", "https", "els...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._http_request
Performs the requested HTTP request.
contentful_management/client.py
def _http_request(self, method, url, request_kwargs=None): """ Performs the requested HTTP request. """ kwargs = request_kwargs if request_kwargs is not None else {} headers = self._request_headers() headers.update(self.additional_headers) if 'headers' in kwargs...
def _http_request(self, method, url, request_kwargs=None): """ Performs the requested HTTP request. """ kwargs = request_kwargs if request_kwargs is not None else {} headers = self._request_headers() headers.update(self.additional_headers) if 'headers' in kwargs...
[ "Performs", "the", "requested", "HTTP", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L669-L696
[ "def", "_http_request", "(", "self", ",", "method", ",", "url", ",", "request_kwargs", "=", "None", ")", ":", "kwargs", "=", "request_kwargs", "if", "request_kwargs", "is", "not", "None", "else", "{", "}", "headers", "=", "self", ".", "_request_headers", "...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._http_get
Performs the HTTP GET request.
contentful_management/client.py
def _http_get(self, url, query, **kwargs): """ Performs the HTTP GET request. """ self._normalize_query(query) kwargs.update({'params': query}) return self._http_request('get', url, kwargs)
def _http_get(self, url, query, **kwargs): """ Performs the HTTP GET request. """ self._normalize_query(query) kwargs.update({'params': query}) return self._http_request('get', url, kwargs)
[ "Performs", "the", "HTTP", "GET", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L698-L707
[ "def", "_http_get", "(", "self", ",", "url", ",", "query", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_normalize_query", "(", "query", ")", "kwargs", ".", "update", "(", "{", "'params'", ":", "query", "}", ")", "return", "self", ".", "_http_req...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._http_post
Performs the HTTP POST request.
contentful_management/client.py
def _http_post(self, url, data, **kwargs): """ Performs the HTTP POST request. """ if not kwargs.get('file_upload', False): data = json.dumps(data) kwargs.update({'data': data}) return self._http_request('post', url, kwargs)
def _http_post(self, url, data, **kwargs): """ Performs the HTTP POST request. """ if not kwargs.get('file_upload', False): data = json.dumps(data) kwargs.update({'data': data}) return self._http_request('post', url, kwargs)
[ "Performs", "the", "HTTP", "POST", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L709-L719
[ "def", "_http_post", "(", "self", ",", "url", ",", "data", ",", "*", "*", "kwargs", ")", ":", "if", "not", "kwargs", ".", "get", "(", "'file_upload'", ",", "False", ")", ":", "data", "=", "json", ".", "dumps", "(", "data", ")", "kwargs", ".", "up...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._http_put
Performs the HTTP PUT request.
contentful_management/client.py
def _http_put(self, url, data, **kwargs): """ Performs the HTTP PUT request. """ kwargs.update({'data': json.dumps(data)}) return self._http_request('put', url, kwargs)
def _http_put(self, url, data, **kwargs): """ Performs the HTTP PUT request. """ kwargs.update({'data': json.dumps(data)}) return self._http_request('put', url, kwargs)
[ "Performs", "the", "HTTP", "PUT", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L721-L728
[ "def", "_http_put", "(", "self", ",", "url", ",", "data", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "{", "'data'", ":", "json", ".", "dumps", "(", "data", ")", "}", ")", "return", "self", ".", "_http_request", "(", "'put'", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._request
Wrapper for the HTTP requests, rate limit backoff is handled here, responses are processed with ResourceBuilder.
contentful_management/client.py
def _request(self, method, url, query_or_data=None, **kwargs): """ Wrapper for the HTTP requests, rate limit backoff is handled here, responses are processed with ResourceBuilder. """ if query_or_data is None: query_or_data = {} request_method = geta...
def _request(self, method, url, query_or_data=None, **kwargs): """ Wrapper for the HTTP requests, rate limit backoff is handled here, responses are processed with ResourceBuilder. """ if query_or_data is None: query_or_data = {} request_method = geta...
[ "Wrapper", "for", "the", "HTTP", "requests", "rate", "limit", "backoff", "is", "handled", "here", "responses", "are", "processed", "with", "ResourceBuilder", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L737-L767
[ "def", "_request", "(", "self", ",", "method", ",", "url", ",", "query_or_data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "query_or_data", "is", "None", ":", "query_or_data", "=", "{", "}", "request_method", "=", "getattr", "(", "self", ",...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._get
Wrapper for the HTTP GET request.
contentful_management/client.py
def _get(self, url, query=None, **kwargs): """ Wrapper for the HTTP GET request. """ return self._request('get', url, query, **kwargs)
def _get(self, url, query=None, **kwargs): """ Wrapper for the HTTP GET request. """ return self._request('get', url, query, **kwargs)
[ "Wrapper", "for", "the", "HTTP", "GET", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L769-L774
[ "def", "_get", "(", "self", ",", "url", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "'get'", ",", "url", ",", "query", ",", "*", "*", "kwargs", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._post
Wrapper for the HTTP POST request.
contentful_management/client.py
def _post(self, url, attributes=None, **kwargs): """ Wrapper for the HTTP POST request. """ return self._request('post', url, attributes, **kwargs)
def _post(self, url, attributes=None, **kwargs): """ Wrapper for the HTTP POST request. """ return self._request('post', url, attributes, **kwargs)
[ "Wrapper", "for", "the", "HTTP", "POST", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L776-L781
[ "def", "_post", "(", "self", ",", "url", ",", "attributes", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "'post'", ",", "url", ",", "attributes", ",", "*", "*", "kwargs", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._put
Wrapper for the HTTP PUT request.
contentful_management/client.py
def _put(self, url, attributes=None, **kwargs): """ Wrapper for the HTTP PUT request. """ return self._request('put', url, attributes, **kwargs)
def _put(self, url, attributes=None, **kwargs): """ Wrapper for the HTTP PUT request. """ return self._request('put', url, attributes, **kwargs)
[ "Wrapper", "for", "the", "HTTP", "PUT", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L783-L788
[ "def", "_put", "(", "self", ",", "url", ",", "attributes", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "'put'", ",", "url", ",", "attributes", ",", "*", "*", "kwargs", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Client._delete
Wrapper for the HTTP DELETE request.
contentful_management/client.py
def _delete(self, url, **kwargs): """ Wrapper for the HTTP DELETE request. """ response = retry_request(self)(self._http_delete)(url, **kwargs) if self.raw_mode: return response if response.status_code >= 300: error = get_error(response) ...
def _delete(self, url, **kwargs): """ Wrapper for the HTTP DELETE request. """ response = retry_request(self)(self._http_delete)(url, **kwargs) if self.raw_mode: return response if response.status_code >= 300: error = get_error(response) ...
[ "Wrapper", "for", "the", "HTTP", "DELETE", "request", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L790-L806
[ "def", "_delete", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "response", "=", "retry_request", "(", "self", ")", "(", "self", ".", "_http_delete", ")", "(", "url", ",", "*", "*", "kwargs", ")", "if", "self", ".", "raw_mode", ":", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Locale.to_json
Returns the JSON representation of the locale.
contentful_management/locale.py
def to_json(self): """ Returns the JSON representation of the locale. """ result = super(Locale, self).to_json() result.update({ 'code': self.code, 'name': self.name, 'fallbackCode': self.fallback_code, 'optional': self.optional, ...
def to_json(self): """ Returns the JSON representation of the locale. """ result = super(Locale, self).to_json() result.update({ 'code': self.code, 'name': self.name, 'fallbackCode': self.fallback_code, 'optional': self.optional, ...
[ "Returns", "the", "JSON", "representation", "of", "the", "locale", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/locale.py#L48-L62
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "Locale", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'code'", ":", "self", ".", "code", ",", "'name'", ":", "self", ".", "name", ",", "'fal...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
AssetsProxy.all
Gets all assets of a space.
contentful_management/assets_proxy.py
def all(self, query=None, **kwargs): """ Gets all assets of a space. """ if query is None: query = {} normalize_select(query) return super(AssetsProxy, self).all(query, **kwargs)
def all(self, query=None, **kwargs): """ Gets all assets of a space. """ if query is None: query = {} normalize_select(query) return super(AssetsProxy, self).all(query, **kwargs)
[ "Gets", "all", "assets", "of", "a", "space", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/assets_proxy.py#L28-L38
[ "def", "all", "(", "self", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "query", "is", "None", ":", "query", "=", "{", "}", "normalize_select", "(", "query", ")", "return", "super", "(", "AssetsProxy", ",", "self", ")", ".", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
AssetsProxy.find
Gets a single asset by ID.
contentful_management/assets_proxy.py
def find(self, asset_id, query=None, **kwargs): """ Gets a single asset by ID. """ if query is None: query = {} normalize_select(query) return super(AssetsProxy, self).find(asset_id, query=query, **kwargs)
def find(self, asset_id, query=None, **kwargs): """ Gets a single asset by ID. """ if query is None: query = {} normalize_select(query) return super(AssetsProxy, self).find(asset_id, query=query, **kwargs)
[ "Gets", "a", "single", "asset", "by", "ID", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/assets_proxy.py#L40-L50
[ "def", "find", "(", "self", ",", "asset_id", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "query", "is", "None", ":", "query", "=", "{", "}", "normalize_select", "(", "query", ")", "return", "super", "(", "AssetsProxy", ",", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Entry.snapshots
Provides access to snapshot management methods for the given entry. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`EntrySnapshotsProxy <contentful_management.entry_snapshots_proxy.EntrySnapshotsProxy>` object. ...
contentful_management/entry.py
def snapshots(self): """ Provides access to snapshot management methods for the given entry. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`EntrySnapshotsProxy <contentful_management.entry_snapshots_pro...
def snapshots(self): """ Provides access to snapshot management methods for the given entry. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots :return: :class:`EntrySnapshotsProxy <contentful_management.entry_snapshots_pro...
[ "Provides", "access", "to", "snapshot", "management", "methods", "for", "the", "given", "entry", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entry.py#L38-L52
[ "def", "snapshots", "(", "self", ")", ":", "return", "EntrySnapshotsProxy", "(", "self", ".", "_client", ",", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "_environment_id", ",", "self", ".", "sys", "[", "'id'", "]", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Entry.update
Updates the entry with attributes.
contentful_management/entry.py
def update(self, attributes=None): """ Updates the entry with attributes. """ if attributes is None: attributes = {} attributes['content_type_id'] = self.sys['content_type'].id return super(Entry, self).update(attributes)
def update(self, attributes=None): """ Updates the entry with attributes. """ if attributes is None: attributes = {} attributes['content_type_id'] = self.sys['content_type'].id return super(Entry, self).update(attributes)
[ "Updates", "the", "entry", "with", "attributes", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entry.py#L54-L64
[ "def", "update", "(", "self", ",", "attributes", "=", "None", ")", ":", "if", "attributes", "is", "None", ":", "attributes", "=", "{", "}", "attributes", "[", "'content_type_id'", "]", "=", "self", ".", "sys", "[", "'content_type'", "]", ".", "id", "re...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ClientProxy.all
Gets resource collection for _resource_class.
contentful_management/client_proxy.py
def all(self, query=None): """ Gets resource collection for _resource_class. """ if query is None: query = {} return self.client._get( self._url(), query )
def all(self, query=None): """ Gets resource collection for _resource_class. """ if query is None: query = {} return self.client._get( self._url(), query )
[ "Gets", "resource", "collection", "for", "_resource_class", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L33-L43
[ "def", "all", "(", "self", ",", "query", "=", "None", ")", ":", "if", "query", "is", "None", ":", "query", "=", "{", "}", "return", "self", ".", "client", ".", "_get", "(", "self", ".", "_url", "(", ")", ",", "query", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ClientProxy.find
Gets a single resource.
contentful_management/client_proxy.py
def find(self, resource_id, query=None, **kwargs): """Gets a single resource.""" if query is None: query = {} return self.client._get( self._url(resource_id), query, **kwargs )
def find(self, resource_id, query=None, **kwargs): """Gets a single resource.""" if query is None: query = {} return self.client._get( self._url(resource_id), query, **kwargs )
[ "Gets", "a", "single", "resource", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L45-L54
[ "def", "find", "(", "self", ",", "resource_id", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "query", "is", "None", ":", "query", "=", "{", "}", "return", "self", ".", "client", ".", "_get", "(", "self", ".", "_url", "(", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ClientProxy.create
Creates a resource with the given ID (optional) and attributes.
contentful_management/client_proxy.py
def create(self, resource_id=None, attributes=None): """ Creates a resource with the given ID (optional) and attributes. """ if attributes is None: attributes = {} result = None if not resource_id: result = self.client._post( self...
def create(self, resource_id=None, attributes=None): """ Creates a resource with the given ID (optional) and attributes. """ if attributes is None: attributes = {} result = None if not resource_id: result = self.client._post( self...
[ "Creates", "a", "resource", "with", "the", "given", "ID", "(", "optional", ")", "and", "attributes", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L56-L78
[ "def", "create", "(", "self", ",", "resource_id", "=", "None", ",", "attributes", "=", "None", ")", ":", "if", "attributes", "is", "None", ":", "attributes", "=", "{", "}", "result", "=", "None", "if", "not", "resource_id", ":", "result", "=", "self", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ClientProxy.delete
Deletes a resource by ID.
contentful_management/client_proxy.py
def delete(self, resource_id, **kwargs): """ Deletes a resource by ID. """ return self.client._delete(self._url(resource_id), **kwargs)
def delete(self, resource_id, **kwargs): """ Deletes a resource by ID. """ return self.client._delete(self._url(resource_id), **kwargs)
[ "Deletes", "a", "resource", "by", "ID", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L80-L85
[ "def", "delete", "(", "self", ",", "resource_id", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "client", ".", "_delete", "(", "self", ".", "_url", "(", "resource_id", ")", ",", "*", "*", "kwargs", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Role.to_json
Returns the JSON representation of the role.
contentful_management/role.py
def to_json(self): """ Returns the JSON representation of the role. """ result = super(Role, self).to_json() result.update({ 'name': self.name, 'description': self.description, 'permissions': self.permissions, 'policies': self.poli...
def to_json(self): """ Returns the JSON representation of the role. """ result = super(Role, self).to_json() result.update({ 'name': self.name, 'description': self.description, 'permissions': self.permissions, 'policies': self.poli...
[ "Returns", "the", "JSON", "representation", "of", "the", "role", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/role.py#L42-L54
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "Role", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'name'", ":", "self", ".", "name", ",", "'description'", ":", "self", ".", "description", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SpaceMembership.to_json
Returns the JSON representation of the space membership.
contentful_management/space_membership.py
def to_json(self): """ Returns the JSON representation of the space membership. """ result = super(SpaceMembership, self).to_json() result.update({ 'admin': self.admin, 'roles': self.roles }) return result
def to_json(self): """ Returns the JSON representation of the space membership. """ result = super(SpaceMembership, self).to_json() result.update({ 'admin': self.admin, 'roles': self.roles }) return result
[ "Returns", "the", "JSON", "representation", "of", "the", "space", "membership", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space_membership.py#L28-L38
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "SpaceMembership", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'admin'", ":", "self", ".", "admin", ",", "'roles'", ":", "self", ".", "roles", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
UploadsProxy.create
Creates an upload for the given file or path.
contentful_management/uploads_proxy.py
def create(self, file_or_path, **kwargs): """ Creates an upload for the given file or path. """ opened = False if isinstance(file_or_path, str_type()): file_or_path = open(file_or_path, 'rb') opened = True elif not getattr(file_or_path, 'read', Fa...
def create(self, file_or_path, **kwargs): """ Creates an upload for the given file or path. """ opened = False if isinstance(file_or_path, str_type()): file_or_path = open(file_or_path, 'rb') opened = True elif not getattr(file_or_path, 'read', Fa...
[ "Creates", "an", "upload", "for", "the", "given", "file", "or", "path", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L35-L56
[ "def", "create", "(", "self", ",", "file_or_path", ",", "*", "*", "kwargs", ")", ":", "opened", "=", "False", "if", "isinstance", "(", "file_or_path", ",", "str_type", "(", ")", ")", ":", "file_or_path", "=", "open", "(", "file_or_path", ",", "'rb'", "...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
UploadsProxy.find
Finds an upload by ID.
contentful_management/uploads_proxy.py
def find(self, upload_id, **kwargs): """ Finds an upload by ID. """ return super(UploadsProxy, self).find(upload_id, file_upload=True)
def find(self, upload_id, **kwargs): """ Finds an upload by ID. """ return super(UploadsProxy, self).find(upload_id, file_upload=True)
[ "Finds", "an", "upload", "by", "ID", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L58-L63
[ "def", "find", "(", "self", ",", "upload_id", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "UploadsProxy", ",", "self", ")", ".", "find", "(", "upload_id", ",", "file_upload", "=", "True", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
UploadsProxy.delete
Deletes an upload by ID.
contentful_management/uploads_proxy.py
def delete(self, upload_id): """ Deletes an upload by ID. """ return super(UploadsProxy, self).delete(upload_id, file_upload=True)
def delete(self, upload_id): """ Deletes an upload by ID. """ return super(UploadsProxy, self).delete(upload_id, file_upload=True)
[ "Deletes", "an", "upload", "by", "ID", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L65-L70
[ "def", "delete", "(", "self", ",", "upload_id", ")", ":", "return", "super", "(", "UploadsProxy", ",", "self", ")", ".", "delete", "(", "upload_id", ",", "file_upload", "=", "True", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentTypeField.to_json
Returns the JSON Representation of the content type field.
contentful_management/content_type_field.py
def to_json(self): """ Returns the JSON Representation of the content type field. """ result = { 'name': self.name, 'id': self._real_id(), 'type': self.type, 'localized': self.localized, 'omitted': self.omitted, 're...
def to_json(self): """ Returns the JSON Representation of the content type field. """ result = { 'name': self.name, 'id': self._real_id(), 'type': self.type, 'localized': self.localized, 'omitted': self.omitted, 're...
[ "Returns", "the", "JSON", "Representation", "of", "the", "content", "type", "field", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_field.py#L38-L60
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "{", "'name'", ":", "self", ".", "name", ",", "'id'", ":", "self", ".", "_real_id", "(", ")", ",", "'type'", ":", "self", ".", "type", ",", "'localized'", ":", "self", ".", "localized", ",", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
LocationField.coerce
Coerces value to location hash.
contentful_management/content_type_field_types.py
def coerce(self, value): """ Coerces value to location hash. """ return { 'lat': float(value.get('lat', value.get('latitude'))), 'lon': float(value.get('lon', value.get('longitude'))) }
def coerce(self, value): """ Coerces value to location hash. """ return { 'lat': float(value.get('lat', value.get('latitude'))), 'lon': float(value.get('lon', value.get('longitude'))) }
[ "Coerces", "value", "to", "location", "hash", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_field_types.py#L167-L175
[ "def", "coerce", "(", "self", ",", "value", ")", ":", "return", "{", "'lat'", ":", "float", "(", "value", ".", "get", "(", "'lat'", ",", "value", ".", "get", "(", "'latitude'", ")", ")", ")", ",", "'lon'", ":", "float", "(", "value", ".", "get", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Snapshot.base_url
Returns the URI for the snapshot.
contentful_management/snapshot.py
def base_url(klass, space_id, parent_resource_id, resource_url='entries', resource_id=None, environment_id=None): """ Returns the URI for the snapshot. """ return "spaces/{0}{1}/{2}/{3}/snapshots/{4}".format( space_id, '/environments/{0}'.format(environment_id) i...
def base_url(klass, space_id, parent_resource_id, resource_url='entries', resource_id=None, environment_id=None): """ Returns the URI for the snapshot. """ return "spaces/{0}{1}/{2}/{3}/snapshots/{4}".format( space_id, '/environments/{0}'.format(environment_id) i...
[ "Returns", "the", "URI", "for", "the", "snapshot", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/snapshot.py#L38-L49
[ "def", "base_url", "(", "klass", ",", "space_id", ",", "parent_resource_id", ",", "resource_url", "=", "'entries'", ",", "resource_id", "=", "None", ",", "environment_id", "=", "None", ")", ":", "return", "\"spaces/{0}{1}/{2}/{3}/snapshots/{4}\"", ".", "format", "...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Snapshot.to_json
Returns the JSON representation of the snapshot.
contentful_management/snapshot.py
def to_json(self): """ Returns the JSON representation of the snapshot. """ result = super(Snapshot, self).to_json() result.update({ 'snapshot': self.snapshot.to_json(), }) return result
def to_json(self): """ Returns the JSON representation of the snapshot. """ result = super(Snapshot, self).to_json() result.update({ 'snapshot': self.snapshot.to_json(), }) return result
[ "Returns", "the", "JSON", "representation", "of", "the", "snapshot", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/snapshot.py#L51-L60
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "Snapshot", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'snapshot'", ":", "self", ".", "snapshot", ".", "to_json", "(", ")", ",", "}", ")", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
UsagePeriodsProxy.all
Gets all usage periods.
contentful_management/usage_periods_proxy.py
def all(self, *args, **kwargs): """ Gets all usage periods. """ return self.client._get( self._url(), {}, headers={ 'x-contentful-enable-alpha-feature': 'usage-insights' } )
def all(self, *args, **kwargs): """ Gets all usage periods. """ return self.client._get( self._url(), {}, headers={ 'x-contentful-enable-alpha-feature': 'usage-insights' } )
[ "Gets", "all", "usage", "periods", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/usage_periods_proxy.py#L31-L42
[ "def", "all", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "client", ".", "_get", "(", "self", ".", "_url", "(", ")", ",", "{", "}", ",", "headers", "=", "{", "'x-contentful-enable-alpha-feature'", ":", "...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Webhook.create_attributes
Attributes for webhook creation.
contentful_management/webhook.py
def create_attributes(klass, attributes, previous_object=None): """ Attributes for webhook creation. """ result = super(Webhook, klass).create_attributes(attributes, previous_object) if 'topics' not in result: raise Exception("Topics ('topics') must be provided for ...
def create_attributes(klass, attributes, previous_object=None): """ Attributes for webhook creation. """ result = super(Webhook, klass).create_attributes(attributes, previous_object) if 'topics' not in result: raise Exception("Topics ('topics') must be provided for ...
[ "Attributes", "for", "webhook", "creation", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L51-L60
[ "def", "create_attributes", "(", "klass", ",", "attributes", ",", "previous_object", "=", "None", ")", ":", "result", "=", "super", "(", "Webhook", ",", "klass", ")", ".", "create_attributes", "(", "attributes", ",", "previous_object", ")", "if", "'topics'", ...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Webhook.calls
Provides access to call overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls :return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_proxy.WebhookWebhooksCallProxy>` object. ...
contentful_management/webhook.py
def calls(self): """ Provides access to call overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls :return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_prox...
def calls(self): """ Provides access to call overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls :return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_prox...
[ "Provides", "access", "to", "call", "overview", "for", "the", "given", "webhook", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L62-L76
[ "def", "calls", "(", "self", ")", ":", "return", "WebhookWebhooksCallProxy", "(", "self", ".", "_client", ",", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "sys", "[", "'id'", "]", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Webhook.health
Provides access to health overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health :return: :class:`WebhookWebhooksHealthProxy <contentful_management.webhook_webhooks_health_proxy.WebhookWebhook...
contentful_management/webhook.py
def health(self): """ Provides access to health overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health :return: :class:`WebhookWebhooksHealthProxy <contentful_management.webhoo...
def health(self): """ Provides access to health overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health :return: :class:`WebhookWebhooksHealthProxy <contentful_management.webhoo...
[ "Provides", "access", "to", "health", "overview", "for", "the", "given", "webhook", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L78-L92
[ "def", "health", "(", "self", ")", ":", "return", "WebhookWebhooksHealthProxy", "(", "self", ".", "_client", ",", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "sys", "[", "'id'", "]", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
Webhook.to_json
Returns the JSON representation of the webhook.
contentful_management/webhook.py
def to_json(self): """ Returns the JSON representation of the webhook. """ result = super(Webhook, self).to_json() result.update({ 'name': self.name, 'url': self.url, 'topics': self.topics, 'httpBasicUsername': self.http_basic_user...
def to_json(self): """ Returns the JSON representation of the webhook. """ result = super(Webhook, self).to_json() result.update({ 'name': self.name, 'url': self.url, 'topics': self.topics, 'httpBasicUsername': self.http_basic_user...
[ "Returns", "the", "JSON", "representation", "of", "the", "webhook", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L94-L114
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "Webhook", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'name'", ":", "self", ".", "name", ",", "'url'", ":", "self", ".", "url", ",", "'topi...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
EditorInterface.base_url
Returns the URI for the editor interface.
contentful_management/editor_interface.py
def base_url(self, space_id, content_type_id, environment_id=None, **kwargs): """ Returns the URI for the editor interface. """ return "spaces/{0}{1}/content_types/{2}/editor_interface".format( space_id, '/environments/{0}'.format(environment_id) if environment_i...
def base_url(self, space_id, content_type_id, environment_id=None, **kwargs): """ Returns the URI for the editor interface. """ return "spaces/{0}{1}/content_types/{2}/editor_interface".format( space_id, '/environments/{0}'.format(environment_id) if environment_i...
[ "Returns", "the", "URI", "for", "the", "editor", "interface", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/editor_interface.py#L27-L36
[ "def", "base_url", "(", "self", ",", "space_id", ",", "content_type_id", ",", "environment_id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "\"spaces/{0}{1}/content_types/{2}/editor_interface\"", ".", "format", "(", "space_id", ",", "'/environments/{0}...
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
EditorInterface.to_json
Returns the JSON representation of the editor interface.
contentful_management/editor_interface.py
def to_json(self): """ Returns the JSON representation of the editor interface. """ result = super(EditorInterface, self).to_json() result.update({'controls': self.controls}) return result
def to_json(self): """ Returns the JSON representation of the editor interface. """ result = super(EditorInterface, self).to_json() result.update({'controls': self.controls}) return result
[ "Returns", "the", "JSON", "representation", "of", "the", "editor", "interface", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/editor_interface.py#L46-L53
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "super", "(", "EditorInterface", ",", "self", ")", ".", "to_json", "(", ")", "result", ".", "update", "(", "{", "'controls'", ":", "self", ".", "controls", "}", ")", "return", "result" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentTypeFieldValidation.to_json
Returns the JSON Representation of the content type field validation.
contentful_management/content_type_field_validation.py
def to_json(self): """ Returns the JSON Representation of the content type field validation. """ result = {} for k, v in self._data.items(): result[camel_case(k)] = v return result
def to_json(self): """ Returns the JSON Representation of the content type field validation. """ result = {} for k, v in self._data.items(): result[camel_case(k)] = v return result
[ "Returns", "the", "JSON", "Representation", "of", "the", "content", "type", "field", "validation", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_field_validation.py#L28-L36
[ "def", "to_json", "(", "self", ")", ":", "result", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "_data", ".", "items", "(", ")", ":", "result", "[", "camel_case", "(", "k", ")", "]", "=", "v", "return", "result" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ResourceBuilder.build
Creates the objects from the JSON response.
contentful_management/resource_builder.py
def build(self): """ Creates the objects from the JSON response. """ if self.json['sys']['type'] == 'Array': return self._build_array() return self._build_item(self.json)
def build(self): """ Creates the objects from the JSON response. """ if self.json['sys']['type'] == 'Array': return self._build_array() return self._build_item(self.json)
[ "Creates", "the", "objects", "from", "the", "JSON", "response", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource_builder.py#L47-L54
[ "def", "build", "(", "self", ")", ":", "if", "self", ".", "json", "[", "'sys'", "]", "[", "'type'", "]", "==", "'Array'", ":", "return", "self", ".", "_build_array", "(", ")", "return", "self", ".", "_build_item", "(", "self", ".", "json", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
ContentTypeResourceProxy.create
Creates a resource with a given ID (optional) and attributes for the current content type.
contentful_management/content_type_resource_proxy.py
def create(self, resource_id=None, attributes=None): """ Creates a resource with a given ID (optional) and attributes for the current content type. """ return self.proxy.create(resource_id=resource_id, attributes=attributes)
def create(self, resource_id=None, attributes=None): """ Creates a resource with a given ID (optional) and attributes for the current content type. """ return self.proxy.create(resource_id=resource_id, attributes=attributes)
[ "Creates", "a", "resource", "with", "a", "given", "ID", "(", "optional", ")", "and", "attributes", "for", "the", "current", "content", "type", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_resource_proxy.py#L43-L48
[ "def", "create", "(", "self", ",", "resource_id", "=", "None", ",", "attributes", "=", "None", ")", ":", "return", "self", ".", "proxy", ".", "create", "(", "resource_id", "=", "resource_id", ",", "attributes", "=", "attributes", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SpaceResourceProxy.find
Finds a single resource by ID related to the current space.
contentful_management/space_resource_proxy.py
def find(self, resource_id, query=None): """ Finds a single resource by ID related to the current space. """ return self.proxy.find(resource_id, query=query)
def find(self, resource_id, query=None): """ Finds a single resource by ID related to the current space. """ return self.proxy.find(resource_id, query=query)
[ "Finds", "a", "single", "resource", "by", "ID", "related", "to", "the", "current", "space", "." ]
contentful/contentful-management.py
python
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space_resource_proxy.py#L36-L41
[ "def", "find", "(", "self", ",", "resource_id", ",", "query", "=", "None", ")", ":", "return", "self", ".", "proxy", ".", "find", "(", "resource_id", ",", "query", "=", "query", ")" ]
707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0
train
SolrResponse.get_ngroups
Returns ngroups count if it was specified in the query, otherwise ValueError. If grouping on more than one field, provide the field argument to specify which count you are looking for.
SolrClient/solrresp.py
def get_ngroups(self, field=None): ''' Returns ngroups count if it was specified in the query, otherwise ValueError. If grouping on more than one field, provide the field argument to specify which count you are looking for. ''' field = field if field else self._determine_group_f...
def get_ngroups(self, field=None): ''' Returns ngroups count if it was specified in the query, otherwise ValueError. If grouping on more than one field, provide the field argument to specify which count you are looking for. ''' field = field if field else self._determine_group_f...
[ "Returns", "ngroups", "count", "if", "it", "was", "specified", "in", "the", "query", "otherwise", "ValueError", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L77-L86
[ "def", "get_ngroups", "(", "self", ",", "field", "=", "None", ")", ":", "field", "=", "field", "if", "field", "else", "self", ".", "_determine_group_field", "(", "field", ")", "if", "'ngroups'", "in", "self", ".", "data", "[", "'grouped'", "]", "[", "f...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_groups_count
Returns 'matches' from group response. If grouping on more than one field, provide the field argument to specify which count you are looking for.
SolrClient/solrresp.py
def get_groups_count(self, field=None): ''' Returns 'matches' from group response. If grouping on more than one field, provide the field argument to specify which count you are looking for. ''' field = field if field else self._determine_group_field(field) if 'ma...
def get_groups_count(self, field=None): ''' Returns 'matches' from group response. If grouping on more than one field, provide the field argument to specify which count you are looking for. ''' field = field if field else self._determine_group_field(field) if 'ma...
[ "Returns", "matches", "from", "group", "response", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L89-L98
[ "def", "get_groups_count", "(", "self", ",", "field", "=", "None", ")", ":", "field", "=", "field", "if", "field", "else", "self", ".", "_determine_group_field", "(", "field", ")", "if", "'matches'", "in", "self", ".", "data", "[", "'grouped'", "]", "[",...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_flat_groups
Flattens the group response and just returns a list of documents.
SolrClient/solrresp.py
def get_flat_groups(self, field=None): ''' Flattens the group response and just returns a list of documents. ''' field = field if field else self._determine_group_field(field) temp_groups = self.data['grouped'][field]['groups'] return [y for x in temp_groups for y in x['d...
def get_flat_groups(self, field=None): ''' Flattens the group response and just returns a list of documents. ''' field = field if field else self._determine_group_field(field) temp_groups = self.data['grouped'][field]['groups'] return [y for x in temp_groups for y in x['d...
[ "Flattens", "the", "group", "response", "and", "just", "returns", "a", "list", "of", "documents", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L101-L107
[ "def", "get_flat_groups", "(", "self", ",", "field", "=", "None", ")", ":", "field", "=", "field", "if", "field", "else", "self", ".", "_determine_group_field", "(", "field", ")", "temp_groups", "=", "self", ".", "data", "[", "'grouped'", "]", "[", "fiel...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_facets
Returns a dictionary of facets:: >>> res = solr.query('SolrClient_unittest',{ 'q':'product_name:Lorem', 'facet':True, 'facet.field':'facet_test', })... ... ... ... >>> res.get_results_count() 4 >>> r...
SolrClient/solrresp.py
def get_facets(self): ''' Returns a dictionary of facets:: >>> res = solr.query('SolrClient_unittest',{ 'q':'product_name:Lorem', 'facet':True, 'facet.field':'facet_test', })... ... ... ... >>> res.get_resul...
def get_facets(self): ''' Returns a dictionary of facets:: >>> res = solr.query('SolrClient_unittest',{ 'q':'product_name:Lorem', 'facet':True, 'facet.field':'facet_test', })... ... ... ... >>> res.get_resul...
[ "Returns", "a", "dictionary", "of", "facets", "::" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L110-L138
[ "def", "get_facets", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'facets'", ")", ":", "self", ".", "facets", "=", "{", "}", "data", "=", "self", ".", "data", "if", "'facet_counts'", "in", "data", ".", "keys", "(", ")", "and", ...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_facets_ranges
Returns query facet ranges :: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'facet':True, 'facet.range':'price', 'facet.range.start':0, 'facet.range.end':100, 'facet.range.gap':10 }) ...
SolrClient/solrresp.py
def get_facets_ranges(self): ''' Returns query facet ranges :: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'facet':True, 'facet.range':'price', 'facet.range.start':0, 'facet.range.end':100, ...
def get_facets_ranges(self): ''' Returns query facet ranges :: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'facet':True, 'facet.range':'price', 'facet.range.start':0, 'facet.range.end':100, ...
[ "Returns", "query", "facet", "ranges", "::" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L150-L179
[ "def", "get_facets_ranges", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'facet_ranges'", ")", ":", "self", ".", "facet_ranges", "=", "{", "}", "data", "=", "self", ".", "data", "if", "'facet_counts'", "in", "data", ".", "keys", "(...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_facet_pivot
Parses facet pivot response. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'fq':'price:[50 TO *]', 'facet':True, 'facet.pivot':'facet_test,price' #Note how there is no space between fields. They are just separated by commas }) ...
SolrClient/solrresp.py
def get_facet_pivot(self): ''' Parses facet pivot response. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'fq':'price:[50 TO *]', 'facet':True, 'facet.pivot':'facet_test,price' #Note how there is no space between fields. The...
def get_facet_pivot(self): ''' Parses facet pivot response. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'fq':'price:[50 TO *]', 'facet':True, 'facet.pivot':'facet_test,price' #Note how there is no space between fields. The...
[ "Parses", "facet", "pivot", "response", ".", "Example", "::", ">>>", "res", "=", "solr", ".", "query", "(", "SolrClient_unittest", "{", "q", ":", "*", ":", "*", "fq", ":", "price", ":", "[", "50", "TO", "*", "]", "facet", ":", "True", "facet", ".",...
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L182-L207
[ "def", "get_facet_pivot", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'facet_pivot'", ")", ":", "self", ".", "facet_pivot", "=", "{", "}", "if", "'facet_counts'", "in", "self", ".", "data", ".", "keys", "(", ")", ":", "pivots", ...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_field_values_as_list
:param str field: The name of the field for which to pull in values. Will parse the query results (must be ungrouped) and return all values of 'field' as a list. Note that these are not unique values. Example:: >>> r.get_field_values_as_list('product_name_exact') ['Mauris risus risus l...
SolrClient/solrresp.py
def get_field_values_as_list(self,field): ''' :param str field: The name of the field for which to pull in values. Will parse the query results (must be ungrouped) and return all values of 'field' as a list. Note that these are not unique values. Example:: >>> r.get_field_values_as...
def get_field_values_as_list(self,field): ''' :param str field: The name of the field for which to pull in values. Will parse the query results (must be ungrouped) and return all values of 'field' as a list. Note that these are not unique values. Example:: >>> r.get_field_values_as...
[ ":", "param", "str", "field", ":", "The", "name", "of", "the", "field", "for", "which", "to", "pull", "in", "values", ".", "Will", "parse", "the", "query", "results", "(", "must", "be", "ungrouped", ")", "and", "return", "all", "values", "of", "field",...
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L222-L231
[ "def", "get_field_values_as_list", "(", "self", ",", "field", ")", ":", "return", "[", "doc", "[", "field", "]", "for", "doc", "in", "self", ".", "docs", "if", "field", "in", "doc", "]" ]
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_first_field_values_as_list
:param str field: The name of the field for lookup. Goes through all documents returned looking for specified field. At first encounter will return the field's value.
SolrClient/solrresp.py
def get_first_field_values_as_list(self, field): ''' :param str field: The name of the field for lookup. Goes through all documents returned looking for specified field. At first encounter will return the field's value. ''' for doc in self.docs: if field in doc.keys(...
def get_first_field_values_as_list(self, field): ''' :param str field: The name of the field for lookup. Goes through all documents returned looking for specified field. At first encounter will return the field's value. ''' for doc in self.docs: if field in doc.keys(...
[ ":", "param", "str", "field", ":", "The", "name", "of", "the", "field", "for", "lookup", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L270-L279
[ "def", "get_first_field_values_as_list", "(", "self", ",", "field", ")", ":", "for", "doc", "in", "self", ".", "docs", ":", "if", "field", "in", "doc", ".", "keys", "(", ")", ":", "return", "doc", "[", "field", "]", "raise", "SolrResponseError", "(", "...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_facet_values_as_list
:param str field: Name of facet field to retrieve values from. Returns facet values as list for a given field. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'facet':'true', 'facet.field':'facet_test', }) >>...
SolrClient/solrresp.py
def get_facet_values_as_list(self, field): ''' :param str field: Name of facet field to retrieve values from. Returns facet values as list for a given field. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'facet':'true', ...
def get_facet_values_as_list(self, field): ''' :param str field: Name of facet field to retrieve values from. Returns facet values as list for a given field. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'facet':'true', ...
[ ":", "param", "str", "field", ":", "Name", "of", "facet", "field", "to", "retrieve", "values", "from", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L281-L305
[ "def", "get_facet_values_as_list", "(", "self", ",", "field", ")", ":", "facets", "=", "self", ".", "get_facets", "(", ")", "out", "=", "[", "]", "if", "field", "in", "facets", ".", "keys", "(", ")", ":", "for", "facetfield", "in", "facets", "[", "fi...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_facet_keys_as_list
:param str field: Name of facet field to retrieve keys from. Similar to get_facet_values_as_list but returns the list of keys as a list instead. Example:: >>> r.get_facet_keys_as_list('facet_test') ['Lorem', 'ipsum', 'amet,', 'dolor', 'sit']
SolrClient/solrresp.py
def get_facet_keys_as_list(self,field): ''' :param str field: Name of facet field to retrieve keys from. Similar to get_facet_values_as_list but returns the list of keys as a list instead. Example:: >>> r.get_facet_keys_as_list('facet_test') ['Lorem', 'ipsum', '...
def get_facet_keys_as_list(self,field): ''' :param str field: Name of facet field to retrieve keys from. Similar to get_facet_values_as_list but returns the list of keys as a list instead. Example:: >>> r.get_facet_keys_as_list('facet_test') ['Lorem', 'ipsum', '...
[ ":", "param", "str", "field", ":", "Name", "of", "facet", "field", "to", "retrieve", "keys", "from", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L307-L322
[ "def", "get_facet_keys_as_list", "(", "self", ",", "field", ")", ":", "facets", "=", "self", ".", "get_facets", "(", ")", "if", "facets", "==", "-", "1", ":", "return", "facets", "if", "field", "in", "facets", ".", "keys", "(", ")", ":", "return", "[...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.json_facet
EXPERIMENTAL Tried to kick back the json.fact output.
SolrClient/solrresp.py
def json_facet(self, field=None): ''' EXPERIMENTAL Tried to kick back the json.fact output. ''' facets = self.data['facets'] if field is None: temp_fields = [x for x in facets.keys() if x != 'count'] if len(temp_fields) != 1: raise...
def json_facet(self, field=None): ''' EXPERIMENTAL Tried to kick back the json.fact output. ''' facets = self.data['facets'] if field is None: temp_fields = [x for x in facets.keys() if x != 'count'] if len(temp_fields) != 1: raise...
[ "EXPERIMENTAL" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L331-L347
[ "def", "json_facet", "(", "self", ",", "field", "=", "None", ")", ":", "facets", "=", "self", ".", "data", "[", "'facets'", "]", "if", "field", "is", "None", ":", "temp_fields", "=", "[", "x", "for", "x", "in", "facets", ".", "keys", "(", ")", "i...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
SolrResponse.get_jsonfacet_counts_as_dict
EXPERIMENTAL Takes facets and returns then as a dictionary that is easier to work with, for example, if you are getting something this:: {'facets': {'count': 50, 'test': {'buckets': [{'count': 10, 'pr': {'buckets': [{'count': 2, 'unique': 1, 'val': 79}, ...
SolrClient/solrresp.py
def get_jsonfacet_counts_as_dict(self, field, data=None): ''' EXPERIMENTAL Takes facets and returns then as a dictionary that is easier to work with, for example, if you are getting something this:: {'facets': {'count': 50, 'test': {'buckets': [{'count': 10, ...
def get_jsonfacet_counts_as_dict(self, field, data=None): ''' EXPERIMENTAL Takes facets and returns then as a dictionary that is easier to work with, for example, if you are getting something this:: {'facets': {'count': 50, 'test': {'buckets': [{'count': 10, ...
[ "EXPERIMENTAL", "Takes", "facets", "and", "returns", "then", "as", "a", "dictionary", "that", "is", "easier", "to", "work", "with", "for", "example", "if", "you", "are", "getting", "something", "this", "::" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L349-L394
[ "def", "get_jsonfacet_counts_as_dict", "(", "self", ",", "field", ",", "data", "=", "None", ")", ":", "data", "=", "data", "if", "data", "else", "self", ".", "data", "[", "'facets'", "]", "if", "field", "not", "in", "data", ":", "raise", "ValueError", ...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ._gen_file_name
Generates a random file name based on self._output_filename_pattern for the output to do file.
SolrClient/indexq.py
def _gen_file_name(self): ''' Generates a random file name based on self._output_filename_pattern for the output to do file. ''' date = datetime.datetime.now() dt = "{}-{}-{}-{}-{}-{}-{}".format(str(date.year),str(date.month),str(date.day),str(date.hour),str(date.minute),str(date...
def _gen_file_name(self): ''' Generates a random file name based on self._output_filename_pattern for the output to do file. ''' date = datetime.datetime.now() dt = "{}-{}-{}-{}-{}-{}-{}".format(str(date.year),str(date.month),str(date.day),str(date.hour),str(date.minute),str(date...
[ "Generates", "a", "random", "file", "name", "based", "on", "self", ".", "_output_filename_pattern", "for", "the", "output", "to", "do", "file", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L74-L80
[ "def", "_gen_file_name", "(", "self", ")", ":", "date", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "dt", "=", "\"{}-{}-{}-{}-{}-{}-{}\"", ".", "format", "(", "str", "(", "date", ".", "year", ")", ",", "str", "(", "date", ".", "month", ")...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ.add
Takes a string, dictionary or list of items for adding to queue. To help troubleshoot it will output the updated buffer size, however when the content gets written it will output the file path of the new file. Generally this can be safely discarded. :param <dict,list> item: Item to add to the queue. If dict wi...
SolrClient/indexq.py
def add(self, item=None, finalize=False, callback=None): ''' Takes a string, dictionary or list of items for adding to queue. To help troubleshoot it will output the updated buffer size, however when the content gets written it will output the file path of the new file. Generally this can be safely disc...
def add(self, item=None, finalize=False, callback=None): ''' Takes a string, dictionary or list of items for adding to queue. To help troubleshoot it will output the updated buffer size, however when the content gets written it will output the file path of the new file. Generally this can be safely disc...
[ "Takes", "a", "string", "dictionary", "or", "list", "of", "items", "for", "adding", "to", "queue", ".", "To", "help", "troubleshoot", "it", "will", "output", "the", "updated", "buffer", "size", "however", "when", "the", "content", "gets", "written", "it", ...
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L83-L104
[ "def", "add", "(", "self", ",", "item", "=", "None", ",", "finalize", "=", "False", ",", "callback", "=", "None", ")", ":", "if", "item", ":", "if", "type", "(", "item", ")", "is", "list", ":", "check", "=", "list", "(", "set", "(", "[", "type"...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ._lock
Locks, or returns False if already locked
SolrClient/indexq.py
def _lock(self): ''' Locks, or returns False if already locked ''' if not self._is_locked(): with open(self._lck,'w') as fh: if self._devel: self.logger.debug("Locking") fh.write(str(os.getpid())) return True else: ...
def _lock(self): ''' Locks, or returns False if already locked ''' if not self._is_locked(): with open(self._lck,'w') as fh: if self._devel: self.logger.debug("Locking") fh.write(str(os.getpid())) return True else: ...
[ "Locks", "or", "returns", "False", "if", "already", "locked" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L167-L177
[ "def", "_lock", "(", "self", ")", ":", "if", "not", "self", ".", "_is_locked", "(", ")", ":", "with", "open", "(", "self", ".", "_lck", ",", "'w'", ")", "as", "fh", ":", "if", "self", ".", "_devel", ":", "self", ".", "logger", ".", "debug", "("...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ._is_locked
Checks to see if we are already pulling items from the queue
SolrClient/indexq.py
def _is_locked(self): ''' Checks to see if we are already pulling items from the queue ''' if os.path.isfile(self._lck): try: import psutil except ImportError: return True #Lock file exists and no psutil #If psutil is im...
def _is_locked(self): ''' Checks to see if we are already pulling items from the queue ''' if os.path.isfile(self._lck): try: import psutil except ImportError: return True #Lock file exists and no psutil #If psutil is im...
[ "Checks", "to", "see", "if", "we", "are", "already", "pulling", "items", "from", "the", "queue" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L180-L194
[ "def", "_is_locked", "(", "self", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "_lck", ")", ":", "try", ":", "import", "psutil", "except", "ImportError", ":", "return", "True", "#Lock file exists and no psutil", "#If psutil is imported",...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ._unlock
Unlocks the index
SolrClient/indexq.py
def _unlock(self): ''' Unlocks the index ''' if self._devel: self.logger.debug("Unlocking Index") if self._is_locked(): os.remove(self._lck) return True else: return True
def _unlock(self): ''' Unlocks the index ''' if self._devel: self.logger.debug("Unlocking Index") if self._is_locked(): os.remove(self._lck) return True else: return True
[ "Unlocks", "the", "index" ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L197-L206
[ "def", "_unlock", "(", "self", ")", ":", "if", "self", ".", "_devel", ":", "self", ".", "logger", ".", "debug", "(", "\"Unlocking Index\"", ")", "if", "self", ".", "_is_locked", "(", ")", ":", "os", ".", "remove", "(", "self", ".", "_lck", ")", "re...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ.get_all_as_list
Returns a list of the the full path to all items currently in the todo directory. The items will be listed in ascending order based on filesystem time. This will re-scan the directory on each execution. Do not use this to process items, this method should only be used for troubleshooting or something a...
SolrClient/indexq.py
def get_all_as_list(self, dir='_todo_dir'): ''' Returns a list of the the full path to all items currently in the todo directory. The items will be listed in ascending order based on filesystem time. This will re-scan the directory on each execution. Do not use this to process items, th...
def get_all_as_list(self, dir='_todo_dir'): ''' Returns a list of the the full path to all items currently in the todo directory. The items will be listed in ascending order based on filesystem time. This will re-scan the directory on each execution. Do not use this to process items, th...
[ "Returns", "a", "list", "of", "the", "the", "full", "path", "to", "all", "items", "currently", "in", "the", "todo", "directory", ".", "The", "items", "will", "be", "listed", "in", "ascending", "order", "based", "on", "filesystem", "time", ".", "This", "w...
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L209-L220
[ "def", "get_all_as_list", "(", "self", ",", "dir", "=", "'_todo_dir'", ")", ":", "dir", "=", "getattr", "(", "self", ",", "dir", ")", "list", "=", "[", "x", "for", "x", "in", "os", ".", "listdir", "(", "dir", ")", "if", "x", ".", "endswith", "(",...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ.get_todo_items
Returns an iterator that will provide each item in the todo queue. Note that to complete each item you have to run complete method with the output of this iterator. That will move the item to the done directory and prevent it from being retrieved in the future.
SolrClient/indexq.py
def get_todo_items(self, **kwargs): ''' Returns an iterator that will provide each item in the todo queue. Note that to complete each item you have to run complete method with the output of this iterator. That will move the item to the done directory and prevent it from being retrieved in the f...
def get_todo_items(self, **kwargs): ''' Returns an iterator that will provide each item in the todo queue. Note that to complete each item you have to run complete method with the output of this iterator. That will move the item to the done directory and prevent it from being retrieved in the f...
[ "Returns", "an", "iterator", "that", "will", "provide", "each", "item", "in", "the", "todo", "queue", ".", "Note", "that", "to", "complete", "each", "item", "you", "have", "to", "run", "complete", "method", "with", "the", "output", "of", "this", "iterator"...
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L223-L237
[ "def", "get_todo_items", "(", "self", ",", "*", "*", "kwargs", ")", ":", "def", "inner", "(", "self", ")", ":", "for", "item", "in", "self", ".", "get_all_as_list", "(", ")", ":", "yield", "item", "self", ".", "_unlock", "(", ")", "if", "not", "sel...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ.complete
Marks the item as complete by moving it to the done directory and optionally gzipping it.
SolrClient/indexq.py
def complete(self, filepath): ''' Marks the item as complete by moving it to the done directory and optionally gzipping it. ''' if not os.path.exists(filepath): raise FileNotFoundError("Can't Complete {}, it doesn't exist".format(filepath)) if self._devel: self.logger...
def complete(self, filepath): ''' Marks the item as complete by moving it to the done directory and optionally gzipping it. ''' if not os.path.exists(filepath): raise FileNotFoundError("Can't Complete {}, it doesn't exist".format(filepath)) if self._devel: self.logger...
[ "Marks", "the", "item", "as", "complete", "by", "moving", "it", "to", "the", "done", "directory", "and", "optionally", "gzipping", "it", "." ]
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L240-L279
[ "def", "complete", "(", "self", ",", "filepath", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "raise", "FileNotFoundError", "(", "\"Can't Complete {}, it doesn't exist\"", ".", "format", "(", "filepath", ")", ")", "if",...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b
train
IndexQ.index
Will index the queue into a specified solr instance and collection. Specify multiple threads to make this faster, however keep in mind that if you specify multiple threads the items may not be in order. Example:: solr = SolrClient('http://localhost:8983/solr/') for doc in self.docs: ...
SolrClient/indexq.py
def index(self, solr, collection, threads=1, send_method='stream_file', **kwargs): ''' Will index the queue into a specified solr instance and collection. Specify multiple threads to make this faster, however keep in mind that if you specify multiple threads the items may not be in order. Exampl...
def index(self, solr, collection, threads=1, send_method='stream_file', **kwargs): ''' Will index the queue into a specified solr instance and collection. Specify multiple threads to make this faster, however keep in mind that if you specify multiple threads the items may not be in order. Exampl...
[ "Will", "index", "the", "queue", "into", "a", "specified", "solr", "instance", "and", "collection", ".", "Specify", "multiple", "threads", "to", "make", "this", "faster", "however", "keep", "in", "mind", "that", "if", "you", "specify", "multiple", "threads", ...
moonlitesolutions/SolrClient
python
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/indexq.py#L295-L336
[ "def", "index", "(", "self", ",", "solr", ",", "collection", ",", "threads", "=", "1", ",", "send_method", "=", "'stream_file'", ",", "*", "*", "kwargs", ")", ":", "try", ":", "method", "=", "getattr", "(", "solr", ",", "send_method", ")", "except", ...
19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b