repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.load_distant
def load_distant(self): """Load the distant Zotero data.""" print("Loading distant Zotero data...") self._references = self.get_references() self.reference_types = self.get_reference_types() self.reference_templates = self.get_reference_templates(self.reference_types) pri...
python
def load_distant(self): """Load the distant Zotero data.""" print("Loading distant Zotero data...") self._references = self.get_references() self.reference_types = self.get_reference_types() self.reference_templates = self.get_reference_templates(self.reference_types) pri...
[ "def", "load_distant", "(", "self", ")", ":", "print", "(", "\"Loading distant Zotero data...\"", ")", "self", ".", "_references", "=", "self", ".", "get_references", "(", ")", "self", ".", "reference_types", "=", "self", ".", "get_reference_types", "(", ")", ...
Load the distant Zotero data.
[ "Load", "the", "distant", "Zotero", "data", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L48-L55
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.cache
def cache(self): """Cache the Zotero data.""" with open(self.cache_path, "wb") as f: cache = {self.CACHE_REFERENCE_LIST: self._references, self.CACHE_REFERENCE_TYPES: self.reference_types, self.CACHE_REFERENCE_TEMPLATES: self.reference_templates} ...
python
def cache(self): """Cache the Zotero data.""" with open(self.cache_path, "wb") as f: cache = {self.CACHE_REFERENCE_LIST: self._references, self.CACHE_REFERENCE_TYPES: self.reference_types, self.CACHE_REFERENCE_TEMPLATES: self.reference_templates} ...
[ "def", "cache", "(", "self", ")", ":", "with", "open", "(", "self", ".", "cache_path", ",", "\"wb\"", ")", "as", "f", ":", "cache", "=", "{", "self", ".", "CACHE_REFERENCE_LIST", ":", "self", ".", "_references", ",", "self", ".", "CACHE_REFERENCE_TYPES",...
Cache the Zotero data.
[ "Cache", "the", "Zotero", "data", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L57-L63
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.create_distant_reference
def create_distant_reference(self, ref_data): """Validate and create the reference in Zotero and return the created item.""" self.validate_reference_data(ref_data) creation_status = self._zotero_lib.create_items([ref_data]) try: created_item = creation_status["successful"]["0...
python
def create_distant_reference(self, ref_data): """Validate and create the reference in Zotero and return the created item.""" self.validate_reference_data(ref_data) creation_status = self._zotero_lib.create_items([ref_data]) try: created_item = creation_status["successful"]["0...
[ "def", "create_distant_reference", "(", "self", ",", "ref_data", ")", ":", "self", ".", "validate_reference_data", "(", "ref_data", ")", "creation_status", "=", "self", ".", "_zotero_lib", ".", "create_items", "(", "[", "ref_data", "]", ")", "try", ":", "creat...
Validate and create the reference in Zotero and return the created item.
[ "Validate", "and", "create", "the", "reference", "in", "Zotero", "and", "return", "the", "created", "item", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L70-L79
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.update_local_reference
def update_local_reference(self, index, ref): """Replace the reference in the reference list and cache it.""" self._references[index] = ref self.cache()
python
def update_local_reference(self, index, ref): """Replace the reference in the reference list and cache it.""" self._references[index] = ref self.cache()
[ "def", "update_local_reference", "(", "self", ",", "index", ",", "ref", ")", ":", "self", ".", "_references", "[", "index", "]", "=", "ref", "self", ".", "cache", "(", ")" ]
Replace the reference in the reference list and cache it.
[ "Replace", "the", "reference", "in", "the", "reference", "list", "and", "cache", "it", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L81-L84
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.update_distant_reference
def update_distant_reference(self, ref): """Validate and update the reference in Zotero. Existing fields not present will be left unmodified. """ self.validate_reference_data(ref["data"]) self._zotero_lib.update_item(ref)
python
def update_distant_reference(self, ref): """Validate and update the reference in Zotero. Existing fields not present will be left unmodified. """ self.validate_reference_data(ref["data"]) self._zotero_lib.update_item(ref)
[ "def", "update_distant_reference", "(", "self", ",", "ref", ")", ":", "self", ".", "validate_reference_data", "(", "ref", "[", "\"data\"", "]", ")", "self", ".", "_zotero_lib", ".", "update_item", "(", "ref", ")" ]
Validate and update the reference in Zotero. Existing fields not present will be left unmodified.
[ "Validate", "and", "update", "the", "reference", "in", "Zotero", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L86-L92
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.validate_reference_data
def validate_reference_data(self, ref_data): """Validate the reference data. Zotero.check_items() caches data after the first API call. """ try: self._zotero_lib.check_items([ref_data]) except InvalidItemFields as e: raise InvalidZoteroItemError from e
python
def validate_reference_data(self, ref_data): """Validate the reference data. Zotero.check_items() caches data after the first API call. """ try: self._zotero_lib.check_items([ref_data]) except InvalidItemFields as e: raise InvalidZoteroItemError from e
[ "def", "validate_reference_data", "(", "self", ",", "ref_data", ")", ":", "try", ":", "self", ".", "_zotero_lib", ".", "check_items", "(", "[", "ref_data", "]", ")", "except", "InvalidItemFields", "as", "e", ":", "raise", "InvalidZoteroItemError", "from", "e" ...
Validate the reference data. Zotero.check_items() caches data after the first API call.
[ "Validate", "the", "reference", "data", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L94-L102
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.get_reference_types
def get_reference_types(self): """Return the reference types. Zotero.item_types() caches data after the first API call. """ item_types = self._zotero_lib.item_types() return sorted([x["itemType"] for x in item_types])
python
def get_reference_types(self): """Return the reference types. Zotero.item_types() caches data after the first API call. """ item_types = self._zotero_lib.item_types() return sorted([x["itemType"] for x in item_types])
[ "def", "get_reference_types", "(", "self", ")", ":", "item_types", "=", "self", ".", "_zotero_lib", ".", "item_types", "(", ")", "return", "sorted", "(", "[", "x", "[", "\"itemType\"", "]", "for", "x", "in", "item_types", "]", ")" ]
Return the reference types. Zotero.item_types() caches data after the first API call.
[ "Return", "the", "reference", "types", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L108-L114
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.get_reference_templates
def get_reference_templates(self, ref_types): """Return the reference templates for the types as an ordered dictionary.""" return OrderedDict([(x, self.get_reference_template(x)) for x in ref_types])
python
def get_reference_templates(self, ref_types): """Return the reference templates for the types as an ordered dictionary.""" return OrderedDict([(x, self.get_reference_template(x)) for x in ref_types])
[ "def", "get_reference_templates", "(", "self", ",", "ref_types", ")", ":", "return", "OrderedDict", "(", "[", "(", "x", ",", "self", ".", "get_reference_template", "(", "x", ")", ")", "for", "x", "in", "ref_types", "]", ")" ]
Return the reference templates for the types as an ordered dictionary.
[ "Return", "the", "reference", "templates", "for", "the", "types", "as", "an", "ordered", "dictionary", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L116-L118
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.get_reference_template
def get_reference_template(self, ref_type): """Return the reference template for the type as an ordered dictionary. Zotero.item_template() caches data after the first API call. """ template = self._zotero_lib.item_template(ref_type) return OrderedDict(sorted(template.items(), ke...
python
def get_reference_template(self, ref_type): """Return the reference template for the type as an ordered dictionary. Zotero.item_template() caches data after the first API call. """ template = self._zotero_lib.item_template(ref_type) return OrderedDict(sorted(template.items(), ke...
[ "def", "get_reference_template", "(", "self", ",", "ref_type", ")", ":", "template", "=", "self", ".", "_zotero_lib", ".", "item_template", "(", "ref_type", ")", "return", "OrderedDict", "(", "sorted", "(", "template", ".", "items", "(", ")", ",", "key", "...
Return the reference template for the type as an ordered dictionary. Zotero.item_template() caches data after the first API call.
[ "Return", "the", "reference", "template", "for", "the", "type", "as", "an", "ordered", "dictionary", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L120-L126
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_extra_field
def reference_extra_field(self, field, index): """Return the value of the field in 'extra', otherwise ''.""" ref_data = self.reference_data(index) extra_fields = ref_data["extra"].split("\n") field_id = field + ":" matched = next((x for x in extra_fields if x.startswith(field_id)...
python
def reference_extra_field(self, field, index): """Return the value of the field in 'extra', otherwise ''.""" ref_data = self.reference_data(index) extra_fields = ref_data["extra"].split("\n") field_id = field + ":" matched = next((x for x in extra_fields if x.startswith(field_id)...
[ "def", "reference_extra_field", "(", "self", ",", "field", ",", "index", ")", ":", "ref_data", "=", "self", ".", "reference_data", "(", "index", ")", "extra_fields", "=", "ref_data", "[", "\"extra\"", "]", ".", "split", "(", "\"\\n\"", ")", "field_id", "="...
Return the value of the field in 'extra', otherwise ''.
[ "Return", "the", "value", "of", "the", "field", "in", "extra", "otherwise", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L142-L151
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_id
def reference_id(self, index): """Return the reference ID (locally defined).""" # TODO Include ISBN and ISSN? doi = self.reference_doi(index) if doi: return doi else: pmid = self.reference_pmid(index) if pmid: return "PMID_" + p...
python
def reference_id(self, index): """Return the reference ID (locally defined).""" # TODO Include ISBN and ISSN? doi = self.reference_doi(index) if doi: return doi else: pmid = self.reference_pmid(index) if pmid: return "PMID_" + p...
[ "def", "reference_id", "(", "self", ",", "index", ")", ":", "# TODO Include ISBN and ISSN?", "doi", "=", "self", ".", "reference_doi", "(", "index", ")", "if", "doi", ":", "return", "doi", "else", ":", "pmid", "=", "self", ".", "reference_pmid", "(", "inde...
Return the reference ID (locally defined).
[ "Return", "the", "reference", "ID", "(", "locally", "defined", ")", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L161-L175
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_doi
def reference_doi(self, index): """Return the reference DOI.""" return self.reference_data(index).get("DOI", self.reference_extra_field("DOI", index))
python
def reference_doi(self, index): """Return the reference DOI.""" return self.reference_data(index).get("DOI", self.reference_extra_field("DOI", index))
[ "def", "reference_doi", "(", "self", ",", "index", ")", ":", "return", "self", ".", "reference_data", "(", "index", ")", ".", "get", "(", "\"DOI\"", ",", "self", ".", "reference_extra_field", "(", "\"DOI\"", ",", "index", ")", ")" ]
Return the reference DOI.
[ "Return", "the", "reference", "DOI", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L177-L179
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_creator_surnames
def reference_creator_surnames(self, index): """Return as a list the surnames of the reference creators (locally defined).""" # TODO Not true, ex: ISBN 978-1-4398-3778-8. Return all creator types? # Academic books published as a collection of chapters contributed by # different authors h...
python
def reference_creator_surnames(self, index): """Return as a list the surnames of the reference creators (locally defined).""" # TODO Not true, ex: ISBN 978-1-4398-3778-8. Return all creator types? # Academic books published as a collection of chapters contributed by # different authors h...
[ "def", "reference_creator_surnames", "(", "self", ",", "index", ")", ":", "# TODO Not true, ex: ISBN 978-1-4398-3778-8. Return all creator types?", "# Academic books published as a collection of chapters contributed by", "# different authors have editors but not authors at the level of the", "...
Return as a list the surnames of the reference creators (locally defined).
[ "Return", "as", "a", "list", "the", "surnames", "of", "the", "reference", "creators", "(", "locally", "defined", ")", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L193-L208
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_year
def reference_year(self, index): """Return the reference publication year.""" # TODO Use meta:parsedDate field instead? ref_date = self.reference_date(index) try: # NB: datetime.year returns an int. return parse(ref_date).year except ValueError: ...
python
def reference_year(self, index): """Return the reference publication year.""" # TODO Use meta:parsedDate field instead? ref_date = self.reference_date(index) try: # NB: datetime.year returns an int. return parse(ref_date).year except ValueError: ...
[ "def", "reference_year", "(", "self", ",", "index", ")", ":", "# TODO Use meta:parsedDate field instead?", "ref_date", "=", "self", ".", "reference_date", "(", "index", ")", "try", ":", "# NB: datetime.year returns an int.", "return", "parse", "(", "ref_date", ")", ...
Return the reference publication year.
[ "Return", "the", "reference", "publication", "year", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L219-L231
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_journal
def reference_journal(self, index): """Return the reference journal name.""" # TODO Change the column name 'Journal' to an other? ref_type = self.reference_type(index) if ref_type == "journalArticle": return self.reference_data(index)["publicationTitle"] else: ...
python
def reference_journal(self, index): """Return the reference journal name.""" # TODO Change the column name 'Journal' to an other? ref_type = self.reference_type(index) if ref_type == "journalArticle": return self.reference_data(index)["publicationTitle"] else: ...
[ "def", "reference_journal", "(", "self", ",", "index", ")", ":", "# TODO Change the column name 'Journal' to an other?", "ref_type", "=", "self", ".", "reference_type", "(", "index", ")", "if", "ref_type", "==", "\"journalArticle\"", ":", "return", "self", ".", "ref...
Return the reference journal name.
[ "Return", "the", "reference", "journal", "name", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L233-L240
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_index
def reference_index(self, ref_id): """Return the first reference with this ID.""" try: indexes = range(self.reference_count()) return next(i for i in indexes if self.reference_id(i) == ref_id) except StopIteration as e: raise ReferenceNotFoundError("ID: " + re...
python
def reference_index(self, ref_id): """Return the first reference with this ID.""" try: indexes = range(self.reference_count()) return next(i for i in indexes if self.reference_id(i) == ref_id) except StopIteration as e: raise ReferenceNotFoundError("ID: " + re...
[ "def", "reference_index", "(", "self", ",", "ref_id", ")", ":", "try", ":", "indexes", "=", "range", "(", "self", ".", "reference_count", "(", ")", ")", "return", "next", "(", "i", "for", "i", "in", "indexes", "if", "self", ".", "reference_id", "(", ...
Return the first reference with this ID.
[ "Return", "the", "first", "reference", "with", "this", "ID", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L244-L250
BlueBrain/nat
nat/zotero_wrap.py
ZoteroWrap.reference_creators_citation
def reference_creators_citation(self, ref_id): """Return for citation the creator surnames (locally defined) and the publication year.""" # FIXME Delayed refactoring. Use an index instead of an ID. index = self.reference_index(ref_id) creators = self.reference_creator_surnames(index) ...
python
def reference_creators_citation(self, ref_id): """Return for citation the creator surnames (locally defined) and the publication year.""" # FIXME Delayed refactoring. Use an index instead of an ID. index = self.reference_index(ref_id) creators = self.reference_creator_surnames(index) ...
[ "def", "reference_creators_citation", "(", "self", ",", "ref_id", ")", ":", "# FIXME Delayed refactoring. Use an index instead of an ID.", "index", "=", "self", ".", "reference_index", "(", "ref_id", ")", "creators", "=", "self", ".", "reference_creator_surnames", "(", ...
Return for citation the creator surnames (locally defined) and the publication year.
[ "Return", "for", "citation", "the", "creator", "surnames", "(", "locally", "defined", ")", "and", "the", "publication", "year", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L252-L266
BlueBrain/nat
nat/restServer.py
computePDFSimilarity
def computePDFSimilarity(paperId, userPDF): if not isPDFInDb(paperId): return None userPDF.save("temp.pdf") # check_call is blocking check_call(['pdftotext', '-enc', 'UTF-8', "temp.pdf", "temp.txt"]) os.remove("temp.pdf") a = open("temp.txt", 'r').read() b = open(join(dbPath, ...
python
def computePDFSimilarity(paperId, userPDF): if not isPDFInDb(paperId): return None userPDF.save("temp.pdf") # check_call is blocking check_call(['pdftotext', '-enc', 'UTF-8', "temp.pdf", "temp.txt"]) os.remove("temp.pdf") a = open("temp.txt", 'r').read() b = open(join(dbPath, ...
[ "def", "computePDFSimilarity", "(", "paperId", ",", "userPDF", ")", ":", "if", "not", "isPDFInDb", "(", "paperId", ")", ":", "return", "None", "userPDF", ".", "save", "(", "\"temp.pdf\"", ")", "# check_call is blocking", "check_call", "(", "[", "'pdftotext'", ...
remove punctuation, lowercase, stem
[ "remove", "punctuation", "lowercase", "stem" ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/restServer.py#L339-L374
BlueBrain/nat
nat/treeData.py
getChildren
def getChildren(root_id, maxDepth=100, relationshipType="subClassOf", alwaysFetch=False): """ Accessing web-based ontology service is too long, so we cache the information in a pickle file and query the services only if the info has not already been cached. """ childrenDic...
python
def getChildren(root_id, maxDepth=100, relationshipType="subClassOf", alwaysFetch=False): """ Accessing web-based ontology service is too long, so we cache the information in a pickle file and query the services only if the info has not already been cached. """ childrenDic...
[ "def", "getChildren", "(", "root_id", ",", "maxDepth", "=", "100", ",", "relationshipType", "=", "\"subClassOf\"", ",", "alwaysFetch", "=", "False", ")", ":", "childrenDic", "=", "{", "}", "fileName", "=", "os", ".", "path", ".", "join", "(", "os", ".", ...
Accessing web-based ontology service is too long, so we cache the information in a pickle file and query the services only if the info has not already been cached.
[ "Accessing", "web", "-", "based", "ontology", "service", "is", "too", "long", "so", "we", "cache", "the", "information", "in", "a", "pickle", "file", "and", "query", "the", "services", "only", "if", "the", "info", "has", "not", "already", "been", "cached",...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/treeData.py#L53-L146
lablup/backend.ai-common
src/ai/backend/common/plugin.py
install_plugins
def install_plugins(plugins, app, install_type, config): """ Automatically install plugins to the app. :param plugins: List of plugin names to discover and install plugins :param app: Any type of app to install plugins :param install_type: The way to install plugins to app :param config: Config...
python
def install_plugins(plugins, app, install_type, config): """ Automatically install plugins to the app. :param plugins: List of plugin names to discover and install plugins :param app: Any type of app to install plugins :param install_type: The way to install plugins to app :param config: Config...
[ "def", "install_plugins", "(", "plugins", ",", "app", ",", "install_type", ",", "config", ")", ":", "try", ":", "disable_plugins", "=", "config", ".", "disable_plugins", "if", "not", "disable_plugins", ":", "disable_plugins", "=", "[", "]", "except", "Attribut...
Automatically install plugins to the app. :param plugins: List of plugin names to discover and install plugins :param app: Any type of app to install plugins :param install_type: The way to install plugins to app :param config: Config object to initialize plugins :return: You should note that ...
[ "Automatically", "install", "plugins", "to", "the", "app", "." ]
train
https://github.com/lablup/backend.ai-common/blob/20b3a2551ee5bb3b88e7836471bc244a70ad0ae6/src/ai/backend/common/plugin.py#L70-L114
siboles/pyFEBio
febio/MeshDef.py
MeshDef.addElement
def addElement(self,etype='hex8',corners=[-1.0,-1.0,-1.0,1.,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0],name='new_elem'): ''' corners - list of nodal coordinates properly ordered for element type (counter clockwise) ''' lastelm = self.element...
python
def addElement(self,etype='hex8',corners=[-1.0,-1.0,-1.0,1.,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0],name='new_elem'): ''' corners - list of nodal coordinates properly ordered for element type (counter clockwise) ''' lastelm = self.element...
[ "def", "addElement", "(", "self", ",", "etype", "=", "'hex8'", ",", "corners", "=", "[", "-", "1.0", ",", "-", "1.0", ",", "-", "1.0", ",", "1.", ",", "-", "1.0", ",", "-", "1.0", ",", "1.0", ",", "1.0", ",", "-", "1.0", ",", "-", "1.0", ",...
corners - list of nodal coordinates properly ordered for element type (counter clockwise)
[ "corners", "-", "list", "of", "nodal", "coordinates", "properly", "ordered", "for", "element", "type", "(", "counter", "clockwise", ")" ]
train
https://github.com/siboles/pyFEBio/blob/95083a558c34b236ad4e197b558099dc15f9e319/febio/MeshDef.py#L145-L169
BlueBrain/nat
nat/scigraph_client.py
Graph.getEdges
def getEdges(self, type, entail='true', limit=100, skip=0, callback=None, output='application/json'): """ Get nodes connected by an edge type from: /graph/edges/{type} Arguments: type: The type of the edge entail: Should subproperties and equivalent properties be included ...
python
def getEdges(self, type, entail='true', limit=100, skip=0, callback=None, output='application/json'): """ Get nodes connected by an edge type from: /graph/edges/{type} Arguments: type: The type of the edge entail: Should subproperties and equivalent properties be included ...
[ "def", "getEdges", "(", "self", ",", "type", ",", "entail", "=", "'true'", ",", "limit", "=", "100", ",", "skip", "=", "0", ",", "callback", "=", "None", ",", "output", "=", "'application/json'", ")", ":", "kwargs", "=", "{", "'type'", ":", "type", ...
Get nodes connected by an edge type from: /graph/edges/{type} Arguments: type: The type of the edge entail: Should subproperties and equivalent properties be included limit: The number of edges to be returned skip: The number of edges to skip callb...
[ "Get", "nodes", "connected", "by", "an", "edge", "type", "from", ":", "/", "graph", "/", "edges", "/", "{", "type", "}", "Arguments", ":", "type", ":", "The", "type", "of", "the", "edge", "entail", ":", "Should", "subproperties", "and", "equivalent", "...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/scigraph_client.py#L96-L124
BlueBrain/nat
nat/scigraph_client.py
Graph.getNeighbors
def getNeighbors(self, id, depth=1, blankNodes='false', relationshipType=None, direction='BOTH', project='*', callback=None, output='application/json'): """ Get neighbors from: /graph/neighbors/{id} Arguments: id: This ID should be either a CURIE or an IRI depth: How far to t...
python
def getNeighbors(self, id, depth=1, blankNodes='false', relationshipType=None, direction='BOTH', project='*', callback=None, output='application/json'): """ Get neighbors from: /graph/neighbors/{id} Arguments: id: This ID should be either a CURIE or an IRI depth: How far to t...
[ "def", "getNeighbors", "(", "self", ",", "id", ",", "depth", "=", "1", ",", "blankNodes", "=", "'false'", ",", "relationshipType", "=", "None", ",", "direction", "=", "'BOTH'", ",", "project", "=", "'*'", ",", "callback", "=", "None", ",", "output", "=...
Get neighbors from: /graph/neighbors/{id} Arguments: id: This ID should be either a CURIE or an IRI depth: How far to traverse neighbors blankNodes: Traverse blank nodes relationshipType: Which relationship to traverse direction: Which direction to...
[ "Get", "neighbors", "from", ":", "/", "graph", "/", "neighbors", "/", "{", "id", "}", "Arguments", ":", "id", ":", "This", "ID", "should", "be", "either", "a", "CURIE", "or", "an", "IRI", "depth", ":", "How", "far", "to", "traverse", "neighbors", "bl...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/scigraph_client.py#L143-L173
BlueBrain/nat
nat/scigraph_client.py
Analyzer.enrich
def enrich(self, sample, ontologyClass, path, callback=None, output='application/json'): """ Class Enrichment Service from: /analyzer/enrichment Arguments: sample: A list of CURIEs for nodes whose attributes are to be tested for enrichment. For example, a list of genes. ontol...
python
def enrich(self, sample, ontologyClass, path, callback=None, output='application/json'): """ Class Enrichment Service from: /analyzer/enrichment Arguments: sample: A list of CURIEs for nodes whose attributes are to be tested for enrichment. For example, a list of genes. ontol...
[ "def", "enrich", "(", "self", ",", "sample", ",", "ontologyClass", ",", "path", ",", "callback", "=", "None", ",", "output", "=", "'application/json'", ")", ":", "kwargs", "=", "{", "'sample'", ":", "sample", ",", "'ontologyClass'", ":", "ontologyClass", "...
Class Enrichment Service from: /analyzer/enrichment Arguments: sample: A list of CURIEs for nodes whose attributes are to be tested for enrichment. For example, a list of genes. ontologyClass: CURIE for parent ontology class for the attribute to be tested. For example, GO biological ...
[ "Class", "Enrichment", "Service", "from", ":", "/", "analyzer", "/", "enrichment", "Arguments", ":", "sample", ":", "A", "list", "of", "CURIEs", "for", "nodes", "whose", "attributes", "are", "to", "be", "tested", "for", "enrichment", ".", "For", "example", ...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/scigraph_client.py#L286-L304
BlueBrain/nat
nat/scigraph_client.py
Annotations.annotatePost
def annotatePost(self, content, includeCat=None, excludeCat=None, minLength=4, longestOnly='false', includeAbbrev='false', includeAcronym='false', includeNumbers='false', ignoreTag=None, stylesheet=None, scripts=None, targetId=None, targetClass=None): """ Annotate text from: /annotations Arguments: ...
python
def annotatePost(self, content, includeCat=None, excludeCat=None, minLength=4, longestOnly='false', includeAbbrev='false', includeAcronym='false', includeNumbers='false', ignoreTag=None, stylesheet=None, scripts=None, targetId=None, targetClass=None): """ Annotate text from: /annotations Arguments: ...
[ "def", "annotatePost", "(", "self", ",", "content", ",", "includeCat", "=", "None", ",", "excludeCat", "=", "None", ",", "minLength", "=", "4", ",", "longestOnly", "=", "'false'", ",", "includeAbbrev", "=", "'false'", ",", "includeAcronym", "=", "'false'", ...
Annotate text from: /annotations Arguments: content: The content to annotate includeCat: A set of categories to include excludeCat: A set of categories to exclude minLength: The minimum number of characters in annotated entities longestOnly: Should...
[ "Annotate", "text", "from", ":", "/", "annotations", "Arguments", ":", "content", ":", "The", "content", "to", "annotate", "includeCat", ":", "A", "set", "of", "categories", "to", "include", "excludeCat", ":", "A", "set", "of", "categories", "to", "exclude",...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/scigraph_client.py#L399-L422
BlueBrain/nat
nat/scigraph_client.py
Lexical.getPos
def getPos(self, text): """ Tag parts of speech. from: /lexical/pos Arguments: text: The text to tag """ kwargs = {'text':text} kwargs = {k:dumps(v) if type(v) is dict else v for k, v in kwargs.items()} param_rest = self._make_rest('text', **kwargs) ...
python
def getPos(self, text): """ Tag parts of speech. from: /lexical/pos Arguments: text: The text to tag """ kwargs = {'text':text} kwargs = {k:dumps(v) if type(v) is dict else v for k, v in kwargs.items()} param_rest = self._make_rest('text', **kwargs) ...
[ "def", "getPos", "(", "self", ",", "text", ")", ":", "kwargs", "=", "{", "'text'", ":", "text", "}", "kwargs", "=", "{", "k", ":", "dumps", "(", "v", ")", "if", "type", "(", "v", ")", "is", "dict", "else", "v", "for", "k", ",", "v", "in", "...
Tag parts of speech. from: /lexical/pos Arguments: text: The text to tag
[ "Tag", "parts", "of", "speech", ".", "from", ":", "/", "lexical", "/", "pos", "Arguments", ":", "text", ":", "The", "text", "to", "tag" ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/scigraph_client.py#L538-L549
BlueBrain/nat
nat/scigraph_client.py
Vocabulary.findByPrefix
def findByPrefix(self, term, limit=20, searchSynonyms='true', searchAbbreviations='false', searchAcronyms='false', includeDeprecated='false', category=None, prefix=None): """ Find a concept by its prefix from: /vocabulary/autocomplete/{term} Arguments: term: Term prefix to find ...
python
def findByPrefix(self, term, limit=20, searchSynonyms='true', searchAbbreviations='false', searchAcronyms='false', includeDeprecated='false', category=None, prefix=None): """ Find a concept by its prefix from: /vocabulary/autocomplete/{term} Arguments: term: Term prefix to find ...
[ "def", "findByPrefix", "(", "self", ",", "term", ",", "limit", "=", "20", ",", "searchSynonyms", "=", "'true'", ",", "searchAbbreviations", "=", "'false'", ",", "searchAcronyms", "=", "'false'", ",", "includeDeprecated", "=", "'false'", ",", "category", "=", ...
Find a concept by its prefix from: /vocabulary/autocomplete/{term} Arguments: term: Term prefix to find limit: Maximum result count searchSynonyms: Should synonyms be matched searchAbbreviations: Should abbreviations be matched searchAcronyms: Shou...
[ "Find", "a", "concept", "by", "its", "prefix", "from", ":", "/", "vocabulary", "/", "autocomplete", "/", "{", "term", "}", "Arguments", ":", "term", ":", "Term", "prefix", "to", "find", "limit", ":", "Maximum", "result", "count", "searchSynonyms", ":", "...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/scigraph_client.py#L585-L603
RI-imaging/nrefocus
examples/example_helper.py
load_cell
def load_cell(fname="HL60_field.zip"): "Load zip file and return complex field" here = op.dirname(op.abspath(__file__)) data = op.join(here, "data") arc = zipfile.ZipFile(op.join(data, fname)) for f in arc.filelist: with arc.open(f) as fd: if f.filename.count("imag"): ...
python
def load_cell(fname="HL60_field.zip"): "Load zip file and return complex field" here = op.dirname(op.abspath(__file__)) data = op.join(here, "data") arc = zipfile.ZipFile(op.join(data, fname)) for f in arc.filelist: with arc.open(f) as fd: if f.filename.count("imag"): ...
[ "def", "load_cell", "(", "fname", "=", "\"HL60_field.zip\"", ")", ":", "here", "=", "op", ".", "dirname", "(", "op", ".", "abspath", "(", "__file__", ")", ")", "data", "=", "op", ".", "join", "(", "here", ",", "\"data\"", ")", "arc", "=", "zipfile", ...
Load zip file and return complex field
[ "Load", "zip", "file", "and", "return", "complex", "field" ]
train
https://github.com/RI-imaging/nrefocus/blob/ad09aeecace609ab8f9effcb662d2b7d50826080/examples/example_helper.py#L7-L21
rainwoodman/kdcount
kdcount/sphere.py
bootstrap
def bootstrap(nside, rand, nbar, *data): """ This function will bootstrap data based on the sky coverage of rand. It is different from bootstrap in the traditional sense, but for correlation functions it gives the correct answer with less computation. nbar : number density of rand, used to ...
python
def bootstrap(nside, rand, nbar, *data): """ This function will bootstrap data based on the sky coverage of rand. It is different from bootstrap in the traditional sense, but for correlation functions it gives the correct answer with less computation. nbar : number density of rand, used to ...
[ "def", "bootstrap", "(", "nside", ",", "rand", ",", "nbar", ",", "*", "data", ")", ":", "def", "split", "(", "data", ",", "indices", ",", "axis", ")", ":", "\"\"\" This function splits array. It fixes the bug\n in numpy that zero length array are improperly h...
This function will bootstrap data based on the sky coverage of rand. It is different from bootstrap in the traditional sense, but for correlation functions it gives the correct answer with less computation. nbar : number density of rand, used to estimate the effective area of a pixel n...
[ "This", "function", "will", "bootstrap", "data", "based", "on", "the", "sky", "coverage", "of", "rand", ".", "It", "is", "different", "from", "bootstrap", "in", "the", "traditional", "sense", "but", "for", "correlation", "functions", "it", "gives", "the", "c...
train
https://github.com/rainwoodman/kdcount/blob/483548f6d27a4f245cd5d98880b5f4edd6cc8dc1/kdcount/sphere.py#L65-L153
rainwoodman/kdcount
kdcount/sphere.py
ang2pix
def ang2pix(nside, theta, phi): r"""Convert angle :math:`\theta` :math:`\phi` to pixel. This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G """ nside, theta, phi = numpy.lib.stride_tricks.broadcast_arrays(nside, theta, phi) ...
python
def ang2pix(nside, theta, phi): r"""Convert angle :math:`\theta` :math:`\phi` to pixel. This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G """ nside, theta, phi = numpy.lib.stride_tricks.broadcast_arrays(nside, theta, phi) ...
[ "def", "ang2pix", "(", "nside", ",", "theta", ",", "phi", ")", ":", "nside", ",", "theta", ",", "phi", "=", "numpy", ".", "lib", ".", "stride_tricks", ".", "broadcast_arrays", "(", "nside", ",", "theta", ",", "phi", ")", "def", "equatorial", "(", "ns...
r"""Convert angle :math:`\theta` :math:`\phi` to pixel. This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G
[ "r", "Convert", "angle", ":", "math", ":", "\\", "theta", ":", "math", ":", "\\", "phi", "to", "pixel", "." ]
train
https://github.com/rainwoodman/kdcount/blob/483548f6d27a4f245cd5d98880b5f4edd6cc8dc1/kdcount/sphere.py#L167-L219
rainwoodman/kdcount
kdcount/sphere.py
pix2ang
def pix2ang(nside, pix): r"""Convert pixel to angle :math:`\theta` :math:`\phi`. nside and pix are broadcast with numpy rules. Returns: theta, phi This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G """ nside, p...
python
def pix2ang(nside, pix): r"""Convert pixel to angle :math:`\theta` :math:`\phi`. nside and pix are broadcast with numpy rules. Returns: theta, phi This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G """ nside, p...
[ "def", "pix2ang", "(", "nside", ",", "pix", ")", ":", "nside", ",", "pix", "=", "numpy", ".", "lib", ".", "stride_tricks", ".", "broadcast_arrays", "(", "nside", ",", "pix", ")", "ncap", "=", "nside", "*", "(", "nside", "-", "1", ")", "*", "2", "...
r"""Convert pixel to angle :math:`\theta` :math:`\phi`. nside and pix are broadcast with numpy rules. Returns: theta, phi This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G
[ "r", "Convert", "pixel", "to", "angle", ":", "math", ":", "\\", "theta", ":", "math", ":", "\\", "phi", "." ]
train
https://github.com/rainwoodman/kdcount/blob/483548f6d27a4f245cd5d98880b5f4edd6cc8dc1/kdcount/sphere.py#L221-L270
anteater/anteater
anteater/src/get_lists.py
GetLists.load_project_flag_list_file
def load_project_flag_list_file(self, project_exceptions, project): """ Loads project specific lists """ if self.loaded: return exception_file = None for item in project_exceptions: if project in item: exception_file = item.get(project) if ...
python
def load_project_flag_list_file(self, project_exceptions, project): """ Loads project specific lists """ if self.loaded: return exception_file = None for item in project_exceptions: if project in item: exception_file = item.get(project) if ...
[ "def", "load_project_flag_list_file", "(", "self", ",", "project_exceptions", ",", "project", ")", ":", "if", "self", ".", "loaded", ":", "return", "exception_file", "=", "None", "for", "item", "in", "project_exceptions", ":", "if", "project", "in", "item", ":...
Loads project specific lists
[ "Loads", "project", "specific", "lists" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L63-L85
anteater/anteater
anteater/src/get_lists.py
GetLists.binary_hash
def binary_hash(self, project, patch_file): """ Gathers sha256 hashes from binary lists """ global il exception_file = None try: project_exceptions = il.get('project_exceptions') except KeyError: logger.info('project_exceptions missing in %s for %s', ignor...
python
def binary_hash(self, project, patch_file): """ Gathers sha256 hashes from binary lists """ global il exception_file = None try: project_exceptions = il.get('project_exceptions') except KeyError: logger.info('project_exceptions missing in %s for %s', ignor...
[ "def", "binary_hash", "(", "self", ",", "project", ",", "patch_file", ")", ":", "global", "il", "exception_file", "=", "None", "try", ":", "project_exceptions", "=", "il", ".", "get", "(", "'project_exceptions'", ")", "except", "KeyError", ":", "logger", "."...
Gathers sha256 hashes from binary lists
[ "Gathers", "sha256", "hashes", "from", "binary", "lists" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L117-L150
anteater/anteater
anteater/src/get_lists.py
GetLists.file_audit_list
def file_audit_list(self, project): """ Gathers file name lists """ project_list = False self.load_project_flag_list_file(il.get('project_exceptions'), project) try: default_list = set((fl['file_audits']['file_names'])) except KeyError: logger.error('Key E...
python
def file_audit_list(self, project): """ Gathers file name lists """ project_list = False self.load_project_flag_list_file(il.get('project_exceptions'), project) try: default_list = set((fl['file_audits']['file_names'])) except KeyError: logger.error('Key E...
[ "def", "file_audit_list", "(", "self", ",", "project", ")", ":", "project_list", "=", "False", "self", ".", "load_project_flag_list_file", "(", "il", ".", "get", "(", "'project_exceptions'", ")", ",", "project", ")", "try", ":", "default_list", "=", "set", "...
Gathers file name lists
[ "Gathers", "file", "name", "lists" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L152-L175
anteater/anteater
anteater/src/get_lists.py
GetLists.file_content_list
def file_content_list(self, project): """ gathers content strings """ project_list = False self.load_project_flag_list_file(il.get('project_exceptions'), project) try: flag_list = (fl['file_audits']['file_contents']) except KeyError: logger.error('Key Erro...
python
def file_content_list(self, project): """ gathers content strings """ project_list = False self.load_project_flag_list_file(il.get('project_exceptions'), project) try: flag_list = (fl['file_audits']['file_contents']) except KeyError: logger.error('Key Erro...
[ "def", "file_content_list", "(", "self", ",", "project", ")", ":", "project_list", "=", "False", "self", ".", "load_project_flag_list_file", "(", "il", ".", "get", "(", "'project_exceptions'", ")", ",", "project", ")", "try", ":", "flag_list", "=", "(", "fl"...
gathers content strings
[ "gathers", "content", "strings" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L177-L207
anteater/anteater
anteater/src/get_lists.py
GetLists.ignore_directories
def ignore_directories(self, project): """ Gathers a list of directories to ignore """ project_list = False try: ignore_directories = il['ignore_directories'] except KeyError: logger.error('Key Error processing ignore_directories list values') try: ...
python
def ignore_directories(self, project): """ Gathers a list of directories to ignore """ project_list = False try: ignore_directories = il['ignore_directories'] except KeyError: logger.error('Key Error processing ignore_directories list values') try: ...
[ "def", "ignore_directories", "(", "self", ",", "project", ")", ":", "project_list", "=", "False", "try", ":", "ignore_directories", "=", "il", "[", "'ignore_directories'", "]", "except", "KeyError", ":", "logger", ".", "error", "(", "'Key Error processing ignore_d...
Gathers a list of directories to ignore
[ "Gathers", "a", "list", "of", "directories", "to", "ignore" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L209-L232
anteater/anteater
anteater/src/get_lists.py
GetLists.url_ignore
def url_ignore(self, project): """ Gathers a list of URLs to ignore """ project_list = False try: url_ignore = il['url_ignore'] except KeyError: logger.error('Key Error processing url_ignore list values') try: project_exceptions = il.get('proj...
python
def url_ignore(self, project): """ Gathers a list of URLs to ignore """ project_list = False try: url_ignore = il['url_ignore'] except KeyError: logger.error('Key Error processing url_ignore list values') try: project_exceptions = il.get('proj...
[ "def", "url_ignore", "(", "self", ",", "project", ")", ":", "project_list", "=", "False", "try", ":", "url_ignore", "=", "il", "[", "'url_ignore'", "]", "except", "KeyError", ":", "logger", ".", "error", "(", "'Key Error processing url_ignore list values'", ")",...
Gathers a list of URLs to ignore
[ "Gathers", "a", "list", "of", "URLs", "to", "ignore" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L234-L259
anteater/anteater
anteater/src/get_lists.py
GetLists.ip_ignore
def ip_ignore(self, project): """ Gathers a list of URLs to ignore """ project_list = False try: ip_ignore = il['ip_ignore'] except KeyError: logger.error('Key Error processing ip_ignore list values') try: project_exceptions = il.get('project_...
python
def ip_ignore(self, project): """ Gathers a list of URLs to ignore """ project_list = False try: ip_ignore = il['ip_ignore'] except KeyError: logger.error('Key Error processing ip_ignore list values') try: project_exceptions = il.get('project_...
[ "def", "ip_ignore", "(", "self", ",", "project", ")", ":", "project_list", "=", "False", "try", ":", "ip_ignore", "=", "il", "[", "'ip_ignore'", "]", "except", "KeyError", ":", "logger", ".", "error", "(", "'Key Error processing ip_ignore list values'", ")", "...
Gathers a list of URLs to ignore
[ "Gathers", "a", "list", "of", "URLs", "to", "ignore" ]
train
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/get_lists.py#L261-L286
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
download_from_github
def download_from_github(fname, path): """ Download database from GitHub :param fname: file name with extension ('.zip') of the target item :type fname: str :param path: path to save unzipped files :type path: str :return: database folder :rtype: folder """ base_url = 'https://...
python
def download_from_github(fname, path): """ Download database from GitHub :param fname: file name with extension ('.zip') of the target item :type fname: str :param path: path to save unzipped files :type path: str :return: database folder :rtype: folder """ base_url = 'https://...
[ "def", "download_from_github", "(", "fname", ",", "path", ")", ":", "base_url", "=", "'https://github.com/ornlneutronimaging/ImagingReso/blob/master/ImagingReso/reference_data/'", "# Add GitHub junk to the file name for downloading.", "f", "=", "fname", "+", "'?raw=true'", "url", ...
Download database from GitHub :param fname: file name with extension ('.zip') of the target item :type fname: str :param path: path to save unzipped files :type path: str :return: database folder :rtype: folder
[ "Download", "database", "from", "GitHub" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L18-L71
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
get_list_element_from_database
def get_list_element_from_database(database='ENDF_VII'): """return a string array of all the element from the database Parameters: ========== database: string. Name of database Raises: ====== ValueError if database can not be found """ _file_path = os.path.abspath(os.path.dirname(...
python
def get_list_element_from_database(database='ENDF_VII'): """return a string array of all the element from the database Parameters: ========== database: string. Name of database Raises: ====== ValueError if database can not be found """ _file_path = os.path.abspath(os.path.dirname(...
[ "def", "get_list_element_from_database", "(", "database", "=", "'ENDF_VII'", ")", ":", "_file_path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "_ref_data_folder", "=", "os", ".", "path", ".",...
return a string array of all the element from the database Parameters: ========== database: string. Name of database Raises: ====== ValueError if database can not be found
[ "return", "a", "string", "array", "of", "all", "the", "element", "from", "the", "database" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L74-L141
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
is_element_in_database
def is_element_in_database(element='', database='ENDF_VII'): """will try to find the element in the folder (database) specified Parameters: ========== element: string. Name of the element. Not case sensitive database: string (default is 'ENDF_VII'). Name of folder that has the list of elements ...
python
def is_element_in_database(element='', database='ENDF_VII'): """will try to find the element in the folder (database) specified Parameters: ========== element: string. Name of the element. Not case sensitive database: string (default is 'ENDF_VII'). Name of folder that has the list of elements ...
[ "def", "is_element_in_database", "(", "element", "=", "''", ",", "database", "=", "'ENDF_VII'", ")", ":", "if", "element", "==", "''", ":", "return", "False", "list_entry_from_database", "=", "get_list_element_from_database", "(", "database", "=", "database", ")",...
will try to find the element in the folder (database) specified Parameters: ========== element: string. Name of the element. Not case sensitive database: string (default is 'ENDF_VII'). Name of folder that has the list of elements Returns: ======= bool: True if element was found in the dat...
[ "will", "try", "to", "find", "the", "element", "in", "the", "folder", "(", "database", ")", "specified" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L144-L163
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
checking_stack
def checking_stack(stack, database='ENDF_VII'): """This method makes sure that all the elements from the various stacks are in the database and that the thickness has the correct format (float) Parameters: ========== stack: dictionary that defines the various stacks database: string (default is...
python
def checking_stack(stack, database='ENDF_VII'): """This method makes sure that all the elements from the various stacks are in the database and that the thickness has the correct format (float) Parameters: ========== stack: dictionary that defines the various stacks database: string (default is...
[ "def", "checking_stack", "(", "stack", ",", "database", "=", "'ENDF_VII'", ")", ":", "for", "_keys", "in", "stack", ":", "_elements", "=", "stack", "[", "_keys", "]", "[", "'elements'", "]", "for", "_element", "in", "_elements", ":", "if", "not", "is_ele...
This method makes sure that all the elements from the various stacks are in the database and that the thickness has the correct format (float) Parameters: ========== stack: dictionary that defines the various stacks database: string (default is 'ENDF_VII') name of database Raises: ====...
[ "This", "method", "makes", "sure", "that", "all", "the", "elements", "from", "the", "various", "stacks", "are", "in", "the", "database", "and", "that", "the", "thickness", "has", "the", "correct", "format", "(", "float", ")" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L166-L199
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
formula_to_dictionary
def formula_to_dictionary(formula='', thickness=np.NaN, density=np.NaN, database='ENDF_VII'): """create dictionary based on formula given Parameters: =========== formula: string ex: 'AgCo2' ex: 'Ag' thickness: float (in mm) default is np.NaN density: float (in g/cm3) default i...
python
def formula_to_dictionary(formula='', thickness=np.NaN, density=np.NaN, database='ENDF_VII'): """create dictionary based on formula given Parameters: =========== formula: string ex: 'AgCo2' ex: 'Ag' thickness: float (in mm) default is np.NaN density: float (in g/cm3) default i...
[ "def", "formula_to_dictionary", "(", "formula", "=", "''", ",", "thickness", "=", "np", ".", "NaN", ",", "density", "=", "np", ".", "NaN", ",", "database", "=", "'ENDF_VII'", ")", ":", "if", "'.'", "in", "formula", ":", "raise", "ValueError", "(", "\"f...
create dictionary based on formula given Parameters: =========== formula: string ex: 'AgCo2' ex: 'Ag' thickness: float (in mm) default is np.NaN density: float (in g/cm3) default is np.NaN database: string (default is ENDV_VIII). Database where to look for elements Ra...
[ "create", "dictionary", "based", "on", "formula", "given", "Parameters", ":", "===========", "formula", ":", "string", "ex", ":", "AgCo2", "ex", ":", "Ag", "thickness", ":", "float", "(", "in", "mm", ")", "default", "is", "np", ".", "NaN", "density", ":"...
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L202-L261
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
get_isotope_dicts
def get_isotope_dicts(element='', database='ENDF_VII'): """return a dictionary with list of isotopes found in database and name of database files Parameters: =========== element: string. Name of the element ex: 'Ag' database: string (default is ENDF_VII) Returns: ======== ...
python
def get_isotope_dicts(element='', database='ENDF_VII'): """return a dictionary with list of isotopes found in database and name of database files Parameters: =========== element: string. Name of the element ex: 'Ag' database: string (default is ENDF_VII) Returns: ======== ...
[ "def", "get_isotope_dicts", "(", "element", "=", "''", ",", "database", "=", "'ENDF_VII'", ")", ":", "_file_path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "_database_folder", "=", "os", ...
return a dictionary with list of isotopes found in database and name of database files Parameters: =========== element: string. Name of the element ex: 'Ag' database: string (default is ENDF_VII) Returns: ======== dictionary with isotopes and files ex: {'Ag': {'isotope...
[ "return", "a", "dictionary", "with", "list", "of", "isotopes", "found", "in", "database", "and", "name", "of", "database", "files", "Parameters", ":", "===========", "element", ":", "string", ".", "Name", "of", "the", "element", "ex", ":", "Ag", "database", ...
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L264-L347
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
get_database_data
def get_database_data(file_name=''): """return the energy (eV) and Sigma (barn) from the file_name Parameters: =========== file_name: string ('' by default) name of csv file Returns: ======== pandas dataframe Raises: ======= IOError if file does not exist """ ...
python
def get_database_data(file_name=''): """return the energy (eV) and Sigma (barn) from the file_name Parameters: =========== file_name: string ('' by default) name of csv file Returns: ======== pandas dataframe Raises: ======= IOError if file does not exist """ ...
[ "def", "get_database_data", "(", "file_name", "=", "''", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "file_name", ")", ":", "raise", "IOError", "(", "\"File {} does not exist!\"", ".", "format", "(", "file_name", ")", ")", "df", "=", "p...
return the energy (eV) and Sigma (barn) from the file_name Parameters: =========== file_name: string ('' by default) name of csv file Returns: ======== pandas dataframe Raises: ======= IOError if file does not exist
[ "return", "the", "energy", "(", "eV", ")", "and", "Sigma", "(", "barn", ")", "from", "the", "file_name", "Parameters", ":", "===========", "file_name", ":", "string", "(", "by", "default", ")", "name", "of", "csv", "file", "Returns", ":", "========", "pa...
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L413-L431
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
get_interpolated_data
def get_interpolated_data(df: pd.DataFrame, e_min=np.nan, e_max=np.nan, e_step=np.nan): """return the interpolated x and y axis for the given x range [e_min, e_max] with step defined :param df: input data frame :type df: pandas.DataFrame :param e_min: left energy range in eV of new interpolated data ...
python
def get_interpolated_data(df: pd.DataFrame, e_min=np.nan, e_max=np.nan, e_step=np.nan): """return the interpolated x and y axis for the given x range [e_min, e_max] with step defined :param df: input data frame :type df: pandas.DataFrame :param e_min: left energy range in eV of new interpolated data ...
[ "def", "get_interpolated_data", "(", "df", ":", "pd", ".", "DataFrame", ",", "e_min", "=", "np", ".", "nan", ",", "e_max", "=", "np", ".", "nan", ",", "e_step", "=", "np", ".", "nan", ")", ":", "nbr_point", "=", "int", "(", "(", "e_max", "-", "e_...
return the interpolated x and y axis for the given x range [e_min, e_max] with step defined :param df: input data frame :type df: pandas.DataFrame :param e_min: left energy range in eV of new interpolated data :type e_min: float :param e_max: right energy range in eV of new interpolated data :t...
[ "return", "the", "interpolated", "x", "and", "y", "axis", "for", "the", "given", "x", "range", "[", "e_min", "e_max", "]", "with", "step", "defined" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L434-L454
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
get_sigma
def get_sigma(database_file_name='', e_min=np.NaN, e_max=np.NaN, e_step=np.NaN, t_kelvin=None): """retrieve the Energy and sigma axis for the given isotope :param database_file_name: path/to/file with extension :type database_file_name: string :param e_min: left energy range in eV of new interpolated d...
python
def get_sigma(database_file_name='', e_min=np.NaN, e_max=np.NaN, e_step=np.NaN, t_kelvin=None): """retrieve the Energy and sigma axis for the given isotope :param database_file_name: path/to/file with extension :type database_file_name: string :param e_min: left energy range in eV of new interpolated d...
[ "def", "get_sigma", "(", "database_file_name", "=", "''", ",", "e_min", "=", "np", ".", "NaN", ",", "e_max", "=", "np", ".", "NaN", ",", "e_step", "=", "np", ".", "NaN", ",", "t_kelvin", "=", "None", ")", ":", "file_extension", "=", "os", ".", "pat...
retrieve the Energy and sigma axis for the given isotope :param database_file_name: path/to/file with extension :type database_file_name: string :param e_min: left energy range in eV of new interpolated data :type e_min: float :param e_max: right energy range in eV of new interpolated data :typ...
[ "retrieve", "the", "Energy", "and", "sigma", "axis", "for", "the", "given", "isotope" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L457-L488
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
get_atoms_per_cm3_of_layer
def get_atoms_per_cm3_of_layer(compound_dict: dict): """ calculate the atoms per cm3 of the given compound (layer) :param compound_dict: compound infomation to pass :type compound_dict: dict :return: molar mass and atom density for layer :rtype: float """ # atoms_per_cm3 = {} _list_...
python
def get_atoms_per_cm3_of_layer(compound_dict: dict): """ calculate the atoms per cm3 of the given compound (layer) :param compound_dict: compound infomation to pass :type compound_dict: dict :return: molar mass and atom density for layer :rtype: float """ # atoms_per_cm3 = {} _list_...
[ "def", "get_atoms_per_cm3_of_layer", "(", "compound_dict", ":", "dict", ")", ":", "# atoms_per_cm3 = {}", "_list_of_elements", "=", "compound_dict", "[", "'elements'", "]", "_stoichiometric_list", "=", "compound_dict", "[", "'stoichiometric_ratio'", "]", "_element_stoichio"...
calculate the atoms per cm3 of the given compound (layer) :param compound_dict: compound infomation to pass :type compound_dict: dict :return: molar mass and atom density for layer :rtype: float
[ "calculate", "the", "atoms", "per", "cm3", "of", "the", "given", "compound", "(", "layer", ")", ":", "param", "compound_dict", ":", "compound", "infomation", "to", "pass", ":", "type", "compound_dict", ":", "dict", ":", "return", ":", "molar", "mass", "and...
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L538-L562
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
calculate_linear_attenuation_coefficient
def calculate_linear_attenuation_coefficient(atoms_per_cm3: np.float, sigma_b: np.array): """calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number o...
python
def calculate_linear_attenuation_coefficient(atoms_per_cm3: np.float, sigma_b: np.array): """calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number o...
[ "def", "calculate_linear_attenuation_coefficient", "(", "atoms_per_cm3", ":", "np", ".", "float", ",", "sigma_b", ":", "np", ".", "array", ")", ":", "miu_per_cm", "=", "1e-24", "*", "sigma_b", "*", "atoms_per_cm3", "return", "np", ".", "array", "(", "miu_per_c...
calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number of atoms per cm3 of element/isotope) sigma_b: np.array of sigma retrieved from database R...
[ "calculate", "the", "transmission", "signal", "using", "the", "formula" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L565-L581
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
calculate_trans
def calculate_trans(thickness_cm: np.float, miu_per_cm: np.array): """calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number of atoms per cm3 of elem...
python
def calculate_trans(thickness_cm: np.float, miu_per_cm: np.array): """calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number of atoms per cm3 of elem...
[ "def", "calculate_trans", "(", "thickness_cm", ":", "np", ".", "float", ",", "miu_per_cm", ":", "np", ".", "array", ")", ":", "transmission", "=", "np", ".", "exp", "(", "-", "thickness_cm", "*", "miu_per_cm", ")", "return", "np", ".", "array", "(", "t...
calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number of atoms per cm3 of element/isotope) sigma_b: np.array of sigma retrieved from database R...
[ "calculate", "the", "transmission", "signal", "using", "the", "formula" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L584-L600
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
calculate_transmission
def calculate_transmission(thickness_cm: np.float, atoms_per_cm3: np.float, sigma_b: np.array): """calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: f...
python
def calculate_transmission(thickness_cm: np.float, atoms_per_cm3: np.float, sigma_b: np.array): """calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: f...
[ "def", "calculate_transmission", "(", "thickness_cm", ":", "np", ".", "float", ",", "atoms_per_cm3", ":", "np", ".", "float", ",", "sigma_b", ":", "np", ".", "array", ")", ":", "miu_per_cm", "=", "calculate_linear_attenuation_coefficient", "(", "atoms_per_cm3", ...
calculate the transmission signal using the formula transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b) Parameters: =========== thickness: float (in cm) atoms_per_cm3: float (number of atoms per cm3 of element/isotope) sigma_b: np.array of sigma retrieved from databas...
[ "calculate", "the", "transmission", "signal", "using", "the", "formula", "transmission", "=", "exp", "(", "-", "thickness_cm", "*", "atoms_per_cm3", "*", "1e", "-", "24", "*", "sigma_b", ")", "Parameters", ":", "===========", "thickness", ":", "float", "(", ...
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L603-L620
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
set_distance_units
def set_distance_units(value=np.NaN, from_units='mm', to_units='cm'): """convert distance into new units Parameters: =========== value: float. value to convert from_units: string. Must be 'mm', 'cm' or 'm' to_units: string. must be 'mm','cm' or 'm' Returns: ======== convert...
python
def set_distance_units(value=np.NaN, from_units='mm', to_units='cm'): """convert distance into new units Parameters: =========== value: float. value to convert from_units: string. Must be 'mm', 'cm' or 'm' to_units: string. must be 'mm','cm' or 'm' Returns: ======== convert...
[ "def", "set_distance_units", "(", "value", "=", "np", ".", "NaN", ",", "from_units", "=", "'mm'", ",", "to_units", "=", "'cm'", ")", ":", "if", "from_units", "==", "to_units", ":", "return", "value", "if", "from_units", "==", "'cm'", ":", "if", "to_units...
convert distance into new units Parameters: =========== value: float. value to convert from_units: string. Must be 'mm', 'cm' or 'm' to_units: string. must be 'mm','cm' or 'm' Returns: ======== converted value Raises: ======= ValueError if from_units is not a v...
[ "convert", "distance", "into", "new", "units", "Parameters", ":", "===========", "value", ":", "float", ".", "value", "to", "convert", "from_units", ":", "string", ".", "Must", "be", "mm", "cm", "or", "m", "to_units", ":", "string", ".", "must", "be", "m...
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L623-L668
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
ev_to_s
def ev_to_s(offset_us, source_to_detector_m, array): # delay values is normal 2.99 us with NONE actual MCP delay settings """convert energy (eV) to time (us) Parameters: =========== array: array (in eV) offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source t...
python
def ev_to_s(offset_us, source_to_detector_m, array): # delay values is normal 2.99 us with NONE actual MCP delay settings """convert energy (eV) to time (us) Parameters: =========== array: array (in eV) offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source t...
[ "def", "ev_to_s", "(", "offset_us", ",", "source_to_detector_m", ",", "array", ")", ":", "# delay values is normal 2.99 us with NONE actual MCP delay settings", "# 1000 is used to convert eV to meV", "time_s", "=", "np", ".", "sqrt", "(", "81.787", "/", "(", "array", "*",...
convert energy (eV) to time (us) Parameters: =========== array: array (in eV) offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source to detector in m Returns: ======== time: array in s
[ "convert", "energy", "(", "eV", ")", "to", "time", "(", "us", ")" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L699-L716
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
s_to_ev
def s_to_ev(offset_us, source_to_detector_m, array): """convert time (s) to energy (eV) Parameters: =========== numpy array of time in s offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source to detector in m Returns: ======== numpy array of energy in...
python
def s_to_ev(offset_us, source_to_detector_m, array): """convert time (s) to energy (eV) Parameters: =========== numpy array of time in s offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source to detector in m Returns: ======== numpy array of energy in...
[ "def", "s_to_ev", "(", "offset_us", ",", "source_to_detector_m", ",", "array", ")", ":", "lambda_a", "=", "3956.", "*", "(", "array", "+", "offset_us", "*", "1e-6", ")", "/", "source_to_detector_m", "return", "(", "81.787", "/", "pow", "(", "lambda_a", ","...
convert time (s) to energy (eV) Parameters: =========== numpy array of time in s offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source to detector in m Returns: ======== numpy array of energy in eV
[ "convert", "time", "(", "s", ")", "to", "energy", "(", "eV", ")", "Parameters", ":", "===========", "numpy", "array", "of", "time", "in", "s", "offset_us", ":", "float", ".", "Delay", "of", "detector", "in", "us", "source_to_detector_m", ":", "float", "....
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L719-L732
ornlneutronimaging/ImagingReso
ImagingReso/_utilities.py
ev_to_image_number
def ev_to_image_number(offset_us, source_to_detector_m, time_resolution_us, t_start_us, array): # delay values is normal 2.99 us with NONE actual MCP delay settings """convert energy (eV) to image numbers (#) Parameters: =========== numpy array of energy in eV offset_us: float. Delay of detecto...
python
def ev_to_image_number(offset_us, source_to_detector_m, time_resolution_us, t_start_us, array): # delay values is normal 2.99 us with NONE actual MCP delay settings """convert energy (eV) to image numbers (#) Parameters: =========== numpy array of energy in eV offset_us: float. Delay of detecto...
[ "def", "ev_to_image_number", "(", "offset_us", ",", "source_to_detector_m", ",", "time_resolution_us", ",", "t_start_us", ",", "array", ")", ":", "# delay values is normal 2.99 us with NONE actual MCP delay settings", "time_tot_us", "=", "np", ".", "sqrt", "(", "81.787", ...
convert energy (eV) to image numbers (#) Parameters: =========== numpy array of energy in eV offset_us: float. Delay of detector in us source_to_detector_m: float. Distance source to detector in m Returns: ======== image numbers: array of image number
[ "convert", "energy", "(", "eV", ")", "to", "image", "numbers", "(", "#", ")" ]
train
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/_utilities.py#L767-L784
Numigi/gitoo
src/core.py
temp_repo
def temp_repo(url, branch, commit=''): """ Clone a git repository inside a temporary folder, yield the folder then delete the folder. :param string url: url of the repo to clone. :param string branch: name of the branch to checkout to. :param string commit: Optional commit rev to checkout to. If mentio...
python
def temp_repo(url, branch, commit=''): """ Clone a git repository inside a temporary folder, yield the folder then delete the folder. :param string url: url of the repo to clone. :param string branch: name of the branch to checkout to. :param string commit: Optional commit rev to checkout to. If mentio...
[ "def", "temp_repo", "(", "url", ",", "branch", ",", "commit", "=", "''", ")", ":", "tmp_folder", "=", "tempfile", ".", "mkdtemp", "(", ")", "git", ".", "Repo", ".", "clone_from", "(", "url", ",", "tmp_folder", ",", "branch", "=", "branch", ")", "if",...
Clone a git repository inside a temporary folder, yield the folder then delete the folder. :param string url: url of the repo to clone. :param string branch: name of the branch to checkout to. :param string commit: Optional commit rev to checkout to. If mentioned, that take over the branch :return: yie...
[ "Clone", "a", "git", "repository", "inside", "a", "temporary", "folder", "yield", "the", "folder", "then", "delete", "the", "folder", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L18-L35
Numigi/gitoo
src/core.py
force_move
def force_move(source, destination): """ Force the move of the source inside the destination even if the destination has already a folder with the name inside. In the case, the folder will be replaced. :param string source: path of the source to move. :param string destination: path of the folder to mo...
python
def force_move(source, destination): """ Force the move of the source inside the destination even if the destination has already a folder with the name inside. In the case, the folder will be replaced. :param string source: path of the source to move. :param string destination: path of the folder to mo...
[ "def", "force_move", "(", "source", ",", "destination", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "destination", ")", ":", "raise", "RuntimeError", "(", "'The code could not be moved to {destination} '", "'because the folder does not exist'", ".", ...
Force the move of the source inside the destination even if the destination has already a folder with the name inside. In the case, the folder will be replaced. :param string source: path of the source to move. :param string destination: path of the folder to move the source to.
[ "Force", "the", "move", "of", "the", "source", "inside", "the", "destination", "even", "if", "the", "destination", "has", "already", "a", "folder", "with", "the", "name", "inside", ".", "In", "the", "case", "the", "folder", "will", "be", "replaced", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L38-L54
Numigi/gitoo
src/core.py
_run_command_inside_folder
def _run_command_inside_folder(command, folder): """Run a command inside the given folder. :param string command: the command to execute. :param string folder: the folder where to execute the command. :return: the return code of the process. :rtype: Tuple[int, str] """ logger.debug("command...
python
def _run_command_inside_folder(command, folder): """Run a command inside the given folder. :param string command: the command to execute. :param string folder: the folder where to execute the command. :return: the return code of the process. :rtype: Tuple[int, str] """ logger.debug("command...
[ "def", "_run_command_inside_folder", "(", "command", ",", "folder", ")", ":", "logger", ".", "debug", "(", "\"command: %s\"", ",", "command", ")", "# avoid usage of shell = True", "# see https://docs.openstack.org/bandit/latest/plugins/subprocess_popen_with_shell_equals_true.html",...
Run a command inside the given folder. :param string command: the command to execute. :param string folder: the folder where to execute the command. :return: the return code of the process. :rtype: Tuple[int, str]
[ "Run", "a", "command", "inside", "the", "given", "folder", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L163-L177
Numigi/gitoo
src/core.py
parse_url
def parse_url(url): """ Parse the given url and update it with environment value if required. :param basestring url: :rtype: basestring :raise: KeyError if environment variable is needed but not found. """ # the url has to be a unicode by pystache's design, but the unicode concept has been rewa...
python
def parse_url(url): """ Parse the given url and update it with environment value if required. :param basestring url: :rtype: basestring :raise: KeyError if environment variable is needed but not found. """ # the url has to be a unicode by pystache's design, but the unicode concept has been rewa...
[ "def", "parse_url", "(", "url", ")", ":", "# the url has to be a unicode by pystache's design, but the unicode concept has been rewamped in py3", "# we use a try except to make the code compatible with py2 and py3", "try", ":", "url", "=", "unicode", "(", "url", ")", "except", "Nam...
Parse the given url and update it with environment value if required. :param basestring url: :rtype: basestring :raise: KeyError if environment variable is needed but not found.
[ "Parse", "the", "given", "url", "and", "update", "it", "with", "environment", "value", "if", "required", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L242-L259
Numigi/gitoo
src/core.py
Addon.install
def install(self, destination): """ Install a third party odoo add-on :param string destination: the folder where the add-on should end up at. """ logger.info( "Installing %s@%s to %s", self.repo, self.commit if self.commit else self.branch, destination )...
python
def install(self, destination): """ Install a third party odoo add-on :param string destination: the folder where the add-on should end up at. """ logger.info( "Installing %s@%s to %s", self.repo, self.commit if self.commit else self.branch, destination )...
[ "def", "install", "(", "self", ",", "destination", ")", ":", "logger", ".", "info", "(", "\"Installing %s@%s to %s\"", ",", "self", ".", "repo", ",", "self", ".", "commit", "if", "self", ".", "commit", "else", "self", ".", "branch", ",", "destination", "...
Install a third party odoo add-on :param string destination: the folder where the add-on should end up at.
[ "Install", "a", "third", "party", "odoo", "add", "-", "on" ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L82-L93
Numigi/gitoo
src/core.py
Addon._move_modules
def _move_modules(self, temp_repo, destination): """Move modules froom the temp directory to the destination. :param string temp_repo: the folder containing the code. :param string destination: the folder where the add-on should end up at. """ folders = self._get_module_folders(...
python
def _move_modules(self, temp_repo, destination): """Move modules froom the temp directory to the destination. :param string temp_repo: the folder containing the code. :param string destination: the folder where the add-on should end up at. """ folders = self._get_module_folders(...
[ "def", "_move_modules", "(", "self", ",", "temp_repo", ",", "destination", ")", ":", "folders", "=", "self", ".", "_get_module_folders", "(", "temp_repo", ")", "for", "folder", "in", "folders", ":", "force_move", "(", "folder", ",", "destination", ")" ]
Move modules froom the temp directory to the destination. :param string temp_repo: the folder containing the code. :param string destination: the folder where the add-on should end up at.
[ "Move", "modules", "froom", "the", "temp", "directory", "to", "the", "destination", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L103-L111
Numigi/gitoo
src/core.py
Addon._get_module_folders
def _get_module_folders(self, temp_repo): """Get a list of module paths contained in a temp directory. :param string temp_repo: the folder containing the modules. """ paths = ( os.path.join(temp_repo, path) for path in os.listdir(temp_repo) if self._is_module_inc...
python
def _get_module_folders(self, temp_repo): """Get a list of module paths contained in a temp directory. :param string temp_repo: the folder containing the modules. """ paths = ( os.path.join(temp_repo, path) for path in os.listdir(temp_repo) if self._is_module_inc...
[ "def", "_get_module_folders", "(", "self", ",", "temp_repo", ")", ":", "paths", "=", "(", "os", ".", "path", ".", "join", "(", "temp_repo", ",", "path", ")", "for", "path", "in", "os", ".", "listdir", "(", "temp_repo", ")", "if", "self", ".", "_is_mo...
Get a list of module paths contained in a temp directory. :param string temp_repo: the folder containing the modules.
[ "Get", "a", "list", "of", "module", "paths", "contained", "in", "a", "temp", "directory", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L113-L122
Numigi/gitoo
src/core.py
Addon._is_module_included
def _is_module_included(self, module): """Evaluate if the module must be included in the Odoo addons. :param string module: the name of the module :rtype: bool """ if module in self.exclude_modules: return False if self.include_modules is None: r...
python
def _is_module_included(self, module): """Evaluate if the module must be included in the Odoo addons. :param string module: the name of the module :rtype: bool """ if module in self.exclude_modules: return False if self.include_modules is None: r...
[ "def", "_is_module_included", "(", "self", ",", "module", ")", ":", "if", "module", "in", "self", ".", "exclude_modules", ":", "return", "False", "if", "self", ".", "include_modules", "is", "None", ":", "return", "True", "return", "module", "in", "self", "...
Evaluate if the module must be included in the Odoo addons. :param string module: the name of the module :rtype: bool
[ "Evaluate", "if", "the", "module", "must", "be", "included", "in", "the", "Odoo", "addons", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L124-L136
Numigi/gitoo
src/core.py
Base._move_modules
def _move_modules(self, temp_repo, destination): """Move odoo modules from the temp directory to the destination. This step is different from a standard repository. In the base code of Odoo, the modules are contained in a addons folder at the root of the git repository. However, when de...
python
def _move_modules(self, temp_repo, destination): """Move odoo modules from the temp directory to the destination. This step is different from a standard repository. In the base code of Odoo, the modules are contained in a addons folder at the root of the git repository. However, when de...
[ "def", "_move_modules", "(", "self", ",", "temp_repo", ",", "destination", ")", ":", "tmp_addons", "=", "os", ".", "path", ".", "join", "(", "temp_repo", ",", "'addons'", ")", "tmp_odoo_addons", "=", "os", ".", "path", ".", "join", "(", "temp_repo", ",",...
Move odoo modules from the temp directory to the destination. This step is different from a standard repository. In the base code of Odoo, the modules are contained in a addons folder at the root of the git repository. However, when deploying the application, those modules are placed in...
[ "Move", "odoo", "modules", "from", "the", "temp", "directory", "to", "the", "destination", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L142-L160
Numigi/gitoo
src/core.py
Patch.apply
def apply(self, folder): """ Merge code from the given repo url to the git repo contained in the given folder. :param string folder: path of the folder where is the git repo cloned at. :raise: RuntimeError if the patch could not be applied. """ logger.info("Apply Patch %s@%s (co...
python
def apply(self, folder): """ Merge code from the given repo url to the git repo contained in the given folder. :param string folder: path of the folder where is the git repo cloned at. :raise: RuntimeError if the patch could not be applied. """ logger.info("Apply Patch %s@%s (co...
[ "def", "apply", "(", "self", ",", "folder", ")", ":", "logger", ".", "info", "(", "\"Apply Patch %s@%s (commit %s)\"", ",", "self", ".", "url", ",", "self", ".", "branch", ",", "self", ".", "commit", ")", "remote_name", "=", "'patch'", "commands", "=", "...
Merge code from the given repo url to the git repo contained in the given folder. :param string folder: path of the folder where is the git repo cloned at. :raise: RuntimeError if the patch could not be applied.
[ "Merge", "code", "from", "the", "given", "repo", "url", "to", "the", "git", "repo", "contained", "in", "the", "given", "folder", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L193-L213
Numigi/gitoo
src/core.py
FilePatch.apply
def apply(self, folder): """Apply a patch from a git patch file. :param string folder: path of the folder where is the git repo cloned at. :raise: RuntimeError if the patch could not be applied. """ logger.info("Apply Patch File %s", self.file_path) command = "git apply ...
python
def apply(self, folder): """Apply a patch from a git patch file. :param string folder: path of the folder where is the git repo cloned at. :raise: RuntimeError if the patch could not be applied. """ logger.info("Apply Patch File %s", self.file_path) command = "git apply ...
[ "def", "apply", "(", "self", ",", "folder", ")", ":", "logger", ".", "info", "(", "\"Apply Patch File %s\"", ",", "self", ".", "file_path", ")", "command", "=", "\"git apply {}\"", ".", "format", "(", "self", ".", "file_path", ")", "return_code", ",", "str...
Apply a patch from a git patch file. :param string folder: path of the folder where is the git repo cloned at. :raise: RuntimeError if the patch could not be applied.
[ "Apply", "a", "patch", "from", "a", "git", "patch", "file", "." ]
train
https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L226-L239
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._set_up_context
def _set_up_context(cls): """Create context to keep all needed variables in.""" cls.context = AttributeDict() cls.context.new_meta = {} cls.context.new_transitions = {} cls.context.new_methods = {}
python
def _set_up_context(cls): """Create context to keep all needed variables in.""" cls.context = AttributeDict() cls.context.new_meta = {} cls.context.new_transitions = {} cls.context.new_methods = {}
[ "def", "_set_up_context", "(", "cls", ")", ":", "cls", ".", "context", "=", "AttributeDict", "(", ")", "cls", ".", "context", ".", "new_meta", "=", "{", "}", "cls", ".", "context", ".", "new_transitions", "=", "{", "}", "cls", ".", "context", ".", "n...
Create context to keep all needed variables in.
[ "Create", "context", "to", "keep", "all", "needed", "variables", "in", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L64-L69
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._check_states_enum
def _check_states_enum(cls): """Check if states enum exists and is proper one.""" states_enum_name = cls.context.get_config('states_enum_name') try: cls.context['states_enum'] = getattr( cls.context.new_class, states_enum_name) except AttributeError: ...
python
def _check_states_enum(cls): """Check if states enum exists and is proper one.""" states_enum_name = cls.context.get_config('states_enum_name') try: cls.context['states_enum'] = getattr( cls.context.new_class, states_enum_name) except AttributeError: ...
[ "def", "_check_states_enum", "(", "cls", ")", ":", "states_enum_name", "=", "cls", ".", "context", ".", "get_config", "(", "'states_enum_name'", ")", "try", ":", "cls", ".", "context", "[", "'states_enum'", "]", "=", "getattr", "(", "cls", ".", "context", ...
Check if states enum exists and is proper one.
[ "Check", "if", "states", "enum", "exists", "and", "is", "proper", "one", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L72-L90
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._check_if_states_are_strings
def _check_if_states_are_strings(cls): """Check if all states are strings.""" for item in list(cls.context.states_enum): if not isinstance(item.value, six.string_types): raise ValueError( 'Item {name} is not string. Only strings are allowed.' ...
python
def _check_if_states_are_strings(cls): """Check if all states are strings.""" for item in list(cls.context.states_enum): if not isinstance(item.value, six.string_types): raise ValueError( 'Item {name} is not string. Only strings are allowed.' ...
[ "def", "_check_if_states_are_strings", "(", "cls", ")", ":", "for", "item", "in", "list", "(", "cls", ".", "context", ".", "states_enum", ")", ":", "if", "not", "isinstance", "(", "item", ".", "value", ",", "six", ".", "string_types", ")", ":", "raise", ...
Check if all states are strings.
[ "Check", "if", "all", "states", "are", "strings", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L93-L100
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._check_state_value
def _check_state_value(cls): """Check initial state value - if is proper and translate it. Initial state is required. """ state_value = cls.context.get_config('initial_state', None) state_value = state_value or getattr( cls.context.new_class, cls.context.state_name, ...
python
def _check_state_value(cls): """Check initial state value - if is proper and translate it. Initial state is required. """ state_value = cls.context.get_config('initial_state', None) state_value = state_value or getattr( cls.context.new_class, cls.context.state_name, ...
[ "def", "_check_state_value", "(", "cls", ")", ":", "state_value", "=", "cls", ".", "context", ".", "get_config", "(", "'initial_state'", ",", "None", ")", "state_value", "=", "state_value", "or", "getattr", "(", "cls", ".", "context", ".", "new_class", ",", ...
Check initial state value - if is proper and translate it. Initial state is required.
[ "Check", "initial", "state", "value", "-", "if", "is", "proper", "and", "translate", "it", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L103-L122
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._add_standard_attributes
def _add_standard_attributes(cls): """Add attributes common to all state machines. These are methods for setting and checking state etc. """ setattr( cls.context.new_class, cls.context.new_meta['state_attribute_name'], cls.context.state_value) ...
python
def _add_standard_attributes(cls): """Add attributes common to all state machines. These are methods for setting and checking state etc. """ setattr( cls.context.new_class, cls.context.new_meta['state_attribute_name'], cls.context.state_value) ...
[ "def", "_add_standard_attributes", "(", "cls", ")", ":", "setattr", "(", "cls", ".", "context", ".", "new_class", ",", "cls", ".", "context", ".", "new_meta", "[", "'state_attribute_name'", "]", ",", "cls", ".", "context", ".", "state_value", ")", "setattr",...
Add attributes common to all state machines. These are methods for setting and checking state etc.
[ "Add", "attributes", "common", "to", "all", "state", "machines", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L125-L142
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._generate_standard_transitions
def _generate_standard_transitions(cls): """Generate methods used for transitions.""" allowed_transitions = cls.context.get_config('transitions', {}) for key, transitions in allowed_transitions.items(): key = cls.context.new_meta['translator'].translate(key) new_transiti...
python
def _generate_standard_transitions(cls): """Generate methods used for transitions.""" allowed_transitions = cls.context.get_config('transitions', {}) for key, transitions in allowed_transitions.items(): key = cls.context.new_meta['translator'].translate(key) new_transiti...
[ "def", "_generate_standard_transitions", "(", "cls", ")", ":", "allowed_transitions", "=", "cls", ".", "context", ".", "get_config", "(", "'transitions'", ",", "{", "}", ")", "for", "key", ",", "transitions", "in", "allowed_transitions", ".", "items", "(", ")"...
Generate methods used for transitions.
[ "Generate", "methods", "used", "for", "transitions", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L145-L161
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._generate_standard_methods
def _generate_standard_methods(cls): """Generate standard setters, getters and checkers.""" for state in cls.context.states_enum: getter_name = 'is_{name}'.format(name=state.value) cls.context.new_methods[getter_name] = utils.generate_getter(state) setter_name = 'set...
python
def _generate_standard_methods(cls): """Generate standard setters, getters and checkers.""" for state in cls.context.states_enum: getter_name = 'is_{name}'.format(name=state.value) cls.context.new_methods[getter_name] = utils.generate_getter(state) setter_name = 'set...
[ "def", "_generate_standard_methods", "(", "cls", ")", ":", "for", "state", "in", "cls", ".", "context", ".", "states_enum", ":", "getter_name", "=", "'is_{name}'", ".", "format", "(", "name", "=", "state", ".", "value", ")", "cls", ".", "context", ".", "...
Generate standard setters, getters and checkers.
[ "Generate", "standard", "setters", "getters", "and", "checkers", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L164-L179
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._add_new_methods
def _add_new_methods(cls): """Add all generated methods to result class.""" for name, method in cls.context.new_methods.items(): if hasattr(cls.context.new_class, name): raise ValueError( "Name collision in state machine class - '{name}'." ...
python
def _add_new_methods(cls): """Add all generated methods to result class.""" for name, method in cls.context.new_methods.items(): if hasattr(cls.context.new_class, name): raise ValueError( "Name collision in state machine class - '{name}'." ...
[ "def", "_add_new_methods", "(", "cls", ")", ":", "for", "name", ",", "method", "in", "cls", ".", "context", ".", "new_methods", ".", "items", "(", ")", ":", "if", "hasattr", "(", "cls", ".", "context", ".", "new_class", ",", "name", ")", ":", "raise"...
Add all generated methods to result class.
[ "Add", "all", "generated", "methods", "to", "result", "class", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L235-L244
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._set_complete_option
def _set_complete_option(cls): """Check and set complete option.""" get_config = cls.context.get_config complete = get_config('complete', None) if complete is None: conditions = [ get_config('transitions', False), get_config('named_transitions'...
python
def _set_complete_option(cls): """Check and set complete option.""" get_config = cls.context.get_config complete = get_config('complete', None) if complete is None: conditions = [ get_config('transitions', False), get_config('named_transitions'...
[ "def", "_set_complete_option", "(", "cls", ")", ":", "get_config", "=", "cls", ".", "context", ".", "get_config", "complete", "=", "get_config", "(", "'complete'", ",", "None", ")", "if", "complete", "is", "None", ":", "conditions", "=", "[", "get_config", ...
Check and set complete option.
[ "Check", "and", "set", "complete", "option", "." ]
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L247-L258
BlueBrain/nat
nat/utils.py
data_directory
def data_directory(): """Return the absolute path to the directory containing the package data.""" package_directory = os.path.abspath(os.path.dirname(__file__)) return os.path.join(package_directory, "data")
python
def data_directory(): """Return the absolute path to the directory containing the package data.""" package_directory = os.path.abspath(os.path.dirname(__file__)) return os.path.join(package_directory, "data")
[ "def", "data_directory", "(", ")", ":", "package_directory", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "return", "os", ".", "path", ".", "join", "(", "package_directory", ",", "\"data\"", ...
Return the absolute path to the directory containing the package data.
[ "Return", "the", "absolute", "path", "to", "the", "directory", "containing", "the", "package", "data", "." ]
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/utils.py#L16-L19
ttinies/sc2gameMapRepo
sc2maptool/functions.py
selectMap
def selectMap(name=None, excludeName=False, closestMatch=True, **tags): """select a map by name and/or critiera""" matches = filterMapAttrs(**tags) if not matches: raise c.InvalidMapSelection("could not find any matching maps given criteria: %s"%tags) if name: # if name is specified, consider only the b...
python
def selectMap(name=None, excludeName=False, closestMatch=True, **tags): """select a map by name and/or critiera""" matches = filterMapAttrs(**tags) if not matches: raise c.InvalidMapSelection("could not find any matching maps given criteria: %s"%tags) if name: # if name is specified, consider only the b...
[ "def", "selectMap", "(", "name", "=", "None", ",", "excludeName", "=", "False", ",", "closestMatch", "=", "True", ",", "*", "*", "tags", ")", ":", "matches", "=", "filterMapAttrs", "(", "*", "*", "tags", ")", "if", "not", "matches", ":", "raise", "c"...
select a map by name and/or critiera
[ "select", "a", "map", "by", "name", "and", "/", "or", "critiera" ]
train
https://github.com/ttinies/sc2gameMapRepo/blob/3a215067fae8f86f6a3ffe37272fbd7a5461cfab/sc2maptool/functions.py#L12-L25
ttinies/sc2gameMapRepo
sc2maptool/functions.py
filterMapAttrs
def filterMapAttrs(records=getIndex(), **tags): """matches available maps if their attributes match as specified""" if len(tags) == 0: return records # otherwise if unspecified, all given records match ret = [] for record in records: # attempt to match attributes if matchRecordAttrs(record, tags...
python
def filterMapAttrs(records=getIndex(), **tags): """matches available maps if their attributes match as specified""" if len(tags) == 0: return records # otherwise if unspecified, all given records match ret = [] for record in records: # attempt to match attributes if matchRecordAttrs(record, tags...
[ "def", "filterMapAttrs", "(", "records", "=", "getIndex", "(", ")", ",", "*", "*", "tags", ")", ":", "if", "len", "(", "tags", ")", "==", "0", ":", "return", "records", "# otherwise if unspecified, all given records match", "ret", "=", "[", "]", "for", "re...
matches available maps if their attributes match as specified
[ "matches", "available", "maps", "if", "their", "attributes", "match", "as", "specified" ]
train
https://github.com/ttinies/sc2gameMapRepo/blob/3a215067fae8f86f6a3ffe37272fbd7a5461cfab/sc2maptool/functions.py#L29-L36
ttinies/sc2gameMapRepo
sc2maptool/functions.py
matchRecordAttrs
def matchRecordAttrs(mapobj, attrs): """attempt to match given attributes against a single map object's attributes""" for k,v in iteritems(attrs): try: val = getattr(mapobj, k) except AttributeError: # k isn't an attr of record if bool(v): return False # if k doesn't exist i...
python
def matchRecordAttrs(mapobj, attrs): """attempt to match given attributes against a single map object's attributes""" for k,v in iteritems(attrs): try: val = getattr(mapobj, k) except AttributeError: # k isn't an attr of record if bool(v): return False # if k doesn't exist i...
[ "def", "matchRecordAttrs", "(", "mapobj", ",", "attrs", ")", ":", "for", "k", ",", "v", "in", "iteritems", "(", "attrs", ")", ":", "try", ":", "val", "=", "getattr", "(", "mapobj", ",", "k", ")", "except", "AttributeError", ":", "# k isn't an attr of rec...
attempt to match given attributes against a single map object's attributes
[ "attempt", "to", "match", "given", "attributes", "against", "a", "single", "map", "object", "s", "attributes" ]
train
https://github.com/ttinies/sc2gameMapRepo/blob/3a215067fae8f86f6a3ffe37272fbd7a5461cfab/sc2maptool/functions.py#L40-L48
ttinies/sc2gameMapRepo
sc2maptool/functions.py
filterMapNames
def filterMapNames(regexText, records=getIndex(), excludeRegex=False, closestMatch=True): """matches each record against regexText according to parameters NOTE: the code could be written more simply, but this is loop-optimized to scale better with a large number of map records""" bestScr = 99999 ...
python
def filterMapNames(regexText, records=getIndex(), excludeRegex=False, closestMatch=True): """matches each record against regexText according to parameters NOTE: the code could be written more simply, but this is loop-optimized to scale better with a large number of map records""" bestScr = 99999 ...
[ "def", "filterMapNames", "(", "regexText", ",", "records", "=", "getIndex", "(", ")", ",", "excludeRegex", "=", "False", ",", "closestMatch", "=", "True", ")", ":", "bestScr", "=", "99999", "# a big enough number to not be a valid file system path", "regex", "=", ...
matches each record against regexText according to parameters NOTE: the code could be written more simply, but this is loop-optimized to scale better with a large number of map records
[ "matches", "each", "record", "against", "regexText", "according", "to", "parameters", "NOTE", ":", "the", "code", "could", "be", "written", "more", "simply", "but", "this", "is", "loop", "-", "optimized", "to", "scale", "better", "with", "a", "large", "numbe...
train
https://github.com/ttinies/sc2gameMapRepo/blob/3a215067fae8f86f6a3ffe37272fbd7a5461cfab/sc2maptool/functions.py#L52-L89
rapidpro/expressions
python/temba_expressions/conversions.py
to_boolean
def to_boolean(value, ctx): """ Tries conversion of any value to a boolean """ if isinstance(value, bool): return value elif isinstance(value, int): return value != 0 elif isinstance(value, Decimal): return value != Decimal(0) elif isinstance(value, str): valu...
python
def to_boolean(value, ctx): """ Tries conversion of any value to a boolean """ if isinstance(value, bool): return value elif isinstance(value, int): return value != 0 elif isinstance(value, Decimal): return value != Decimal(0) elif isinstance(value, str): valu...
[ "def", "to_boolean", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "value", "elif", "isinstance", "(", "value", ",", "int", ")", ":", "return", "value", "!=", "0", "elif", "isinstance", "(", "v...
Tries conversion of any value to a boolean
[ "Tries", "conversion", "of", "any", "value", "to", "a", "boolean" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L7-L26
rapidpro/expressions
python/temba_expressions/conversions.py
to_integer
def to_integer(value, ctx): """ Tries conversion of any value to an integer """ if isinstance(value, bool): return 1 if value else 0 elif isinstance(value, int): return value elif isinstance(value, Decimal): try: val = int(value.to_integral_exact(ROUND_HALF_UP...
python
def to_integer(value, ctx): """ Tries conversion of any value to an integer """ if isinstance(value, bool): return 1 if value else 0 elif isinstance(value, int): return value elif isinstance(value, Decimal): try: val = int(value.to_integral_exact(ROUND_HALF_UP...
[ "def", "to_integer", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "1", "if", "value", "else", "0", "elif", "isinstance", "(", "value", ",", "int", ")", ":", "return", "value", "elif", "isinsta...
Tries conversion of any value to an integer
[ "Tries", "conversion", "of", "any", "value", "to", "an", "integer" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L29-L50
rapidpro/expressions
python/temba_expressions/conversions.py
to_decimal
def to_decimal(value, ctx): """ Tries conversion of any value to a decimal """ if isinstance(value, bool): return Decimal(1) if value else Decimal(0) elif isinstance(value, int): return Decimal(value) elif isinstance(value, Decimal): return value elif isinstance(value...
python
def to_decimal(value, ctx): """ Tries conversion of any value to a decimal """ if isinstance(value, bool): return Decimal(1) if value else Decimal(0) elif isinstance(value, int): return Decimal(value) elif isinstance(value, Decimal): return value elif isinstance(value...
[ "def", "to_decimal", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "Decimal", "(", "1", ")", "if", "value", "else", "Decimal", "(", "0", ")", "elif", "isinstance", "(", "value", ",", "int", "...
Tries conversion of any value to a decimal
[ "Tries", "conversion", "of", "any", "value", "to", "a", "decimal" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L53-L69
rapidpro/expressions
python/temba_expressions/conversions.py
to_string
def to_string(value, ctx): """ Tries conversion of any value to a string """ if isinstance(value, bool): return "TRUE" if value else "FALSE" elif isinstance(value, int): return str(value) elif isinstance(value, Decimal): return format_decimal(value) elif isinstance(va...
python
def to_string(value, ctx): """ Tries conversion of any value to a string """ if isinstance(value, bool): return "TRUE" if value else "FALSE" elif isinstance(value, int): return str(value) elif isinstance(value, Decimal): return format_decimal(value) elif isinstance(va...
[ "def", "to_string", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "\"TRUE\"", "if", "value", "else", "\"FALSE\"", "elif", "isinstance", "(", "value", ",", "int", ")", ":", "return", "str", "(", ...
Tries conversion of any value to a string
[ "Tries", "conversion", "of", "any", "value", "to", "a", "string" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L72-L91
rapidpro/expressions
python/temba_expressions/conversions.py
to_date
def to_date(value, ctx): """ Tries conversion of any value to a date """ if isinstance(value, str): temporal = ctx.get_date_parser().auto(value) if temporal is not None: return to_date(temporal, ctx) elif type(value) == datetime.date: return value elif isinsta...
python
def to_date(value, ctx): """ Tries conversion of any value to a date """ if isinstance(value, str): temporal = ctx.get_date_parser().auto(value) if temporal is not None: return to_date(temporal, ctx) elif type(value) == datetime.date: return value elif isinsta...
[ "def", "to_date", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "temporal", "=", "ctx", ".", "get_date_parser", "(", ")", ".", "auto", "(", "value", ")", "if", "temporal", "is", "not", "None", ":", "ret...
Tries conversion of any value to a date
[ "Tries", "conversion", "of", "any", "value", "to", "a", "date" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L94-L107
rapidpro/expressions
python/temba_expressions/conversions.py
to_datetime
def to_datetime(value, ctx): """ Tries conversion of any value to a datetime """ if isinstance(value, str): temporal = ctx.get_date_parser().auto(value) if temporal is not None: return to_datetime(temporal, ctx) elif type(value) == datetime.date: return ctx.timezo...
python
def to_datetime(value, ctx): """ Tries conversion of any value to a datetime """ if isinstance(value, str): temporal = ctx.get_date_parser().auto(value) if temporal is not None: return to_datetime(temporal, ctx) elif type(value) == datetime.date: return ctx.timezo...
[ "def", "to_datetime", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "temporal", "=", "ctx", ".", "get_date_parser", "(", ")", ".", "auto", "(", "value", ")", "if", "temporal", "is", "not", "None", ":", ...
Tries conversion of any value to a datetime
[ "Tries", "conversion", "of", "any", "value", "to", "a", "datetime" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L110-L123
rapidpro/expressions
python/temba_expressions/conversions.py
to_date_or_datetime
def to_date_or_datetime(value, ctx): """ Tries conversion of any value to a date or datetime """ if isinstance(value, str): temporal = ctx.get_date_parser().auto(value) if temporal is not None: return temporal elif type(value) == datetime.date: return value el...
python
def to_date_or_datetime(value, ctx): """ Tries conversion of any value to a date or datetime """ if isinstance(value, str): temporal = ctx.get_date_parser().auto(value) if temporal is not None: return temporal elif type(value) == datetime.date: return value el...
[ "def", "to_date_or_datetime", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "temporal", "=", "ctx", ".", "get_date_parser", "(", ")", ".", "auto", "(", "value", ")", "if", "temporal", "is", "not", "None", ...
Tries conversion of any value to a date or datetime
[ "Tries", "conversion", "of", "any", "value", "to", "a", "date", "or", "datetime" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L126-L139
rapidpro/expressions
python/temba_expressions/conversions.py
to_time
def to_time(value, ctx): """ Tries conversion of any value to a time """ if isinstance(value, str): time = ctx.get_date_parser().time(value) if time is not None: return time elif isinstance(value, datetime.time): return value elif isinstance(value, datetime.da...
python
def to_time(value, ctx): """ Tries conversion of any value to a time """ if isinstance(value, str): time = ctx.get_date_parser().time(value) if time is not None: return time elif isinstance(value, datetime.time): return value elif isinstance(value, datetime.da...
[ "def", "to_time", "(", "value", ",", "ctx", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "time", "=", "ctx", ".", "get_date_parser", "(", ")", ".", "time", "(", "value", ")", "if", "time", "is", "not", "None", ":", "return", ...
Tries conversion of any value to a time
[ "Tries", "conversion", "of", "any", "value", "to", "a", "time" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L142-L155
rapidpro/expressions
python/temba_expressions/conversions.py
to_same
def to_same(value1, value2, ctx): """ Converts a pair of arguments to their most-likely types. This deviates from Excel which doesn't auto convert values but is necessary for us to intuitively handle contact fields which don't use the correct value type """ if type(value1) == type(value2): r...
python
def to_same(value1, value2, ctx): """ Converts a pair of arguments to their most-likely types. This deviates from Excel which doesn't auto convert values but is necessary for us to intuitively handle contact fields which don't use the correct value type """ if type(value1) == type(value2): r...
[ "def", "to_same", "(", "value1", ",", "value2", ",", "ctx", ")", ":", "if", "type", "(", "value1", ")", "==", "type", "(", "value2", ")", ":", "return", "value1", ",", "value2", "try", ":", "# try converting to two decimals", "return", "to_decimal", "(", ...
Converts a pair of arguments to their most-likely types. This deviates from Excel which doesn't auto convert values but is necessary for us to intuitively handle contact fields which don't use the correct value type
[ "Converts", "a", "pair", "of", "arguments", "to", "their", "most", "-", "likely", "types", ".", "This", "deviates", "from", "Excel", "which", "doesn", "t", "auto", "convert", "values", "but", "is", "necessary", "for", "us", "to", "intuitively", "handle", "...
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L158-L184
rapidpro/expressions
python/temba_expressions/conversions.py
to_repr
def to_repr(value, ctx): """ Converts a value back to its representation form, e.g. x -> "x" """ as_string = to_string(value, ctx) if isinstance(value, str) or isinstance(value, datetime.date) or isinstance(value, datetime.time): as_string = as_string.replace('"', '""') # escape quotes by ...
python
def to_repr(value, ctx): """ Converts a value back to its representation form, e.g. x -> "x" """ as_string = to_string(value, ctx) if isinstance(value, str) or isinstance(value, datetime.date) or isinstance(value, datetime.time): as_string = as_string.replace('"', '""') # escape quotes by ...
[ "def", "to_repr", "(", "value", ",", "ctx", ")", ":", "as_string", "=", "to_string", "(", "value", ",", "ctx", ")", "if", "isinstance", "(", "value", ",", "str", ")", "or", "isinstance", "(", "value", ",", "datetime", ".", "date", ")", "or", "isinsta...
Converts a value back to its representation form, e.g. x -> "x"
[ "Converts", "a", "value", "back", "to", "its", "representation", "form", "e", ".", "g", ".", "x", "-", ">", "x" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L187-L197
rapidpro/expressions
python/temba_expressions/conversions.py
format_decimal
def format_decimal(decimal): """ Formats a decimal number :param decimal: the decimal value :return: the formatted string value """ # strip trailing fractional zeros normalized = decimal.normalize() sign, digits, exponent = normalized.as_tuple() if exponent >= 1: normalized =...
python
def format_decimal(decimal): """ Formats a decimal number :param decimal: the decimal value :return: the formatted string value """ # strip trailing fractional zeros normalized = decimal.normalize() sign, digits, exponent = normalized.as_tuple() if exponent >= 1: normalized =...
[ "def", "format_decimal", "(", "decimal", ")", ":", "# strip trailing fractional zeros", "normalized", "=", "decimal", ".", "normalize", "(", ")", "sign", ",", "digits", ",", "exponent", "=", "normalized", ".", "as_tuple", "(", ")", "if", "exponent", ">=", "1",...
Formats a decimal number :param decimal: the decimal value :return: the formatted string value
[ "Formats", "a", "decimal", "number", ":", "param", "decimal", ":", "the", "decimal", "value", ":", "return", ":", "the", "formatted", "string", "value" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L200-L212
lablup/backend.ai-common
src/ai/backend/common/identity.py
is_containerized
def is_containerized() -> bool: ''' Check if I am running inside a Linux container. ''' try: cginfo = Path('/proc/self/cgroup').read_text() if '/docker/' in cginfo or '/lxc/' in cginfo: return True except IOError: return False
python
def is_containerized() -> bool: ''' Check if I am running inside a Linux container. ''' try: cginfo = Path('/proc/self/cgroup').read_text() if '/docker/' in cginfo or '/lxc/' in cginfo: return True except IOError: return False
[ "def", "is_containerized", "(", ")", "->", "bool", ":", "try", ":", "cginfo", "=", "Path", "(", "'/proc/self/cgroup'", ")", ".", "read_text", "(", ")", "if", "'/docker/'", "in", "cginfo", "or", "'/lxc/'", "in", "cginfo", ":", "return", "True", "except", ...
Check if I am running inside a Linux container.
[ "Check", "if", "I", "am", "running", "inside", "a", "Linux", "container", "." ]
train
https://github.com/lablup/backend.ai-common/blob/20b3a2551ee5bb3b88e7836471bc244a70ad0ae6/src/ai/backend/common/identity.py#L24-L33
lablup/backend.ai-common
src/ai/backend/common/identity.py
detect_cloud
def detect_cloud() -> str: ''' Detect the cloud provider where I am running on. ''' # NOTE: Contributions are welcome! # Please add other cloud providers such as Rackspace, IBM BlueMix, etc. if sys.platform.startswith('linux'): # Google Cloud Platform or Amazon AWS (hvm) try: ...
python
def detect_cloud() -> str: ''' Detect the cloud provider where I am running on. ''' # NOTE: Contributions are welcome! # Please add other cloud providers such as Rackspace, IBM BlueMix, etc. if sys.platform.startswith('linux'): # Google Cloud Platform or Amazon AWS (hvm) try: ...
[ "def", "detect_cloud", "(", ")", "->", "str", ":", "# NOTE: Contributions are welcome!", "# Please add other cloud providers such as Rackspace, IBM BlueMix, etc.", "if", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", ":", "# Google Cloud Platform or Amazon AWS ...
Detect the cloud provider where I am running on.
[ "Detect", "the", "cloud", "provider", "where", "I", "am", "running", "on", "." ]
train
https://github.com/lablup/backend.ai-common/blob/20b3a2551ee5bb3b88e7836471bc244a70ad0ae6/src/ai/backend/common/identity.py#L36-L73
siboles/pyFEBio
febio/MatDef.py
MatDef.addBlock
def addBlock(self,branch=None,btype=None,mtype=None,attributes=None): ''' Add block definition to list of blocks in material Order for list entry: branch level (0=root), block type (material,solid,fluid,etc.), matid (integer if root, False otherwise), material name (string if root, F...
python
def addBlock(self,branch=None,btype=None,mtype=None,attributes=None): ''' Add block definition to list of blocks in material Order for list entry: branch level (0=root), block type (material,solid,fluid,etc.), matid (integer if root, False otherwise), material name (string if root, F...
[ "def", "addBlock", "(", "self", ",", "branch", "=", "None", ",", "btype", "=", "None", ",", "mtype", "=", "None", ",", "attributes", "=", "None", ")", ":", "if", "branch", "==", "0", ":", "attributes", "=", "self", ".", "attributes", "blk", "=", "{...
Add block definition to list of blocks in material Order for list entry: branch level (0=root), block type (material,solid,fluid,etc.), matid (integer if root, False otherwise), material name (string if root, False otherwise), material type, dictionary of attributes or False if none
[ "Add", "block", "definition", "to", "list", "of", "blocks", "in", "material", "Order", "for", "list", "entry", ":", "branch", "level", "(", "0", "=", "root", ")", "block", "type", "(", "material", "solid", "fluid", "etc", ".", ")", "matid", "(", "integ...
train
https://github.com/siboles/pyFEBio/blob/95083a558c34b236ad4e197b558099dc15f9e319/febio/MatDef.py#L38-L51
RI-imaging/nrefocus
nrefocus/_propagate.py
refocus
def refocus(field, d, nm, res, method="helmholtz", num_cpus=1, padding=True): """Refocus a 1D or 2D field Parameters ---------- field : 1d or 2d array 1D or 2D background corrected electric field (Ex/BEx) d : float Distance to be propagated in pixels (negative for backwards) nm...
python
def refocus(field, d, nm, res, method="helmholtz", num_cpus=1, padding=True): """Refocus a 1D or 2D field Parameters ---------- field : 1d or 2d array 1D or 2D background corrected electric field (Ex/BEx) d : float Distance to be propagated in pixels (negative for backwards) nm...
[ "def", "refocus", "(", "field", ",", "d", ",", "nm", ",", "res", ",", "method", "=", "\"helmholtz\"", ",", "num_cpus", "=", "1", ",", "padding", "=", "True", ")", ":", "# FFT of field", "fshape", "=", "len", "(", "field", ".", "shape", ")", "assert",...
Refocus a 1D or 2D field Parameters ---------- field : 1d or 2d array 1D or 2D background corrected electric field (Ex/BEx) d : float Distance to be propagated in pixels (negative for backwards) nm : float Refractive index of medium res : float Wavelenth in pixe...
[ "Refocus", "a", "1D", "or", "2D", "field" ]
train
https://github.com/RI-imaging/nrefocus/blob/ad09aeecace609ab8f9effcb662d2b7d50826080/nrefocus/_propagate.py#L12-L69
RI-imaging/nrefocus
nrefocus/_propagate.py
refocus_stack
def refocus_stack(fieldstack, d, nm, res, method="helmholtz", num_cpus=_cpu_count, copy=True, padding=True): """Refocus a stack of 1D or 2D fields Parameters ---------- fieldstack : 2d or 3d array Stack of 1D or 2D background corrected electric fields (Ex/BEx). The fi...
python
def refocus_stack(fieldstack, d, nm, res, method="helmholtz", num_cpus=_cpu_count, copy=True, padding=True): """Refocus a stack of 1D or 2D fields Parameters ---------- fieldstack : 2d or 3d array Stack of 1D or 2D background corrected electric fields (Ex/BEx). The fi...
[ "def", "refocus_stack", "(", "fieldstack", ",", "d", ",", "nm", ",", "res", ",", "method", "=", "\"helmholtz\"", ",", "num_cpus", "=", "_cpu_count", ",", "copy", "=", "True", ",", "padding", "=", "True", ")", ":", "func", "=", "refocus", "names", "=", ...
Refocus a stack of 1D or 2D fields Parameters ---------- fieldstack : 2d or 3d array Stack of 1D or 2D background corrected electric fields (Ex/BEx). The first axis iterates through the individual fields. d : float Distance to be propagated in pixels (negative for backwards) ...
[ "Refocus", "a", "stack", "of", "1D", "or", "2D", "fields" ]
train
https://github.com/RI-imaging/nrefocus/blob/ad09aeecace609ab8f9effcb662d2b7d50826080/nrefocus/_propagate.py#L72-L157
RI-imaging/nrefocus
nrefocus/_propagate.py
fft_propagate
def fft_propagate(fftfield, d, nm, res, method="helmholtz", ret_fft=False): """Propagates a 1D or 2D Fourier transformed field Parameters ---------- fftfield : 1-dimensional or 2-dimensional ndarray Fourier transform of 1D Electric field component d : float Distan...
python
def fft_propagate(fftfield, d, nm, res, method="helmholtz", ret_fft=False): """Propagates a 1D or 2D Fourier transformed field Parameters ---------- fftfield : 1-dimensional or 2-dimensional ndarray Fourier transform of 1D Electric field component d : float Distan...
[ "def", "fft_propagate", "(", "fftfield", ",", "d", ",", "nm", ",", "res", ",", "method", "=", "\"helmholtz\"", ",", "ret_fft", "=", "False", ")", ":", "fshape", "=", "len", "(", "fftfield", ".", "shape", ")", "assert", "fshape", "in", "[", "1", ",", ...
Propagates a 1D or 2D Fourier transformed field Parameters ---------- fftfield : 1-dimensional or 2-dimensional ndarray Fourier transform of 1D Electric field component d : float Distance to be propagated in pixels (negative for backwards) nm : float Refractive index of med...
[ "Propagates", "a", "1D", "or", "2D", "Fourier", "transformed", "field" ]
train
https://github.com/RI-imaging/nrefocus/blob/ad09aeecace609ab8f9effcb662d2b7d50826080/nrefocus/_propagate.py#L160-L207
RI-imaging/nrefocus
nrefocus/_propagate.py
fft_propagate_2d
def fft_propagate_2d(fftfield, d, nm, res, method="helmholtz", ret_fft=False): """Propagate a 1D Fourier transformed field in 2D Parameters ---------- fftfield : 1d array Fourier transform of 1D Electric field component d : float Distance to be propagated in p...
python
def fft_propagate_2d(fftfield, d, nm, res, method="helmholtz", ret_fft=False): """Propagate a 1D Fourier transformed field in 2D Parameters ---------- fftfield : 1d array Fourier transform of 1D Electric field component d : float Distance to be propagated in p...
[ "def", "fft_propagate_2d", "(", "fftfield", ",", "d", ",", "nm", ",", "res", ",", "method", "=", "\"helmholtz\"", ",", "ret_fft", "=", "False", ")", ":", "assert", "len", "(", "fftfield", ".", "shape", ")", "==", "1", ",", "\"Dimension of `fftfield` must b...
Propagate a 1D Fourier transformed field in 2D Parameters ---------- fftfield : 1d array Fourier transform of 1D Electric field component d : float Distance to be propagated in pixels (negative for backwards) nm : float Refractive index of medium res : float Wa...
[ "Propagate", "a", "1D", "Fourier", "transformed", "field", "in", "2D" ]
train
https://github.com/RI-imaging/nrefocus/blob/ad09aeecace609ab8f9effcb662d2b7d50826080/nrefocus/_propagate.py#L210-L265
RI-imaging/nrefocus
nrefocus/_propagate.py
fft_propagate_3d
def fft_propagate_3d(fftfield, d, nm, res, method="helmholtz", ret_fft=False): """Propagate a 2D Fourier transformed field in 3D Parameters ---------- fftfield : 2d array Fourier transform of 2D Electric field component d : float Distance to be propagated in p...
python
def fft_propagate_3d(fftfield, d, nm, res, method="helmholtz", ret_fft=False): """Propagate a 2D Fourier transformed field in 3D Parameters ---------- fftfield : 2d array Fourier transform of 2D Electric field component d : float Distance to be propagated in p...
[ "def", "fft_propagate_3d", "(", "fftfield", ",", "d", ",", "nm", ",", "res", ",", "method", "=", "\"helmholtz\"", ",", "ret_fft", "=", "False", ")", ":", "assert", "len", "(", "fftfield", ".", "shape", ")", "==", "2", ",", "\"Dimension of `fftfield` must b...
Propagate a 2D Fourier transformed field in 3D Parameters ---------- fftfield : 2d array Fourier transform of 2D Electric field component d : float Distance to be propagated in pixels (negative for backwards) nm : float Refractive index of medium res : float Wa...
[ "Propagate", "a", "2D", "Fourier", "transformed", "field", "in", "3D" ]
train
https://github.com/RI-imaging/nrefocus/blob/ad09aeecace609ab8f9effcb662d2b7d50826080/nrefocus/_propagate.py#L268-L326
BlueBrain/nat
nat/gitManager.py
GitManager.push
def push(self): """ Adding the no_thin argument to the GIT push because we had some issues pushing previously. According to http://stackoverflow.com/questions/16586642/git-unpack-error-on-push-to-gerrit#comment42953435_23610917, "a new optimization which causes git to send as little d...
python
def push(self): """ Adding the no_thin argument to the GIT push because we had some issues pushing previously. According to http://stackoverflow.com/questions/16586642/git-unpack-error-on-push-to-gerrit#comment42953435_23610917, "a new optimization which causes git to send as little d...
[ "def", "push", "(", "self", ")", ":", "if", "not", "self", ".", "canRunRemoteCmd", "(", ")", ":", "return", "None", "try", ":", "fetchInfo", "=", "self", ".", "repo", ".", "remotes", ".", "origin", ".", "push", "(", "no_thin", "=", "True", ")", "["...
Adding the no_thin argument to the GIT push because we had some issues pushing previously. According to http://stackoverflow.com/questions/16586642/git-unpack-error-on-push-to-gerrit#comment42953435_23610917, "a new optimization which causes git to send as little data as possible over the network caus...
[ "Adding", "the", "no_thin", "argument", "to", "the", "GIT", "push", "because", "we", "had", "some", "issues", "pushing", "previously", ".", "According", "to", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "16586642", "/", "git", "-...
train
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/gitManager.py#L141-L167