repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
datadesk/python-documentcloud
documentcloud/__init__.py
ProjectClient.create
def create(self, title, description=None, document_ids=None): """ Creates a new project. Returns its unique identifer in documentcloud Example usage: >> documentcloud.projects.create("The Ruben Salazar Files") """ params = { 'title': title, ...
python
def create(self, title, description=None, document_ids=None): """ Creates a new project. Returns its unique identifer in documentcloud Example usage: >> documentcloud.projects.create("The Ruben Salazar Files") """ params = { 'title': title, ...
[ "def", "create", "(", "self", ",", "title", ",", "description", "=", "None", ",", "document_ids", "=", "None", ")", ":", "params", "=", "{", "'title'", ":", "title", ",", "}", "if", "description", ":", "params", "[", "'description'", "]", "=", "descrip...
Creates a new project. Returns its unique identifer in documentcloud Example usage: >> documentcloud.projects.create("The Ruben Salazar Files")
[ "Creates", "a", "new", "project", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L497-L532
train
datadesk/python-documentcloud
documentcloud/__init__.py
ProjectClient.get_or_create_by_title
def get_or_create_by_title(self, title): """ Fetch a title, if it exists. Create it if it doesn't. Returns a tuple with the object first, and then a boolean that indicates whether or not the object was created fresh. True means it's brand new. """ try: ...
python
def get_or_create_by_title(self, title): """ Fetch a title, if it exists. Create it if it doesn't. Returns a tuple with the object first, and then a boolean that indicates whether or not the object was created fresh. True means it's brand new. """ try: ...
[ "def", "get_or_create_by_title", "(", "self", ",", "title", ")", ":", "try", ":", "obj", "=", "self", ".", "get_by_title", "(", "title", ")", "created", "=", "False", "except", "DoesNotExistError", ":", "obj", "=", "self", ".", "create", "(", "title", "=...
Fetch a title, if it exists. Create it if it doesn't. Returns a tuple with the object first, and then a boolean that indicates whether or not the object was created fresh. True means it's brand new.
[ "Fetch", "a", "title", "if", "it", "exists", ".", "Create", "it", "if", "it", "doesn", "t", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L535-L549
train
datadesk/python-documentcloud
documentcloud/__init__.py
Annotation.get_location
def get_location(self): """ Return the location as a good """ image_string = self.__dict__['location']['image'] image_ints = list(map(int, image_string.split(","))) return Location(*image_ints)
python
def get_location(self): """ Return the location as a good """ image_string = self.__dict__['location']['image'] image_ints = list(map(int, image_string.split(","))) return Location(*image_ints)
[ "def", "get_location", "(", "self", ")", ":", "image_string", "=", "self", ".", "__dict__", "[", "'location'", "]", "[", "'image'", "]", "image_ints", "=", "list", "(", "map", "(", "int", ",", "image_string", ".", "split", "(", "\",\"", ")", ")", ")", ...
Return the location as a good
[ "Return", "the", "location", "as", "a", "good" ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L594-L600
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.put
def put(self): """ Save changes made to the object to DocumentCloud. According to DocumentCloud's docs, edits are allowed for the following fields: * title * source * description * related_article * access * publis...
python
def put(self): """ Save changes made to the object to DocumentCloud. According to DocumentCloud's docs, edits are allowed for the following fields: * title * source * description * related_article * access * publis...
[ "def", "put", "(", "self", ")", ":", "params", "=", "dict", "(", "title", "=", "self", ".", "title", "or", "''", ",", "source", "=", "self", ".", "source", "or", "''", ",", "description", "=", "self", ".", "description", "or", "''", ",", "related_a...
Save changes made to the object to DocumentCloud. According to DocumentCloud's docs, edits are allowed for the following fields: * title * source * description * related_article * access * published_url * data key/valu...
[ "Save", "changes", "made", "to", "the", "object", "to", "DocumentCloud", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L652-L678
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document._lazy_load
def _lazy_load(self): """ Fetch metadata if it was overlooked during the object's creation. This can happen when you retrieve documents via search, because the JSON response does not include complete meta data for all results. """ obj = self._connection.documents...
python
def _lazy_load(self): """ Fetch metadata if it was overlooked during the object's creation. This can happen when you retrieve documents via search, because the JSON response does not include complete meta data for all results. """ obj = self._connection.documents...
[ "def", "_lazy_load", "(", "self", ")", ":", "obj", "=", "self", ".", "_connection", ".", "documents", ".", "get", "(", "id", "=", "self", ".", "id", ")", "self", ".", "__dict__", "[", "'contributor'", "]", "=", "obj", ".", "contributor", "self", ".",...
Fetch metadata if it was overlooked during the object's creation. This can happen when you retrieve documents via search, because the JSON response does not include complete meta data for all results.
[ "Fetch", "metadata", "if", "it", "was", "overlooked", "during", "the", "object", "s", "creation", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L696-L710
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.set_data
def set_data(self, data): """ Update the data attribute, making sure it's a dictionary. """ # Make sure a dict got passed it if not isinstance(data, type({})): raise TypeError("This attribute must be a dictionary.") # Set the attribute self.__dict__['d...
python
def set_data(self, data): """ Update the data attribute, making sure it's a dictionary. """ # Make sure a dict got passed it if not isinstance(data, type({})): raise TypeError("This attribute must be a dictionary.") # Set the attribute self.__dict__['d...
[ "def", "set_data", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "type", "(", "{", "}", ")", ")", ":", "raise", "TypeError", "(", "\"This attribute must be a dictionary.\"", ")", "self", ".", "__dict__", "[", "'data'", ...
Update the data attribute, making sure it's a dictionary.
[ "Update", "the", "data", "attribute", "making", "sure", "it", "s", "a", "dictionary", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L734-L742
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_data
def get_data(self): """ Fetch the data field if it does not exist. """ try: return DocumentDataDict(self.__dict__['data']) except KeyError: self._lazy_load() return DocumentDataDict(self.__dict__['data'])
python
def get_data(self): """ Fetch the data field if it does not exist. """ try: return DocumentDataDict(self.__dict__['data']) except KeyError: self._lazy_load() return DocumentDataDict(self.__dict__['data'])
[ "def", "get_data", "(", "self", ")", ":", "try", ":", "return", "DocumentDataDict", "(", "self", ".", "__dict__", "[", "'data'", "]", ")", "except", "KeyError", ":", "self", ".", "_lazy_load", "(", ")", "return", "DocumentDataDict", "(", "self", ".", "__...
Fetch the data field if it does not exist.
[ "Fetch", "the", "data", "field", "if", "it", "does", "not", "exist", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L744-L752
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_annotations
def get_annotations(self): """ Fetch the annotations field if it does not exist. """ try: obj_list = self.__dict__['annotations'] return [Annotation(i) for i in obj_list] except KeyError: self._lazy_load() obj_list = self.__dict__['...
python
def get_annotations(self): """ Fetch the annotations field if it does not exist. """ try: obj_list = self.__dict__['annotations'] return [Annotation(i) for i in obj_list] except KeyError: self._lazy_load() obj_list = self.__dict__['...
[ "def", "get_annotations", "(", "self", ")", ":", "try", ":", "obj_list", "=", "self", ".", "__dict__", "[", "'annotations'", "]", "return", "[", "Annotation", "(", "i", ")", "for", "i", "in", "obj_list", "]", "except", "KeyError", ":", "self", ".", "_l...
Fetch the annotations field if it does not exist.
[ "Fetch", "the", "annotations", "field", "if", "it", "does", "not", "exist", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L755-L765
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_sections
def get_sections(self): """ Fetch the sections field if it does not exist. """ try: obj_list = self.__dict__['sections'] return [Section(i) for i in obj_list] except KeyError: self._lazy_load() obj_list = self.__dict__['sections'] ...
python
def get_sections(self): """ Fetch the sections field if it does not exist. """ try: obj_list = self.__dict__['sections'] return [Section(i) for i in obj_list] except KeyError: self._lazy_load() obj_list = self.__dict__['sections'] ...
[ "def", "get_sections", "(", "self", ")", ":", "try", ":", "obj_list", "=", "self", ".", "__dict__", "[", "'sections'", "]", "return", "[", "Section", "(", "i", ")", "for", "i", "in", "obj_list", "]", "except", "KeyError", ":", "self", ".", "_lazy_load"...
Fetch the sections field if it does not exist.
[ "Fetch", "the", "sections", "field", "if", "it", "does", "not", "exist", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L768-L778
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_entities
def get_entities(self): """ Fetch the entities extracted from this document by OpenCalais. """ try: return self.__dict__['entities'] except KeyError: entities = self._connection.fetch( "documents/%s/entities.json" % self.id ).ge...
python
def get_entities(self): """ Fetch the entities extracted from this document by OpenCalais. """ try: return self.__dict__['entities'] except KeyError: entities = self._connection.fetch( "documents/%s/entities.json" % self.id ).ge...
[ "def", "get_entities", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "'entities'", "]", "except", "KeyError", ":", "entities", "=", "self", ".", "_connection", ".", "fetch", "(", "\"documents/%s/entities.json\"", "%", "self", "."...
Fetch the entities extracted from this document by OpenCalais.
[ "Fetch", "the", "entities", "extracted", "from", "this", "document", "by", "OpenCalais", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L781-L798
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_page_text_url
def get_page_text_url(self, page): """ Returns the URL for the full text of a particular page in the document. """ template = self.resources.page.get('text') url = template.replace("{page}", str(page)) return url
python
def get_page_text_url(self, page): """ Returns the URL for the full text of a particular page in the document. """ template = self.resources.page.get('text') url = template.replace("{page}", str(page)) return url
[ "def", "get_page_text_url", "(", "self", ",", "page", ")", ":", "template", "=", "self", ".", "resources", ".", "page", ".", "get", "(", "'text'", ")", "url", "=", "template", ".", "replace", "(", "\"{page}\"", ",", "str", "(", "page", ")", ")", "ret...
Returns the URL for the full text of a particular page in the document.
[ "Returns", "the", "URL", "for", "the", "full", "text", "of", "a", "particular", "page", "in", "the", "document", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L832-L838
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_page_text
def get_page_text(self, page): """ Downloads and returns the full text of a particular page in the document. """ url = self.get_page_text_url(page) return self._get_url(url)
python
def get_page_text(self, page): """ Downloads and returns the full text of a particular page in the document. """ url = self.get_page_text_url(page) return self._get_url(url)
[ "def", "get_page_text", "(", "self", ",", "page", ")", ":", "url", "=", "self", ".", "get_page_text_url", "(", "page", ")", "return", "self", ".", "_get_url", "(", "url", ")" ]
Downloads and returns the full text of a particular page in the document.
[ "Downloads", "and", "returns", "the", "full", "text", "of", "a", "particular", "page", "in", "the", "document", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L840-L846
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_small_image_url
def get_small_image_url(self, page=1): """ Returns the URL for the small sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace( "{page}", ...
python
def get_small_image_url(self, page=1): """ Returns the URL for the small sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace( "{page}", ...
[ "def", "get_small_image_url", "(", "self", ",", "page", "=", "1", ")", ":", "template", "=", "self", ".", "resources", ".", "page", ".", "get", "(", "'image'", ")", "return", "template", ".", "replace", "(", "\"{page}\"", ",", "str", "(", "page", ")", ...
Returns the URL for the small sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Returns", "the", "URL", "for", "the", "small", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L866-L876
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_thumbnail_image_url
def get_thumbnail_image_url(self, page=1): """ Returns the URL for the thumbnail sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace( "{page}"...
python
def get_thumbnail_image_url(self, page=1): """ Returns the URL for the thumbnail sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace( "{page}"...
[ "def", "get_thumbnail_image_url", "(", "self", ",", "page", "=", "1", ")", ":", "template", "=", "self", ".", "resources", ".", "page", ".", "get", "(", "'image'", ")", "return", "template", ".", "replace", "(", "\"{page}\"", ",", "str", "(", "page", "...
Returns the URL for the thumbnail sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Returns", "the", "URL", "for", "the", "thumbnail", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L879-L889
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_normal_image_url
def get_normal_image_url(self, page=1): """ Returns the URL for the "normal" sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace( "{page}", ...
python
def get_normal_image_url(self, page=1): """ Returns the URL for the "normal" sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace( "{page}", ...
[ "def", "get_normal_image_url", "(", "self", ",", "page", "=", "1", ")", ":", "template", "=", "self", ".", "resources", ".", "page", ".", "get", "(", "'image'", ")", "return", "template", ".", "replace", "(", "\"{page}\"", ",", "str", "(", "page", ")",...
Returns the URL for the "normal" sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Returns", "the", "URL", "for", "the", "normal", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L892-L902
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_large_image_url
def get_large_image_url(self, page=1): """ Returns the URL for the large sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace("{page}", str(page)).replace(...
python
def get_large_image_url(self, page=1): """ Returns the URL for the large sized image of a single page. The page kwarg specifies which page to return. One is the default. """ template = self.resources.page.get('image') return template.replace("{page}", str(page)).replace(...
[ "def", "get_large_image_url", "(", "self", ",", "page", "=", "1", ")", ":", "template", "=", "self", ".", "resources", ".", "page", ".", "get", "(", "'image'", ")", "return", "template", ".", "replace", "(", "\"{page}\"", ",", "str", "(", "page", ")", ...
Returns the URL for the large sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Returns", "the", "URL", "for", "the", "large", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L905-L912
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_small_image
def get_small_image(self, page=1): """ Downloads and returns the small sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_small_image_url(page=page) return self._get_url(url)
python
def get_small_image(self, page=1): """ Downloads and returns the small sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_small_image_url(page=page) return self._get_url(url)
[ "def", "get_small_image", "(", "self", ",", "page", "=", "1", ")", ":", "url", "=", "self", ".", "get_small_image_url", "(", "page", "=", "page", ")", "return", "self", ".", "_get_url", "(", "url", ")" ]
Downloads and returns the small sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Downloads", "and", "returns", "the", "small", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L945-L952
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_thumbnail_image
def get_thumbnail_image(self, page=1): """ Downloads and returns the thumbnail sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_thumbnail_image_url(page=page) return self._get_url(url)
python
def get_thumbnail_image(self, page=1): """ Downloads and returns the thumbnail sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_thumbnail_image_url(page=page) return self._get_url(url)
[ "def", "get_thumbnail_image", "(", "self", ",", "page", "=", "1", ")", ":", "url", "=", "self", ".", "get_thumbnail_image_url", "(", "page", "=", "page", ")", "return", "self", ".", "_get_url", "(", "url", ")" ]
Downloads and returns the thumbnail sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Downloads", "and", "returns", "the", "thumbnail", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L955-L962
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_normal_image
def get_normal_image(self, page=1): """ Downloads and returns the normal sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_normal_image_url(page=page) return self._get_url(url)
python
def get_normal_image(self, page=1): """ Downloads and returns the normal sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_normal_image_url(page=page) return self._get_url(url)
[ "def", "get_normal_image", "(", "self", ",", "page", "=", "1", ")", ":", "url", "=", "self", ".", "get_normal_image_url", "(", "page", "=", "page", ")", "return", "self", ".", "_get_url", "(", "url", ")" ]
Downloads and returns the normal sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Downloads", "and", "returns", "the", "normal", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L965-L972
train
datadesk/python-documentcloud
documentcloud/__init__.py
Document.get_large_image
def get_large_image(self, page=1): """ Downloads and returns the large sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_large_image_url(page=page) return self._get_url(url)
python
def get_large_image(self, page=1): """ Downloads and returns the large sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_large_image_url(page=page) return self._get_url(url)
[ "def", "get_large_image", "(", "self", ",", "page", "=", "1", ")", ":", "url", "=", "self", ".", "get_large_image_url", "(", "page", "=", "page", ")", "return", "self", ".", "_get_url", "(", "url", ")" ]
Downloads and returns the large sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Downloads", "and", "returns", "the", "large", "sized", "image", "of", "a", "single", "page", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L975-L982
train
datadesk/python-documentcloud
documentcloud/__init__.py
Project.put
def put(self): """ Save changes made to the object to documentcloud.org According to DocumentCloud's docs, edits are allowed for the following fields: * title * description * document_ids Returns nothing. """ params = dict( ...
python
def put(self): """ Save changes made to the object to documentcloud.org According to DocumentCloud's docs, edits are allowed for the following fields: * title * description * document_ids Returns nothing. """ params = dict( ...
[ "def", "put", "(", "self", ")", ":", "params", "=", "dict", "(", "title", "=", "self", ".", "title", "or", "''", ",", "description", "=", "self", ".", "description", "or", "''", ",", "document_ids", "=", "[", "str", "(", "i", ".", "id", ")", "for...
Save changes made to the object to documentcloud.org According to DocumentCloud's docs, edits are allowed for the following fields: * title * description * document_ids Returns nothing.
[ "Save", "changes", "made", "to", "the", "object", "to", "documentcloud", ".", "org" ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L1104-L1122
train
datadesk/python-documentcloud
documentcloud/__init__.py
Project.get_document_list
def get_document_list(self): """ Retrieves all documents included in this project. """ try: return self.__dict__['document_list'] except KeyError: obj_list = DocumentSet([ self._connection.documents.get(i) for i in self.document_ids ...
python
def get_document_list(self): """ Retrieves all documents included in this project. """ try: return self.__dict__['document_list'] except KeyError: obj_list = DocumentSet([ self._connection.documents.get(i) for i in self.document_ids ...
[ "def", "get_document_list", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "'document_list'", "]", "except", "KeyError", ":", "obj_list", "=", "DocumentSet", "(", "[", "self", ".", "_connection", ".", "documents", ".", "get", "(...
Retrieves all documents included in this project.
[ "Retrieves", "all", "documents", "included", "in", "this", "project", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L1140-L1151
train
datadesk/python-documentcloud
documentcloud/__init__.py
Project.get_document
def get_document(self, id): """ Retrieves a particular document from this project. """ obj_list = self.document_list matches = [i for i in obj_list if str(i.id) == str(id)] if not matches: raise DoesNotExistError("The resource you've requested does not \ exist...
python
def get_document(self, id): """ Retrieves a particular document from this project. """ obj_list = self.document_list matches = [i for i in obj_list if str(i.id) == str(id)] if not matches: raise DoesNotExistError("The resource you've requested does not \ exist...
[ "def", "get_document", "(", "self", ",", "id", ")", ":", "obj_list", "=", "self", ".", "document_list", "matches", "=", "[", "i", "for", "i", "in", "obj_list", "if", "str", "(", "i", ".", "id", ")", "==", "str", "(", "id", ")", "]", "if", "not", ...
Retrieves a particular document from this project.
[ "Retrieves", "a", "particular", "document", "from", "this", "project", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L1154-L1163
train
mrstephenneal/pdfconduit
pdf/conduit/watermark/watermark.py
Watermark.draw
def draw(self, text1=None, text2=None, copyright=True, image=IMAGE_DEFAULT, rotate=30, opacity=0.08, compress=0, flatten=False, add=False): """ Draw watermark PDF file. Create watermark using either a reportlabs canvas or a PIL image. :param text1: str Text lin...
python
def draw(self, text1=None, text2=None, copyright=True, image=IMAGE_DEFAULT, rotate=30, opacity=0.08, compress=0, flatten=False, add=False): """ Draw watermark PDF file. Create watermark using either a reportlabs canvas or a PIL image. :param text1: str Text lin...
[ "def", "draw", "(", "self", ",", "text1", "=", "None", ",", "text2", "=", "None", ",", "copyright", "=", "True", ",", "image", "=", "IMAGE_DEFAULT", ",", "rotate", "=", "30", ",", "opacity", "=", "0.08", ",", "compress", "=", "0", ",", "flatten", "...
Draw watermark PDF file. Create watermark using either a reportlabs canvas or a PIL image. :param text1: str Text line 1 :param text2: str Text line 2 :param copyright: bool Draw copyright and year to canvas :param image: str Logo...
[ "Draw", "watermark", "PDF", "file", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/conduit/watermark/watermark.py#L81-L133
train
mrstephenneal/pdfconduit
pdf/conduit/watermark/watermark.py
Watermark.add
def add(self, document=None, watermark=None, underneath=False, output=None, suffix='watermarked', method='pdfrw'): """ Add a watermark file to an existing PDF document. Rotate and upscale watermark file as needed to fit existing PDF document. Watermark can be overlayed or placed undern...
python
def add(self, document=None, watermark=None, underneath=False, output=None, suffix='watermarked', method='pdfrw'): """ Add a watermark file to an existing PDF document. Rotate and upscale watermark file as needed to fit existing PDF document. Watermark can be overlayed or placed undern...
[ "def", "add", "(", "self", ",", "document", "=", "None", ",", "watermark", "=", "None", ",", "underneath", "=", "False", ",", "output", "=", "None", ",", "suffix", "=", "'watermarked'", ",", "method", "=", "'pdfrw'", ")", ":", "if", "self", ".", "use...
Add a watermark file to an existing PDF document. Rotate and upscale watermark file as needed to fit existing PDF document. Watermark can be overlayed or placed underneath. :param document: str PDF document full path :param watermark: str Watermark PDF full pat...
[ "Add", "a", "watermark", "file", "to", "an", "existing", "PDF", "document", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/conduit/watermark/watermark.py#L135-L169
train
mrstephenneal/pdfconduit
pdf/conduit/watermark/watermark.py
Watermark.encrypt
def encrypt(self, user_pw='', owner_pw=None, encrypt_128=True, allow_printing=True, allow_commenting=False, document=None): """ Encrypt a PDF document to add passwords and restrict permissions. Add a user password that must be entered to view document and a owner password that m...
python
def encrypt(self, user_pw='', owner_pw=None, encrypt_128=True, allow_printing=True, allow_commenting=False, document=None): """ Encrypt a PDF document to add passwords and restrict permissions. Add a user password that must be entered to view document and a owner password that m...
[ "def", "encrypt", "(", "self", ",", "user_pw", "=", "''", ",", "owner_pw", "=", "None", ",", "encrypt_128", "=", "True", ",", "allow_printing", "=", "True", ",", "allow_commenting", "=", "False", ",", "document", "=", "None", ")", ":", "document", "=", ...
Encrypt a PDF document to add passwords and restrict permissions. Add a user password that must be entered to view document and a owner password that must be entered to alter permissions and security settings. Encryption keys are 128 bit when encrypt_128 is True and 40 bit when False. By defa...
[ "Encrypt", "a", "PDF", "document", "to", "add", "passwords", "and", "restrict", "permissions", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/conduit/watermark/watermark.py#L171-L209
train
datadesk/python-documentcloud
documentcloud/toolbox.py
credentials_required
def credentials_required(method_func): """ Decorator for methods that checks that the client has credentials. Throws a CredentialsMissingError when they are absent. """ def _checkcredentials(self, *args, **kwargs): if self.username and self.password: return method_func(self, *ar...
python
def credentials_required(method_func): """ Decorator for methods that checks that the client has credentials. Throws a CredentialsMissingError when they are absent. """ def _checkcredentials(self, *args, **kwargs): if self.username and self.password: return method_func(self, *ar...
[ "def", "credentials_required", "(", "method_func", ")", ":", "def", "_checkcredentials", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "username", "and", "self", ".", "password", ":", "return", "method_func", "(", "self",...
Decorator for methods that checks that the client has credentials. Throws a CredentialsMissingError when they are absent.
[ "Decorator", "for", "methods", "that", "checks", "that", "the", "client", "has", "credentials", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/toolbox.py#L45-L59
train
datadesk/python-documentcloud
documentcloud/toolbox.py
retry
def retry(ExceptionToCheck, tries=3, delay=2, backoff=2): """ Retry decorator published by Saltry Crane. http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ """ def deco_retry(f): def f_retry(*args, **kwargs): mtries, mdelay = tries, delay try_o...
python
def retry(ExceptionToCheck, tries=3, delay=2, backoff=2): """ Retry decorator published by Saltry Crane. http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ """ def deco_retry(f): def f_retry(*args, **kwargs): mtries, mdelay = tries, delay try_o...
[ "def", "retry", "(", "ExceptionToCheck", ",", "tries", "=", "3", ",", "delay", "=", "2", ",", "backoff", "=", "2", ")", ":", "def", "deco_retry", "(", "f", ")", ":", "def", "f_retry", "(", "*", "args", ",", "**", "kwargs", ")", ":", "mtries", ","...
Retry decorator published by Saltry Crane. http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
[ "Retry", "decorator", "published", "by", "Saltry", "Crane", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/toolbox.py#L62-L86
train
mrstephenneal/pdfconduit
pdf/modify/draw/pdf.py
text_width
def text_width(string, font_name, font_size): """Determine with width in pixels of string.""" return stringWidth(string, fontName=font_name, fontSize=font_size)
python
def text_width(string, font_name, font_size): """Determine with width in pixels of string.""" return stringWidth(string, fontName=font_name, fontSize=font_size)
[ "def", "text_width", "(", "string", ",", "font_name", ",", "font_size", ")", ":", "return", "stringWidth", "(", "string", ",", "fontName", "=", "font_name", ",", "fontSize", "=", "font_size", ")" ]
Determine with width in pixels of string.
[ "Determine", "with", "width", "in", "pixels", "of", "string", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/modify/draw/pdf.py#L15-L17
train
mrstephenneal/pdfconduit
pdf/modify/draw/pdf.py
center_str
def center_str(txt, font_name, font_size, offset=0): """Center a string on the x axis of a reportslab canvas""" return -(text_width(txt, font_name, font_size) / 2.0) + offset
python
def center_str(txt, font_name, font_size, offset=0): """Center a string on the x axis of a reportslab canvas""" return -(text_width(txt, font_name, font_size) / 2.0) + offset
[ "def", "center_str", "(", "txt", ",", "font_name", ",", "font_size", ",", "offset", "=", "0", ")", ":", "return", "-", "(", "text_width", "(", "txt", ",", "font_name", ",", "font_size", ")", "/", "2.0", ")", "+", "offset" ]
Center a string on the x axis of a reportslab canvas
[ "Center", "a", "string", "on", "the", "x", "axis", "of", "a", "reportslab", "canvas" ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/modify/draw/pdf.py#L20-L22
train
mrstephenneal/pdfconduit
pdf/modify/draw/pdf.py
split_str
def split_str(string): """Split string in half to return two strings""" split = string.split(' ') return ' '.join(split[:len(split) // 2]), ' '.join(split[len(split) // 2:])
python
def split_str(string): """Split string in half to return two strings""" split = string.split(' ') return ' '.join(split[:len(split) // 2]), ' '.join(split[len(split) // 2:])
[ "def", "split_str", "(", "string", ")", ":", "split", "=", "string", ".", "split", "(", "' '", ")", "return", "' '", ".", "join", "(", "split", "[", ":", "len", "(", "split", ")", "//", "2", "]", ")", ",", "' '", ".", "join", "(", "split", "[",...
Split string in half to return two strings
[ "Split", "string", "in", "half", "to", "return", "two", "strings" ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/modify/draw/pdf.py#L25-L28
train
mrstephenneal/pdfconduit
pdf/modify/draw/pdf.py
WatermarkDraw._draw_image
def _draw_image(self, ci): """ Draw image object to reportlabs canvas. :param ci: CanvasImage object """ img = img_adjust(ci.image, ci.opacity, tempdir=self.dir) self.can.drawImage(img, x=ci.x, y=ci.y, width=ci.w, height=ci.h, mask=ci.mask, pre...
python
def _draw_image(self, ci): """ Draw image object to reportlabs canvas. :param ci: CanvasImage object """ img = img_adjust(ci.image, ci.opacity, tempdir=self.dir) self.can.drawImage(img, x=ci.x, y=ci.y, width=ci.w, height=ci.h, mask=ci.mask, pre...
[ "def", "_draw_image", "(", "self", ",", "ci", ")", ":", "img", "=", "img_adjust", "(", "ci", ".", "image", ",", "ci", ".", "opacity", ",", "tempdir", "=", "self", ".", "dir", ")", "self", ".", "can", ".", "drawImage", "(", "img", ",", "x", "=", ...
Draw image object to reportlabs canvas. :param ci: CanvasImage object
[ "Draw", "image", "object", "to", "reportlabs", "canvas", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/modify/draw/pdf.py#L105-L113
train
mrstephenneal/pdfconduit
pdf/modify/draw/pdf.py
WatermarkDraw._draw_string
def _draw_string(self, cs): """ Draw string object to reportlabs canvas. Canvas Parameter changes (applied if set values differ from string object values) 1. Font name 2. Font size 3. Font fill color & opacity 4. X and Y position :param cs: CanvasString ...
python
def _draw_string(self, cs): """ Draw string object to reportlabs canvas. Canvas Parameter changes (applied if set values differ from string object values) 1. Font name 2. Font size 3. Font fill color & opacity 4. X and Y position :param cs: CanvasString ...
[ "def", "_draw_string", "(", "self", ",", "cs", ")", ":", "if", "self", ".", "can", ".", "_fontname", "!=", "cs", ".", "font", ":", "self", ".", "can", ".", "setFont", "(", "cs", ".", "font", ",", "cs", ".", "size", ")", "elif", "self", ".", "ca...
Draw string object to reportlabs canvas. Canvas Parameter changes (applied if set values differ from string object values) 1. Font name 2. Font size 3. Font fill color & opacity 4. X and Y position :param cs: CanvasString object
[ "Draw", "string", "object", "to", "reportlabs", "canvas", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/modify/draw/pdf.py#L115-L164
train
mrstephenneal/pdfconduit
pdf/transform/merge.py
Merge._get_pdf_list
def _get_pdf_list(self, input_pdfs): """ Generate list of PDF documents. :param input_pdfs: List of PDFs or a directory path Directory - Scans directory contents List - Filters list to assert all list items are paths to PDF documents :return: List of PDF paths ...
python
def _get_pdf_list(self, input_pdfs): """ Generate list of PDF documents. :param input_pdfs: List of PDFs or a directory path Directory - Scans directory contents List - Filters list to assert all list items are paths to PDF documents :return: List of PDF paths ...
[ "def", "_get_pdf_list", "(", "self", ",", "input_pdfs", ")", ":", "if", "isinstance", "(", "input_pdfs", ",", "list", ")", ":", "return", "[", "pdf", "for", "pdf", "in", "input_pdfs", "if", "self", ".", "validate", "(", "pdf", ")", "]", "elif", "os", ...
Generate list of PDF documents. :param input_pdfs: List of PDFs or a directory path Directory - Scans directory contents List - Filters list to assert all list items are paths to PDF documents :return: List of PDF paths
[ "Generate", "list", "of", "PDF", "documents", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/transform/merge.py#L24-L36
train
mrstephenneal/pdfconduit
pdf/transform/merge.py
Merge.merge
def merge(self, pdf_files, output): """Merge list of PDF files to a single PDF file.""" if self.method is 'pypdf3': return self.pypdf3(pdf_files, output) else: return self.pdfrw(pdf_files, output)
python
def merge(self, pdf_files, output): """Merge list of PDF files to a single PDF file.""" if self.method is 'pypdf3': return self.pypdf3(pdf_files, output) else: return self.pdfrw(pdf_files, output)
[ "def", "merge", "(", "self", ",", "pdf_files", ",", "output", ")", ":", "if", "self", ".", "method", "is", "'pypdf3'", ":", "return", "self", ".", "pypdf3", "(", "pdf_files", ",", "output", ")", "else", ":", "return", "self", ".", "pdfrw", "(", "pdf_...
Merge list of PDF files to a single PDF file.
[ "Merge", "list", "of", "PDF", "files", "to", "a", "single", "PDF", "file", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/transform/merge.py#L38-L43
train
mrstephenneal/pdfconduit
pdf/utils/path.py
set_destination
def set_destination(source, suffix, filename=False, ext=None): """Create new pdf filename for temp files""" source_dirname = os.path.dirname(source) # Do not create nested temp folders (/temp/temp) if not source_dirname.endswith('temp'): directory = os.path.join(source_dirname, 'temp') # direc...
python
def set_destination(source, suffix, filename=False, ext=None): """Create new pdf filename for temp files""" source_dirname = os.path.dirname(source) # Do not create nested temp folders (/temp/temp) if not source_dirname.endswith('temp'): directory = os.path.join(source_dirname, 'temp') # direc...
[ "def", "set_destination", "(", "source", ",", "suffix", ",", "filename", "=", "False", ",", "ext", "=", "None", ")", ":", "source_dirname", "=", "os", ".", "path", ".", "dirname", "(", "source", ")", "if", "not", "source_dirname", ".", "endswith", "(", ...
Create new pdf filename for temp files
[ "Create", "new", "pdf", "filename", "for", "temp", "files" ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/utils/path.py#L25-L64
train
datadesk/python-documentcloud
documentcloud/MultipartPostHandler.py
getsize
def getsize(o_file): """ get the size, either by seeeking to the end. """ startpos = o_file.tell() o_file.seek(0) o_file.seek(0, SEEK_END) size = o_file.tell() o_file.seek(startpos) return size
python
def getsize(o_file): """ get the size, either by seeeking to the end. """ startpos = o_file.tell() o_file.seek(0) o_file.seek(0, SEEK_END) size = o_file.tell() o_file.seek(startpos) return size
[ "def", "getsize", "(", "o_file", ")", ":", "startpos", "=", "o_file", ".", "tell", "(", ")", "o_file", ".", "seek", "(", "0", ")", "o_file", ".", "seek", "(", "0", ",", "SEEK_END", ")", "size", "=", "o_file", ".", "tell", "(", ")", "o_file", ".",...
get the size, either by seeeking to the end.
[ "get", "the", "size", "either", "by", "seeeking", "to", "the", "end", "." ]
0d7f42cbf1edf5c61fca37ed846362cba4abfd76
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/MultipartPostHandler.py#L201-L210
train
mrstephenneal/pdfconduit
pdf/gui/forms/watermark.py
WatermarkGUI.window
def window(self): """GUI window for Watermark parameters input.""" platform = system() # Tabbed layout for Windows if platform is 'Windows': layout_tab_1 = [] layout_tab_1.extend(header('PDF Watermark Utility')) layout_tab_1.extend(self.input_source())...
python
def window(self): """GUI window for Watermark parameters input.""" platform = system() # Tabbed layout for Windows if platform is 'Windows': layout_tab_1 = [] layout_tab_1.extend(header('PDF Watermark Utility')) layout_tab_1.extend(self.input_source())...
[ "def", "window", "(", "self", ")", ":", "platform", "=", "system", "(", ")", "if", "platform", "is", "'Windows'", ":", "layout_tab_1", "=", "[", "]", "layout_tab_1", ".", "extend", "(", "header", "(", "'PDF Watermark Utility'", ")", ")", "layout_tab_1", "....
GUI window for Watermark parameters input.
[ "GUI", "window", "for", "Watermark", "parameters", "input", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/gui/forms/watermark.py#L143-L177
train
mrstephenneal/pdfconduit
pdf/convert/pdf2img.py
pdf2img
def pdf2img(file_name, output=None, tempdir=None, ext='png', progress_bar=None): """Wrapper function for PDF2IMG class""" return PDF2IMG(file_name=file_name, output=output, tempdir=tempdir, ext=ext, progress_bar=progress_bar).save()
python
def pdf2img(file_name, output=None, tempdir=None, ext='png', progress_bar=None): """Wrapper function for PDF2IMG class""" return PDF2IMG(file_name=file_name, output=output, tempdir=tempdir, ext=ext, progress_bar=progress_bar).save()
[ "def", "pdf2img", "(", "file_name", ",", "output", "=", "None", ",", "tempdir", "=", "None", ",", "ext", "=", "'png'", ",", "progress_bar", "=", "None", ")", ":", "return", "PDF2IMG", "(", "file_name", "=", "file_name", ",", "output", "=", "output", ",...
Wrapper function for PDF2IMG class
[ "Wrapper", "function", "for", "PDF2IMG", "class" ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/convert/pdf2img.py#L123-L125
train
mrstephenneal/pdfconduit
pdf/convert/pdf2img.py
PDF2IMG._get_page_data
def _get_page_data(self, pno, zoom=0): """ Return a PNG image for a document page number. If zoom is other than 0, one of the 4 page quadrants are zoomed-in instead and the corresponding clip returned. """ dlist = self.dlist_tab[pno] # get display list if not dlist: # c...
python
def _get_page_data(self, pno, zoom=0): """ Return a PNG image for a document page number. If zoom is other than 0, one of the 4 page quadrants are zoomed-in instead and the corresponding clip returned. """ dlist = self.dlist_tab[pno] # get display list if not dlist: # c...
[ "def", "_get_page_data", "(", "self", ",", "pno", ",", "zoom", "=", "0", ")", ":", "dlist", "=", "self", ".", "dlist_tab", "[", "pno", "]", "if", "not", "dlist", ":", "self", ".", "dlist_tab", "[", "pno", "]", "=", "self", ".", "doc", "[", "pno",...
Return a PNG image for a document page number. If zoom is other than 0, one of the 4 page quadrants are zoomed-in instead and the corresponding clip returned.
[ "Return", "a", "PNG", "image", "for", "a", "document", "page", "number", ".", "If", "zoom", "is", "other", "than", "0", "one", "of", "the", "4", "page", "quadrants", "are", "zoomed", "-", "in", "instead", "and", "the", "corresponding", "clip", "returned"...
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/convert/pdf2img.py#L51-L79
train
mrstephenneal/pdfconduit
pdf/conduit/extract.py
text_extract
def text_extract(path, password=None): """Extract text from a PDF file""" pdf = Info(path, password).pdf return [pdf.getPage(i).extractText() for i in range(pdf.getNumPages())]
python
def text_extract(path, password=None): """Extract text from a PDF file""" pdf = Info(path, password).pdf return [pdf.getPage(i).extractText() for i in range(pdf.getNumPages())]
[ "def", "text_extract", "(", "path", ",", "password", "=", "None", ")", ":", "pdf", "=", "Info", "(", "path", ",", "password", ")", ".", "pdf", "return", "[", "pdf", ".", "getPage", "(", "i", ")", ".", "extractText", "(", ")", "for", "i", "in", "r...
Extract text from a PDF file
[ "Extract", "text", "from", "a", "PDF", "file" ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/conduit/extract.py#L44-L48
train
mrstephenneal/pdfconduit
pdf/utils/view.py
open_window
def open_window(path): """Open path in finder or explorer window""" if 'pathlib' in modules: try: call(["open", "-R", str(Path(str(path)))]) except FileNotFoundError: Popen(r'explorer /select,' + str(Path(str(path)))) else: print('pathlib module must be instal...
python
def open_window(path): """Open path in finder or explorer window""" if 'pathlib' in modules: try: call(["open", "-R", str(Path(str(path)))]) except FileNotFoundError: Popen(r'explorer /select,' + str(Path(str(path)))) else: print('pathlib module must be instal...
[ "def", "open_window", "(", "path", ")", ":", "if", "'pathlib'", "in", "modules", ":", "try", ":", "call", "(", "[", "\"open\"", ",", "\"-R\"", ",", "str", "(", "Path", "(", "str", "(", "path", ")", ")", ")", "]", ")", "except", "FileNotFoundError", ...
Open path in finder or explorer window
[ "Open", "path", "in", "finder", "or", "explorer", "window" ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/utils/view.py#L7-L15
train
mrstephenneal/pdfconduit
sandbox/pdftk_encrypt.py
secure
def secure(pdf, user_pw, owner_pw, restrict_permission=True, pdftk=get_pdftk_path(), output=None): """ Encrypt a PDF file and restrict permissions to print only. Utilizes pdftk command line tool. :param pdf: Path to PDF file :param user_pw: Password to open and view :param owner_pw: Password t...
python
def secure(pdf, user_pw, owner_pw, restrict_permission=True, pdftk=get_pdftk_path(), output=None): """ Encrypt a PDF file and restrict permissions to print only. Utilizes pdftk command line tool. :param pdf: Path to PDF file :param user_pw: Password to open and view :param owner_pw: Password t...
[ "def", "secure", "(", "pdf", ",", "user_pw", ",", "owner_pw", ",", "restrict_permission", "=", "True", ",", "pdftk", "=", "get_pdftk_path", "(", ")", ",", "output", "=", "None", ")", ":", "if", "pdftk", ":", "with", "open", "(", "pdf", ",", "'rb'", "...
Encrypt a PDF file and restrict permissions to print only. Utilizes pdftk command line tool. :param pdf: Path to PDF file :param user_pw: Password to open and view :param owner_pw: Password to transform permissions :param restrict_permission: Restrict permissions to print only :param pdftk: Pa...
[ "Encrypt", "a", "PDF", "file", "and", "restrict", "permissions", "to", "print", "only", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/sandbox/pdftk_encrypt.py#L29-L71
train
mrstephenneal/pdfconduit
pdf/conduit/watermark/add.py
WatermarkAdd.add
def add(self, document, watermark): """Add watermark to PDF by merging original PDF and watermark file.""" # 5a. Create output PDF file name output_filename = self.output_filename def pypdf3(): """Much slower than PyPDF3 method.""" # 5b. Get our files ready ...
python
def add(self, document, watermark): """Add watermark to PDF by merging original PDF and watermark file.""" # 5a. Create output PDF file name output_filename = self.output_filename def pypdf3(): """Much slower than PyPDF3 method.""" # 5b. Get our files ready ...
[ "def", "add", "(", "self", ",", "document", ",", "watermark", ")", ":", "output_filename", "=", "self", ".", "output_filename", "def", "pypdf3", "(", ")", ":", "document_reader", "=", "PdfFileReader", "(", "document", ")", "output_file", "=", "PdfFileWriter", ...
Add watermark to PDF by merging original PDF and watermark file.
[ "Add", "watermark", "to", "PDF", "by", "merging", "original", "PDF", "and", "watermark", "file", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/conduit/watermark/add.py#L141-L262
train
mrstephenneal/pdfconduit
sandbox/img_opacity.py
img_opacity
def img_opacity(image, opacity): """ Reduce the opacity of a PNG image. Inspiration: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 :param image: PNG image file :param opacity: float representing opacity percentage :return: Path to modified PNG """ # Validate parameters...
python
def img_opacity(image, opacity): """ Reduce the opacity of a PNG image. Inspiration: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 :param image: PNG image file :param opacity: float representing opacity percentage :return: Path to modified PNG """ # Validate parameters...
[ "def", "img_opacity", "(", "image", ",", "opacity", ")", ":", "assert", "0", "<=", "opacity", "<=", "1", ",", "'Opacity must be a float between 0 and 1'", "assert", "os", ".", "path", ".", "isfile", "(", "image", ")", ",", "'Image is not a file'", "im", "=", ...
Reduce the opacity of a PNG image. Inspiration: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 :param image: PNG image file :param opacity: float representing opacity percentage :return: Path to modified PNG
[ "Reduce", "the", "opacity", "of", "a", "PNG", "image", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/sandbox/img_opacity.py#L18-L47
train
mrstephenneal/pdfconduit
pdf/convert/img2pdf.py
IMG2PDF._image_loop
def _image_loop(self): """Retrieve an iterable of images either with, or without a progress bar.""" if self.progress_bar and 'tqdm' in self.progress_bar.lower(): return tqdm(self.imgs, desc='Saving PNGs as flat PDFs', total=len(self.imgs), unit='PDFs') else: return self.i...
python
def _image_loop(self): """Retrieve an iterable of images either with, or without a progress bar.""" if self.progress_bar and 'tqdm' in self.progress_bar.lower(): return tqdm(self.imgs, desc='Saving PNGs as flat PDFs', total=len(self.imgs), unit='PDFs') else: return self.i...
[ "def", "_image_loop", "(", "self", ")", ":", "if", "self", ".", "progress_bar", "and", "'tqdm'", "in", "self", ".", "progress_bar", ".", "lower", "(", ")", ":", "return", "tqdm", "(", "self", ".", "imgs", ",", "desc", "=", "'Saving PNGs as flat PDFs'", "...
Retrieve an iterable of images either with, or without a progress bar.
[ "Retrieve", "an", "iterable", "of", "images", "either", "with", "or", "without", "a", "progress", "bar", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/convert/img2pdf.py#L40-L45
train
mrstephenneal/pdfconduit
pdf/convert/img2pdf.py
IMG2PDF._convert
def _convert(self, image, output=None): """Private method for converting a single PNG image to a PDF.""" with Image.open(image) as im: width, height = im.size co = CanvasObjects() co.add(CanvasImg(image, 1.0, w=width, h=height)) return WatermarkDraw(co, ...
python
def _convert(self, image, output=None): """Private method for converting a single PNG image to a PDF.""" with Image.open(image) as im: width, height = im.size co = CanvasObjects() co.add(CanvasImg(image, 1.0, w=width, h=height)) return WatermarkDraw(co, ...
[ "def", "_convert", "(", "self", ",", "image", ",", "output", "=", "None", ")", ":", "with", "Image", ".", "open", "(", "image", ")", "as", "im", ":", "width", ",", "height", "=", "im", ".", "size", "co", "=", "CanvasObjects", "(", ")", "co", ".",...
Private method for converting a single PNG image to a PDF.
[ "Private", "method", "for", "converting", "a", "single", "PNG", "image", "to", "a", "PDF", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/convert/img2pdf.py#L47-L55
train
mrstephenneal/pdfconduit
pdf/convert/img2pdf.py
IMG2PDF.convert
def convert(self, image, output=None): """ Convert an image to a PDF. :param image: Image file path :param output: Output name, same as image name with .pdf extension by default :return: PDF file path """ return self._convert(image, image.replace(Path(image).suff...
python
def convert(self, image, output=None): """ Convert an image to a PDF. :param image: Image file path :param output: Output name, same as image name with .pdf extension by default :return: PDF file path """ return self._convert(image, image.replace(Path(image).suff...
[ "def", "convert", "(", "self", ",", "image", ",", "output", "=", "None", ")", ":", "return", "self", ".", "_convert", "(", "image", ",", "image", ".", "replace", "(", "Path", "(", "image", ")", ".", "suffix", ",", "'.pdf'", ")", "if", "not", "outpu...
Convert an image to a PDF. :param image: Image file path :param output: Output name, same as image name with .pdf extension by default :return: PDF file path
[ "Convert", "an", "image", "to", "a", "PDF", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/convert/img2pdf.py#L57-L65
train
mrstephenneal/pdfconduit
pdf/gui/config/images.py
add
def add(image_path, file_name=None): """Add an image to the GUI img library.""" if file_name is not None: dst_path = os.path.join(IMG_DIR, str(Path(file_name).stem + Path(image_path).suffix)) else: dst_path = IMG_DIR if os.path.isfile(image_path): shutil.copy2(image_path, dst_pa...
python
def add(image_path, file_name=None): """Add an image to the GUI img library.""" if file_name is not None: dst_path = os.path.join(IMG_DIR, str(Path(file_name).stem + Path(image_path).suffix)) else: dst_path = IMG_DIR if os.path.isfile(image_path): shutil.copy2(image_path, dst_pa...
[ "def", "add", "(", "image_path", ",", "file_name", "=", "None", ")", ":", "if", "file_name", "is", "not", "None", ":", "dst_path", "=", "os", ".", "path", ".", "join", "(", "IMG_DIR", ",", "str", "(", "Path", "(", "file_name", ")", ".", "stem", "+"...
Add an image to the GUI img library.
[ "Add", "an", "image", "to", "the", "GUI", "img", "library", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/gui/config/images.py#L14-L22
train
mrstephenneal/pdfconduit
pdf/gui/config/images.py
remove
def remove(image): """Remove an image to the GUI img library.""" path = os.path.join(IMG_DIR, image) if os.path.isfile(path): os.remove(path)
python
def remove(image): """Remove an image to the GUI img library.""" path = os.path.join(IMG_DIR, image) if os.path.isfile(path): os.remove(path)
[ "def", "remove", "(", "image", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "IMG_DIR", ",", "image", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "os", ".", "remove", "(", "path", ")" ]
Remove an image to the GUI img library.
[ "Remove", "an", "image", "to", "the", "GUI", "img", "library", "." ]
993421cc087eefefe01ff09afabd893bcc2718ec
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/gui/config/images.py#L25-L29
train
staugur/Flask-PluginKit
flask_pluginkit/web.py
pluginkit_beforerequest
def pluginkit_beforerequest(): """blueprint access auth""" authMethod = current_app.config.get("PLUGINKIT_AUTHMETHOD") authResult = dict(msg=None, code=1, method=authMethod) def authTipmsg(authResult, code=403): """make response message""" return "%s Authentication failed [%s]: %s [%s]"...
python
def pluginkit_beforerequest(): """blueprint access auth""" authMethod = current_app.config.get("PLUGINKIT_AUTHMETHOD") authResult = dict(msg=None, code=1, method=authMethod) def authTipmsg(authResult, code=403): """make response message""" return "%s Authentication failed [%s]: %s [%s]"...
[ "def", "pluginkit_beforerequest", "(", ")", ":", "authMethod", "=", "current_app", ".", "config", ".", "get", "(", "\"PLUGINKIT_AUTHMETHOD\"", ")", "authResult", "=", "dict", "(", "msg", "=", "None", ",", "code", "=", "1", ",", "method", "=", "authMethod", ...
blueprint access auth
[ "blueprint", "access", "auth" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/web.py#L29-L93
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.__scanPlugins
def __scanPlugins(self): """Scanning local plugin directories and third-party plugin packages. :returns: No return, but self.__plugins will be updated :raises: PluginError: raises an exception, maybe CSSLoadError, VersionError, based PluginError """ self.logger.info("Initializa...
python
def __scanPlugins(self): """Scanning local plugin directories and third-party plugin packages. :returns: No return, but self.__plugins will be updated :raises: PluginError: raises an exception, maybe CSSLoadError, VersionError, based PluginError """ self.logger.info("Initializa...
[ "def", "__scanPlugins", "(", "self", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Initialization Plugins Start, local plugins path: %s, third party plugins: %s\"", "%", "(", "self", ".", "plugins_abspath", ",", "self", ".", "plugin_packages", ")", ")", "if", ...
Scanning local plugin directories and third-party plugin packages. :returns: No return, but self.__plugins will be updated :raises: PluginError: raises an exception, maybe CSSLoadError, VersionError, based PluginError
[ "Scanning", "local", "plugin", "directories", "and", "third", "-", "party", "plugin", "packages", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L245-L273
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.__getPluginInfo
def __getPluginInfo(self, plugin, package_abspath, package_name): """ Organize plugin information. :returns: dict: plugin info """ if not isValidSemver(plugin.__version__): raise VersionError("The plugin version does not conform to the standard named %s" % package_name) ...
python
def __getPluginInfo(self, plugin, package_abspath, package_name): """ Organize plugin information. :returns: dict: plugin info """ if not isValidSemver(plugin.__version__): raise VersionError("The plugin version does not conform to the standard named %s" % package_name) ...
[ "def", "__getPluginInfo", "(", "self", ",", "plugin", ",", "package_abspath", ",", "package_name", ")", ":", "if", "not", "isValidSemver", "(", "plugin", ".", "__version__", ")", ":", "raise", "VersionError", "(", "\"The plugin version does not conform to the standard...
Organize plugin information. :returns: dict: plugin info
[ "Organize", "plugin", "information", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L411-L467
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.get_plugin_info
def get_plugin_info(self, plugin_name): """Get plugin information""" if plugin_name: for i in self.get_all_plugins: if i["plugin_name"] == plugin_name: return i
python
def get_plugin_info(self, plugin_name): """Get plugin information""" if plugin_name: for i in self.get_all_plugins: if i["plugin_name"] == plugin_name: return i
[ "def", "get_plugin_info", "(", "self", ",", "plugin_name", ")", ":", "if", "plugin_name", ":", "for", "i", "in", "self", ".", "get_all_plugins", ":", "if", "i", "[", "\"plugin_name\"", "]", "==", "plugin_name", ":", "return", "i" ]
Get plugin information
[ "Get", "plugin", "information" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L474-L479
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.get_all_tep
def get_all_tep(self): """Template extension point :returns: dict: {tep: dict(HTMLFile=[], HTMLString=[]), tep...} """ teps = {} for p in self.get_enabled_plugins: for e, v in p["plugin_tep"].items(): tep = teps.get(e, dict()) tepHF = ...
python
def get_all_tep(self): """Template extension point :returns: dict: {tep: dict(HTMLFile=[], HTMLString=[]), tep...} """ teps = {} for p in self.get_enabled_plugins: for e, v in p["plugin_tep"].items(): tep = teps.get(e, dict()) tepHF = ...
[ "def", "get_all_tep", "(", "self", ")", ":", "teps", "=", "{", "}", "for", "p", "in", "self", ".", "get_enabled_plugins", ":", "for", "e", ",", "v", "in", "p", "[", "\"plugin_tep\"", "]", ".", "items", "(", ")", ":", "tep", "=", "teps", ".", "get...
Template extension point :returns: dict: {tep: dict(HTMLFile=[], HTMLString=[]), tep...}
[ "Template", "extension", "point" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L510-L524
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.get_all_hep
def get_all_hep(self): """Hook extension point. * before_request_hook, Before request (intercept requests are allowed) * before_request_top_hook, Before top request (Put it first) * after_request_hook, After request (no exception before return) * teardown_request_hook, After ...
python
def get_all_hep(self): """Hook extension point. * before_request_hook, Before request (intercept requests are allowed) * before_request_top_hook, Before top request (Put it first) * after_request_hook, After request (no exception before return) * teardown_request_hook, After ...
[ "def", "get_all_hep", "(", "self", ")", ":", "return", "dict", "(", "before_request_hook", "=", "[", "plugin", "[", "\"plugin_hep\"", "]", "[", "\"before_request_hook\"", "]", "for", "plugin", "in", "self", ".", "get_enabled_plugins", "if", "plugin", "[", "\"p...
Hook extension point. * before_request_hook, Before request (intercept requests are allowed) * before_request_top_hook, Before top request (Put it first) * after_request_hook, After request (no exception before return) * teardown_request_hook, After request (before return, with or wi...
[ "Hook", "extension", "point", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L527-L543
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.push_dcp
def push_dcp(self, event, callback, position="right"): """Connect a dcp, push a function. :param event: str,unicode: A unique identifier name for dcp. :param callback: callable: Corresponding to the event to perform a function. :param position: The position of the insertion function, ...
python
def push_dcp(self, event, callback, position="right"): """Connect a dcp, push a function. :param event: str,unicode: A unique identifier name for dcp. :param callback: callable: Corresponding to the event to perform a function. :param position: The position of the insertion function, ...
[ "def", "push_dcp", "(", "self", ",", "event", ",", "callback", ",", "position", "=", "\"right\"", ")", ":", "if", "event", "and", "isinstance", "(", "event", ",", "string_types", ")", "and", "callable", "(", "callback", ")", "and", "position", "in", "(",...
Connect a dcp, push a function. :param event: str,unicode: A unique identifier name for dcp. :param callback: callable: Corresponding to the event to perform a function. :param position: The position of the insertion function, right(default) and left. :raises: DCPError,NotCallableErr...
[ "Connect", "a", "dcp", "push", "a", "function", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L649-L673
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
PluginManager.push_func
def push_func(self, cuin, callback): """Push a function for dfp. :param cuin: str,unicode: Callback Unique Identifier Name. :param callback: callable: Corresponding to the cuin to perform a function. :raises: DFPError,NotCallableError: raises an exception .. versionadded:: 2....
python
def push_func(self, cuin, callback): """Push a function for dfp. :param cuin: str,unicode: Callback Unique Identifier Name. :param callback: callable: Corresponding to the cuin to perform a function. :raises: DFPError,NotCallableError: raises an exception .. versionadded:: 2....
[ "def", "push_func", "(", "self", ",", "cuin", ",", "callback", ")", ":", "if", "cuin", "and", "isinstance", "(", "cuin", ",", "string_types", ")", "and", "callable", "(", "callback", ")", ":", "if", "cuin", "in", "self", ".", "_dfp_funcs", ":", "raise"...
Push a function for dfp. :param cuin: str,unicode: Callback Unique Identifier Name. :param callback: callable: Corresponding to the cuin to perform a function. :raises: DFPError,NotCallableError: raises an exception .. versionadded:: 2.3.0
[ "Push", "a", "function", "for", "dfp", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L697-L716
train
staugur/Flask-PluginKit
setup.py
PublishCommand.finalize_options
def finalize_options(self): """Post-process options.""" if self.test: print("V%s will publish to the test.pypi.org" % version) elif self.release: print("V%s will publish to the pypi.org" % version)
python
def finalize_options(self): """Post-process options.""" if self.test: print("V%s will publish to the test.pypi.org" % version) elif self.release: print("V%s will publish to the pypi.org" % version)
[ "def", "finalize_options", "(", "self", ")", ":", "if", "self", ".", "test", ":", "print", "(", "\"V%s will publish to the test.pypi.org\"", "%", "version", ")", "elif", "self", ".", "release", ":", "print", "(", "\"V%s will publish to the pypi.org\"", "%", "versi...
Post-process options.
[ "Post", "-", "process", "options", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/setup.py#L57-L62
train
staugur/Flask-PluginKit
example/plugins/jwt/utils.py
JWTUtil.signatureJWT
def signatureJWT(self, message): """ Python generate HMAC-SHA-256 from string """ return hmac.new( key=self.secretkey, msg=message, digestmod=hashlib.sha256 ).hexdigest()
python
def signatureJWT(self, message): """ Python generate HMAC-SHA-256 from string """ return hmac.new( key=self.secretkey, msg=message, digestmod=hashlib.sha256 ).hexdigest()
[ "def", "signatureJWT", "(", "self", ",", "message", ")", ":", "return", "hmac", ".", "new", "(", "key", "=", "self", ".", "secretkey", ",", "msg", "=", "message", ",", "digestmod", "=", "hashlib", ".", "sha256", ")", ".", "hexdigest", "(", ")" ]
Python generate HMAC-SHA-256 from string
[ "Python", "generate", "HMAC", "-", "SHA", "-", "256", "from", "string" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/example/plugins/jwt/utils.py#L77-L83
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__isValidTGZ
def __isValidTGZ(self, suffix): """To determine whether the suffix `.tar.gz` or `.tgz` format""" if suffix and isinstance(suffix, string_types): if suffix.endswith(".tar.gz") or suffix.endswith(".tgz"): return True return False
python
def __isValidTGZ(self, suffix): """To determine whether the suffix `.tar.gz` or `.tgz` format""" if suffix and isinstance(suffix, string_types): if suffix.endswith(".tar.gz") or suffix.endswith(".tgz"): return True return False
[ "def", "__isValidTGZ", "(", "self", ",", "suffix", ")", ":", "if", "suffix", "and", "isinstance", "(", "suffix", ",", "string_types", ")", ":", "if", "suffix", ".", "endswith", "(", "\".tar.gz\"", ")", "or", "suffix", ".", "endswith", "(", "\".tgz\"", ")...
To determine whether the suffix `.tar.gz` or `.tgz` format
[ "To", "determine", "whether", "the", "suffix", ".", "tar", ".", "gz", "or", ".", "tgz", "format" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L67-L72
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__isValidZIP
def __isValidZIP(self, suffix): """Determine if the suffix is `.zip` format""" if suffix and isinstance(suffix, string_types): if suffix.endswith(".zip"): return True return False
python
def __isValidZIP(self, suffix): """Determine if the suffix is `.zip` format""" if suffix and isinstance(suffix, string_types): if suffix.endswith(".zip"): return True return False
[ "def", "__isValidZIP", "(", "self", ",", "suffix", ")", ":", "if", "suffix", "and", "isinstance", "(", "suffix", ",", "string_types", ")", ":", "if", "suffix", ".", "endswith", "(", "\".zip\"", ")", ":", "return", "True", "return", "False" ]
Determine if the suffix is `.zip` format
[ "Determine", "if", "the", "suffix", "is", ".", "zip", "format" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L74-L79
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__isValidFilename
def __isValidFilename(self, filename): """Determine whether filename is valid""" if filename and isinstance(filename, string_types): if re.match(r'^[\w\d\_\-\.]+$', filename, re.I): if self.__isValidTGZ(filename) or self.__isValidZIP(filename): return...
python
def __isValidFilename(self, filename): """Determine whether filename is valid""" if filename and isinstance(filename, string_types): if re.match(r'^[\w\d\_\-\.]+$', filename, re.I): if self.__isValidTGZ(filename) or self.__isValidZIP(filename): return...
[ "def", "__isValidFilename", "(", "self", ",", "filename", ")", ":", "if", "filename", "and", "isinstance", "(", "filename", ",", "string_types", ")", ":", "if", "re", ".", "match", "(", "r'^[\\w\\d\\_\\-\\.]+$'", ",", "filename", ",", "re", ".", "I", ")", ...
Determine whether filename is valid
[ "Determine", "whether", "filename", "is", "valid" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L81-L87
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__getFilename
def __getFilename(self, data, scene=1): """To get the data from different scenarios in the filename, scene value see `remote_download` in 1, 2, 3, 4""" try: filename = None if scene == 1: plugin_filename = [i for i in parse_qs(urlsplit(data).query).get("plugi...
python
def __getFilename(self, data, scene=1): """To get the data from different scenarios in the filename, scene value see `remote_download` in 1, 2, 3, 4""" try: filename = None if scene == 1: plugin_filename = [i for i in parse_qs(urlsplit(data).query).get("plugi...
[ "def", "__getFilename", "(", "self", ",", "data", ",", "scene", "=", "1", ")", ":", "try", ":", "filename", "=", "None", "if", "scene", "==", "1", ":", "plugin_filename", "=", "[", "i", "for", "i", "in", "parse_qs", "(", "urlsplit", "(", "data", ")...
To get the data from different scenarios in the filename, scene value see `remote_download` in 1, 2, 3, 4
[ "To", "get", "the", "data", "from", "different", "scenarios", "in", "the", "filename", "scene", "value", "see", "remote_download", "in", "1", "2", "3", "4" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L89-L118
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__getFilenameSuffix
def __getFilenameSuffix(self, filename): """Gets the filename suffix""" if filename and isinstance(filename, string_types): if self.__isValidTGZ(filename): return ".tar.gz" elif filename.endswith(".zip"): return ".zip"
python
def __getFilenameSuffix(self, filename): """Gets the filename suffix""" if filename and isinstance(filename, string_types): if self.__isValidTGZ(filename): return ".tar.gz" elif filename.endswith(".zip"): return ".zip"
[ "def", "__getFilenameSuffix", "(", "self", ",", "filename", ")", ":", "if", "filename", "and", "isinstance", "(", "filename", ",", "string_types", ")", ":", "if", "self", ".", "__isValidTGZ", "(", "filename", ")", ":", "return", "\".tar.gz\"", "elif", "filen...
Gets the filename suffix
[ "Gets", "the", "filename", "suffix" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L120-L126
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__unpack_tgz
def __unpack_tgz(self, filename): """Unpack the `tar.gz`, `tgz` compressed file format""" if isinstance(filename, string_types) and self.__isValidTGZ(filename) and tarfile.is_tarfile(filename): with tarfile.open(filename, mode='r:gz') as t: for name in t.getnames(): ...
python
def __unpack_tgz(self, filename): """Unpack the `tar.gz`, `tgz` compressed file format""" if isinstance(filename, string_types) and self.__isValidTGZ(filename) and tarfile.is_tarfile(filename): with tarfile.open(filename, mode='r:gz') as t: for name in t.getnames(): ...
[ "def", "__unpack_tgz", "(", "self", ",", "filename", ")", ":", "if", "isinstance", "(", "filename", ",", "string_types", ")", "and", "self", ".", "__isValidTGZ", "(", "filename", ")", "and", "tarfile", ".", "is_tarfile", "(", "filename", ")", ":", "with", ...
Unpack the `tar.gz`, `tgz` compressed file format
[ "Unpack", "the", "tar", ".", "gz", "tgz", "compressed", "file", "format" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L128-L135
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller.__unpack_zip
def __unpack_zip(self, filename): """Unpack the `zip` compressed file format""" if isinstance(filename, string_types) and self.__isValidZIP(filename) and zipfile.is_zipfile(filename): with zipfile.ZipFile(filename) as z: for name in z.namelist(): z.ex...
python
def __unpack_zip(self, filename): """Unpack the `zip` compressed file format""" if isinstance(filename, string_types) and self.__isValidZIP(filename) and zipfile.is_zipfile(filename): with zipfile.ZipFile(filename) as z: for name in z.namelist(): z.ex...
[ "def", "__unpack_zip", "(", "self", ",", "filename", ")", ":", "if", "isinstance", "(", "filename", ",", "string_types", ")", "and", "self", ".", "__isValidZIP", "(", "filename", ")", "and", "zipfile", ".", "is_zipfile", "(", "filename", ")", ":", "with", ...
Unpack the `zip` compressed file format
[ "Unpack", "the", "zip", "compressed", "file", "format" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L137-L144
train
staugur/Flask-PluginKit
flask_pluginkit/installer.py
PluginInstaller._local_upload
def _local_upload(self, filepath, remove=False): """Local plugin package processing""" if os.path.isfile(filepath): filename = os.path.basename(os.path.abspath(filepath)) if filename and self.__isValidFilename(filename): suffix = self.__getFilenameSuffix(file...
python
def _local_upload(self, filepath, remove=False): """Local plugin package processing""" if os.path.isfile(filepath): filename = os.path.basename(os.path.abspath(filepath)) if filename and self.__isValidFilename(filename): suffix = self.__getFilenameSuffix(file...
[ "def", "_local_upload", "(", "self", ",", "filepath", ",", "remove", "=", "False", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "filepath", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "os", ".", "path", ".", "abspa...
Local plugin package processing
[ "Local", "plugin", "package", "processing" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/installer.py#L190-L204
train
staugur/Flask-PluginKit
flask_pluginkit/utils.py
sortedSemver
def sortedSemver(versions, sort="asc"): """Semantically sort the list of version Numbers""" if versions and isinstance(versions, (list, tuple)): if PY2: return sorted(versions, cmp=semver.compare, reverse=True if sort.upper() == "DESC" else False) else: from functools imp...
python
def sortedSemver(versions, sort="asc"): """Semantically sort the list of version Numbers""" if versions and isinstance(versions, (list, tuple)): if PY2: return sorted(versions, cmp=semver.compare, reverse=True if sort.upper() == "DESC" else False) else: from functools imp...
[ "def", "sortedSemver", "(", "versions", ",", "sort", "=", "\"asc\"", ")", ":", "if", "versions", "and", "isinstance", "(", "versions", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "PY2", ":", "return", "sorted", "(", "versions", ",", "cmp", "...
Semantically sort the list of version Numbers
[ "Semantically", "sort", "the", "list", "of", "version", "Numbers" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/utils.py#L141-L150
train
staugur/Flask-PluginKit
flask_pluginkit/utils.py
LocalStorage.set
def set(self, key, value): """Set persistent data with shelve. :param key: string: Index key :param value: All supported data types in python :raises: :returns: """ db = self.open() try: db[key] = value finally: db.close...
python
def set(self, key, value): """Set persistent data with shelve. :param key: string: Index key :param value: All supported data types in python :raises: :returns: """ db = self.open() try: db[key] = value finally: db.close...
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "db", "=", "self", ".", "open", "(", ")", "try", ":", "db", "[", "key", "]", "=", "value", "finally", ":", "db", ".", "close", "(", ")" ]
Set persistent data with shelve. :param key: string: Index key :param value: All supported data types in python :raises: :returns:
[ "Set", "persistent", "data", "with", "shelve", "." ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/utils.py#L49-L64
train
staugur/Flask-PluginKit
flask_pluginkit/utils.py
RedisStorage.set
def set(self, key, value): """set key data""" if self._db: self._db.hset(self.index, key, value)
python
def set(self, key, value): """set key data""" if self._db: self._db.hset(self.index, key, value)
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "if", "self", ".", "_db", ":", "self", ".", "_db", ".", "hset", "(", "self", ".", "index", ",", "key", ",", "value", ")" ]
set key data
[ "set", "key", "data" ]
512aabf87fa13f4dc1082abd08d1d1dcf3b03f16
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/utils.py#L114-L117
train
wright-group/WrightTools
WrightTools/kit/_list.py
flatten_list
def flatten_list(items, seqtypes=(list, tuple), in_place=True): """Flatten an irregular sequence. Works generally but may be slower than it could be if you can make assumptions about your list. `Source`__ __ https://stackoverflow.com/a/10824086 Parameters ---------- items : iterable ...
python
def flatten_list(items, seqtypes=(list, tuple), in_place=True): """Flatten an irregular sequence. Works generally but may be slower than it could be if you can make assumptions about your list. `Source`__ __ https://stackoverflow.com/a/10824086 Parameters ---------- items : iterable ...
[ "def", "flatten_list", "(", "items", ",", "seqtypes", "=", "(", "list", ",", "tuple", ")", ",", "in_place", "=", "True", ")", ":", "if", "not", "in_place", ":", "items", "=", "items", "[", ":", "]", "for", "i", ",", "_", "in", "enumerate", "(", "...
Flatten an irregular sequence. Works generally but may be slower than it could be if you can make assumptions about your list. `Source`__ __ https://stackoverflow.com/a/10824086 Parameters ---------- items : iterable The irregular sequence to flatten. seqtypes : iterable of t...
[ "Flatten", "an", "irregular", "sequence", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_list.py#L17-L52
train
wright-group/WrightTools
WrightTools/kit/_list.py
intersperse
def intersperse(lis, value): """Put value between each existing item in list. Parameters ---------- lis : list List to intersperse. value : object Value to insert. Returns ------- list interspersed list """ out = [value] * (len(lis) * 2 - 1) out[0::2...
python
def intersperse(lis, value): """Put value between each existing item in list. Parameters ---------- lis : list List to intersperse. value : object Value to insert. Returns ------- list interspersed list """ out = [value] * (len(lis) * 2 - 1) out[0::2...
[ "def", "intersperse", "(", "lis", ",", "value", ")", ":", "out", "=", "[", "value", "]", "*", "(", "len", "(", "lis", ")", "*", "2", "-", "1", ")", "out", "[", "0", ":", ":", "2", "]", "=", "lis", "return", "out" ]
Put value between each existing item in list. Parameters ---------- lis : list List to intersperse. value : object Value to insert. Returns ------- list interspersed list
[ "Put", "value", "between", "each", "existing", "item", "in", "list", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_list.py#L55-L72
train
wright-group/WrightTools
WrightTools/kit/_list.py
get_index
def get_index(lis, argument): """Find the index of an item, given either the item or index as an argument. Particularly useful as a wrapper for arguments like channel or axis. Parameters ---------- lis : list List to parse. argument : int or object Argument. Returns --...
python
def get_index(lis, argument): """Find the index of an item, given either the item or index as an argument. Particularly useful as a wrapper for arguments like channel or axis. Parameters ---------- lis : list List to parse. argument : int or object Argument. Returns --...
[ "def", "get_index", "(", "lis", ",", "argument", ")", ":", "if", "isinstance", "(", "argument", ",", "int", ")", ":", "if", "-", "len", "(", "lis", ")", "<=", "argument", "<", "len", "(", "lis", ")", ":", "return", "argument", "else", ":", "raise",...
Find the index of an item, given either the item or index as an argument. Particularly useful as a wrapper for arguments like channel or axis. Parameters ---------- lis : list List to parse. argument : int or object Argument. Returns ------- int Index of chosen...
[ "Find", "the", "index", "of", "an", "item", "given", "either", "the", "item", "or", "index", "as", "an", "argument", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_list.py#L75-L99
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
_title
def _title(fig, title, subtitle="", *, margin=1, fontsize=20, subfontsize=18): """Add a title to a figure. Parameters ---------- fig : matplotlib Figure Figure. title : string Title. subtitle : string Subtitle. margin : number (optional) Distance from top of ...
python
def _title(fig, title, subtitle="", *, margin=1, fontsize=20, subfontsize=18): """Add a title to a figure. Parameters ---------- fig : matplotlib Figure Figure. title : string Title. subtitle : string Subtitle. margin : number (optional) Distance from top of ...
[ "def", "_title", "(", "fig", ",", "title", ",", "subtitle", "=", "\"\"", ",", "*", ",", "margin", "=", "1", ",", "fontsize", "=", "20", ",", "subfontsize", "=", "18", ")", ":", "fig", ".", "suptitle", "(", "title", ",", "fontsize", "=", "fontsize",...
Add a title to a figure. Parameters ---------- fig : matplotlib Figure Figure. title : string Title. subtitle : string Subtitle. margin : number (optional) Distance from top of plot, in inches. Default is 1. fontsize : number (optional) Title fontsize...
[ "Add", "a", "title", "to", "a", "figure", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L53-L75
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
add_sideplot
def add_sideplot( ax, along, pad=0., *, grid=True, zero_line=True, arrs_to_bin=None, normalize_bin=True, ymin=0, ymax=1.1, height=0.75, c="C0" ): """Add a sideplot to an axis. Sideplots share their corresponding axis. Parameters ---------- ax : matplotlib...
python
def add_sideplot( ax, along, pad=0., *, grid=True, zero_line=True, arrs_to_bin=None, normalize_bin=True, ymin=0, ymax=1.1, height=0.75, c="C0" ): """Add a sideplot to an axis. Sideplots share their corresponding axis. Parameters ---------- ax : matplotlib...
[ "def", "add_sideplot", "(", "ax", ",", "along", ",", "pad", "=", "0.", ",", "*", ",", "grid", "=", "True", ",", "zero_line", "=", "True", ",", "arrs_to_bin", "=", "None", ",", "normalize_bin", "=", "True", ",", "ymin", "=", "0", ",", "ymax", "=", ...
Add a sideplot to an axis. Sideplots share their corresponding axis. Parameters ---------- ax : matplotlib AxesSubplot object The axis to add a sideplot along. along : {'x', 'y'} The dimension to add a sideplot along. pad : number (optional) Distance between axis and sideplo...
[ "Add", "a", "sideplot", "to", "an", "axis", ".", "Sideplots", "share", "their", "corresponding", "axis", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L78-L163
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
corner_text
def corner_text( text, distance=0.075, *, ax=None, corner="UL", factor=200, bbox=True, fontsize=18, background_alpha=1, edgecolor=None ): """Place some text in the corner of the figure. Parameters ---------- text : str The text to use. distance : numb...
python
def corner_text( text, distance=0.075, *, ax=None, corner="UL", factor=200, bbox=True, fontsize=18, background_alpha=1, edgecolor=None ): """Place some text in the corner of the figure. Parameters ---------- text : str The text to use. distance : numb...
[ "def", "corner_text", "(", "text", ",", "distance", "=", "0.075", ",", "*", ",", "ax", "=", "None", ",", "corner", "=", "\"UL\"", ",", "factor", "=", "200", ",", "bbox", "=", "True", ",", "fontsize", "=", "18", ",", "background_alpha", "=", "1", ",...
Place some text in the corner of the figure. Parameters ---------- text : str The text to use. distance : number (optional) Distance from the corner. Default is 0.05. ax : axis (optional) The axis object to label. If None, uses current axis. Default is None. corner : {'U...
[ "Place", "some", "text", "in", "the", "corner", "of", "the", "figure", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L166-L232
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
create_figure
def create_figure( *, width="single", nrows=1, cols=[1], margin=1., hspace=0.25, wspace=0.25, cbar_width=0.25, aspects=[], default_aspect=1 ): """Re-parameterization of matplotlib figure creation tools, exposing convenient variables. Figures are defined primarily by thei...
python
def create_figure( *, width="single", nrows=1, cols=[1], margin=1., hspace=0.25, wspace=0.25, cbar_width=0.25, aspects=[], default_aspect=1 ): """Re-parameterization of matplotlib figure creation tools, exposing convenient variables. Figures are defined primarily by thei...
[ "def", "create_figure", "(", "*", ",", "width", "=", "\"single\"", ",", "nrows", "=", "1", ",", "cols", "=", "[", "1", "]", ",", "margin", "=", "1.", ",", "hspace", "=", "0.25", ",", "wspace", "=", "0.25", ",", "cbar_width", "=", "0.25", ",", "as...
Re-parameterization of matplotlib figure creation tools, exposing convenient variables. Figures are defined primarily by their width. Height is defined by the aspect ratios of the subplots contained within. hspace, wspace, and cbar_width are defined in inches, making it easier to make consistent plots....
[ "Re", "-", "parameterization", "of", "matplotlib", "figure", "creation", "tools", "exposing", "convenient", "variables", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L235-L392
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
diagonal_line
def diagonal_line(xi=None, yi=None, *, ax=None, c=None, ls=None, lw=None, zorder=3): """Plot a diagonal line. Parameters ---------- xi : 1D array-like (optional) The x axis points. If None, taken from axis limits. Default is None. yi : 1D array-like The y axis points. If None, taken...
python
def diagonal_line(xi=None, yi=None, *, ax=None, c=None, ls=None, lw=None, zorder=3): """Plot a diagonal line. Parameters ---------- xi : 1D array-like (optional) The x axis points. If None, taken from axis limits. Default is None. yi : 1D array-like The y axis points. If None, taken...
[ "def", "diagonal_line", "(", "xi", "=", "None", ",", "yi", "=", "None", ",", "*", ",", "ax", "=", "None", ",", "c", "=", "None", ",", "ls", "=", "None", ",", "lw", "=", "None", ",", "zorder", "=", "3", ")", ":", "if", "ax", "is", "None", ":...
Plot a diagonal line. Parameters ---------- xi : 1D array-like (optional) The x axis points. If None, taken from axis limits. Default is None. yi : 1D array-like The y axis points. If None, taken from axis limits. Default is None. ax : axis (optional) Axis to plot on. If non...
[ "Plot", "a", "diagonal", "line", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L395-L441
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
get_scaled_bounds
def get_scaled_bounds(ax, position, *, distance=0.1, factor=200): """Get scaled bounds. Parameters ---------- ax : Axes object Axes object. position : {'UL', 'LL', 'UR', 'LR'} Position. distance : number (optional) Distance. Default is 0.1. factor : number (optional)...
python
def get_scaled_bounds(ax, position, *, distance=0.1, factor=200): """Get scaled bounds. Parameters ---------- ax : Axes object Axes object. position : {'UL', 'LL', 'UR', 'LR'} Position. distance : number (optional) Distance. Default is 0.1. factor : number (optional)...
[ "def", "get_scaled_bounds", "(", "ax", ",", "position", ",", "*", ",", "distance", "=", "0.1", ",", "factor", "=", "200", ")", ":", "x0", ",", "y0", ",", "width", ",", "height", "=", "ax", ".", "bbox", ".", "bounds", "width_scaled", "=", "width", "...
Get scaled bounds. Parameters ---------- ax : Axes object Axes object. position : {'UL', 'LL', 'UR', 'LR'} Position. distance : number (optional) Distance. Default is 0.1. factor : number (optional) Factor. Default is 200. Returns ------- ([h_scaled,...
[ "Get", "scaled", "bounds", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L444-L492
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
pcolor_helper
def pcolor_helper(xi, yi, zi=None): """Prepare a set of arrays for plotting using `pcolor`. The return values are suitable for feeding directly into ``matplotlib.pcolor`` such that the pixels are properly centered. Parameters ---------- xi : 1D or 2D array-like Array of X-coordinates. ...
python
def pcolor_helper(xi, yi, zi=None): """Prepare a set of arrays for plotting using `pcolor`. The return values are suitable for feeding directly into ``matplotlib.pcolor`` such that the pixels are properly centered. Parameters ---------- xi : 1D or 2D array-like Array of X-coordinates. ...
[ "def", "pcolor_helper", "(", "xi", ",", "yi", ",", "zi", "=", "None", ")", ":", "xi", "=", "xi", ".", "copy", "(", ")", "yi", "=", "yi", ".", "copy", "(", ")", "if", "xi", ".", "ndim", "==", "1", ":", "xi", ".", "shape", "=", "(", "xi", "...
Prepare a set of arrays for plotting using `pcolor`. The return values are suitable for feeding directly into ``matplotlib.pcolor`` such that the pixels are properly centered. Parameters ---------- xi : 1D or 2D array-like Array of X-coordinates. yi : 1D or 2D array-like Array ...
[ "Prepare", "a", "set", "of", "arrays", "for", "plotting", "using", "pcolor", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L495-L562
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
plot_colorbar
def plot_colorbar( cax=None, cmap="default", ticks=None, clim=None, vlim=None, label=None, tick_fontsize=14, label_fontsize=18, decimals=None, orientation="vertical", ticklocation="auto", extend="neither", extendfrac=None, extendrect=False, ): """Easily add a ...
python
def plot_colorbar( cax=None, cmap="default", ticks=None, clim=None, vlim=None, label=None, tick_fontsize=14, label_fontsize=18, decimals=None, orientation="vertical", ticklocation="auto", extend="neither", extendfrac=None, extendrect=False, ): """Easily add a ...
[ "def", "plot_colorbar", "(", "cax", "=", "None", ",", "cmap", "=", "\"default\"", ",", "ticks", "=", "None", ",", "clim", "=", "None", ",", "vlim", "=", "None", ",", "label", "=", "None", ",", "tick_fontsize", "=", "14", ",", "label_fontsize", "=", "...
Easily add a colormap to an axis. Parameters ---------- cax : matplotlib axis (optional) The axis to plot the colorbar on. Finds the current axis if none is given. cmap : string or LinearSegmentedColormap (optional) The colormap to fill the colorbar with. Strings map as keys to ...
[ "Easily", "add", "a", "colormap", "to", "an", "axis", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L565-L692
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
plot_margins
def plot_margins(*, fig=None, inches=1., centers=True, edges=True): """Add lines onto a figure indicating the margins, centers, and edges. Useful for ensuring your figure design scripts work as intended, and for laying out figures. Parameters ---------- fig : matplotlib.figure.Figure object (o...
python
def plot_margins(*, fig=None, inches=1., centers=True, edges=True): """Add lines onto a figure indicating the margins, centers, and edges. Useful for ensuring your figure design scripts work as intended, and for laying out figures. Parameters ---------- fig : matplotlib.figure.Figure object (o...
[ "def", "plot_margins", "(", "*", ",", "fig", "=", "None", ",", "inches", "=", "1.", ",", "centers", "=", "True", ",", "edges", "=", "True", ")", ":", "if", "fig", "is", "None", ":", "fig", "=", "plt", ".", "gcf", "(", ")", "size", "=", "fig", ...
Add lines onto a figure indicating the margins, centers, and edges. Useful for ensuring your figure design scripts work as intended, and for laying out figures. Parameters ---------- fig : matplotlib.figure.Figure object (optional) The figure to plot onto. If None, gets current figure. Def...
[ "Add", "lines", "onto", "a", "figure", "indicating", "the", "margins", "centers", "and", "edges", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L695-L750
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
plot_gridlines
def plot_gridlines(ax=None, c="grey", lw=1, diagonal=False, zorder=2, makegrid=True): """Plot dotted gridlines onto an axis. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to add gridlines to. If None, uses current axis. Default is None. c : matplotlib color argume...
python
def plot_gridlines(ax=None, c="grey", lw=1, diagonal=False, zorder=2, makegrid=True): """Plot dotted gridlines onto an axis. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to add gridlines to. If None, uses current axis. Default is None. c : matplotlib color argume...
[ "def", "plot_gridlines", "(", "ax", "=", "None", ",", "c", "=", "\"grey\"", ",", "lw", "=", "1", ",", "diagonal", "=", "False", ",", "zorder", "=", "2", ",", "makegrid", "=", "True", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", "....
Plot dotted gridlines onto an axis. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to add gridlines to. If None, uses current axis. Default is None. c : matplotlib color argument (optional) Gridline color. Default is grey. lw : number (optional) Gri...
[ "Plot", "dotted", "gridlines", "onto", "an", "axis", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L753-L808
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
savefig
def savefig(path, fig=None, close=True, *, dpi=300): """Save a figure. Parameters ---------- path : str Path to save figure at. fig : matplotlib.figure.Figure object (optional) The figure to plot onto. If None, gets current figure. Default is None. close : bool (optional) ...
python
def savefig(path, fig=None, close=True, *, dpi=300): """Save a figure. Parameters ---------- path : str Path to save figure at. fig : matplotlib.figure.Figure object (optional) The figure to plot onto. If None, gets current figure. Default is None. close : bool (optional) ...
[ "def", "savefig", "(", "path", ",", "fig", "=", "None", ",", "close", "=", "True", ",", "*", ",", "dpi", "=", "300", ")", ":", "if", "fig", "is", "None", ":", "fig", "=", "plt", ".", "gcf", "(", ")", "path", "=", "os", ".", "path", ".", "ab...
Save a figure. Parameters ---------- path : str Path to save figure at. fig : matplotlib.figure.Figure object (optional) The figure to plot onto. If None, gets current figure. Default is None. close : bool (optional) Toggle closing of figure after saving. Default is True. ...
[ "Save", "a", "figure", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L811-L839
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
set_ax_labels
def set_ax_labels(ax=None, xlabel=None, ylabel=None, xticks=None, yticks=None, label_fontsize=18): """Set all axis labels properties easily. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to set. If None, uses current axis. Default is None. xlabel : None or string ...
python
def set_ax_labels(ax=None, xlabel=None, ylabel=None, xticks=None, yticks=None, label_fontsize=18): """Set all axis labels properties easily. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to set. If None, uses current axis. Default is None. xlabel : None or string ...
[ "def", "set_ax_labels", "(", "ax", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "xticks", "=", "None", ",", "yticks", "=", "None", ",", "label_fontsize", "=", "18", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", ...
Set all axis labels properties easily. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to set. If None, uses current axis. Default is None. xlabel : None or string (optional) x axis label. Default is None. ylabel : None or string (optional) y axis la...
[ "Set", "all", "axis", "labels", "properties", "easily", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L842-L886
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
set_ax_spines
def set_ax_spines(ax=None, *, c="k", lw=3, zorder=10): """Easily set the properties of all four axis spines. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to set. If None, uses current axis. Default is None. c : any matplotlib color argument (optional) Spi...
python
def set_ax_spines(ax=None, *, c="k", lw=3, zorder=10): """Easily set the properties of all four axis spines. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to set. If None, uses current axis. Default is None. c : any matplotlib color argument (optional) Spi...
[ "def", "set_ax_spines", "(", "ax", "=", "None", ",", "*", ",", "c", "=", "\"k\"", ",", "lw", "=", "3", ",", "zorder", "=", "10", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "for", "key", "in", "[", "\"bo...
Easily set the properties of all four axis spines. Parameters ---------- ax : matplotlib AxesSubplot object (optional) Axis to set. If None, uses current axis. Default is None. c : any matplotlib color argument (optional) Spine color. Default is k. lw : number (optional) Spi...
[ "Easily", "set", "the", "properties", "of", "all", "four", "axis", "spines", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L889-L910
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
set_fig_labels
def set_fig_labels( fig=None, xlabel=None, ylabel=None, xticks=None, yticks=None, title=None, row=-1, col=0, label_fontsize=18, title_fontsize=20, ): """Set all axis labels of a figure simultaniously. Only plots ticks and labels for edge axes. Parameters -------...
python
def set_fig_labels( fig=None, xlabel=None, ylabel=None, xticks=None, yticks=None, title=None, row=-1, col=0, label_fontsize=18, title_fontsize=20, ): """Set all axis labels of a figure simultaniously. Only plots ticks and labels for edge axes. Parameters -------...
[ "def", "set_fig_labels", "(", "fig", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "xticks", "=", "None", ",", "yticks", "=", "None", ",", "title", "=", "None", ",", "row", "=", "-", "1", ",", "col", "=", "0", ",", "...
Set all axis labels of a figure simultaniously. Only plots ticks and labels for edge axes. Parameters ---------- fig : matplotlib.figure.Figure object (optional) Figure to set labels of. If None, uses current figure. Default is None. xlabel : None or string (optional) x axis label....
[ "Set", "all", "axis", "labels", "of", "a", "figure", "simultaniously", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L913-L986
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
subplots_adjust
def subplots_adjust(fig=None, inches=1): """Enforce margin to be equal around figure, starting at subplots. .. note:: You probably should be using wt.artists.create_figure instead. See Also -------- wt.artists.plot_margins Visualize margins, for debugging / layout. wt.artists.c...
python
def subplots_adjust(fig=None, inches=1): """Enforce margin to be equal around figure, starting at subplots. .. note:: You probably should be using wt.artists.create_figure instead. See Also -------- wt.artists.plot_margins Visualize margins, for debugging / layout. wt.artists.c...
[ "def", "subplots_adjust", "(", "fig", "=", "None", ",", "inches", "=", "1", ")", ":", "if", "fig", "is", "None", ":", "fig", "=", "plt", ".", "gcf", "(", ")", "size", "=", "fig", ".", "get_size_inches", "(", ")", "vert", "=", "inches", "/", "size...
Enforce margin to be equal around figure, starting at subplots. .. note:: You probably should be using wt.artists.create_figure instead. See Also -------- wt.artists.plot_margins Visualize margins, for debugging / layout. wt.artists.create_figure Convinience method for crea...
[ "Enforce", "margin", "to", "be", "equal", "around", "figure", "starting", "at", "subplots", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L989-L1007
train
wright-group/WrightTools
WrightTools/artists/_helpers.py
stitch_to_animation
def stitch_to_animation(images, outpath=None, *, duration=0.5, palettesize=256, verbose=True): """Stitch a series of images into an animation. Currently supports animated gifs, other formats coming as needed. Parameters ---------- images : list of strings Filepaths to the images to stitch ...
python
def stitch_to_animation(images, outpath=None, *, duration=0.5, palettesize=256, verbose=True): """Stitch a series of images into an animation. Currently supports animated gifs, other formats coming as needed. Parameters ---------- images : list of strings Filepaths to the images to stitch ...
[ "def", "stitch_to_animation", "(", "images", ",", "outpath", "=", "None", ",", "*", ",", "duration", "=", "0.5", ",", "palettesize", "=", "256", ",", "verbose", "=", "True", ")", ":", "if", "outpath", "is", "None", ":", "outpath", "=", "os", ".", "pa...
Stitch a series of images into an animation. Currently supports animated gifs, other formats coming as needed. Parameters ---------- images : list of strings Filepaths to the images to stitch together, in order of apperence. outpath : string (optional) Path of output, including ext...
[ "Stitch", "a", "series", "of", "images", "into", "an", "animation", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L1010-L1045
train
wright-group/WrightTools
WrightTools/_group.py
Group.item_names
def item_names(self): """Item names.""" if "item_names" not in self.attrs.keys(): self.attrs["item_names"] = np.array([], dtype="S") return tuple(n.decode() for n in self.attrs["item_names"])
python
def item_names(self): """Item names.""" if "item_names" not in self.attrs.keys(): self.attrs["item_names"] = np.array([], dtype="S") return tuple(n.decode() for n in self.attrs["item_names"])
[ "def", "item_names", "(", "self", ")", ":", "if", "\"item_names\"", "not", "in", "self", ".", "attrs", ".", "keys", "(", ")", ":", "self", ".", "attrs", "[", "\"item_names\"", "]", "=", "np", ".", "array", "(", "[", "]", ",", "dtype", "=", "\"S\"",...
Item names.
[ "Item", "names", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_group.py#L226-L230
train
wright-group/WrightTools
WrightTools/_group.py
Group.natural_name
def natural_name(self): """Natural name.""" try: assert self._natural_name is not None except (AssertionError, AttributeError): self._natural_name = self.attrs["name"] finally: return self._natural_name
python
def natural_name(self): """Natural name.""" try: assert self._natural_name is not None except (AssertionError, AttributeError): self._natural_name = self.attrs["name"] finally: return self._natural_name
[ "def", "natural_name", "(", "self", ")", ":", "try", ":", "assert", "self", ".", "_natural_name", "is", "not", "None", "except", "(", "AssertionError", ",", "AttributeError", ")", ":", "self", ".", "_natural_name", "=", "self", ".", "attrs", "[", "\"name\"...
Natural name.
[ "Natural", "name", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_group.py#L233-L240
train
wright-group/WrightTools
WrightTools/_group.py
Group.natural_name
def natural_name(self, value): """Set natural name.""" if value is None: value = "" if hasattr(self, "_natural_name") and self.name != "/": keys = [k for k in self._instances.keys() if k.startswith(self.fullpath)] dskeys = [k for k in Dataset._instances.keys()...
python
def natural_name(self, value): """Set natural name.""" if value is None: value = "" if hasattr(self, "_natural_name") and self.name != "/": keys = [k for k in self._instances.keys() if k.startswith(self.fullpath)] dskeys = [k for k in Dataset._instances.keys()...
[ "def", "natural_name", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "value", "=", "\"\"", "if", "hasattr", "(", "self", ",", "\"_natural_name\"", ")", "and", "self", ".", "name", "!=", "\"/\"", ":", "keys", "=", "[", "k", ...
Set natural name.
[ "Set", "natural", "name", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_group.py#L243-L257
train
wright-group/WrightTools
WrightTools/_group.py
Group.close
def close(self): """Close the file that contains the Group. All groups which are in the file will be closed and removed from the _instances dictionaries. Tempfiles, if they exist, will be removed """ from .collection import Collection from .data._data import Chan...
python
def close(self): """Close the file that contains the Group. All groups which are in the file will be closed and removed from the _instances dictionaries. Tempfiles, if they exist, will be removed """ from .collection import Collection from .data._data import Chan...
[ "def", "close", "(", "self", ")", ":", "from", ".", "collection", "import", "Collection", "from", ".", "data", ".", "_data", "import", "Channel", ",", "Data", ",", "Variable", "path", "=", "os", ".", "path", ".", "abspath", "(", "self", ".", "filepath"...
Close the file that contains the Group. All groups which are in the file will be closed and removed from the _instances dictionaries. Tempfiles, if they exist, will be removed
[ "Close", "the", "file", "that", "contains", "the", "Group", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_group.py#L272-L314
train
wright-group/WrightTools
WrightTools/_group.py
Group.copy
def copy(self, parent=None, name=None, verbose=True): """Create a copy under parent. All children are copied as well. Parameters ---------- parent : WrightTools Collection (optional) Parent to copy within. If None, copy is created in root of new tempfile...
python
def copy(self, parent=None, name=None, verbose=True): """Create a copy under parent. All children are copied as well. Parameters ---------- parent : WrightTools Collection (optional) Parent to copy within. If None, copy is created in root of new tempfile...
[ "def", "copy", "(", "self", ",", "parent", "=", "None", ",", "name", "=", "None", ",", "verbose", "=", "True", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "natural_name", "if", "parent", "is", "None", ":", "from", ".", "_...
Create a copy under parent. All children are copied as well. Parameters ---------- parent : WrightTools Collection (optional) Parent to copy within. If None, copy is created in root of new tempfile. Default is None. name : string (optional) N...
[ "Create", "a", "copy", "under", "parent", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_group.py#L316-L359
train
wright-group/WrightTools
WrightTools/_group.py
Group.save
def save(self, filepath=None, overwrite=False, verbose=True): """Save as root of a new file. Parameters ---------- filepath : Path-like object (optional) Filepath to write. If None, file is created using natural_name. overwrite : boolean (optional) Toggle...
python
def save(self, filepath=None, overwrite=False, verbose=True): """Save as root of a new file. Parameters ---------- filepath : Path-like object (optional) Filepath to write. If None, file is created using natural_name. overwrite : boolean (optional) Toggle...
[ "def", "save", "(", "self", ",", "filepath", "=", "None", ",", "overwrite", "=", "False", ",", "verbose", "=", "True", ")", ":", "if", "filepath", "is", "None", ":", "filepath", "=", "pathlib", ".", "Path", "(", "\".\"", ")", "/", "self", ".", "nat...
Save as root of a new file. Parameters ---------- filepath : Path-like object (optional) Filepath to write. If None, file is created using natural_name. overwrite : boolean (optional) Toggle overwrite behavior. Default is False. verbose : boolean (optiona...
[ "Save", "as", "root", "of", "a", "new", "file", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_group.py#L365-L409
train
wright-group/WrightTools
WrightTools/data/_jasco.py
from_JASCO
def from_JASCO(filepath, name=None, parent=None, verbose=True) -> Data: """Create a data object from JASCO UV-Vis spectrometers. Parameters ---------- filepath : path-like Path to .txt file. Can be either a local or remote file (http/ftp). Can be compressed with gz/bz2, decompre...
python
def from_JASCO(filepath, name=None, parent=None, verbose=True) -> Data: """Create a data object from JASCO UV-Vis spectrometers. Parameters ---------- filepath : path-like Path to .txt file. Can be either a local or remote file (http/ftp). Can be compressed with gz/bz2, decompre...
[ "def", "from_JASCO", "(", "filepath", ",", "name", "=", "None", ",", "parent", "=", "None", ",", "verbose", "=", "True", ")", "->", "Data", ":", "filestr", "=", "os", ".", "fspath", "(", "filepath", ")", "filepath", "=", "pathlib", ".", "Path", "(", ...
Create a data object from JASCO UV-Vis spectrometers. Parameters ---------- filepath : path-like Path to .txt file. Can be either a local or remote file (http/ftp). Can be compressed with gz/bz2, decompression based on file name. name : string (optional) Name to give to ...
[ "Create", "a", "data", "object", "from", "JASCO", "UV", "-", "Vis", "spectrometers", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_jasco.py#L25-L77
train
wright-group/WrightTools
WrightTools/artists/_colors.py
make_cubehelix
def make_cubehelix(name="WrightTools", gamma=0.5, s=0.25, r=-1, h=1.3, reverse=False, darkest=0.7): """Define cubehelix type colorbars. Look `here`__ for more information. __ http://arxiv.org/abs/1108.5083 Parameters ---------- name : string (optional) Name of new cmap. Default is Wr...
python
def make_cubehelix(name="WrightTools", gamma=0.5, s=0.25, r=-1, h=1.3, reverse=False, darkest=0.7): """Define cubehelix type colorbars. Look `here`__ for more information. __ http://arxiv.org/abs/1108.5083 Parameters ---------- name : string (optional) Name of new cmap. Default is Wr...
[ "def", "make_cubehelix", "(", "name", "=", "\"WrightTools\"", ",", "gamma", "=", "0.5", ",", "s", "=", "0.25", ",", "r", "=", "-", "1", ",", "h", "=", "1.3", ",", "reverse", "=", "False", ",", "darkest", "=", "0.7", ")", ":", "rr", "=", ".213", ...
Define cubehelix type colorbars. Look `here`__ for more information. __ http://arxiv.org/abs/1108.5083 Parameters ---------- name : string (optional) Name of new cmap. Default is WrightTools. gamma : number (optional) Intensity factor. Default is 0.5 s : number (optional)...
[ "Define", "cubehelix", "type", "colorbars", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_colors.py#L32-L94
train
wright-group/WrightTools
WrightTools/artists/_colors.py
make_colormap
def make_colormap(seq, name="CustomMap", plot=False): """Generate a LinearSegmentedColormap. Parameters ---------- seq : list of tuples A sequence of floats and RGB-tuples. The floats should be increasing and in the interval (0,1). name : string (optional) A name for the col...
python
def make_colormap(seq, name="CustomMap", plot=False): """Generate a LinearSegmentedColormap. Parameters ---------- seq : list of tuples A sequence of floats and RGB-tuples. The floats should be increasing and in the interval (0,1). name : string (optional) A name for the col...
[ "def", "make_colormap", "(", "seq", ",", "name", "=", "\"CustomMap\"", ",", "plot", "=", "False", ")", ":", "seq", "=", "[", "(", "None", ",", ")", "*", "3", ",", "0.0", "]", "+", "list", "(", "seq", ")", "+", "[", "1.0", ",", "(", "None", ",...
Generate a LinearSegmentedColormap. Parameters ---------- seq : list of tuples A sequence of floats and RGB-tuples. The floats should be increasing and in the interval (0,1). name : string (optional) A name for the colormap plot : boolean (optional) Use to generate a...
[ "Generate", "a", "LinearSegmentedColormap", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_colors.py#L97-L131
train
wright-group/WrightTools
WrightTools/artists/_colors.py
plot_colormap_components
def plot_colormap_components(cmap): """Plot the components of a given colormap.""" from ._helpers import set_ax_labels # recursive import protection plt.figure(figsize=[8, 4]) gs = grd.GridSpec(3, 1, height_ratios=[1, 10, 1], hspace=0.05) # colorbar ax = plt.subplot(gs[0]) gradient = np.li...
python
def plot_colormap_components(cmap): """Plot the components of a given colormap.""" from ._helpers import set_ax_labels # recursive import protection plt.figure(figsize=[8, 4]) gs = grd.GridSpec(3, 1, height_ratios=[1, 10, 1], hspace=0.05) # colorbar ax = plt.subplot(gs[0]) gradient = np.li...
[ "def", "plot_colormap_components", "(", "cmap", ")", ":", "from", ".", "_helpers", "import", "set_ax_labels", "plt", ".", "figure", "(", "figsize", "=", "[", "8", ",", "4", "]", ")", "gs", "=", "grd", ".", "GridSpec", "(", "3", ",", "1", ",", "height...
Plot the components of a given colormap.
[ "Plot", "the", "components", "of", "a", "given", "colormap", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_colors.py#L194-L233
train