-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into develop-0.1.0
- Loading branch information
Showing
20 changed files
with
12,839 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# libraries licenses | ||
|
||
Licenses for my dependencies, I have copy pasted them from your github repositories, if you see anything wrong please contact me! | ||
|
||
## pyparsing | ||
|
||
``` | ||
# Copyright (c) 2003-2019 Paul T. McGuire | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining | ||
# a copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to | ||
# the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be | ||
# included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
``` | ||
|
||
## asttokens | ||
|
||
``` | ||
# Copyright 2016 Grist Labs, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
``` | ||
|
||
## astmonkey | ||
|
||
``` | ||
Copyright [2013] [Konrad Hałas] | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
``` | ||
|
||
## six | ||
|
||
``` | ||
Copyright (c) 2010-2019 Benjamin Peterson | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
``` | ||
|
||
## segment_tree | ||
|
||
``` | ||
MIT License | ||
Copyright (c) 2017 Evgeny Yurtaev | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
``` | ||
|
||
## pydot | ||
|
||
``` | ||
Copyright (c) 2014 Carlos Jenkins | ||
Copyright (c) 2014 Lance Helper | ||
Copyright (c) 2004 Ero Carrera | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
* | ||
*.dist-info | ||
__pycache__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '0.3.6' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import ast | ||
|
||
|
||
class ParentChildNodeTransformer(object): | ||
|
||
def visit(self, node): | ||
self._prepare_node(node) | ||
for field, value in ast.iter_fields(node): | ||
self._process_field(node, field, value) | ||
return node | ||
|
||
@staticmethod | ||
def _prepare_node(node): | ||
if not hasattr(node, 'parent'): | ||
node.parent = None | ||
if not hasattr(node, 'parents'): | ||
node.parents = [] | ||
if not hasattr(node, 'children'): | ||
node.children = [] | ||
|
||
def _process_field(self, node, field, value): | ||
if isinstance(value, list): | ||
for index, item in enumerate(value): | ||
if isinstance(item, ast.AST): | ||
self._process_child(item, node, field, index) | ||
elif isinstance(value, ast.AST): | ||
self._process_child(value, node, field) | ||
|
||
def _process_child(self, child, parent, field_name, index=None): | ||
self.visit(child) | ||
child.parent = parent | ||
child.parents.append(parent) | ||
child.parent_field = field_name | ||
child.parent_field_index = index | ||
child.parent.children.append(child) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import ast | ||
import sys | ||
|
||
|
||
def is_docstring(node): | ||
if node.parent is None or node.parent.parent is None: | ||
return False | ||
def_node = node.parent.parent | ||
return ( | ||
isinstance(def_node, (ast.FunctionDef, ast.ClassDef, ast.Module)) and def_node.body and | ||
isinstance(def_node.body[0], ast.Expr) and isinstance(def_node.body[0].value, ast.Str) and | ||
def_node.body[0].value == node | ||
) | ||
|
||
|
||
def get_by_python_version(classes, python_version=sys.version_info): | ||
result = None | ||
for cls in classes: | ||
if cls.__python_version__ <= python_version: | ||
if not result or cls.__python_version__ > result.__python_version__: | ||
result = cls | ||
if not result: | ||
raise NotImplementedError('astmonkey does not support Python %s.' % sys.version) | ||
return result | ||
|
||
|
||
class CommaWriter: | ||
|
||
def __init__(self, write_func, add_space_at_beginning=False): | ||
self.write_func = write_func | ||
self.add_space_at_beginning = add_space_at_beginning | ||
self.not_called_yet = True | ||
|
||
def __call__(self, *args, **kwargs): | ||
if self.not_called_yet: | ||
self.not_called_yet = False | ||
if self.add_space_at_beginning: | ||
self.write_func(' ') | ||
else: | ||
self.write_func(', ') | ||
|
||
def check_version(from_inclusive=None, to_exclusive=None): | ||
if (not from_inclusive or sys.version_info >= from_inclusive) \ | ||
and (not to_exclusive or sys.version_info < to_exclusive): | ||
return True | ||
return False |
Oops, something went wrong.