id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
50,600
PixelwarStudio/PyTree
Tree/utils.py
Node.get_node_angle
def get_node_angle(self, node): """Get the angle beetween 2 nodes relative to the horizont. Args: node (object): The other node. Returns: rad: The angle """ return atan2(self.pos[0]-node.pos[0], self.pos[1]-node.pos[1]) - pi / 2
python
def get_node_angle(self, node): """Get the angle beetween 2 nodes relative to the horizont. Args: node (object): The other node. Returns: rad: The angle """ return atan2(self.pos[0]-node.pos[0], self.pos[1]-node.pos[1]) - pi / 2
[ "def", "get_node_angle", "(", "self", ",", "node", ")", ":", "return", "atan2", "(", "self", ".", "pos", "[", "0", "]", "-", "node", ".", "pos", "[", "0", "]", ",", "self", ".", "pos", "[", "1", "]", "-", "node", ".", "pos", "[", "1", "]", ...
Get the angle beetween 2 nodes relative to the horizont. Args: node (object): The other node. Returns: rad: The angle
[ "Get", "the", "angle", "beetween", "2", "nodes", "relative", "to", "the", "horizont", "." ]
f14b25ea145da6b00d836e34251d2a4c823766dc
https://github.com/PixelwarStudio/PyTree/blob/f14b25ea145da6b00d836e34251d2a4c823766dc/Tree/utils.py#L44-L53
50,601
PixelwarStudio/PyTree
Tree/utils.py
Node.get_distance
def get_distance(self, node): """Get the distance beetween 2 nodes Args: node (object): The other node. """ delta = (node.pos[0]-self.pos[0], node.pos[1]-self.pos[1]) return sqrt(delta[0]**2+delta[1]**2)
python
def get_distance(self, node): """Get the distance beetween 2 nodes Args: node (object): The other node. """ delta = (node.pos[0]-self.pos[0], node.pos[1]-self.pos[1]) return sqrt(delta[0]**2+delta[1]**2)
[ "def", "get_distance", "(", "self", ",", "node", ")", ":", "delta", "=", "(", "node", ".", "pos", "[", "0", "]", "-", "self", ".", "pos", "[", "0", "]", ",", "node", ".", "pos", "[", "1", "]", "-", "self", ".", "pos", "[", "1", "]", ")", ...
Get the distance beetween 2 nodes Args: node (object): The other node.
[ "Get", "the", "distance", "beetween", "2", "nodes" ]
f14b25ea145da6b00d836e34251d2a4c823766dc
https://github.com/PixelwarStudio/PyTree/blob/f14b25ea145da6b00d836e34251d2a4c823766dc/Tree/utils.py#L55-L62
50,602
PixelwarStudio/PyTree
Tree/utils.py
Node.move
def move(self, delta): """Move the node. Args: delta (tupel): A tupel, holding the adjustment of the position. """ self.pos = (self.pos[0]+delta[0], self.pos[1]+delta[1])
python
def move(self, delta): """Move the node. Args: delta (tupel): A tupel, holding the adjustment of the position. """ self.pos = (self.pos[0]+delta[0], self.pos[1]+delta[1])
[ "def", "move", "(", "self", ",", "delta", ")", ":", "self", ".", "pos", "=", "(", "self", ".", "pos", "[", "0", "]", "+", "delta", "[", "0", "]", ",", "self", ".", "pos", "[", "1", "]", "+", "delta", "[", "1", "]", ")" ]
Move the node. Args: delta (tupel): A tupel, holding the adjustment of the position.
[ "Move", "the", "node", "." ]
f14b25ea145da6b00d836e34251d2a4c823766dc
https://github.com/PixelwarStudio/PyTree/blob/f14b25ea145da6b00d836e34251d2a4c823766dc/Tree/utils.py#L72-L78
50,603
rosenbrockc/fortpy
fortpy/stats/bp.py
_exec_check_pointers
def _exec_check_pointers(executable): """Checks the specified executable for the pointer condition that not all members of the derived type have had their values set. Returns (list of offending members, parameter name). """ oparams = [] pmembers = {} xassigns = map(lambda x: x.lower().strip...
python
def _exec_check_pointers(executable): """Checks the specified executable for the pointer condition that not all members of the derived type have had their values set. Returns (list of offending members, parameter name). """ oparams = [] pmembers = {} xassigns = map(lambda x: x.lower().strip...
[ "def", "_exec_check_pointers", "(", "executable", ")", ":", "oparams", "=", "[", "]", "pmembers", "=", "{", "}", "xassigns", "=", "map", "(", "lambda", "x", ":", "x", ".", "lower", "(", ")", ".", "strip", "(", ")", ",", "executable", ".", "external_a...
Checks the specified executable for the pointer condition that not all members of the derived type have had their values set. Returns (list of offending members, parameter name).
[ "Checks", "the", "specified", "executable", "for", "the", "pointer", "condition", "that", "not", "all", "members", "of", "the", "derived", "type", "have", "had", "their", "values", "set", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/stats/bp.py#L5-L48
50,604
rosenbrockc/fortpy
fortpy/stats/bp.py
_type_check_pointers
def _type_check_pointers(utype): """Checks the user-derived type for non-nullified pointer array declarations in its base definition. Returns (list of offending members). """ result = [] for mname, member in utype.members.items(): if ("pointer" in member.modifiers and member.D > 0 and ...
python
def _type_check_pointers(utype): """Checks the user-derived type for non-nullified pointer array declarations in its base definition. Returns (list of offending members). """ result = [] for mname, member in utype.members.items(): if ("pointer" in member.modifiers and member.D > 0 and ...
[ "def", "_type_check_pointers", "(", "utype", ")", ":", "result", "=", "[", "]", "for", "mname", ",", "member", "in", "utype", ".", "members", ".", "items", "(", ")", ":", "if", "(", "\"pointer\"", "in", "member", ".", "modifiers", "and", "member", ".",...
Checks the user-derived type for non-nullified pointer array declarations in its base definition. Returns (list of offending members).
[ "Checks", "the", "user", "-", "derived", "type", "for", "non", "-", "nullified", "pointer", "array", "declarations", "in", "its", "base", "definition", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/stats/bp.py#L50-L62
50,605
ptcryan/hydrawiser
hydrawiser/helpers.py
status_schedule
def status_schedule(token): """ Returns the json string from the Hydrawise server after calling statusschedule.php. :param token: The users API token. :type token: string :returns: The response from the controller. If there was an error returns None. :rtype: string or None ...
python
def status_schedule(token): """ Returns the json string from the Hydrawise server after calling statusschedule.php. :param token: The users API token. :type token: string :returns: The response from the controller. If there was an error returns None. :rtype: string or None ...
[ "def", "status_schedule", "(", "token", ")", ":", "url", "=", "'https://app.hydrawise.com/api/v1/statusschedule.php'", "payload", "=", "{", "'api_key'", ":", "token", ",", "'hours'", ":", "168", "}", "get_response", "=", "requests", ".", "get", "(", "url", ",", ...
Returns the json string from the Hydrawise server after calling statusschedule.php. :param token: The users API token. :type token: string :returns: The response from the controller. If there was an error returns None. :rtype: string or None
[ "Returns", "the", "json", "string", "from", "the", "Hydrawise", "server", "after", "calling", "statusschedule", ".", "php", "." ]
53acafb08b5cee0f6628414044b9b9f9a0b15e50
https://github.com/ptcryan/hydrawiser/blob/53acafb08b5cee0f6628414044b9b9f9a0b15e50/hydrawiser/helpers.py#L10-L34
50,606
ptcryan/hydrawiser
hydrawiser/helpers.py
set_zones
def set_zones(token, action, relay=None, time=None): """ Controls the zone relays to turn sprinklers on and off. :param token: The users API token. :type token: string :param action: The action to perform. Available actions are: run, runall, stop, stopall, suspend, and suspendall...
python
def set_zones(token, action, relay=None, time=None): """ Controls the zone relays to turn sprinklers on and off. :param token: The users API token. :type token: string :param action: The action to perform. Available actions are: run, runall, stop, stopall, suspend, and suspendall...
[ "def", "set_zones", "(", "token", ",", "action", ",", "relay", "=", "None", ",", "time", "=", "None", ")", ":", "# Actions must be one from this list.", "action_list", "=", "[", "'run'", ",", "# Run a zone for an amount of time.", "'runall'", ",", "# Run all zones f...
Controls the zone relays to turn sprinklers on and off. :param token: The users API token. :type token: string :param action: The action to perform. Available actions are: run, runall, stop, stopall, suspend, and suspendall. :type action: string :param relay: The zone to take act...
[ "Controls", "the", "zone", "relays", "to", "turn", "sprinklers", "on", "and", "off", "." ]
53acafb08b5cee0f6628414044b9b9f9a0b15e50
https://github.com/ptcryan/hydrawiser/blob/53acafb08b5cee0f6628414044b9b9f9a0b15e50/hydrawiser/helpers.py#L64-L135
50,607
benspaulding/django-faq
faq/admin.py
update_status
def update_status(modeladmin, request, queryset, status): """The workhorse function for the admin action functions that follow.""" # We loop over the objects here rather than use queryset.update() for # two reasons: # # 1. No one should ever be updating zillions of Topics or Questions, so # ...
python
def update_status(modeladmin, request, queryset, status): """The workhorse function for the admin action functions that follow.""" # We loop over the objects here rather than use queryset.update() for # two reasons: # # 1. No one should ever be updating zillions of Topics or Questions, so # ...
[ "def", "update_status", "(", "modeladmin", ",", "request", ",", "queryset", ",", "status", ")", ":", "# We loop over the objects here rather than use queryset.update() for", "# two reasons:", "#", "# 1. No one should ever be updating zillions of Topics or Questions, so", "# perf...
The workhorse function for the admin action functions that follow.
[ "The", "workhorse", "function", "for", "the", "admin", "action", "functions", "that", "follow", "." ]
9a744e7c1943fd05bfa42c84b2ce003367c58e6e
https://github.com/benspaulding/django-faq/blob/9a744e7c1943fd05bfa42c84b2ce003367c58e6e/faq/admin.py#L15-L50
50,608
rosenbrockc/fortpy
fortpy/stats/calltree.py
_exec_callers
def _exec_callers(xinst, result): """Adds the dependency calls from the specified executable instance to the results dictionary. """ for depkey, depval in xinst.dependencies.items(): if depval.target is not None: if depval.target.name in result: if xinst not in result...
python
def _exec_callers(xinst, result): """Adds the dependency calls from the specified executable instance to the results dictionary. """ for depkey, depval in xinst.dependencies.items(): if depval.target is not None: if depval.target.name in result: if xinst not in result...
[ "def", "_exec_callers", "(", "xinst", ",", "result", ")", ":", "for", "depkey", ",", "depval", "in", "xinst", ".", "dependencies", ".", "items", "(", ")", ":", "if", "depval", ".", "target", "is", "not", "None", ":", "if", "depval", ".", "target", "....
Adds the dependency calls from the specified executable instance to the results dictionary.
[ "Adds", "the", "dependency", "calls", "from", "the", "specified", "executable", "instance", "to", "the", "results", "dictionary", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/stats/calltree.py#L8-L21
50,609
rosenbrockc/fortpy
fortpy/stats/calltree.py
_module_callers
def _module_callers(parser, modname, result): """Adds any calls to executables contained in the specified module. """ if modname in result: #We have already processed this module. return module = parser.get(modname) mresult = {} if module is not None: for xname, xins...
python
def _module_callers(parser, modname, result): """Adds any calls to executables contained in the specified module. """ if modname in result: #We have already processed this module. return module = parser.get(modname) mresult = {} if module is not None: for xname, xins...
[ "def", "_module_callers", "(", "parser", ",", "modname", ",", "result", ")", ":", "if", "modname", "in", "result", ":", "#We have already processed this module.", "return", "module", "=", "parser", ".", "get", "(", "modname", ")", "mresult", "=", "{", "}", "...
Adds any calls to executables contained in the specified module.
[ "Adds", "any", "calls", "to", "executables", "contained", "in", "the", "specified", "module", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/stats/calltree.py#L23-L39
50,610
rosenbrockc/fortpy
fortpy/stats/calltree.py
_call_fan
def _call_fan(branch, calls, executable): """Appends a list of callees to the branch for each parent in the call list that calls this executable. """ #Since we don't keep track of the specific logic in the executables #it is possible that we could get a infinite recursion of executables #that ke...
python
def _call_fan(branch, calls, executable): """Appends a list of callees to the branch for each parent in the call list that calls this executable. """ #Since we don't keep track of the specific logic in the executables #it is possible that we could get a infinite recursion of executables #that ke...
[ "def", "_call_fan", "(", "branch", ",", "calls", ",", "executable", ")", ":", "#Since we don't keep track of the specific logic in the executables", "#it is possible that we could get a infinite recursion of executables", "#that keep calling each other.", "if", "executable", "in", "b...
Appends a list of callees to the branch for each parent in the call list that calls this executable.
[ "Appends", "a", "list", "of", "callees", "to", "the", "branch", "for", "each", "parent", "in", "the", "call", "list", "that", "calls", "this", "executable", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/stats/calltree.py#L49-L64
50,611
benspaulding/django-faq
faq/views/normal.py
topic_detail
def topic_detail(request, slug): """ A detail view of a Topic Templates: :template:`faq/topic_detail.html` Context: topic An :model:`faq.Topic` object. question_list A list of all published :model:`faq.Question` objects that relate to the give...
python
def topic_detail(request, slug): """ A detail view of a Topic Templates: :template:`faq/topic_detail.html` Context: topic An :model:`faq.Topic` object. question_list A list of all published :model:`faq.Question` objects that relate to the give...
[ "def", "topic_detail", "(", "request", ",", "slug", ")", ":", "extra_context", "=", "{", "'question_list'", ":", "Question", ".", "objects", ".", "published", "(", ")", ".", "filter", "(", "topic__slug", "=", "slug", ")", ",", "}", "return", "object_detail...
A detail view of a Topic Templates: :template:`faq/topic_detail.html` Context: topic An :model:`faq.Topic` object. question_list A list of all published :model:`faq.Question` objects that relate to the given :model:`faq.Topic`.
[ "A", "detail", "view", "of", "a", "Topic" ]
9a744e7c1943fd05bfa42c84b2ce003367c58e6e
https://github.com/benspaulding/django-faq/blob/9a744e7c1943fd05bfa42c84b2ce003367c58e6e/faq/views/normal.py#L11-L30
50,612
rosenbrockc/fortpy
fortpy/isense/classes.py
BaseDefinition.description
def description(self): """Returns the full docstring information for the element suggested as a completion.""" result = "" if isinstance(self._element, ValueElement): if self._element.kind is not None: result = "{}({}) | {}".format(self._element.dtype, self._...
python
def description(self): """Returns the full docstring information for the element suggested as a completion.""" result = "" if isinstance(self._element, ValueElement): if self._element.kind is not None: result = "{}({}) | {}".format(self._element.dtype, self._...
[ "def", "description", "(", "self", ")", ":", "result", "=", "\"\"", "if", "isinstance", "(", "self", ".", "_element", ",", "ValueElement", ")", ":", "if", "self", ".", "_element", ".", "kind", "is", "not", "None", ":", "result", "=", "\"{}({}) | {}\"", ...
Returns the full docstring information for the element suggested as a completion.
[ "Returns", "the", "full", "docstring", "information", "for", "the", "element", "suggested", "as", "a", "completion", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/classes.py#L62-L82
50,613
rosenbrockc/fortpy
fortpy/isense/classes.py
BaseDefinition.params
def params(self): """ Raises an ``AttributeError``if the definition is not callable. Otherwise returns a list of `ValueElement` that represents the params. """ if self.context.el_type in [Function, Subroutine]: return self.evaluator.element.parameters
python
def params(self): """ Raises an ``AttributeError``if the definition is not callable. Otherwise returns a list of `ValueElement` that represents the params. """ if self.context.el_type in [Function, Subroutine]: return self.evaluator.element.parameters
[ "def", "params", "(", "self", ")", ":", "if", "self", ".", "context", ".", "el_type", "in", "[", "Function", ",", "Subroutine", "]", ":", "return", "self", ".", "evaluator", ".", "element", ".", "parameters" ]
Raises an ``AttributeError``if the definition is not callable. Otherwise returns a list of `ValueElement` that represents the params.
[ "Raises", "an", "AttributeError", "if", "the", "definition", "is", "not", "callable", ".", "Otherwise", "returns", "a", "list", "of", "ValueElement", "that", "represents", "the", "params", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/classes.py#L90-L96
50,614
rosenbrockc/fortpy
fortpy/isense/classes.py
Completion._type_description
def _type_description(self): """Gets the completion description for a TypeExecutable.""" #This is a little tricker because the docstring is housed #inside of the module that contains the actual executable. #These TypeExecutables are just pointers. iexec = self._element.target ...
python
def _type_description(self): """Gets the completion description for a TypeExecutable.""" #This is a little tricker because the docstring is housed #inside of the module that contains the actual executable. #These TypeExecutables are just pointers. iexec = self._element.target ...
[ "def", "_type_description", "(", "self", ")", ":", "#This is a little tricker because the docstring is housed", "#inside of the module that contains the actual executable.", "#These TypeExecutables are just pointers.", "iexec", "=", "self", ".", "_element", ".", "target", "if", "ie...
Gets the completion description for a TypeExecutable.
[ "Gets", "the", "completion", "description", "for", "a", "TypeExecutable", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/classes.py#L155-L165
50,615
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.overwrite_docs
def overwrite_docs(self, doc): """Adds the specified DocElement to the docstring list. However, if an element with the same xml tag and pointsto value already exists, it will be overwritten.""" for i in range(len(self.docstring)): if (self.docstring[i].doctype == doc.doctype ...
python
def overwrite_docs(self, doc): """Adds the specified DocElement to the docstring list. However, if an element with the same xml tag and pointsto value already exists, it will be overwritten.""" for i in range(len(self.docstring)): if (self.docstring[i].doctype == doc.doctype ...
[ "def", "overwrite_docs", "(", "self", ",", "doc", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "docstring", ")", ")", ":", "if", "(", "self", ".", "docstring", "[", "i", "]", ".", "doctype", "==", "doc", ".", "doctype", "and...
Adds the specified DocElement to the docstring list. However, if an element with the same xml tag and pointsto value already exists, it will be overwritten.
[ "Adds", "the", "specified", "DocElement", "to", "the", "docstring", "list", ".", "However", "if", "an", "element", "with", "the", "same", "xml", "tag", "and", "pointsto", "value", "already", "exists", "it", "will", "be", "overwritten", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L42-L52
50,616
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.unpickle_docs
def unpickle_docs(self): """Sets the pointers for the docstrings that have groups.""" for doc in self.docstring: if (doc.parent_name is not None and doc.parent_name in self.groups): doc.group = self.groups[doc.parent_name]
python
def unpickle_docs(self): """Sets the pointers for the docstrings that have groups.""" for doc in self.docstring: if (doc.parent_name is not None and doc.parent_name in self.groups): doc.group = self.groups[doc.parent_name]
[ "def", "unpickle_docs", "(", "self", ")", ":", "for", "doc", "in", "self", ".", "docstring", ":", "if", "(", "doc", ".", "parent_name", "is", "not", "None", "and", "doc", ".", "parent_name", "in", "self", ".", "groups", ")", ":", "doc", ".", "group",...
Sets the pointers for the docstrings that have groups.
[ "Sets", "the", "pointers", "for", "the", "docstrings", "that", "have", "groups", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L74-L79
50,617
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.absstart
def absstart(self): """Returns the absolute start of the element by including docstrings outside of the element definition if applicable.""" if hasattr(self, "docstart") and self.docstart > 0: return self.docstart else: return self.start
python
def absstart(self): """Returns the absolute start of the element by including docstrings outside of the element definition if applicable.""" if hasattr(self, "docstart") and self.docstart > 0: return self.docstart else: return self.start
[ "def", "absstart", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "\"docstart\"", ")", "and", "self", ".", "docstart", ">", "0", ":", "return", "self", ".", "docstart", "else", ":", "return", "self", ".", "start" ]
Returns the absolute start of the element by including docstrings outside of the element definition if applicable.
[ "Returns", "the", "absolute", "start", "of", "the", "element", "by", "including", "docstrings", "outside", "of", "the", "element", "definition", "if", "applicable", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L93-L99
50,618
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.module
def module(self): """Returns the module that this code element belongs to.""" if self._module is None: root = self while self._module is None and root is not None: if isinstance(root, Module): self._module = root else: ...
python
def module(self): """Returns the module that this code element belongs to.""" if self._module is None: root = self while self._module is None and root is not None: if isinstance(root, Module): self._module = root else: ...
[ "def", "module", "(", "self", ")", ":", "if", "self", ".", "_module", "is", "None", ":", "root", "=", "self", "while", "self", ".", "_module", "is", "None", "and", "root", "is", "not", "None", ":", "if", "isinstance", "(", "root", ",", "Module", ")...
Returns the module that this code element belongs to.
[ "Returns", "the", "module", "that", "this", "code", "element", "belongs", "to", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L102-L112
50,619
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.summary
def summary(self): """Returns the docstring summary for the code element if it exists.""" if self._summary is None: self._summary = "No summary for element." for doc in self.docstring: if doc.doctype == "summary": self._summary = doc.contents ...
python
def summary(self): """Returns the docstring summary for the code element if it exists.""" if self._summary is None: self._summary = "No summary for element." for doc in self.docstring: if doc.doctype == "summary": self._summary = doc.contents ...
[ "def", "summary", "(", "self", ")", ":", "if", "self", ".", "_summary", "is", "None", ":", "self", ".", "_summary", "=", "\"No summary for element.\"", "for", "doc", "in", "self", ".", "docstring", ":", "if", "doc", ".", "doctype", "==", "\"summary\"", "...
Returns the docstring summary for the code element if it exists.
[ "Returns", "the", "docstring", "summary", "for", "the", "code", "element", "if", "it", "exists", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L115-L134
50,620
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.full_name
def full_name(self): """Returns the full name of this element by visiting every non-None parent in its ancestor chain.""" if self._full_name is None: ancestors = [ self.name ] current = self.parent while current is not None and type(current).__name__ != "CodeP...
python
def full_name(self): """Returns the full name of this element by visiting every non-None parent in its ancestor chain.""" if self._full_name is None: ancestors = [ self.name ] current = self.parent while current is not None and type(current).__name__ != "CodeP...
[ "def", "full_name", "(", "self", ")", ":", "if", "self", ".", "_full_name", "is", "None", ":", "ancestors", "=", "[", "self", ".", "name", "]", "current", "=", "self", ".", "parent", "while", "current", "is", "not", "None", "and", "type", "(", "curre...
Returns the full name of this element by visiting every non-None parent in its ancestor chain.
[ "Returns", "the", "full", "name", "of", "this", "element", "by", "visiting", "every", "non", "-", "None", "parent", "in", "its", "ancestor", "chain", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L137-L149
50,621
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.doc_children
def doc_children(self, doctype, limiters=[]): """Finds all grand-children of this element's docstrings that match the specified doctype. If 'limiters' is specified, only docstrings with those doctypes are searched. """ result = [] for doc in self.docstring: if...
python
def doc_children(self, doctype, limiters=[]): """Finds all grand-children of this element's docstrings that match the specified doctype. If 'limiters' is specified, only docstrings with those doctypes are searched. """ result = [] for doc in self.docstring: if...
[ "def", "doc_children", "(", "self", ",", "doctype", ",", "limiters", "=", "[", "]", ")", ":", "result", "=", "[", "]", "for", "doc", "in", "self", ".", "docstring", ":", "if", "len", "(", "limiters", ")", "==", "0", "or", "doc", ".", "doctype", "...
Finds all grand-children of this element's docstrings that match the specified doctype. If 'limiters' is specified, only docstrings with those doctypes are searched.
[ "Finds", "all", "grand", "-", "children", "of", "this", "element", "s", "docstrings", "that", "match", "the", "specified", "doctype", ".", "If", "limiters", "is", "specified", "only", "docstrings", "with", "those", "doctypes", "are", "searched", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L181-L191
50,622
rosenbrockc/fortpy
fortpy/elements.py
CodeElement.warn
def warn(self, collection): """Checks this code element for documentation related problems.""" if not self.has_docstring(): collection.append("WARNING: no docstring on code element {}".format(self.name))
python
def warn(self, collection): """Checks this code element for documentation related problems.""" if not self.has_docstring(): collection.append("WARNING: no docstring on code element {}".format(self.name))
[ "def", "warn", "(", "self", ",", "collection", ")", ":", "if", "not", "self", ".", "has_docstring", "(", ")", ":", "collection", ".", "append", "(", "\"WARNING: no docstring on code element {}\"", ".", "format", "(", "self", ".", "name", ")", ")" ]
Checks this code element for documentation related problems.
[ "Checks", "this", "code", "element", "for", "documentation", "related", "problems", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L193-L196
50,623
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.matched
def matched(self, other): """Returns True if the two ValueElement instances differ only by name, default value or some other inconsequential modifier. """ mods = ["allocatable", "pointer"] return (self.kind.lower() == other.kind.lower() and self.dtype.lower() == o...
python
def matched(self, other): """Returns True if the two ValueElement instances differ only by name, default value or some other inconsequential modifier. """ mods = ["allocatable", "pointer"] return (self.kind.lower() == other.kind.lower() and self.dtype.lower() == o...
[ "def", "matched", "(", "self", ",", "other", ")", ":", "mods", "=", "[", "\"allocatable\"", ",", "\"pointer\"", "]", "return", "(", "self", ".", "kind", ".", "lower", "(", ")", "==", "other", ".", "kind", ".", "lower", "(", ")", "and", "self", ".",...
Returns True if the two ValueElement instances differ only by name, default value or some other inconsequential modifier.
[ "Returns", "True", "if", "the", "two", "ValueElement", "instances", "differ", "only", "by", "name", "default", "value", "or", "some", "other", "inconsequential", "modifier", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L235-L243
50,624
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.strtype
def strtype(self): """Returns a string representing the type and kind of this value element.""" if self.kind is not None: return "{}({})".format(self.dtype, self.kind) else: return self.dtype
python
def strtype(self): """Returns a string representing the type and kind of this value element.""" if self.kind is not None: return "{}({})".format(self.dtype, self.kind) else: return self.dtype
[ "def", "strtype", "(", "self", ")", ":", "if", "self", ".", "kind", "is", "not", "None", ":", "return", "\"{}({})\"", ".", "format", "(", "self", ".", "dtype", ",", "self", ".", "kind", ")", "else", ":", "return", "self", ".", "dtype" ]
Returns a string representing the type and kind of this value element.
[ "Returns", "a", "string", "representing", "the", "type", "and", "kind", "of", "this", "value", "element", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L246-L251
50,625
rosenbrockc/fortpy
fortpy/elements.py
ValueElement._get_ctypes_name
def _get_ctypes_name(self, index=None): """Returns a formatted name for the ctypes Fortran wrapper module. :arg index: the index of the array to return a name for. None for the new parameter, otherwise the index for the integer variable name of that dimension. """ if index is ...
python
def _get_ctypes_name(self, index=None): """Returns a formatted name for the ctypes Fortran wrapper module. :arg index: the index of the array to return a name for. None for the new parameter, otherwise the index for the integer variable name of that dimension. """ if index is ...
[ "def", "_get_ctypes_name", "(", "self", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "if", "(", "\"allocatable\"", "not", "in", "self", ".", "modifiers", "and", "\"pointer\"", "not", "in", "self", ".", "modifiers", "and", "self"...
Returns a formatted name for the ctypes Fortran wrapper module. :arg index: the index of the array to return a name for. None for the new parameter, otherwise the index for the integer variable name of that dimension.
[ "Returns", "a", "formatted", "name", "for", "the", "ctypes", "Fortran", "wrapper", "module", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L253-L267
50,626
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.ctypes_parameter
def ctypes_parameter(self): """Returns the parameter list for this ValueElement adjusted for interoperability with the ctypes module. """ if self._ctypes_parameter is None: #Essentially, we just need to check if we are an array that doesn't have explicitly #define...
python
def ctypes_parameter(self): """Returns the parameter list for this ValueElement adjusted for interoperability with the ctypes module. """ if self._ctypes_parameter is None: #Essentially, we just need to check if we are an array that doesn't have explicitly #define...
[ "def", "ctypes_parameter", "(", "self", ")", ":", "if", "self", ".", "_ctypes_parameter", "is", "None", ":", "#Essentially, we just need to check if we are an array that doesn't have explicitly", "#defined bounds. Assumed-shape arrays have to be 'pointer' or 'allocatable'. However,", "...
Returns the parameter list for this ValueElement adjusted for interoperability with the ctypes module.
[ "Returns", "the", "parameter", "list", "for", "this", "ValueElement", "adjusted", "for", "interoperability", "with", "the", "ctypes", "module", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L269-L293
50,627
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.definition
def definition(self, suffix = "", local=False, ctype=None, optionals=True, customdim=None, modifiers=None): """Returns the fortran code string that would define this value element. :arg suffix: an optional suffix to append to the name of the variable. Useful for re-using de...
python
def definition(self, suffix = "", local=False, ctype=None, optionals=True, customdim=None, modifiers=None): """Returns the fortran code string that would define this value element. :arg suffix: an optional suffix to append to the name of the variable. Useful for re-using de...
[ "def", "definition", "(", "self", ",", "suffix", "=", "\"\"", ",", "local", "=", "False", ",", "ctype", "=", "None", ",", "optionals", "=", "True", ",", "customdim", "=", "None", ",", "modifiers", "=", "None", ")", ":", "kind", "=", "\"({})\"", ".", ...
Returns the fortran code string that would define this value element. :arg suffix: an optional suffix to append to the name of the variable. Useful for re-using definitions with new names. :arg local: when True, the parameter definition is re-cast as a local variable definition that...
[ "Returns", "the", "fortran", "code", "string", "that", "would", "define", "this", "value", "element", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L314-L355
50,628
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.argtypes
def argtypes(self): """Returns the ctypes argtypes for use with the method.argtypes assignment for an executable loaded from a shared library. """ if self.dimension is not None: result = [] if "in" in self.direction: #The only complication here is ...
python
def argtypes(self): """Returns the ctypes argtypes for use with the method.argtypes assignment for an executable loaded from a shared library. """ if self.dimension is not None: result = [] if "in" in self.direction: #The only complication here is ...
[ "def", "argtypes", "(", "self", ")", ":", "if", "self", ".", "dimension", "is", "not", "None", ":", "result", "=", "[", "]", "if", "\"in\"", "in", "self", ".", "direction", ":", "#The only complication here is that the 'known' dimensionality could actually", "#be ...
Returns the ctypes argtypes for use with the method.argtypes assignment for an executable loaded from a shared library.
[ "Returns", "the", "ctypes", "argtypes", "for", "use", "with", "the", "method", ".", "argtypes", "assignment", "for", "an", "executable", "loaded", "from", "a", "shared", "library", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L382-L417
50,629
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.ctype
def ctype(self): """Returns the name of the c_type from iso_c_binding to use when declaring the output parameter for interaction with python ctypes. """ if self.dtype == "logical": return "C_BOOL" elif self.dtype == "complex": #We don't actually know what ...
python
def ctype(self): """Returns the name of the c_type from iso_c_binding to use when declaring the output parameter for interaction with python ctypes. """ if self.dtype == "logical": return "C_BOOL" elif self.dtype == "complex": #We don't actually know what ...
[ "def", "ctype", "(", "self", ")", ":", "if", "self", ".", "dtype", "==", "\"logical\"", ":", "return", "\"C_BOOL\"", "elif", "self", ".", "dtype", "==", "\"complex\"", ":", "#We don't actually know what the precision of the complex numbers is because", "#it is defined b...
Returns the name of the c_type from iso_c_binding to use when declaring the output parameter for interaction with python ctypes.
[ "Returns", "the", "name", "of", "the", "c_type", "from", "iso_c_binding", "to", "use", "when", "declaring", "the", "output", "parameter", "for", "interaction", "with", "python", "ctypes", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L436-L479
50,630
rosenbrockc/fortpy
fortpy/elements.py
ValueElement.customtype
def customtype(self): """If this variable is a user-derivedy type, return the CustomType instance that is its kind. """ result = None if self.is_custom: #Look for the module that declares this variable's kind in its public list. self.dependency() ...
python
def customtype(self): """If this variable is a user-derivedy type, return the CustomType instance that is its kind. """ result = None if self.is_custom: #Look for the module that declares this variable's kind in its public list. self.dependency() ...
[ "def", "customtype", "(", "self", ")", ":", "result", "=", "None", "if", "self", ".", "is_custom", ":", "#Look for the module that declares this variable's kind in its public list.", "self", ".", "dependency", "(", ")", "if", "self", ".", "_kind_module", "is", "not"...
If this variable is a user-derivedy type, return the CustomType instance that is its kind.
[ "If", "this", "variable", "is", "a", "user", "-", "derivedy", "type", "return", "the", "CustomType", "instance", "that", "is", "its", "kind", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L507-L519
50,631
rosenbrockc/fortpy
fortpy/elements.py
Dependency.external_name
def external_name(self): """Returns the modulename.executable string that uniquely identifies the executable that this dependency points to.""" target = self.target if target is not None: return "{}.{}".format(target.name.lower(), self.name) else: return "...
python
def external_name(self): """Returns the modulename.executable string that uniquely identifies the executable that this dependency points to.""" target = self.target if target is not None: return "{}.{}".format(target.name.lower(), self.name) else: return "...
[ "def", "external_name", "(", "self", ")", ":", "target", "=", "self", ".", "target", "if", "target", "is", "not", "None", ":", "return", "\"{}.{}\"", ".", "format", "(", "target", ".", "name", ".", "lower", "(", ")", ",", "self", ".", "name", ")", ...
Returns the modulename.executable string that uniquely identifies the executable that this dependency points to.
[ "Returns", "the", "modulename", ".", "executable", "string", "that", "uniquely", "identifies", "the", "executable", "that", "this", "dependency", "points", "to", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L572-L579
50,632
rosenbrockc/fortpy
fortpy/elements.py
Dependency.target
def target(self): """Returns the executable code element that this dependency points to if it can be found. """ if self._target is None: if '%' in self.name: parts = self.name.split('%') base = self.module.parent.type_search(parts[0], self.name...
python
def target(self): """Returns the executable code element that this dependency points to if it can be found. """ if self._target is None: if '%' in self.name: parts = self.name.split('%') base = self.module.parent.type_search(parts[0], self.name...
[ "def", "target", "(", "self", ")", ":", "if", "self", ".", "_target", "is", "None", ":", "if", "'%'", "in", "self", ".", "name", ":", "parts", "=", "self", ".", "name", ".", "split", "(", "'%'", ")", "base", "=", "self", ".", "module", ".", "pa...
Returns the executable code element that this dependency points to if it can be found.
[ "Returns", "the", "executable", "code", "element", "that", "this", "dependency", "points", "to", "if", "it", "can", "be", "found", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L582-L604
50,633
rosenbrockc/fortpy
fortpy/elements.py
Dependency.clean
def clean(self, argslist): """Cleans the argslist.""" result = [] for arg in argslist: if type(arg) == type([]): if len(result) > 0: result[-1] = result[-1] + "(*{})".format(len(self.clean(arg))) elif "/" not in arg[0]: ...
python
def clean(self, argslist): """Cleans the argslist.""" result = [] for arg in argslist: if type(arg) == type([]): if len(result) > 0: result[-1] = result[-1] + "(*{})".format(len(self.clean(arg))) elif "/" not in arg[0]: ...
[ "def", "clean", "(", "self", ",", "argslist", ")", ":", "result", "=", "[", "]", "for", "arg", "in", "argslist", ":", "if", "type", "(", "arg", ")", "==", "type", "(", "[", "]", ")", ":", "if", "len", "(", "result", ")", ">", "0", ":", "resul...
Cleans the argslist.
[ "Cleans", "the", "argslist", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L619-L633
50,634
rosenbrockc/fortpy
fortpy/elements.py
Decoratable.find_section
def find_section(self, charindex): """Returns a value indicating whether the specified character index is owned by the current object.""" #All objects instances of decorable also inherit from CodeElement, #so we should have no problem accessing the start and end attributes. resul...
python
def find_section(self, charindex): """Returns a value indicating whether the specified character index is owned by the current object.""" #All objects instances of decorable also inherit from CodeElement, #so we should have no problem accessing the start and end attributes. resul...
[ "def", "find_section", "(", "self", ",", "charindex", ")", ":", "#All objects instances of decorable also inherit from CodeElement,", "#so we should have no problem accessing the start and end attributes.", "result", "=", "None", "if", "hasattr", "(", "self", ",", "\"start\"", ...
Returns a value indicating whether the specified character index is owned by the current object.
[ "Returns", "a", "value", "indicating", "whether", "the", "specified", "character", "index", "is", "owned", "by", "the", "current", "object", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L642-L660
50,635
rosenbrockc/fortpy
fortpy/elements.py
Executable.search_dependencies
def search_dependencies(self): """Returns a list of modules that this executable needs in order to run properly. This includes special kind declarations for precision or derived types, but not dependency executable calls. """ #It is understood that this executable's module is obv...
python
def search_dependencies(self): """Returns a list of modules that this executable needs in order to run properly. This includes special kind declarations for precision or derived types, but not dependency executable calls. """ #It is understood that this executable's module is obv...
[ "def", "search_dependencies", "(", "self", ")", ":", "#It is understood that this executable's module is obviously required. Just", "#add any additional modules from the parameters.", "result", "=", "[", "p", ".", "dependency", "(", ")", "for", "p", "in", "self", ".", "orde...
Returns a list of modules that this executable needs in order to run properly. This includes special kind declarations for precision or derived types, but not dependency executable calls.
[ "Returns", "a", "list", "of", "modules", "that", "this", "executable", "needs", "in", "order", "to", "run", "properly", ".", "This", "includes", "special", "kind", "declarations", "for", "precision", "or", "derived", "types", "but", "not", "dependency", "execu...
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L687-L698
50,636
rosenbrockc/fortpy
fortpy/elements.py
Executable._unpickle_collection
def _unpickle_collection(self, collection): """Unpickles all members of the specified dictionary.""" for mkey in collection: if isinstance(collection[mkey], list): for item in collection[mkey]: item.unpickle(self) else: collecti...
python
def _unpickle_collection(self, collection): """Unpickles all members of the specified dictionary.""" for mkey in collection: if isinstance(collection[mkey], list): for item in collection[mkey]: item.unpickle(self) else: collecti...
[ "def", "_unpickle_collection", "(", "self", ",", "collection", ")", ":", "for", "mkey", "in", "collection", ":", "if", "isinstance", "(", "collection", "[", "mkey", "]", ",", "list", ")", ":", "for", "item", "in", "collection", "[", "mkey", "]", ":", "...
Unpickles all members of the specified dictionary.
[ "Unpickles", "all", "members", "of", "the", "specified", "dictionary", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L732-L739
50,637
rosenbrockc/fortpy
fortpy/elements.py
Executable.rt_update
def rt_update(self, statement, linenum, mode, xparser): """Uses the specified line parser to parse the given line. :arg statement: a string of lines that are part of a single statement. :arg linenum: the line number of the first line in the list relative to the entire module contents....
python
def rt_update(self, statement, linenum, mode, xparser): """Uses the specified line parser to parse the given line. :arg statement: a string of lines that are part of a single statement. :arg linenum: the line number of the first line in the list relative to the entire module contents....
[ "def", "rt_update", "(", "self", ",", "statement", ",", "linenum", ",", "mode", ",", "xparser", ")", ":", "section", "=", "self", ".", "find_section", "(", "self", ".", "module", ".", "charindex", "(", "linenum", ",", "1", ")", ")", "if", "section", ...
Uses the specified line parser to parse the given line. :arg statement: a string of lines that are part of a single statement. :arg linenum: the line number of the first line in the list relative to the entire module contents. arg mode: either 'insert', 'replace' or 'delete' :...
[ "Uses", "the", "specified", "line", "parser", "to", "parse", "the", "given", "line", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L741-L757
50,638
rosenbrockc/fortpy
fortpy/elements.py
Executable.update_name
def update_name(self, name): """Changes the name of this executable and the reference to it in the parent module.""" if name != self.name: self.parent.executables[name] = self del self.parent.executables[self.name] self.name = name
python
def update_name(self, name): """Changes the name of this executable and the reference to it in the parent module.""" if name != self.name: self.parent.executables[name] = self del self.parent.executables[self.name] self.name = name
[ "def", "update_name", "(", "self", ",", "name", ")", ":", "if", "name", "!=", "self", ".", "name", ":", "self", ".", "parent", ".", "executables", "[", "name", "]", "=", "self", "del", "self", ".", "parent", ".", "executables", "[", "self", ".", "n...
Changes the name of this executable and the reference to it in the parent module.
[ "Changes", "the", "name", "of", "this", "executable", "and", "the", "reference", "to", "it", "in", "the", "parent", "module", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L761-L767
50,639
rosenbrockc/fortpy
fortpy/elements.py
Executable.is_type_target
def is_type_target(self): """Returns the CustomType instance if this executable is an embedded procedure in a custom type declaration; else False. """ if self._is_type_target is None: #All we need to do is search through the custom types in the parent #module and...
python
def is_type_target(self): """Returns the CustomType instance if this executable is an embedded procedure in a custom type declaration; else False. """ if self._is_type_target is None: #All we need to do is search through the custom types in the parent #module and...
[ "def", "is_type_target", "(", "self", ")", ":", "if", "self", ".", "_is_type_target", "is", "None", ":", "#All we need to do is search through the custom types in the parent", "#module and see if any of their executables points to this method.", "self", ".", "_is_type_target", "=...
Returns the CustomType instance if this executable is an embedded procedure in a custom type declaration; else False.
[ "Returns", "the", "CustomType", "instance", "if", "this", "executable", "is", "an", "embedded", "procedure", "in", "a", "custom", "type", "declaration", ";", "else", "False", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L770-L787
50,640
rosenbrockc/fortpy
fortpy/elements.py
Executable._get_assignments_in
def _get_assignments_in(self, filterlist, symbol = ""): """Returns a list of code elements whose names are in the specified object. :arg filterlist: the list of symbols to check agains the assignments. :arg symbol: when specified, return true if that symbol has its value changed via a...
python
def _get_assignments_in(self, filterlist, symbol = ""): """Returns a list of code elements whose names are in the specified object. :arg filterlist: the list of symbols to check agains the assignments. :arg symbol: when specified, return true if that symbol has its value changed via a...
[ "def", "_get_assignments_in", "(", "self", ",", "filterlist", ",", "symbol", "=", "\"\"", ")", ":", "if", "symbol", "!=", "\"\"", ":", "lsymbol", "=", "symbol", "for", "assign", "in", "self", ".", "_assignments", ":", "target", "=", "assign", ".", "split...
Returns a list of code elements whose names are in the specified object. :arg filterlist: the list of symbols to check agains the assignments. :arg symbol: when specified, return true if that symbol has its value changed via an assignment.
[ "Returns", "a", "list", "of", "code", "elements", "whose", "names", "are", "in", "the", "specified", "object", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L846-L864
50,641
rosenbrockc/fortpy
fortpy/elements.py
Executable.get_parameter
def get_parameter(self, index): """Returns the ValueElement corresponding to the parameter at the specified index.""" result = None if index < len(self.paramorder): key = self.paramorder[index] if key in self._parameters: result = self._parameters[...
python
def get_parameter(self, index): """Returns the ValueElement corresponding to the parameter at the specified index.""" result = None if index < len(self.paramorder): key = self.paramorder[index] if key in self._parameters: result = self._parameters[...
[ "def", "get_parameter", "(", "self", ",", "index", ")", ":", "result", "=", "None", "if", "index", "<", "len", "(", "self", ".", "paramorder", ")", ":", "key", "=", "self", ".", "paramorder", "[", "index", "]", "if", "key", "in", "self", ".", "_par...
Returns the ValueElement corresponding to the parameter at the specified index.
[ "Returns", "the", "ValueElement", "corresponding", "to", "the", "parameter", "at", "the", "specified", "index", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L882-L891
50,642
rosenbrockc/fortpy
fortpy/elements.py
Executable.add_parameter
def add_parameter(self, parameter): """Adds the specified parameter value to the list.""" if parameter.name.lower() not in self.paramorder: self.paramorder.append(parameter.name.lower()) self._parameters[parameter.name.lower()] = parameter
python
def add_parameter(self, parameter): """Adds the specified parameter value to the list.""" if parameter.name.lower() not in self.paramorder: self.paramorder.append(parameter.name.lower()) self._parameters[parameter.name.lower()] = parameter
[ "def", "add_parameter", "(", "self", ",", "parameter", ")", ":", "if", "parameter", ".", "name", ".", "lower", "(", ")", "not", "in", "self", ".", "paramorder", ":", "self", ".", "paramorder", ".", "append", "(", "parameter", ".", "name", ".", "lower",...
Adds the specified parameter value to the list.
[ "Adds", "the", "specified", "parameter", "value", "to", "the", "list", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L893-L897
50,643
rosenbrockc/fortpy
fortpy/elements.py
Executable.remove_parameter
def remove_parameter(self, parameter_name): """Removes the specified parameter from the list.""" if parameter_name in self.paramorder: index = self.paramorder.index(parameter_name) del self.paramorder[index] if parameter_name in self._parameters: del self._pa...
python
def remove_parameter(self, parameter_name): """Removes the specified parameter from the list.""" if parameter_name in self.paramorder: index = self.paramorder.index(parameter_name) del self.paramorder[index] if parameter_name in self._parameters: del self._pa...
[ "def", "remove_parameter", "(", "self", ",", "parameter_name", ")", ":", "if", "parameter_name", "in", "self", ".", "paramorder", ":", "index", "=", "self", ".", "paramorder", ".", "index", "(", "parameter_name", ")", "del", "self", ".", "paramorder", "[", ...
Removes the specified parameter from the list.
[ "Removes", "the", "specified", "parameter", "from", "the", "list", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L899-L906
50,644
rosenbrockc/fortpy
fortpy/elements.py
Executable.parameters_as_string
def parameters_as_string(self): """Returns a comma-separated list of the parameters in the executable definition.""" params = ", ".join([ p.name for p in self.ordered_parameters ]) return params
python
def parameters_as_string(self): """Returns a comma-separated list of the parameters in the executable definition.""" params = ", ".join([ p.name for p in self.ordered_parameters ]) return params
[ "def", "parameters_as_string", "(", "self", ")", ":", "params", "=", "\", \"", ".", "join", "(", "[", "p", ".", "name", "for", "p", "in", "self", ".", "ordered_parameters", "]", ")", "return", "params" ]
Returns a comma-separated list of the parameters in the executable definition.
[ "Returns", "a", "comma", "-", "separated", "list", "of", "the", "parameters", "in", "the", "executable", "definition", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L908-L911
50,645
rosenbrockc/fortpy
fortpy/elements.py
Executable.add_dependency
def add_dependency(self, value): """Adds the specified executable dependency to the list for this executable.""" if value.name in self.dependencies: self.dependencies[value.name.lower()].append(value) else: self.dependencies[value.name.lower()] = [ value ]
python
def add_dependency(self, value): """Adds the specified executable dependency to the list for this executable.""" if value.name in self.dependencies: self.dependencies[value.name.lower()].append(value) else: self.dependencies[value.name.lower()] = [ value ]
[ "def", "add_dependency", "(", "self", ",", "value", ")", ":", "if", "value", ".", "name", "in", "self", ".", "dependencies", ":", "self", ".", "dependencies", "[", "value", ".", "name", ".", "lower", "(", ")", "]", ".", "append", "(", "value", ")", ...
Adds the specified executable dependency to the list for this executable.
[ "Adds", "the", "specified", "executable", "dependency", "to", "the", "list", "for", "this", "executable", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L919-L924
50,646
rosenbrockc/fortpy
fortpy/elements.py
Function.update
def update(self, name, modifiers, dtype, kind): """Updates the attributes for the function instance, handles name changes in the parent module as well.""" self.update_name(name) self.modifiers = modifiers self.dtype = dtype self.kind = kind self.update_dtype()
python
def update(self, name, modifiers, dtype, kind): """Updates the attributes for the function instance, handles name changes in the parent module as well.""" self.update_name(name) self.modifiers = modifiers self.dtype = dtype self.kind = kind self.update_dtype()
[ "def", "update", "(", "self", ",", "name", ",", "modifiers", ",", "dtype", ",", "kind", ")", ":", "self", ".", "update_name", "(", "name", ")", "self", ".", "modifiers", "=", "modifiers", "self", ".", "dtype", "=", "dtype", "self", ".", "kind", "=", ...
Updates the attributes for the function instance, handles name changes in the parent module as well.
[ "Updates", "the", "attributes", "for", "the", "function", "instance", "handles", "name", "changes", "in", "the", "parent", "module", "as", "well", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L960-L967
50,647
rosenbrockc/fortpy
fortpy/elements.py
Function.returns
def returns(self): """Gets a string showing the return type and modifiers for the function in a nice display format.""" kind = "({}) ".format(self.kind) if self.kind is not None else "" mods = ", ".join(self.modifiers) + " " dtype = self.dtype if self.dtype is not None else...
python
def returns(self): """Gets a string showing the return type and modifiers for the function in a nice display format.""" kind = "({}) ".format(self.kind) if self.kind is not None else "" mods = ", ".join(self.modifiers) + " " dtype = self.dtype if self.dtype is not None else...
[ "def", "returns", "(", "self", ")", ":", "kind", "=", "\"({}) \"", ".", "format", "(", "self", ".", "kind", ")", "if", "self", ".", "kind", "is", "not", "None", "else", "\"\"", "mods", "=", "\", \"", ".", "join", "(", "self", ".", "modifiers", ")",...
Gets a string showing the return type and modifiers for the function in a nice display format.
[ "Gets", "a", "string", "showing", "the", "return", "type", "and", "modifiers", "for", "the", "function", "in", "a", "nice", "display", "format", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L993-L999
50,648
rosenbrockc/fortpy
fortpy/elements.py
Subroutine.signature
def signature(self): """Returns the signature definition for the subroutine.""" mods = ", ".join(self.modifiers) return "{} SUBROUTINE {}({})".format(mods, self.name, self.parameters_as_string())
python
def signature(self): """Returns the signature definition for the subroutine.""" mods = ", ".join(self.modifiers) return "{} SUBROUTINE {}({})".format(mods, self.name, self.parameters_as_string())
[ "def", "signature", "(", "self", ")", ":", "mods", "=", "\", \"", ".", "join", "(", "self", ".", "modifiers", ")", "return", "\"{} SUBROUTINE {}({})\"", ".", "format", "(", "mods", ",", "self", ".", "name", ",", "self", ".", "parameters_as_string", "(", ...
Returns the signature definition for the subroutine.
[ "Returns", "the", "signature", "definition", "for", "the", "subroutine", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1024-L1028
50,649
rosenbrockc/fortpy
fortpy/elements.py
Subroutine.update
def update(self, name, modifiers): """Updates the attributes for the subroutine instance, handles name changes in the parent module as well.""" self.update_name(name) self.modifiers = modifiers
python
def update(self, name, modifiers): """Updates the attributes for the subroutine instance, handles name changes in the parent module as well.""" self.update_name(name) self.modifiers = modifiers
[ "def", "update", "(", "self", ",", "name", ",", "modifiers", ")", ":", "self", ".", "update_name", "(", "name", ")", "self", ".", "modifiers", "=", "modifiers" ]
Updates the attributes for the subroutine instance, handles name changes in the parent module as well.
[ "Updates", "the", "attributes", "for", "the", "subroutine", "instance", "handles", "name", "changes", "in", "the", "parent", "module", "as", "well", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1035-L1039
50,650
rosenbrockc/fortpy
fortpy/elements.py
TypeExecutable.target
def target(self): """Returns the code element that is the actual executable that this type executable points to.""" if self.pointsto is not None: #It is in the format of module.executable. xinst = self.module.parent.get_executable(self.pointsto.lower()) return...
python
def target(self): """Returns the code element that is the actual executable that this type executable points to.""" if self.pointsto is not None: #It is in the format of module.executable. xinst = self.module.parent.get_executable(self.pointsto.lower()) return...
[ "def", "target", "(", "self", ")", ":", "if", "self", ".", "pointsto", "is", "not", "None", ":", "#It is in the format of module.executable.", "xinst", "=", "self", ".", "module", ".", "parent", ".", "get_executable", "(", "self", ".", "pointsto", ".", "lowe...
Returns the code element that is the actual executable that this type executable points to.
[ "Returns", "the", "code", "element", "that", "is", "the", "actual", "executable", "that", "this", "type", "executable", "points", "to", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1063-L1073
50,651
rosenbrockc/fortpy
fortpy/elements.py
CustomType.fixedvar
def fixedvar(self): """Returns the name of a member in this type that is non-custom so that it would terminate the auto-class variable context chain. """ possible = [m for m in self.members.values() if not m.is_custom] #If any of the possible variables is not allocatable or point...
python
def fixedvar(self): """Returns the name of a member in this type that is non-custom so that it would terminate the auto-class variable context chain. """ possible = [m for m in self.members.values() if not m.is_custom] #If any of the possible variables is not allocatable or point...
[ "def", "fixedvar", "(", "self", ")", ":", "possible", "=", "[", "m", "for", "m", "in", "self", ".", "members", ".", "values", "(", ")", "if", "not", "m", ".", "is_custom", "]", "#If any of the possible variables is not allocatable or pointer, it will always", "#...
Returns the name of a member in this type that is non-custom so that it would terminate the auto-class variable context chain.
[ "Returns", "the", "name", "of", "a", "member", "in", "this", "type", "that", "is", "non", "-", "custom", "so", "that", "it", "would", "terminate", "the", "auto", "-", "class", "variable", "context", "chain", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1097-L1109
50,652
rosenbrockc/fortpy
fortpy/elements.py
CustomType.recursive
def recursive(self): """When True, this CustomType has at least one member that is of the same type as itself. """ for m in self.members.values(): if m.kind is not None and m.kind.lower() == self.name.lower(): return True else: return False
python
def recursive(self): """When True, this CustomType has at least one member that is of the same type as itself. """ for m in self.members.values(): if m.kind is not None and m.kind.lower() == self.name.lower(): return True else: return False
[ "def", "recursive", "(", "self", ")", ":", "for", "m", "in", "self", ".", "members", ".", "values", "(", ")", ":", "if", "m", ".", "kind", "is", "not", "None", "and", "m", ".", "kind", ".", "lower", "(", ")", "==", "self", ".", "name", ".", "...
When True, this CustomType has at least one member that is of the same type as itself.
[ "When", "True", "this", "CustomType", "has", "at", "least", "one", "member", "that", "is", "of", "the", "same", "type", "as", "itself", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1112-L1120
50,653
rosenbrockc/fortpy
fortpy/elements.py
CustomType.update_name
def update_name(self, name): """Updates the name of the custom type in this instance and its parent reference.""" if name != self.name: self.parent.types[name] = self del self.parent.types[self.name] self.name = name
python
def update_name(self, name): """Updates the name of the custom type in this instance and its parent reference.""" if name != self.name: self.parent.types[name] = self del self.parent.types[self.name] self.name = name
[ "def", "update_name", "(", "self", ",", "name", ")", ":", "if", "name", "!=", "self", ".", "name", ":", "self", ".", "parent", ".", "types", "[", "name", "]", "=", "self", "del", "self", ".", "parent", ".", "types", "[", "self", ".", "name", "]",...
Updates the name of the custom type in this instance and its parent reference.
[ "Updates", "the", "name", "of", "the", "custom", "type", "in", "this", "instance", "and", "its", "parent", "reference", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1133-L1139
50,654
rosenbrockc/fortpy
fortpy/elements.py
Interface.get_parameter
def get_parameter(self, index): """Gets the list of parameters at the specified index in the calling argument list for each of the module procedures in the interface. :arg index: the 0-based index of the parameter in the argument list. """ result = [] for target in self....
python
def get_parameter(self, index): """Gets the list of parameters at the specified index in the calling argument list for each of the module procedures in the interface. :arg index: the 0-based index of the parameter in the argument list. """ result = [] for target in self....
[ "def", "get_parameter", "(", "self", ",", "index", ")", ":", "result", "=", "[", "]", "for", "target", "in", "self", ".", "targets", ":", "if", "target", "is", "not", "None", ":", "result", ".", "append", "(", "target", ".", "get_parameter", "(", "in...
Gets the list of parameters at the specified index in the calling argument list for each of the module procedures in the interface. :arg index: the 0-based index of the parameter in the argument list.
[ "Gets", "the", "list", "of", "parameters", "at", "the", "specified", "index", "in", "the", "calling", "argument", "list", "for", "each", "of", "the", "module", "procedures", "in", "the", "interface", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1242-L1253
50,655
rosenbrockc/fortpy
fortpy/elements.py
Interface.find_docstring
def find_docstring(self): """Sets the docstring of this interface using the docstrings of its embedded module procedures that it is an interface for. """ #The docstrings for the interface are compiled from the separate docstrings #of the module procedures it is an interface for. ...
python
def find_docstring(self): """Sets the docstring of this interface using the docstrings of its embedded module procedures that it is an interface for. """ #The docstrings for the interface are compiled from the separate docstrings #of the module procedures it is an interface for. ...
[ "def", "find_docstring", "(", "self", ")", ":", "#The docstrings for the interface are compiled from the separate docstrings", "#of the module procedures it is an interface for. We choose the first of these", "#procedures by convention and copy its docstrings over.", "#Just use the very first embe...
Sets the docstring of this interface using the docstrings of its embedded module procedures that it is an interface for.
[ "Sets", "the", "docstring", "of", "this", "interface", "using", "the", "docstrings", "of", "its", "embedded", "module", "procedures", "that", "it", "is", "an", "interface", "for", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1255-L1264
50,656
rosenbrockc/fortpy
fortpy/elements.py
Interface.describe
def describe(self): """Returns a home-grown description that includes a summary of the calling interface for all the module procedures embedded in this interface. """ #Interfaces are tricky because we can have an arbitrary number of embedded procedures #that each have different c...
python
def describe(self): """Returns a home-grown description that includes a summary of the calling interface for all the module procedures embedded in this interface. """ #Interfaces are tricky because we can have an arbitrary number of embedded procedures #that each have different c...
[ "def", "describe", "(", "self", ")", ":", "#Interfaces are tricky because we can have an arbitrary number of embedded procedures", "#that each have different calling interfaces and return types. We are trying to ", "#summarize that information in a single interface. Interfaces can't mix executable",...
Returns a home-grown description that includes a summary of the calling interface for all the module procedures embedded in this interface.
[ "Returns", "a", "home", "-", "grown", "description", "that", "includes", "a", "summary", "of", "the", "calling", "interface", "for", "all", "the", "module", "procedures", "embedded", "in", "this", "interface", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1266-L1298
50,657
rosenbrockc/fortpy
fortpy/elements.py
Interface.first
def first(self): """Returns the first module procedure embedded in the interface that has a valid instance of a CodeElement. """ if self._first is None: for target in self.targets: if target is not None: self._first = target ...
python
def first(self): """Returns the first module procedure embedded in the interface that has a valid instance of a CodeElement. """ if self._first is None: for target in self.targets: if target is not None: self._first = target ...
[ "def", "first", "(", "self", ")", ":", "if", "self", ".", "_first", "is", "None", ":", "for", "target", "in", "self", ".", "targets", ":", "if", "target", "is", "not", "None", ":", "self", ".", "_first", "=", "target", "break", "else", ":", "self",...
Returns the first module procedure embedded in the interface that has a valid instance of a CodeElement.
[ "Returns", "the", "first", "module", "procedure", "embedded", "in", "the", "interface", "that", "has", "a", "valid", "instance", "of", "a", "CodeElement", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1315-L1327
50,658
rosenbrockc/fortpy
fortpy/elements.py
Interface.targets
def targets(self): """Provides an ordered list of CodeElement instances for each of the embedded module procedures in the generic interface. """ if self._targets is None: self._targets = {} for key in self.procedures: element = self.module.parent.g...
python
def targets(self): """Provides an ordered list of CodeElement instances for each of the embedded module procedures in the generic interface. """ if self._targets is None: self._targets = {} for key in self.procedures: element = self.module.parent.g...
[ "def", "targets", "(", "self", ")", ":", "if", "self", ".", "_targets", "is", "None", ":", "self", ".", "_targets", "=", "{", "}", "for", "key", "in", "self", ".", "procedures", ":", "element", "=", "self", ".", "module", ".", "parent", ".", "get_e...
Provides an ordered list of CodeElement instances for each of the embedded module procedures in the generic interface.
[ "Provides", "an", "ordered", "list", "of", "CodeElement", "instances", "for", "each", "of", "the", "embedded", "module", "procedures", "in", "the", "generic", "interface", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1330-L1345
50,659
rosenbrockc/fortpy
fortpy/elements.py
Module.search_dependencies
def search_dependencies(self): """Returns a list of other modules that this module and its members and executables depend on in order to run correctly. This differs from the self.dependencies attribute that just hase explicit module names from the 'use' clauses. """ result = [sel...
python
def search_dependencies(self): """Returns a list of other modules that this module and its members and executables depend on in order to run correctly. This differs from the self.dependencies attribute that just hase explicit module names from the 'use' clauses. """ result = [sel...
[ "def", "search_dependencies", "(", "self", ")", ":", "result", "=", "[", "self", ".", "module", ".", "name", "]", "#First we look at the explicit use references from this module and all", "#its dependencies until the chain terminates.", "stack", "=", "self", ".", "needs", ...
Returns a list of other modules that this module and its members and executables depend on in order to run correctly. This differs from the self.dependencies attribute that just hase explicit module names from the 'use' clauses.
[ "Returns", "a", "list", "of", "other", "modules", "that", "this", "module", "and", "its", "members", "and", "executables", "depend", "on", "in", "order", "to", "run", "correctly", ".", "This", "differs", "from", "the", "self", ".", "dependencies", "attribute...
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1401-L1437
50,660
rosenbrockc/fortpy
fortpy/elements.py
Module.compile_path
def compile_path(self): """Returns the file path to this module taking the pre-processing into account. If the module requires pre-processing, the extension is reported as F90; otherwise, the regular self.filepath is returned. """ if not self.precompile: return self.f...
python
def compile_path(self): """Returns the file path to this module taking the pre-processing into account. If the module requires pre-processing, the extension is reported as F90; otherwise, the regular self.filepath is returned. """ if not self.precompile: return self.f...
[ "def", "compile_path", "(", "self", ")", ":", "if", "not", "self", ".", "precompile", ":", "return", "self", ".", "filepath", "else", ":", "if", "self", ".", "_compile_path", "is", "None", ":", "segs", "=", "self", ".", "filepath", ".", "split", "(", ...
Returns the file path to this module taking the pre-processing into account. If the module requires pre-processing, the extension is reported as F90; otherwise, the regular self.filepath is returned.
[ "Returns", "the", "file", "path", "to", "this", "module", "taking", "the", "pre", "-", "processing", "into", "account", ".", "If", "the", "module", "requires", "pre", "-", "processing", "the", "extension", "is", "reported", "as", "F90", ";", "otherwise", "...
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1447-L1461
50,661
rosenbrockc/fortpy
fortpy/elements.py
Module.all_to_public
def all_to_public(self): """Sets all members, types and executables in this module as public as long as it doesn't already have the 'private' modifier. """ if "private" not in self.modifiers: def public_collection(attribute): for key in self.collection(attribu...
python
def all_to_public(self): """Sets all members, types and executables in this module as public as long as it doesn't already have the 'private' modifier. """ if "private" not in self.modifiers: def public_collection(attribute): for key in self.collection(attribu...
[ "def", "all_to_public", "(", "self", ")", ":", "if", "\"private\"", "not", "in", "self", ".", "modifiers", ":", "def", "public_collection", "(", "attribute", ")", ":", "for", "key", "in", "self", ".", "collection", "(", "attribute", ")", ":", "if", "key"...
Sets all members, types and executables in this module as public as long as it doesn't already have the 'private' modifier.
[ "Sets", "all", "members", "types", "and", "executables", "in", "this", "module", "as", "public", "as", "long", "as", "it", "doesn", "t", "already", "have", "the", "private", "modifier", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1471-L1482
50,662
rosenbrockc/fortpy
fortpy/elements.py
Module.rt_update
def rt_update(self, statement, linenum, mode, modulep, lineparser): """Uses the specified line parser to parse the given statement. :arg statement: a string of lines that are part of a single statement. :arg linenum: the line number of the first line in the statement relative to the e...
python
def rt_update(self, statement, linenum, mode, modulep, lineparser): """Uses the specified line parser to parse the given statement. :arg statement: a string of lines that are part of a single statement. :arg linenum: the line number of the first line in the statement relative to the e...
[ "def", "rt_update", "(", "self", ",", "statement", ",", "linenum", ",", "mode", ",", "modulep", ",", "lineparser", ")", ":", "#Most of the module is body, since that includes everything inside", "#of the module ... end module keywords. Since docstrings are handled", "#at a higher...
Uses the specified line parser to parse the given statement. :arg statement: a string of lines that are part of a single statement. :arg linenum: the line number of the first line in the statement relative to the entire module contents. :arg mode: either 'insert', 'replace' or 'delete...
[ "Uses", "the", "specified", "line", "parser", "to", "parse", "the", "given", "statement", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1484-L1502
50,663
rosenbrockc/fortpy
fortpy/elements.py
Module.get_dependency_element
def get_dependency_element(self, symbol): """Checks if the specified symbol is the name of one of the methods that this module depends on. If it is, search for the actual code element and return it.""" for depend in self.dependencies: if "." in depend: #We kno...
python
def get_dependency_element(self, symbol): """Checks if the specified symbol is the name of one of the methods that this module depends on. If it is, search for the actual code element and return it.""" for depend in self.dependencies: if "." in depend: #We kno...
[ "def", "get_dependency_element", "(", "self", ",", "symbol", ")", ":", "for", "depend", "in", "self", ".", "dependencies", ":", "if", "\".\"", "in", "depend", ":", "#We know the module name and the executable name, easy", "if", "depend", ".", "split", "(", "\".\""...
Checks if the specified symbol is the name of one of the methods that this module depends on. If it is, search for the actual code element and return it.
[ "Checks", "if", "the", "specified", "symbol", "is", "the", "name", "of", "one", "of", "the", "methods", "that", "this", "module", "depends", "on", ".", "If", "it", "is", "search", "for", "the", "actual", "code", "element", "and", "return", "it", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1552-L1575
50,664
rosenbrockc/fortpy
fortpy/elements.py
Module.completions
def completions(self, symbol, attribute, recursive = False): """Finds all possible symbol completions of the given symbol that belong to this module and its dependencies. :arg symbol: the code symbol that needs to be completed. :arg attribute: one of ['dependencies', 'publics', 'members...
python
def completions(self, symbol, attribute, recursive = False): """Finds all possible symbol completions of the given symbol that belong to this module and its dependencies. :arg symbol: the code symbol that needs to be completed. :arg attribute: one of ['dependencies', 'publics', 'members...
[ "def", "completions", "(", "self", ",", "symbol", ",", "attribute", ",", "recursive", "=", "False", ")", ":", "possible", "=", "[", "]", "for", "ekey", "in", "self", ".", "collection", "(", "attribute", ")", ":", "if", "symbol", "in", "ekey", ":", "p...
Finds all possible symbol completions of the given symbol that belong to this module and its dependencies. :arg symbol: the code symbol that needs to be completed. :arg attribute: one of ['dependencies', 'publics', 'members', 'types', 'executables'] for specifying which collections t...
[ "Finds", "all", "possible", "symbol", "completions", "of", "the", "given", "symbol", "that", "belong", "to", "this", "module", "and", "its", "dependencies", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1577-L1600
50,665
rosenbrockc/fortpy
fortpy/elements.py
Module.needs
def needs(self): """Returns a unique list of module names that this module depends on.""" result = [] for dep in self.dependencies: module = dep.split(".")[0].lower() if module not in result: result.append(module) return result
python
def needs(self): """Returns a unique list of module names that this module depends on.""" result = [] for dep in self.dependencies: module = dep.split(".")[0].lower() if module not in result: result.append(module) return result
[ "def", "needs", "(", "self", ")", ":", "result", "=", "[", "]", "for", "dep", "in", "self", ".", "dependencies", ":", "module", "=", "dep", ".", "split", "(", "\".\"", ")", "[", "0", "]", ".", "lower", "(", ")", "if", "module", "not", "in", "re...
Returns a unique list of module names that this module depends on.
[ "Returns", "a", "unique", "list", "of", "module", "names", "that", "this", "module", "depends", "on", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1641-L1649
50,666
rosenbrockc/fortpy
fortpy/elements.py
Module._filter_execs
def _filter_execs(self, isSubroutine): """Filters the executables in the dictionary by their type.""" result = {} for key in self.executables: if (isinstance(self.executables[key], Subroutine) and isSubroutine) or \ (isinstance(self.executables[key], Function) and not ...
python
def _filter_execs(self, isSubroutine): """Filters the executables in the dictionary by their type.""" result = {} for key in self.executables: if (isinstance(self.executables[key], Subroutine) and isSubroutine) or \ (isinstance(self.executables[key], Function) and not ...
[ "def", "_filter_execs", "(", "self", ",", "isSubroutine", ")", ":", "result", "=", "{", "}", "for", "key", "in", "self", ".", "executables", ":", "if", "(", "isinstance", "(", "self", ".", "executables", "[", "key", "]", ",", "Subroutine", ")", "and", ...
Filters the executables in the dictionary by their type.
[ "Filters", "the", "executables", "in", "the", "dictionary", "by", "their", "type", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1666-L1674
50,667
rosenbrockc/fortpy
fortpy/elements.py
Module.warn
def warn(self, collection): """Checks the module for documentation and best-practice warnings.""" super(CodeElement, self).warn(collection) if not "implicit none" in self.modifiers: collection.append("WARNING: implicit none not set in {}".format(self.name))
python
def warn(self, collection): """Checks the module for documentation and best-practice warnings.""" super(CodeElement, self).warn(collection) if not "implicit none" in self.modifiers: collection.append("WARNING: implicit none not set in {}".format(self.name))
[ "def", "warn", "(", "self", ",", "collection", ")", ":", "super", "(", "CodeElement", ",", "self", ")", ".", "warn", "(", "collection", ")", "if", "not", "\"implicit none\"", "in", "self", ".", "modifiers", ":", "collection", ".", "append", "(", "\"WARNI...
Checks the module for documentation and best-practice warnings.
[ "Checks", "the", "module", "for", "documentation", "and", "best", "-", "practice", "warnings", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1676-L1680
50,668
rosenbrockc/fortpy
fortpy/elements.py
Module.collection
def collection(self, attribute): """Returns the collection corresponding the attribute name.""" return { "dependencies": self.dependencies, "publics": self.publics, "members": self.members, "types": self.types, "executables": self.executables, ...
python
def collection(self, attribute): """Returns the collection corresponding the attribute name.""" return { "dependencies": self.dependencies, "publics": self.publics, "members": self.members, "types": self.types, "executables": self.executables, ...
[ "def", "collection", "(", "self", ",", "attribute", ")", ":", "return", "{", "\"dependencies\"", ":", "self", ".", "dependencies", ",", "\"publics\"", ":", "self", ".", "publics", ",", "\"members\"", ":", "self", ".", "members", ",", "\"types\"", ":", "sel...
Returns the collection corresponding the attribute name.
[ "Returns", "the", "collection", "corresponding", "the", "attribute", "name", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1695-L1704
50,669
rosenbrockc/fortpy
fortpy/elements.py
Module.update_refstring
def update_refstring(self, string): """Updates the refstring that represents the original string that the module was parsed from. Also updates any properties or attributes that are derived from the refstring.""" self.refstring = string self._lines = [] self._contains_inde...
python
def update_refstring(self, string): """Updates the refstring that represents the original string that the module was parsed from. Also updates any properties or attributes that are derived from the refstring.""" self.refstring = string self._lines = [] self._contains_inde...
[ "def", "update_refstring", "(", "self", ",", "string", ")", ":", "self", ".", "refstring", "=", "string", "self", ".", "_lines", "=", "[", "]", "self", ".", "_contains_index", "=", "None", "self", ".", "changed", "=", "True", "#The only other references that...
Updates the refstring that represents the original string that the module was parsed from. Also updates any properties or attributes that are derived from the refstring.
[ "Updates", "the", "refstring", "that", "represents", "the", "original", "string", "that", "the", "module", "was", "parsed", "from", ".", "Also", "updates", "any", "properties", "or", "attributes", "that", "are", "derived", "from", "the", "refstring", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1706-L1722
50,670
rosenbrockc/fortpy
fortpy/elements.py
Module.update_elements
def update_elements(self, line, column, charcount, docdelta=0): """Updates all the element instances that are children of this module to have new start and end charindex values based on an operation that was performed on the module source code. :arg line: the line number of the *start* ...
python
def update_elements(self, line, column, charcount, docdelta=0): """Updates all the element instances that are children of this module to have new start and end charindex values based on an operation that was performed on the module source code. :arg line: the line number of the *start* ...
[ "def", "update_elements", "(", "self", ",", "line", ",", "column", ",", "charcount", ",", "docdelta", "=", "0", ")", ":", "target", "=", "self", ".", "charindex", "(", "line", ",", "column", ")", "+", "charcount", "#We are looking for all the instances whose *...
Updates all the element instances that are children of this module to have new start and end charindex values based on an operation that was performed on the module source code. :arg line: the line number of the *start* of the operation. :arg column: the column number of the start of th...
[ "Updates", "all", "the", "element", "instances", "that", "are", "children", "of", "this", "module", "to", "have", "new", "start", "and", "end", "charindex", "values", "based", "on", "an", "operation", "that", "was", "performed", "on", "the", "module", "sourc...
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1724-L1756
50,671
rosenbrockc/fortpy
fortpy/elements.py
Module._update_char_check
def _update_char_check(self, element, target, docdelta): """Checks whether the specified element should have its character indices updated as part of real-time updating.""" if docdelta != 0: if (element.docstart <= target and element.docend >= target - docdelta): ...
python
def _update_char_check(self, element, target, docdelta): """Checks whether the specified element should have its character indices updated as part of real-time updating.""" if docdelta != 0: if (element.docstart <= target and element.docend >= target - docdelta): ...
[ "def", "_update_char_check", "(", "self", ",", "element", ",", "target", ",", "docdelta", ")", ":", "if", "docdelta", "!=", "0", ":", "if", "(", "element", ".", "docstart", "<=", "target", "and", "element", ".", "docend", ">=", "target", "-", "docdelta",...
Checks whether the specified element should have its character indices updated as part of real-time updating.
[ "Checks", "whether", "the", "specified", "element", "should", "have", "its", "character", "indices", "updated", "as", "part", "of", "real", "-", "time", "updating", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1758-L1768
50,672
rosenbrockc/fortpy
fortpy/elements.py
Module._element_charfix
def _element_charfix(self, element, charcount): """Updates the start and end attributes by charcount for the element.""" element.start += charcount element.docstart += charcount element.end += charcount element.docend += charcount
python
def _element_charfix(self, element, charcount): """Updates the start and end attributes by charcount for the element.""" element.start += charcount element.docstart += charcount element.end += charcount element.docend += charcount
[ "def", "_element_charfix", "(", "self", ",", "element", ",", "charcount", ")", ":", "element", ".", "start", "+=", "charcount", "element", ".", "docstart", "+=", "charcount", "element", ".", "end", "+=", "charcount", "element", ".", "docend", "+=", "charcoun...
Updates the start and end attributes by charcount for the element.
[ "Updates", "the", "start", "and", "end", "attributes", "by", "charcount", "for", "the", "element", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1770-L1775
50,673
rosenbrockc/fortpy
fortpy/elements.py
Module.get_element
def get_element(self, line, column): """Gets the instance of the element who owns the specified line and column.""" ichar = self.charindex(line, column) icontains = self.contains_index result = None if line < icontains: #We only need to search through the typ...
python
def get_element(self, line, column): """Gets the instance of the element who owns the specified line and column.""" ichar = self.charindex(line, column) icontains = self.contains_index result = None if line < icontains: #We only need to search through the typ...
[ "def", "get_element", "(", "self", ",", "line", ",", "column", ")", ":", "ichar", "=", "self", ".", "charindex", "(", "line", ",", "column", ")", "icontains", "=", "self", ".", "contains_index", "result", "=", "None", "if", "line", "<", "icontains", ":...
Gets the instance of the element who owns the specified line and column.
[ "Gets", "the", "instance", "of", "the", "element", "who", "owns", "the", "specified", "line", "and", "column", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1777-L1825
50,674
rosenbrockc/fortpy
fortpy/elements.py
Module.update_embedded
def update_embedded(self, attribute): """Updates the elements in the module 'result' that have character indices that are a subset of another element. These correspond to cases where the type or subroutine is declared within another subroutine. :attr attribute: the name of the collectio...
python
def update_embedded(self, attribute): """Updates the elements in the module 'result' that have character indices that are a subset of another element. These correspond to cases where the type or subroutine is declared within another subroutine. :attr attribute: the name of the collectio...
[ "def", "update_embedded", "(", "self", ",", "attribute", ")", ":", "#The parser doesn't handle embeddings deeper than two levels.", "coll", "=", "self", ".", "collection", "(", "attribute", ")", "keys", "=", "list", "(", "coll", ".", "keys", "(", ")", ")", "for"...
Updates the elements in the module 'result' that have character indices that are a subset of another element. These correspond to cases where the type or subroutine is declared within another subroutine. :attr attribute: the name of the collection to update over.
[ "Updates", "the", "elements", "in", "the", "module", "result", "that", "have", "character", "indices", "that", "are", "a", "subset", "of", "another", "element", ".", "These", "correspond", "to", "cases", "where", "the", "type", "or", "subroutine", "is", "dec...
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1827-L1848
50,675
rosenbrockc/fortpy
fortpy/elements.py
Module.charindex
def charindex(self, line, column): """Gets the absolute character index of the line and column in the continuous string.""" #Make sure that we have chars and lines to work from if this #gets called before linenum() does. if len(self._lines) == 0: self.linenum(1) ...
python
def charindex(self, line, column): """Gets the absolute character index of the line and column in the continuous string.""" #Make sure that we have chars and lines to work from if this #gets called before linenum() does. if len(self._lines) == 0: self.linenum(1) ...
[ "def", "charindex", "(", "self", ",", "line", ",", "column", ")", ":", "#Make sure that we have chars and lines to work from if this", "#gets called before linenum() does.", "if", "len", "(", "self", ".", "_lines", ")", "==", "0", ":", "self", ".", "linenum", "(", ...
Gets the absolute character index of the line and column in the continuous string.
[ "Gets", "the", "absolute", "character", "index", "of", "the", "line", "and", "column", "in", "the", "continuous", "string", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1870-L1881
50,676
rosenbrockc/fortpy
fortpy/elements.py
Module.linenum
def linenum(self, index): """Gets the line number of the character at the specified index. If the result is unknown, -1 is returned.""" if len(self._lines) == 0 and self.refstring != "": self._lines = self.refstring.split("\n") #Add one for the \n that we split on for eac...
python
def linenum(self, index): """Gets the line number of the character at the specified index. If the result is unknown, -1 is returned.""" if len(self._lines) == 0 and self.refstring != "": self._lines = self.refstring.split("\n") #Add one for the \n that we split on for eac...
[ "def", "linenum", "(", "self", ",", "index", ")", ":", "if", "len", "(", "self", ".", "_lines", ")", "==", "0", "and", "self", ".", "refstring", "!=", "\"\"", ":", "self", ".", "_lines", "=", "self", ".", "refstring", ".", "split", "(", "\"\\n\"", ...
Gets the line number of the character at the specified index. If the result is unknown, -1 is returned.
[ "Gets", "the", "line", "number", "of", "the", "character", "at", "the", "specified", "index", ".", "If", "the", "result", "is", "unknown", "-", "1", "is", "returned", "." ]
1ed0757c52d549e41d9d44bdea68cb89529293a5
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L1883-L1912
50,677
twaldear/flask-secure-headers
flask_secure_headers/headers.py
Simple_Header.check_valid
def check_valid(self): """ check if input is valid """ for k,input in self.inputs.items(): if k in self.valid_opts: for param in self.valid_opts[k]: if param is None or input is None: return True elif type(param) is str and '+' in param: if re.search(r'^'+param,str(input)): retur...
python
def check_valid(self): """ check if input is valid """ for k,input in self.inputs.items(): if k in self.valid_opts: for param in self.valid_opts[k]: if param is None or input is None: return True elif type(param) is str and '+' in param: if re.search(r'^'+param,str(input)): retur...
[ "def", "check_valid", "(", "self", ")", ":", "for", "k", ",", "input", "in", "self", ".", "inputs", ".", "items", "(", ")", ":", "if", "k", "in", "self", ".", "valid_opts", ":", "for", "param", "in", "self", ".", "valid_opts", "[", "k", "]", ":",...
check if input is valid
[ "check", "if", "input", "is", "valid" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L5-L24
50,678
twaldear/flask-secure-headers
flask_secure_headers/headers.py
Simple_Header.update_policy
def update_policy(self,defaultHeaders): """ if policy in default but not input still return """ if self.inputs is not None: for k,v in defaultHeaders.items(): if k not in self.inputs: self.inputs[k] = v return self.inputs else: return self.inputs
python
def update_policy(self,defaultHeaders): """ if policy in default but not input still return """ if self.inputs is not None: for k,v in defaultHeaders.items(): if k not in self.inputs: self.inputs[k] = v return self.inputs else: return self.inputs
[ "def", "update_policy", "(", "self", ",", "defaultHeaders", ")", ":", "if", "self", ".", "inputs", "is", "not", "None", ":", "for", "k", ",", "v", "in", "defaultHeaders", ".", "items", "(", ")", ":", "if", "k", "not", "in", "self", ".", "inputs", "...
if policy in default but not input still return
[ "if", "policy", "in", "default", "but", "not", "input", "still", "return" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L26-L34
50,679
twaldear/flask-secure-headers
flask_secure_headers/headers.py
Simple_Header.create_header
def create_header(self): """ return header dict """ try: self.check_valid() _header_list = [] for k,v in self.inputs.items(): if v is None: return {self.__class__.__name__.replace('_','-'):None} elif k == 'value': _header_list.insert(0,str(v)) elif isinstance(v,bool): if v is Tr...
python
def create_header(self): """ return header dict """ try: self.check_valid() _header_list = [] for k,v in self.inputs.items(): if v is None: return {self.__class__.__name__.replace('_','-'):None} elif k == 'value': _header_list.insert(0,str(v)) elif isinstance(v,bool): if v is Tr...
[ "def", "create_header", "(", "self", ")", ":", "try", ":", "self", ".", "check_valid", "(", ")", "_header_list", "=", "[", "]", "for", "k", ",", "v", "in", "self", ".", "inputs", ".", "items", "(", ")", ":", "if", "v", "is", "None", ":", "return"...
return header dict
[ "return", "header", "dict" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L40-L57
50,680
twaldear/flask-secure-headers
flask_secure_headers/headers.py
HPKP.update_policy
def update_policy(self,defaultHeaders): """ rewrite update policy so that additional pins are added and not overwritten """ if self.inputs is not None: for k,v in defaultHeaders.items(): if k not in self.inputs: self.inputs[k] = v if k == 'pins': self.inputs[k] = self.inputs[k] + defaultHeaders...
python
def update_policy(self,defaultHeaders): """ rewrite update policy so that additional pins are added and not overwritten """ if self.inputs is not None: for k,v in defaultHeaders.items(): if k not in self.inputs: self.inputs[k] = v if k == 'pins': self.inputs[k] = self.inputs[k] + defaultHeaders...
[ "def", "update_policy", "(", "self", ",", "defaultHeaders", ")", ":", "if", "self", ".", "inputs", "is", "not", "None", ":", "for", "k", ",", "v", "in", "defaultHeaders", ".", "items", "(", ")", ":", "if", "k", "not", "in", "self", ".", "inputs", "...
rewrite update policy so that additional pins are added and not overwritten
[ "rewrite", "update", "policy", "so", "that", "additional", "pins", "are", "added", "and", "not", "overwritten" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L108-L118
50,681
twaldear/flask-secure-headers
flask_secure_headers/headers.py
HPKP.create_header
def create_header(self): """ rewrite return header dict for HPKP """ try: self.check_valid() _header_list = [] for k,v in self.inputs.items(): if v is None: return {self.__class__.__name__.replace('_','-'):None} elif k == 'value': _header_list.insert(0,str(v)) elif isinstance(v,bool)...
python
def create_header(self): """ rewrite return header dict for HPKP """ try: self.check_valid() _header_list = [] for k,v in self.inputs.items(): if v is None: return {self.__class__.__name__.replace('_','-'):None} elif k == 'value': _header_list.insert(0,str(v)) elif isinstance(v,bool)...
[ "def", "create_header", "(", "self", ")", ":", "try", ":", "self", ".", "check_valid", "(", ")", "_header_list", "=", "[", "]", "for", "k", ",", "v", "in", "self", ".", "inputs", ".", "items", "(", ")", ":", "if", "v", "is", "None", ":", "return"...
rewrite return header dict for HPKP
[ "rewrite", "return", "header", "dict", "for", "HPKP" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L120-L138
50,682
twaldear/flask-secure-headers
flask_secure_headers/headers.py
CSP.update_policy
def update_policy(self,cspDefaultHeaders): """ add items to existing csp policies """ try: self.check_valid(cspDefaultHeaders) if self.inputs is not None: for p,l in self.inputs.items(): cspDefaultHeaders[p] = cspDefaultHeaders[p]+ list(set(self.inputs[p]) - set(cspDefaultHeaders[p])) return cspD...
python
def update_policy(self,cspDefaultHeaders): """ add items to existing csp policies """ try: self.check_valid(cspDefaultHeaders) if self.inputs is not None: for p,l in self.inputs.items(): cspDefaultHeaders[p] = cspDefaultHeaders[p]+ list(set(self.inputs[p]) - set(cspDefaultHeaders[p])) return cspD...
[ "def", "update_policy", "(", "self", ",", "cspDefaultHeaders", ")", ":", "try", ":", "self", ".", "check_valid", "(", "cspDefaultHeaders", ")", "if", "self", ".", "inputs", "is", "not", "None", ":", "for", "p", ",", "l", "in", "self", ".", "inputs", "....
add items to existing csp policies
[ "add", "items", "to", "existing", "csp", "policies" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L155-L166
50,683
twaldear/flask-secure-headers
flask_secure_headers/headers.py
CSP.rewrite_policy
def rewrite_policy(self,cspDefaultHeaders): """ fresh csp policy """ try: self.check_valid(cspDefaultHeaders) if self.inputs is not None: for p,l in cspDefaultHeaders.items(): if p in self.inputs: cspDefaultHeaders[p] = self.inputs[p] else: cspDefaultHeaders[p] = [] return cspDef...
python
def rewrite_policy(self,cspDefaultHeaders): """ fresh csp policy """ try: self.check_valid(cspDefaultHeaders) if self.inputs is not None: for p,l in cspDefaultHeaders.items(): if p in self.inputs: cspDefaultHeaders[p] = self.inputs[p] else: cspDefaultHeaders[p] = [] return cspDef...
[ "def", "rewrite_policy", "(", "self", ",", "cspDefaultHeaders", ")", ":", "try", ":", "self", ".", "check_valid", "(", "cspDefaultHeaders", ")", "if", "self", ".", "inputs", "is", "not", "None", ":", "for", "p", ",", "l", "in", "cspDefaultHeaders", ".", ...
fresh csp policy
[ "fresh", "csp", "policy" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L168-L182
50,684
twaldear/flask-secure-headers
flask_secure_headers/headers.py
CSP.create_header
def create_header(self): """ return CSP header dict """ encapsulate = re.compile("|".join(['^self','^none','^unsafe-inline','^unsafe-eval','^sha[\d]+-[\w=-]+','^nonce-[\w=-]+'])) csp = {} for p,array in self.inputs.items(): csp[p] = ' '.join(["'%s'" % l if encapsulate.match(l) else l for l in array]) ret...
python
def create_header(self): """ return CSP header dict """ encapsulate = re.compile("|".join(['^self','^none','^unsafe-inline','^unsafe-eval','^sha[\d]+-[\w=-]+','^nonce-[\w=-]+'])) csp = {} for p,array in self.inputs.items(): csp[p] = ' '.join(["'%s'" % l if encapsulate.match(l) else l for l in array]) ret...
[ "def", "create_header", "(", "self", ")", ":", "encapsulate", "=", "re", ".", "compile", "(", "\"|\"", ".", "join", "(", "[", "'^self'", ",", "'^none'", ",", "'^unsafe-inline'", ",", "'^unsafe-eval'", ",", "'^sha[\\d]+-[\\w=-]+'", ",", "'^nonce-[\\w=-]+'", "]"...
return CSP header dict
[ "return", "CSP", "header", "dict" ]
3eca972b369608a7669b67cbe66679570a6505ce
https://github.com/twaldear/flask-secure-headers/blob/3eca972b369608a7669b67cbe66679570a6505ce/flask_secure_headers/headers.py#L184-L191
50,685
justinabrahms/imhotep
imhotep/tools.py
Tool.invoke
def invoke(self, dirname, filenames=set(), linter_configs=set()): """ Main entrypoint for all plugins. Returns results in the format of: {'filename': { 'line_number': [ 'error1', 'error2' ] } } """ retval ...
python
def invoke(self, dirname, filenames=set(), linter_configs=set()): """ Main entrypoint for all plugins. Returns results in the format of: {'filename': { 'line_number': [ 'error1', 'error2' ] } } """ retval ...
[ "def", "invoke", "(", "self", ",", "dirname", ",", "filenames", "=", "set", "(", ")", ",", "linter_configs", "=", "set", "(", ")", ")", ":", "retval", "=", "defaultdict", "(", "lambda", ":", "defaultdict", "(", "list", ")", ")", "if", "len", "(", "...
Main entrypoint for all plugins. Returns results in the format of: {'filename': { 'line_number': [ 'error1', 'error2' ] } }
[ "Main", "entrypoint", "for", "all", "plugins", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/tools.py#L26-L68
50,686
justinabrahms/imhotep
imhotep/reporters/github.py
GitHubReporter.clean_already_reported
def clean_already_reported(self, comments, file_name, position, message): """ message is potentially a list of messages to post. This is later converted into a string. """ for comment in comments: if ((comment['path'] == file_name and ...
python
def clean_already_reported(self, comments, file_name, position, message): """ message is potentially a list of messages to post. This is later converted into a string. """ for comment in comments: if ((comment['path'] == file_name and ...
[ "def", "clean_already_reported", "(", "self", ",", "comments", ",", "file_name", ",", "position", ",", "message", ")", ":", "for", "comment", "in", "comments", ":", "if", "(", "(", "comment", "[", "'path'", "]", "==", "file_name", "and", "comment", "[", ...
message is potentially a list of messages to post. This is later converted into a string.
[ "message", "is", "potentially", "a", "list", "of", "messages", "to", "post", ".", "This", "is", "later", "converted", "into", "a", "string", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/reporters/github.py#L14-L26
50,687
justinabrahms/imhotep
imhotep/reporters/github.py
GitHubReporter.convert_message_to_string
def convert_message_to_string(self, message): """Convert message from list to string for GitHub API.""" final_message = '' for submessage in message: final_message += '* {submessage}\n'.format(submessage=submessage) return final_message
python
def convert_message_to_string(self, message): """Convert message from list to string for GitHub API.""" final_message = '' for submessage in message: final_message += '* {submessage}\n'.format(submessage=submessage) return final_message
[ "def", "convert_message_to_string", "(", "self", ",", "message", ")", ":", "final_message", "=", "''", "for", "submessage", "in", "message", ":", "final_message", "+=", "'* {submessage}\\n'", ".", "format", "(", "submessage", "=", "submessage", ")", "return", "f...
Convert message from list to string for GitHub API.
[ "Convert", "message", "from", "list", "to", "string", "for", "GitHub", "API", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/reporters/github.py#L39-L44
50,688
justinabrahms/imhotep
imhotep/reporters/github.py
PRReporter.post_comment
def post_comment(self, message): """ Comments on an issue, not on a particular line. """ report_url = ( 'https://api.github.com/repos/%s/issues/%s/comments' % (self.repo_name, self.pr_number) ) result = self.requester.post(report_url, {'body': mess...
python
def post_comment(self, message): """ Comments on an issue, not on a particular line. """ report_url = ( 'https://api.github.com/repos/%s/issues/%s/comments' % (self.repo_name, self.pr_number) ) result = self.requester.post(report_url, {'body': mess...
[ "def", "post_comment", "(", "self", ",", "message", ")", ":", "report_url", "=", "(", "'https://api.github.com/repos/%s/issues/%s/comments'", "%", "(", "self", ".", "repo_name", ",", "self", ".", "pr_number", ")", ")", "result", "=", "self", ".", "requester", ...
Comments on an issue, not on a particular line.
[ "Comments", "on", "an", "issue", "not", "on", "a", "particular", "line", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/reporters/github.py#L97-L108
50,689
bennylope/elasticstack
elasticstack/views.py
SearchView.get
def get(self, request, *args, **kwargs): """ Handles GET requests and instantiates a blank version of the form. """ form_class = self.get_form_class() form = self.get_form(form_class) if form.is_valid(): return self.form_valid(form) else: ...
python
def get(self, request, *args, **kwargs): """ Handles GET requests and instantiates a blank version of the form. """ form_class = self.get_form_class() form = self.get_form(form_class) if form.is_valid(): return self.form_valid(form) else: ...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "form_class", "=", "self", ".", "get_form_class", "(", ")", "form", "=", "self", ".", "get_form", "(", "form_class", ")", "if", "form", ".", "is_valid", ...
Handles GET requests and instantiates a blank version of the form.
[ "Handles", "GET", "requests", "and", "instantiates", "a", "blank", "version", "of", "the", "form", "." ]
8d1e99489815de6346fbf6720c9df5176546288e
https://github.com/bennylope/elasticstack/blob/8d1e99489815de6346fbf6720c9df5176546288e/elasticstack/views.py#L128-L138
50,690
f213/django-suit-daterange-filter
date_range_filter/filter.py
DateRangeFilter.queryset
def queryset(self, request, queryset): form = self.get_form(request) """ That's the trick - we create self.form when django tries to get our queryset. This allows to create unbount and bound form in the single place. """ self.form = form start_date = form.start_...
python
def queryset(self, request, queryset): form = self.get_form(request) """ That's the trick - we create self.form when django tries to get our queryset. This allows to create unbount and bound form in the single place. """ self.form = form start_date = form.start_...
[ "def", "queryset", "(", "self", ",", "request", ",", "queryset", ")", ":", "form", "=", "self", ".", "get_form", "(", "request", ")", "self", ".", "form", "=", "form", "start_date", "=", "form", ".", "start_date", "(", ")", "end_date", "=", "form", "...
That's the trick - we create self.form when django tries to get our queryset. This allows to create unbount and bound form in the single place.
[ "That", "s", "the", "trick", "-", "we", "create", "self", ".", "form", "when", "django", "tries", "to", "get", "our", "queryset", ".", "This", "allows", "to", "create", "unbount", "and", "bound", "form", "in", "the", "single", "place", "." ]
641d216af224435fb70faddaea031882b2d3a76c
https://github.com/f213/django-suit-daterange-filter/blob/641d216af224435fb70faddaea031882b2d3a76c/date_range_filter/filter.py#L69-L86
50,691
justinabrahms/imhotep
imhotep/repomanagers.py
RepoManager.clone_repo
def clone_repo(self, repo_name, remote_repo, ref): """Clones the given repo and returns the Repository object.""" self.shallow_clone = False dirname, repo = self.set_up_clone(repo_name, remote_repo) if os.path.isdir("%s/.git" % dirname): log.debug("Updating %s to %s", repo.do...
python
def clone_repo(self, repo_name, remote_repo, ref): """Clones the given repo and returns the Repository object.""" self.shallow_clone = False dirname, repo = self.set_up_clone(repo_name, remote_repo) if os.path.isdir("%s/.git" % dirname): log.debug("Updating %s to %s", repo.do...
[ "def", "clone_repo", "(", "self", ",", "repo_name", ",", "remote_repo", ",", "ref", ")", ":", "self", ".", "shallow_clone", "=", "False", "dirname", ",", "repo", "=", "self", ".", "set_up_clone", "(", "repo_name", ",", "remote_repo", ")", "if", "os", "."...
Clones the given repo and returns the Repository object.
[ "Clones", "the", "given", "repo", "and", "returns", "the", "Repository", "object", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/repomanagers.py#L68-L88
50,692
bennylope/elasticstack
elasticstack/utils.py
prepare_object
def prepare_object(obj, using="default"): """ Returns a Python dictionary representation of the given object, expected to be a Model object with an associated SearchIndex. The optional argument `using` specifies the backend to use from the Haystack connections list. """ model = obj.__class__ ...
python
def prepare_object(obj, using="default"): """ Returns a Python dictionary representation of the given object, expected to be a Model object with an associated SearchIndex. The optional argument `using` specifies the backend to use from the Haystack connections list. """ model = obj.__class__ ...
[ "def", "prepare_object", "(", "obj", ",", "using", "=", "\"default\"", ")", ":", "model", "=", "obj", ".", "__class__", "unified_index", "=", "connections", "[", "using", "]", ".", "get_unified_index", "(", ")", "index", "=", "unified_index", ".", "get_index...
Returns a Python dictionary representation of the given object, expected to be a Model object with an associated SearchIndex. The optional argument `using` specifies the backend to use from the Haystack connections list.
[ "Returns", "a", "Python", "dictionary", "representation", "of", "the", "given", "object", "expected", "to", "be", "a", "Model", "object", "with", "an", "associated", "SearchIndex", ".", "The", "optional", "argument", "using", "specifies", "the", "backend", "to",...
8d1e99489815de6346fbf6720c9df5176546288e
https://github.com/bennylope/elasticstack/blob/8d1e99489815de6346fbf6720c9df5176546288e/elasticstack/utils.py#L28-L41
50,693
bennylope/elasticstack
elasticstack/utils.py
get_model
def get_model(app_label, model_name): """ Fetches a Django model using the app registry. This doesn't require that an app with the given app label exists, which makes it safe to call when the registry is being populated. All other methods to access models might raise an exception about the registry...
python
def get_model(app_label, model_name): """ Fetches a Django model using the app registry. This doesn't require that an app with the given app label exists, which makes it safe to call when the registry is being populated. All other methods to access models might raise an exception about the registry...
[ "def", "get_model", "(", "app_label", ",", "model_name", ")", ":", "try", ":", "from", "django", ".", "apps", "import", "apps", "from", "django", ".", "core", ".", "exceptions", "import", "AppRegistryNotReady", "except", "ImportError", ":", "# Django < 1.7", "...
Fetches a Django model using the app registry. This doesn't require that an app with the given app label exists, which makes it safe to call when the registry is being populated. All other methods to access models might raise an exception about the registry not being ready yet. Raises LookupError ...
[ "Fetches", "a", "Django", "model", "using", "the", "app", "registry", "." ]
8d1e99489815de6346fbf6720c9df5176546288e
https://github.com/bennylope/elasticstack/blob/8d1e99489815de6346fbf6720c9df5176546288e/elasticstack/utils.py#L44-L85
50,694
justinabrahms/imhotep
imhotep/main.py
main
def main(): """ Main entrypoint for the command-line app. """ args = app.parse_args(sys.argv[1:]) params = args.__dict__ params.update(**load_config(args.config_file)) if params['debug']: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig() try: ...
python
def main(): """ Main entrypoint for the command-line app. """ args = app.parse_args(sys.argv[1:]) params = args.__dict__ params.update(**load_config(args.config_file)) if params['debug']: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig() try: ...
[ "def", "main", "(", ")", ":", "args", "=", "app", ".", "parse_args", "(", "sys", ".", "argv", "[", "1", ":", "]", ")", "params", "=", "args", ".", "__dict__", "params", ".", "update", "(", "*", "*", "load_config", "(", "args", ".", "config_file", ...
Main entrypoint for the command-line app.
[ "Main", "entrypoint", "for", "the", "command", "-", "line", "app", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/main.py#L28-L54
50,695
twidi/django-templates-macros
setup.py
read_relative_file
def read_relative_file(filename): """Returns contents of the given file, which path is supposed relative to this module.""" with open(join(dirname(abspath(__file__)), filename)) as f: return f.read()
python
def read_relative_file(filename): """Returns contents of the given file, which path is supposed relative to this module.""" with open(join(dirname(abspath(__file__)), filename)) as f: return f.read()
[ "def", "read_relative_file", "(", "filename", ")", ":", "with", "open", "(", "join", "(", "dirname", "(", "abspath", "(", "__file__", ")", ")", ",", "filename", ")", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
Returns contents of the given file, which path is supposed relative to this module.
[ "Returns", "contents", "of", "the", "given", "file", "which", "path", "is", "supposed", "relative", "to", "this", "module", "." ]
d4eb0891b2f4b42ce2ab7cf793e7b88421ace188
https://github.com/twidi/django-templates-macros/blob/d4eb0891b2f4b42ce2ab7cf793e7b88421ace188/setup.py#L7-L11
50,696
justinabrahms/imhotep
imhotep/repositories.py
Repository.diff_commit
def diff_commit(self, commit, compare_point=None): """ Returns a diff as a string from the current HEAD to the given commit. """ # @@@ This is a security hazard as compare-point is user-passed in # data. Doesn't matter until we wrap this in a service. if compare_point is ...
python
def diff_commit(self, commit, compare_point=None): """ Returns a diff as a string from the current HEAD to the given commit. """ # @@@ This is a security hazard as compare-point is user-passed in # data. Doesn't matter until we wrap this in a service. if compare_point is ...
[ "def", "diff_commit", "(", "self", ",", "commit", ",", "compare_point", "=", "None", ")", ":", "# @@@ This is a security hazard as compare-point is user-passed in", "# data. Doesn't matter until we wrap this in a service.", "if", "compare_point", "is", "not", "None", ":", "se...
Returns a diff as a string from the current HEAD to the given commit.
[ "Returns", "a", "diff", "as", "a", "string", "from", "the", "current", "HEAD", "to", "the", "given", "commit", "." ]
c6dc365ef34505d7b6837187900e59b00e5fab08
https://github.com/justinabrahms/imhotep/blob/c6dc365ef34505d7b6837187900e59b00e5fab08/imhotep/repositories.py#L35-L43
50,697
mlenzen/collections-extended
collections_extended/indexed_dict.py
IndexedDict.get
def get(self, key=NOT_SET, index=NOT_SET, d=None): """Return value with given key or index. If no value is found, return d (None by default). """ if index is NOT_SET and key is not NOT_SET: try: index, value = self._dict[key] except KeyError: return d else: return value elif index is not...
python
def get(self, key=NOT_SET, index=NOT_SET, d=None): """Return value with given key or index. If no value is found, return d (None by default). """ if index is NOT_SET and key is not NOT_SET: try: index, value = self._dict[key] except KeyError: return d else: return value elif index is not...
[ "def", "get", "(", "self", ",", "key", "=", "NOT_SET", ",", "index", "=", "NOT_SET", ",", "d", "=", "None", ")", ":", "if", "index", "is", "NOT_SET", "and", "key", "is", "not", "NOT_SET", ":", "try", ":", "index", ",", "value", "=", "self", ".", ...
Return value with given key or index. If no value is found, return d (None by default).
[ "Return", "value", "with", "given", "key", "or", "index", "." ]
ee9e86f6bbef442dbebcb3a5970642c5c969e2cf
https://github.com/mlenzen/collections-extended/blob/ee9e86f6bbef442dbebcb3a5970642c5c969e2cf/collections_extended/indexed_dict.py#L34-L54
50,698
mlenzen/collections-extended
collections_extended/indexed_dict.py
IndexedDict._pop_key
def _pop_key(self, key, has_default): """Remove an element by key.""" try: index, value = self._dict.pop(key) except KeyError: if has_default: return None, None else: raise key2, value2 = self._list.pop(index) assert key is key2 assert value is value2 return index, value
python
def _pop_key(self, key, has_default): """Remove an element by key.""" try: index, value = self._dict.pop(key) except KeyError: if has_default: return None, None else: raise key2, value2 = self._list.pop(index) assert key is key2 assert value is value2 return index, value
[ "def", "_pop_key", "(", "self", ",", "key", ",", "has_default", ")", ":", "try", ":", "index", ",", "value", "=", "self", ".", "_dict", ".", "pop", "(", "key", ")", "except", "KeyError", ":", "if", "has_default", ":", "return", "None", ",", "None", ...
Remove an element by key.
[ "Remove", "an", "element", "by", "key", "." ]
ee9e86f6bbef442dbebcb3a5970642c5c969e2cf
https://github.com/mlenzen/collections-extended/blob/ee9e86f6bbef442dbebcb3a5970642c5c969e2cf/collections_extended/indexed_dict.py#L79-L92
50,699
mlenzen/collections-extended
collections_extended/indexed_dict.py
IndexedDict._pop_index
def _pop_index(self, index, has_default): """Remove an element by index, or last element.""" try: if index is NOT_SET: index = len(self._list) - 1 key, value = self._list.pop() else: key, value = self._list.pop(index) if index < 0: index += len(self._list) + 1 except IndexError: if h...
python
def _pop_index(self, index, has_default): """Remove an element by index, or last element.""" try: if index is NOT_SET: index = len(self._list) - 1 key, value = self._list.pop() else: key, value = self._list.pop(index) if index < 0: index += len(self._list) + 1 except IndexError: if h...
[ "def", "_pop_index", "(", "self", ",", "index", ",", "has_default", ")", ":", "try", ":", "if", "index", "is", "NOT_SET", ":", "index", "=", "len", "(", "self", ".", "_list", ")", "-", "1", "key", ",", "value", "=", "self", ".", "_list", ".", "po...
Remove an element by index, or last element.
[ "Remove", "an", "element", "by", "index", "or", "last", "element", "." ]
ee9e86f6bbef442dbebcb3a5970642c5c969e2cf
https://github.com/mlenzen/collections-extended/blob/ee9e86f6bbef442dbebcb3a5970642c5c969e2cf/collections_extended/indexed_dict.py#L94-L113