diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | README._ast_compatibility | 6 | ||||
-rw-r--r-- | __init__.py | 4 | ||||
-rw-r--r-- | __pkginfo__.py | 4 | ||||
-rw-r--r-- | _nodes_ast.py | 4 | ||||
-rw-r--r-- | _nodes_compiler.py | 6 | ||||
-rw-r--r-- | builder.py | 2 | ||||
-rw-r--r-- | inference.py | 4 | ||||
-rw-r--r-- | infutils.py | 12 | ||||
-rw-r--r-- | inspector.py | 20 | ||||
-rw-r--r-- | lookup.py | 16 | ||||
-rw-r--r-- | manager.py | 6 | ||||
-rw-r--r-- | nodes.py | 2 | ||||
-rw-r--r-- | nodes_as_string.py | 2 | ||||
-rw-r--r-- | patchcomptransformer.py | 2 | ||||
-rw-r--r-- | protocols.py | 14 | ||||
-rw-r--r-- | raw_building.py | 4 | ||||
-rw-r--r-- | scoped_nodes.py | 24 | ||||
-rw-r--r-- | test/unittest_builder.py | 6 | ||||
-rw-r--r-- | test/unittest_inference.py | 2 | ||||
-rw-r--r-- | test/unittest_lookup.py | 4 | ||||
-rw-r--r-- | test/unittest_scoped_nodes.py | 2 | ||||
-rw-r--r-- | utils.py | 4 |
24 files changed, 88 insertions, 88 deletions
@@ -45,7 +45,7 @@ Change log for the astng package 2008-09-10 -- 0.17.3 * fix #5889: astng crash on certain pyreverse projects - * fix bug w/ loop assigment in .lookup + * fix bug w/ loop assignment in .lookup * apply Maarten patch fixing a crash on TryFinalaly.block_range and fixing 'else'/'final' block line detection @@ -58,13 +58,13 @@ Change log for the astng package * fixed recursion arguments in nodes_of_class method as notified by Dave Borowitz - * new InstanceMethod node introduced to wrap bound method (eg Function + * new InstanceMethod node introduced to wrap bound method (e.g. Function node), patch provided by Dave Borowitz 2007-06-07 -- 0.17.1 - * fix #3651: crash when callable as defaut arg + * fix #3651: crash when callable as default arg * fix #3670: subscription inference crash in some cases @@ -94,7 +94,7 @@ Change log for the astng package * basic math operation inference - * new pytype method on possibly infered node (eg module, classes, const...) + * new pytype method on possibly inferred node (e.g. module, classes, const...) * fix a living object astng building bug, which was making "open" uninferable @@ -169,7 +169,7 @@ Change log for the astng package classes * new .ass_type method on assignment related node, returning the - assigment type node (Assign, For, ListCompFor, GenExprFor, + assignment type node (Assign, For, ListCompFor, GenExprFor, TryExcept) * more API refactoring... .resolve method has disappeared, now you @@ -186,7 +186,7 @@ Change log for the astng package 2006-01-10 -- 0.14.0 - * some major inference improvments and refactoring ! The drawback is + * some major inference improvements and refactoring ! The drawback is the introduction of some non backward compatible change in the API but it's imho much cleaner and powerful now :) @@ -209,11 +209,11 @@ Change log for the astng package __init__ file * fix a bug regarding construction of Function node from living object - with realier version of python 2.4 + with earlier version of python 2.4 * fix a NameError on Import and From self_resolve method - * fix a bug occuring when building an astng from a living object with + * fix a bug occurring when building an astng from a living object with a property * lint fixes @@ -222,7 +222,7 @@ Change log for the astng package 2005-11-07 -- 0.13.1 * fix bug on building from living module the same object in - encountered more than once time (eg builtins.object) (close #10069) + encountered more than once time (e.g. builtins.object) (close #10069) * fix bug in Class.ancestors() regarding inner classes (close #10072) @@ -247,8 +247,8 @@ Change log for the astng package 2005-10-21 -- 0.13.0 * .locals and .globals on scoped node handle now a list of references - to each assigment statements instead of a single reference to the - first assigment statement. + to each assignment statements instead of a single reference to the + first assignment statement. * fix bug with manager.astng_from_module_name when a context file is given (notably fix ZODB 3.4 crash with pylint/pyreverse) @@ -6,7 +6,7 @@ What's this ? The aim of this module is to provide a common base representation of python source code for projects such as pychecker, pyreverse, -pylint... Well, actually the development of this library is essentialy +pylint... Well, actually the development of this library is essentially governed by pylint's needs. Since 0.18, it provides a compatible representation which may come @@ -16,7 +16,7 @@ from the `compiler` module (for python <= 2.4) pr the `_ast` module It extends bare node classes with some additional methods and attributes. Instance attributes are added by a builder object, which can generate extended ast (let's call them astng ;) by visiting either -an existant ast tree or by inspecting living object. Methods are added +an existent ast tree or by inspecting living object. Methods are added by monkey patching ast classes. Finally some support for static inference is provided. diff --git a/README._ast_compatibility b/README._ast_compatibility index bd046b32..f7079ffa 100644 --- a/README._ast_compatibility +++ b/README._ast_compatibility @@ -1,4 +1,4 @@ -XXX deprecated, update by descrinbg the unified tree structure, how we acheive this and remaining differences... +XXX deprecated, update by describing the unified tree structure, how we achieve this and remaining differences... this branch aims to provide compatibility between the `compiler` module and the new `_ast` module provided by python >= 2.5. @@ -15,11 +15,11 @@ minimize backward incompatibilities, so pylint for instance can work with this new representation without too much modifications. Nodes' class names will still differ, though the provided visitor will map _ast -class names to compiler class names (eg for instance when a `_ast.ClassDef` node +class names to compiler class names (e.g. for instance when a `_ast.ClassDef` node is visited, the `visit_class` method will be called). This is done to ease compatibility with code using earlier astng version. -Attribute names are made compatible, and I've choosen _ast or compiler's name +Attribute names are made compatible, and I've chosen _ast or compiler's name by using the most relevant, imo. Those can be found using the `_astng_fields` attribute on each node class. diff --git a/__init__.py b/__init__.py index d298ab80..24bab640 100644 --- a/__init__.py +++ b/__init__.py @@ -14,13 +14,13 @@ The aim of this module is to provide a common base representation of python source code for projects such as pychecker, pyreverse, -pylint... Well, actually the development of this library is essentialy +pylint... Well, actually the development of this library is essentially governed by pylint's needs. It extends class defined in the compiler.ast [1] module with some additional methods and attributes. Instance attributes are added by a builder object, which can either generate extended ast (let's call -them astng ;) by visiting an existant ast tree or by inspecting living +them astng ;) by visiting an existent ast tree or by inspecting living object. Methods are added by monkey patching ast classes. Main modules are: diff --git a/__pkginfo__.py b/__pkginfo__.py index 0a861576..49123233 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -42,13 +42,13 @@ short_desc = "extend python's abstract syntax tree" long_desc = """The aim of this module is to provide a common base \ representation of python source code for projects such as pychecker, pyreverse, -pylint... Well, actually the development of this library is essentialy +pylint... Well, actually the development of this library is essentially governed by pylint's needs. It extends class defined in the compiler.ast [1] module (python <= 2.4) or in the builtin _ast module (python >= 2.5) with some additional methods and attributes. Instance attributes are added by a builder object, which can either -generate extended ast (let's call them astng ;) by visiting an existant ast +generate extended ast (let's call them astng ;) by visiting an existent ast tree or by inspecting living object. Methods are added by monkey patching ast classes.""" diff --git a/_nodes_ast.py b/_nodes_ast.py index 2b5e378f..5f7e84ca 100644 --- a/_nodes_ast.py +++ b/_nodes_ast.py @@ -165,7 +165,7 @@ from _ast import Str as _Str, Num as _Num _Num.accept = lambda self, visitor: visitor.visit_num(self) _Str.accept = lambda self, visitor: visitor.visit_str(self) -# some astng nodes unexistant in _ast ######################################### +# some astng nodes unexistent in _ast ######################################### class AssAttr(Node): """represent Attribute Assignment statements""" @@ -196,7 +196,7 @@ class Decorators(Node): # _ast rebuilder ############################################################## class TreeRebuilder(ASTVisitor): - """REbuilds the _ast tree to become an ASTNG tree""" + """Rebuilds the _ast tree to become an ASTNG tree""" def __init__(self, rebuild_visitor): self.visitor = rebuild_visitor diff --git a/_nodes_compiler.py b/_nodes_compiler.py index d83ff61d..15038cfb 100644 --- a/_nodes_compiler.py +++ b/_nodes_compiler.py @@ -87,7 +87,7 @@ class With: pass class IfExp: pass # introduced in python 2.5 -From.level = 0 # will be overiden by instance attribute with py>=2.5 +From.level = 0 # will be overridden by instance attribute with py>=2.5 from logilab.astng.utils import ASTVisitor @@ -129,14 +129,14 @@ def native_repr_tree(node, indent='', _done=None): print indent + field, repr(attr) -# some astng nodes unexistant in compiler ##################################### +# some astng nodes unexistent in compiler ##################################### class ExceptHandler(Node): def __init__(self, exc_type, name, body, parent): self.type = exc_type self.name = name self.body = body.nodes - # XXX parent.lineno is wrong, cant't catch the right line ... + # XXX parent.lineno is wrong, can't catch the right line ... if exc_type and exc_type.lineno: self.fromlineno = exc_type.lineno else: @@ -128,7 +128,7 @@ class ASTNGBuilder: return self.ast_build(parse(data + '\n'), modname, path) def ast_build(self, node, modname='', path=None): - """recurse on the ast (soon ng) to add some arguments et method""" + """recurse on the ast (soon ng) to add some arguments at method""" if path is not None: node.file = node.path = abspath(path) else: diff --git a/inference.py b/inference.py index f8ab6169..46d86278 100644 --- a/inference.py +++ b/inference.py @@ -76,7 +76,7 @@ nodes.Dict.pytype = lambda x: '__builtin__.dict' class CallContext: - """when infering a function call, this class is used to remember values + """when inferring a function call, this class is used to remember values given as argument """ def __init__(self, args, starargs, dstarargs): @@ -91,7 +91,7 @@ class CallContext: self.dstarargs = dstarargs def infer_argument(self, funcnode, name, context): - """infer a function argument value according the the call context""" + """infer a function argument value according to the call context""" # 1. search in named keywords try: return self.nargs[name].infer(context) diff --git a/infutils.py b/infutils.py index 4226b0f7..1e5aa9c5 100644 --- a/infutils.py +++ b/infutils.py @@ -88,7 +88,7 @@ def are_exclusive(stmt1, stmt2, exceptions=None): 1) index stmt1's parents 2) climb among stmt2's parents until we find a common parent 3) if the common parent is a If or TryExcept statement, look if nodes are - in exclusive branchs + in exclusive branches """ # index stmt1's parents stmt1_parents = {} @@ -106,7 +106,7 @@ def are_exclusive(stmt1, stmt2, exceptions=None): while node: if stmt1_parents.has_key(node): # if the common parent is a If or TryExcept statement, look if - # nodes are in exclusive branchs + # nodes are in exclusive branches if isinstance(node, If) and exceptions is None: if (node.locate_child(previous)[1] is not node.locate_child(children[node])[1]): @@ -129,8 +129,8 @@ def are_exclusive(stmt1, stmt2, exceptions=None): def unpack_infer(stmt, context=None): - """return an iterator on nodes infered by the given statement if the infered - value is a list or a tuple, recurse on it to get values infered by its + """return an iterator on nodes inferred by the given statement if the inferred + value is a list or a tuple, recurse on it to get values inferred by its content """ if isinstance(stmt, (List, Tuple)): @@ -148,7 +148,7 @@ def copy_context(context): return InferenceContext() def _infer_stmts(stmts, context, frame=None): - """return an iterator on statements infered by each statement in <stmts> + """return an iterator on statements inferred by each statement in <stmts> """ stmt = None infered = False @@ -258,7 +258,7 @@ class Instance(Proxy): raise NotFoundError(name) def igetattr(self, name, context=None): - """infered getattr""" + """inferred getattr""" try: # XXX frame should be self._proxied, or not ? return _infer_stmts( diff --git a/inspector.py b/inspector.py index c2a66d01..45a18b65 100644 --- a/inspector.py +++ b/inspector.py @@ -11,7 +11,7 @@ # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """visitor doing some postprocessing on the astng tree. -Try to resolve definitions (namespace) dictionnary, relationship... +Try to resolve definitions (namespace) dictionary, relationship... This module has been imported from pyreverse @@ -48,7 +48,7 @@ class IdGeneratorMixIn: self.id_count = start_value def generate_id(self): - """generate a new identifer + """generate a new identifier """ self.id_count += 1 return self.id_count @@ -91,7 +91,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): def visit_project(self, node): """visit an astng.Project node - * optionaly tag the node wth a unique id + * optionally tag the node with a unique id """ if self.tag: node.uid = self.generate_id() @@ -101,7 +101,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): def visit_package(self, node): """visit an astng.Package node - * optionaly tag the node wth a unique id + * optionally tag the node with a unique id """ if self.tag: node.uid = self.generate_id() @@ -113,7 +113,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): * set the locals_type mapping * set the depends mapping - * optionaly tag the node wth a unique id + * optionally tag the node with a unique id """ if hasattr(node, 'locals_type'): return @@ -127,7 +127,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): * set the locals_type and instance_attrs_type mappings * set the implements list and build it - * optionaly tag the node wth a unique id + * optionally tag the node with a unique id """ if hasattr(node, 'locals_type'): return @@ -154,7 +154,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): """visit an astng.Function node * set the locals_type mapping - * optionaly tag the node wth a unique id + * optionally tag the node with a unique id """ if hasattr(node, 'locals_type'): return @@ -227,7 +227,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): for name in node.names: if name[0] == '*': continue - # analyze dependancies + # analyze dependencies fullname = '%s.%s' % (basename, name[0]) if fullname.find('.') > -1: try: @@ -251,7 +251,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): # protected methods ######################################################## def _imported_module(self, node, mod_path, relative): - """notify an imported module, used to analyze dependancies + """notify an imported module, used to analyze dependencies """ module = node.root() context_name = module.name @@ -259,7 +259,7 @@ class Linker(IdGeneratorMixIn, LocalsVisitor): mod_path = '%s.%s' % ('.'.join(context_name.split('.')[:-1]), mod_path) if self.compute_module(context_name, mod_path): - # handle dependancies + # handle dependencies if not hasattr(module, 'depends'): module.depends = [] mod_paths = module.depends @@ -16,8 +16,8 @@ Function, Lambda, GenExpr...): * .lookup(name) * .ilookup(name) -Be careful, lookup is nternal and returns a tuple (scope, [stmts]), while -ilookup returns an iterator on infered values. +Be careful, lookup is internal and returns a tuple (scope, [stmts]), while +ilookup returns an iterator on inferred values. :author: Sylvain Thenault :copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE) @@ -119,9 +119,9 @@ def builtin_lookup(name): return builtinastng, stmts def ilookup(self, name, context=None): - """infered lookup + """inferred lookup - return an iterator on infered values of the statements returned by + return an iterator on inferred values of the statements returned by the lookup method """ frame, stmts = self.lookup(name) @@ -184,8 +184,8 @@ def _filter_stmts(self, stmts, frame, offset): break optional_assign = isinstance(ass_type, nodes.LOOP_SCOPES) if optional_assign and ass_type.parent_of(self): - # we are inside a loop, loop var assigment is hidding previous - # assigment + # we are inside a loop, loop var assignment is hiding previous + # assignment _stmts = [node] _stmt_parents = [stmt.parent] continue @@ -201,7 +201,7 @@ def _filter_stmts(self, stmts, frame, offset): # both statements are not at the same block level continue # if currently visited node is following previously considered - # assignement and both are not exclusive, we can drop the previous + # assignment and both are not exclusive, we can drop the previous # one. For instance in the following code :: # # if a: @@ -221,7 +221,7 @@ def _filter_stmts(self, stmts, frame, offset): # # moreover, on loop assignment types, assignment won't necessarily # be done if the loop has no iteration, so we don't want to clear - # previous assigments if any (hence the test on optional_assign) + # previous assignments if any (hence the test on optional_assign) if not (optional_assign or are_exclusive(_stmts[pindex], node)): del _stmt_parents[pindex] @@ -10,7 +10,7 @@ # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -"""astng manager: avoid multible astng build of a same module when +"""astng manager: avoid multiple astng build of a same module when possible by providing a class responsible to get astng representation from various source and using a cache of built modules) @@ -236,7 +236,7 @@ class ASTNGManager(OptionsProviderMixIn): 'Unable to get module for %s' % safe_repr(klass)) except Exception, ex: raise ASTNGBuildingException( - 'Unexpected error while retreiving module for %s: %s' + 'Unexpected error while retrieving module for %s: %s' % (safe_repr(klass), ex)) try: name = klass.__name__ @@ -245,7 +245,7 @@ class ASTNGManager(OptionsProviderMixIn): 'Unable to get name for %s' % safe_repr(klass)) except Exception, ex: raise ASTNGBuildingException( - 'Unexpected error while retreiving name for %s: %s' + 'Unexpected error while retrieving name for %s: %s' % (safe_repr(klass), ex)) # take care, on living object __module__ is regularly wrong :( modastng = self.astng_from_module_name(modname) @@ -139,7 +139,7 @@ ALL_NODES = STMT_NODES + ( class NodeNG: """/!\ this class should not be used directly /!\ It is used as method and attribute container, and updates the - original class from the compiler.ast / _ast module using its dictionnary + original class from the compiler.ast / _ast module using its dictionary (see below the class definition) """ is_statement = False diff --git a/nodes_as_string.py b/nodes_as_string.py index 1d68e09a..d827d2cf 100644 --- a/nodes_as_string.py +++ b/nodes_as_string.py @@ -20,7 +20,7 @@ """ """This module renders ASTNG nodes to string representation. -It will problably not work on compiler.ast or _ast trees. +It will probably not work on compiler.ast or _ast trees. """ diff --git a/patchcomptransformer.py b/patchcomptransformer.py index 5f3e3c92..586effe8 100644 --- a/patchcomptransformer.py +++ b/patchcomptransformer.py @@ -86,7 +86,7 @@ def fixlineno_wrap(function, stype): return fixlineno_wrapper class ASTNGTransformer(BaseTransformer): - """ovverides transformer for a better source line number handling""" + """overrides transformer for a better source line number handling""" def com_NEWLINE(self, *args): # A ';' at the end of a line can make a NEWLINE token appear # here, Render it harmless. (genc discards ('discard', diff --git a/protocols.py b/protocols.py index 8385c666..7249fc96 100644 --- a/protocols.py +++ b/protocols.py @@ -50,7 +50,7 @@ nodes.Dict.infer_unary_op = dict_infer_unary_op def const_infer_unary_op(self, operator): if operator == 'not': return const_factory(not self.value) - # XXX log potentialy raised TypeError + # XXX log potentially raised TypeError elif operator == '+': return const_factory(+self.value) else: # operator == '-': @@ -125,7 +125,7 @@ nodes.Dict.infer_binary_op = yes_if_nothing_infered(dict_infer_binary_op) # assignment ################################################################## """the assigned_stmts method is responsible to return the assigned statement -(eg not infered) according to the assignment type. +(e.g. not inferred) according to the assignment type. The `asspath` argument is used to record the lhs path of the original node. For instance if we want assigned statements for 'c' in 'a, (b,c)', asspath @@ -155,14 +155,14 @@ def _resolve_looppart(parts, asspath, context): except (AttributeError, IndexError): continue if not asspath: - # we acheived to resolved the assigment path, + # we achieved to resolved the assignment path, # don't infer the last part yield assigned elif assigned is YES: break else: # we are not yet on the last part of the path - # search on each possibly infered value + # search on each possibly inferred value try: for infered in _resolve_looppart(assigned.infer(context), asspath, context): yield infered @@ -199,7 +199,7 @@ nodes.AssAttr.assigned_stmts = assend_assigned_stmts def _arguments_infer_argname(self, name, context): - # arguments informmtion may be missing, in which case we can't do anything + # arguments information may be missing, in which case we can't do anything # more if not (self.args or self.vararg or self.kwarg): yield YES @@ -267,14 +267,14 @@ def _resolve_asspart(parts, asspath, context): except (TypeError, IndexError): return if not asspath: - # we acheived to resolved the assigment path, don't infer the + # we achieved to resolved the assignment path, don't infer the # last part yield assigned elif assigned is YES: return else: # we are not yet on the last part of the path search on each - # possibly infered value + # possibly inferred value try: for infered in _resolve_asspart(assigned.infer(context), asspath, context): diff --git a/raw_building.py b/raw_building.py index 6718a9cb..621be5f6 100644 --- a/raw_building.py +++ b/raw_building.py @@ -98,11 +98,11 @@ def build_function(name, args=None, defaults=None, flag=0, doc=None): if sys.version_info < (2, 5): def build_from_import(fromname, names): - """create and intialize an astng From import statement""" + """create and initialize an astng From import statement""" return nodes.From(fromname, [(name, None) for name in names]) else: def build_from_import(fromname, names): - """create and intialize an astng From import statement""" + """create and initialize an astng From import statement""" return nodes.From(fromname, [(name, None) for name in names], 0) def register_arguments(func, args=None): diff --git a/scoped_nodes.py b/scoped_nodes.py index bd70b920..1b46b0c3 100644 --- a/scoped_nodes.py +++ b/scoped_nodes.py @@ -67,7 +67,7 @@ class LocalsDictMixIn(object): /!\ this class should not be used directly /!\ it's only used as a methods and attribute container, and update the - original class from the compiler.ast module using its dictionnary + original class from the compiler.ast module using its dictionary (see below the class definition) """ @@ -78,7 +78,7 @@ class LocalsDictMixIn(object): locals = None def qname(self): - """return the 'qualified' name of the node, eg module.name, + """return the 'qualified' name of the node, e.g. module.name, module.class.name ... """ if self.parent is None: @@ -124,7 +124,7 @@ class LocalsDictMixIn(object): def __getitem__(self, item): """method from the `dict` interface returning the first node - associated with the given name in the locals dictionnary + associated with the given name in the locals dictionary :type item: str :param item: the name of the locally defined object @@ -194,7 +194,7 @@ def std_special_attributes(self, name, add_locals=True): class ModuleNG(object): """/!\ this class should not be used directly /!\ it's only used as a methods and attribute container, and update the - original class from the compiler.ast module using its dictionnary + original class from the compiler.ast module using its dictionary (see below the class definition) """ fromlineno = 0 @@ -248,7 +248,7 @@ class ModuleNG(object): getattr = remove_nodes(getattr, DelName) def igetattr(self, name, context=None): - """infered getattr""" + """inferred getattr""" # set lookup name since this is necessary to infer on import nodes for # instance context = copy_context(context) @@ -314,7 +314,7 @@ class ModuleNG(object): return modname def wildcard_import_names(self): - """return the list of imported names when this module is 'wildard + """return the list of imported names when this module is 'wildcard imported' It doesn't include the '__builtins__' name which is added by the @@ -357,7 +357,7 @@ extend_class(Module, ModuleNG) class FunctionNG(object): """/!\ this class should not be used directly /!\ it's only used as a methods and attribute container, and update the - original class from the compiler.ast module using its dictionnary + original class from the compiler.ast module using its dictionary (see below the class definition) """ @@ -393,7 +393,7 @@ class FunctionNG(object): def is_method(self): """return true if the function node should be considered as a method""" # check we are defined in a Class, because this is usually expected - # (eg pylint...) when is_method() return True + # (e.g. pylint...) when is_method() return True return self.type != 'function' and isinstance(self.parent.frame(), Class) @cached @@ -572,7 +572,7 @@ def _iface_hdlr(iface_node): class ClassNG(object): """/!\ this class should not be used directly /!\ it's only used as a methods and attribute container, and update the - original class from the compiler.ast module using its dictionnary + original class from the compiler.ast module using its dictionary (see below the class definition) """ special_attributes = set(('__name__', '__doc__', '__dict__', '__module__', @@ -620,7 +620,7 @@ class ClassNG(object): # a dictionary of class instances attributes instance_attrs = None - # list of parent class as a list of string (ie names as they appears + # list of parent class as a list of string (i.e. names as they appears # in the class definition) XXX bw compat def basenames(self): return [as_string(bnode) for bnode in self.bases] @@ -736,10 +736,10 @@ class ClassNG(object): getattr = function_to_unbound_method(remove_nodes(getattr, DelAttr)) def igetattr(self, name, context=None): - """infered getattr, need special treatment in class to handle + """inferred getattr, need special treatment in class to handle descriptors """ - # set lookoup name since this is necessary to infer on import nodes for + # set lookup name since this is necessary to infer on import nodes for # instance context = copy_context(context) context.lookupname = name diff --git a/test/unittest_builder.py b/test/unittest_builder.py index 02f7b4c3..1bfe7311 100644 --- a/test/unittest_builder.py +++ b/test/unittest_builder.py @@ -414,7 +414,7 @@ def global_no_effect(): def test_socket_build(self): import socket astng = self.builder.module_build(socket) - # XXX just check the first one. Actually 3 objects are infered (look at + # XXX just check the first one. Actually 3 objects are inferred (look at # the socket module) but the last one as those attributes dynamically # set and astng is missing this. for fclass in astng.igetattr('socket'): @@ -428,7 +428,7 @@ def global_no_effect(): def test_gen_expr_var_scope(self): data = 'l = list(n for n in range(10))\n' astng = self.builder.string_build(data, __name__, __file__) - # n unvailable touside gen expr scope + # n unavailable outside gen expr scope self.failIf('n' in astng) # test n is inferable anyway n = get_name_node(astng, 'n') @@ -598,7 +598,7 @@ A.ass_type = A_ass_type # import compiler # sn = astng.MANAGER.astng_from_file(join(astng.__path__[0], 'inference.py')) # astastng = astng.MANAGER.astng_from_file(join(compiler.__path__[0], 'ast.py')) -# # check monkey patching of the compiler module has been infered +# # check monkey patching of the compiler module has been inferred # lclass = list(astastng.igetattr('Function')) # self.assertEquals(len(lclass), 1) # lclass = lclass[0] diff --git a/test/unittest_inference.py b/test/unittest_inference.py index fc3c9e0c..ab5575c0 100644 --- a/test/unittest_inference.py +++ b/test/unittest_inference.py @@ -656,7 +656,7 @@ print ((d,e) for e,d in ([1,2], [3,4])) code = ''' help() ''' - # XXX failing with python > 2.3 since __builtin__.help assigment has + # XXX failing with python > 2.3 since __builtin__.help assignment has # been moved into a function... astng = builder.string_build(code, __name__, __file__) node = get_name_node(astng, 'help', -1) diff --git a/test/unittest_lookup.py b/test/unittest_lookup.py index 932d2272..f1ccd6c0 100644 --- a/test/unittest_lookup.py +++ b/test/unittest_lookup.py @@ -127,9 +127,9 @@ if x > 0: print '#' * x """, __name__, __file__) xnames = [n for n in astng.nodes_of_class(nodes.Name) if n.name == 'x'] - # inside the loop, only one possible assigment + # inside the loop, only one possible assignment self.assertEquals(len(xnames[0].lookup('x')[1]), 1) - # outside the loop, two possible assigments + # outside the loop, two possible assignments self.assertEquals(len(xnames[1].lookup('x')[1]), 2) self.assertEquals(len(xnames[2].lookup('x')[1]), 2) diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py index b29a4ccd..c20162d1 100644 --- a/test/unittest_scoped_nodes.py +++ b/test/unittest_scoped_nodes.py @@ -1,4 +1,4 @@ -"""tests for specific behaviour of astng scoped nodes (ie module, class and +"""tests for specific behaviour of astng scoped nodes (i.e. module, class and function) """ @@ -43,7 +43,7 @@ def extend_class(original, addons): class ASTVisitor(object): """Abstract Base Class for Python AST Visitors. - Visitors inheritating from ASTVisitors could visit + Visitors inheriting from ASTVisitors could visit compiler.ast, _ast or astng trees. Not all methods will have to be implemented; @@ -327,7 +327,7 @@ class ASTWalker: class LocalsVisitor(ASTWalker): - """visit a project by traversing the locals dictionnary""" + """visit a project by traversing the locals dictionary""" def __init__(self): ASTWalker.__init__(self, self) self._visited = {} |