diff options
-rw-r--r-- | astroid/arguments.py | 2 | ||||
-rw-r--r-- | astroid/builder.py | 2 | ||||
-rw-r--r-- | astroid/modutils.py | 4 | ||||
-rw-r--r-- | astroid/scoped_nodes.py | 2 | ||||
-rw-r--r-- | astroid/test_utils.py | 1 | ||||
-rw-r--r-- | astroid/tests/unittest_brain.py | 2 | ||||
-rw-r--r-- | astroid/tests/unittest_builder.py | 4 | ||||
-rw-r--r-- | astroid/tests/unittest_inference.py | 12 | ||||
-rw-r--r-- | astroid/tests/unittest_nodes.py | 2 | ||||
-rw-r--r-- | astroid/tests/unittest_raw_building.py | 2 | ||||
-rw-r--r-- | astroid/tests/unittest_regrtest.py | 4 | ||||
-rw-r--r-- | astroid/tests/unittest_scoped_nodes.py | 4 | ||||
-rw-r--r-- | doc/conf.py | 12 |
13 files changed, 26 insertions, 27 deletions
diff --git a/astroid/arguments.py b/astroid/arguments.py index f81ccbd6..ba463981 100644 --- a/astroid/arguments.py +++ b/astroid/arguments.py @@ -162,7 +162,7 @@ class CallSite(object): positional = self.positional_arguments[:len(funcnode.args.args)] vararg = self.positional_arguments[len(funcnode.args.args):] argindex = funcnode.args.find_argname(name)[0] - kwonlyargs = set(arg.name for arg in funcnode.args.kwonlyargs) + kwonlyargs = {arg.name for arg in funcnode.args.kwonlyargs} kwargs = { key: value for key, value in self.keyword_arguments.items() if key not in kwonlyargs diff --git a/astroid/builder.py b/astroid/builder.py index b870c5a6..2522ef01 100644 --- a/astroid/builder.py +++ b/astroid/builder.py @@ -83,7 +83,7 @@ def _can_assign_attr(node, attrname): except NotImplementedError: pass else: - if slots and attrname not in set(slot.value for slot in slots): + if slots and attrname not in {slot.value for slot in slots}: return False return True diff --git a/astroid/modutils.py b/astroid/modutils.py index 4d8dfec0..530bab5f 100644 --- a/astroid/modutils.py +++ b/astroid/modutils.py @@ -49,11 +49,11 @@ try: # with the prefix from which the virtualenv was created. This throws # off the detection logic for standard library modules, thus the # workaround. - STD_LIB_DIRS = set([ + STD_LIB_DIRS = { get_python_lib(standard_lib=True, prefix=sys.prefix), # Take care of installations where exec_prefix != prefix. get_python_lib(standard_lib=True, prefix=sys.exec_prefix), - get_python_lib(standard_lib=True)]) + get_python_lib(standard_lib=True)} # get_python_lib(standard_lib=1) is not available on pypy, set STD_LIB_DIR to # non-valid path, see https://bugs.pypy.org/issue1164 except DistutilsPlatformError: diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py index 99a275c9..e6ac1d38 100644 --- a/astroid/scoped_nodes.py +++ b/astroid/scoped_nodes.py @@ -2068,7 +2068,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, """ # FIXME: should be possible to choose the resolution order # FIXME: inference make infinite loops possible here - yielded = set([self]) + yielded = {self} if context is None: context = contextmod.InferenceContext() if not self.bases and self.qname() != 'builtins.object': diff --git a/astroid/test_utils.py b/astroid/test_utils.py index e7e64b17..a4f5e36e 100644 --- a/astroid/test_utils.py +++ b/astroid/test_utils.py @@ -58,4 +58,3 @@ def enable_warning(warning): # Reset it to default value, so it will take # into account the values from the -W flag. warnings.simplefilter('default', warning) -
\ No newline at end of file diff --git a/astroid/tests/unittest_brain.py b/astroid/tests/unittest_brain.py index 3234e50d..97de8bcc 100644 --- a/astroid/tests/unittest_brain.py +++ b/astroid/tests/unittest_brain.py @@ -488,7 +488,7 @@ class ThreadingBrainTest(unittest.TestCase): def _test_lock_object(self, object_name): lock_instance = builder.extract_node(""" import threading - threading.{0}() + threading.{}() """.format(object_name)) inferred = next(lock_instance.infer()) self.assert_is_valid_lock(inferred) diff --git a/astroid/tests/unittest_builder.py b/astroid/tests/unittest_builder.py index c4f33c94..fa22d270 100644 --- a/astroid/tests/unittest_builder.py +++ b/astroid/tests/unittest_builder.py @@ -464,14 +464,14 @@ class BuilderTest(unittest.TestCase): def test_future_imports(self): mod = builder.parse("from __future__ import print_function") - self.assertEqual(set(['print_function']), mod.future_imports) + self.assertEqual({'print_function'}, mod.future_imports) def test_two_future_imports(self): mod = builder.parse(""" from __future__ import print_function from __future__ import absolute_import """) - self.assertEqual(set(['print_function', 'absolute_import']), mod.future_imports) + self.assertEqual({'print_function', 'absolute_import'}, mod.future_imports) def test_inferred_build(self): code = ''' diff --git a/astroid/tests/unittest_inference.py b/astroid/tests/unittest_inference.py index 702f247c..688891cf 100644 --- a/astroid/tests/unittest_inference.py +++ b/astroid/tests/unittest_inference.py @@ -82,8 +82,8 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): inferred = next(node.infer()) self.assertIsInstance(inferred, nodes.Dict) - elts = set([(key.value, value.value) - for (key, value) in inferred.items]) + elts = {(key.value, value.value) + for (key, value) in inferred.items} self.assertEqual(sorted(elts), sorted(expected.items())) assertInferTuple = partialmethod(_assertInferElts, nodes.Tuple) @@ -219,7 +219,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): inferred = self.ast['i'].infer() const = next(inferred) self.assertIsInstance(const, nodes.Const) - self.assertEqual(const.value, u"glup") + self.assertEqual(const.value, "glup") self.assertRaises(StopIteration, partial(next, inferred)) inferred = self.ast['j'].infer() const = next(inferred) @@ -1275,7 +1275,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): my_smtp = SendMailController().smtp my_me = SendMailController().me ''' - decorators = set(['%s.property' % BUILTINS]) + decorators = {'%s.property' % BUILTINS} ast = parse(code, __name__) self.assertEqual(ast['SendMailController']['smtp'].decoratornames(), decorators) @@ -2036,7 +2036,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): ' '.count() #@ """ ast = extract_node(code, __name__) - self.assertInferConst(ast[0], u'') + self.assertInferConst(ast[0], '') for i in range(1, 16): self.assertInferConst(ast[i], '') for i in range(16, 19): @@ -2069,7 +2069,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): ast = extract_node(code, __name__) self.assertInferConst(ast[0], '') for i in range(1, 16): - self.assertInferConst(ast[i], u'') + self.assertInferConst(ast[i], '') for i in range(16, 19): self.assertInferConst(ast[i], 0) diff --git a/astroid/tests/unittest_nodes.py b/astroid/tests/unittest_nodes.py index 6a4d68c2..1963c0ce 100644 --- a/astroid/tests/unittest_nodes.py +++ b/astroid/tests/unittest_nodes.py @@ -438,7 +438,7 @@ class ConstNodeTest(unittest.TestCase): self._test('a') def test_unicode(self): - self._test(u'a') + self._test('a') class NameNodeTest(unittest.TestCase): diff --git a/astroid/tests/unittest_raw_building.py b/astroid/tests/unittest_raw_building.py index f5b4af38..76365e0a 100644 --- a/astroid/tests/unittest_raw_building.py +++ b/astroid/tests/unittest_raw_building.py @@ -81,7 +81,7 @@ class RawBuildingTC(unittest.TestCase): for name, _ in inspect.getmembers(builtins, predicate=inspect.isbuiltin): if name == 'print': continue - node = extract_node('{0} #@'.format(name)) + node = extract_node('{} #@'.format(name)) inferred = next(node.infer()) self.assertIsInstance(inferred, nodes.FunctionDef, name) self.assertEqual(inferred.root().name, BUILTINS, name) diff --git a/astroid/tests/unittest_regrtest.py b/astroid/tests/unittest_regrtest.py index 3d3a00a5..342ebc56 100644 --- a/astroid/tests/unittest_regrtest.py +++ b/astroid/tests/unittest_regrtest.py @@ -258,7 +258,7 @@ def test(): # Test for https://bitbucket.org/logilab/astroid/issues/273/ # In a regular file, "coding: utf-8" would have been used. - node = extract_node(u''' + node = extract_node(''' from __future__ import unicode_literals class MyClass(object): @@ -266,7 +266,7 @@ def test(): "With unicode : %s " instance = MyClass() - ''' % u"\u2019") + ''' % "\u2019") next(node.value.infer()).as_string() diff --git a/astroid/tests/unittest_scoped_nodes.py b/astroid/tests/unittest_scoped_nodes.py index b8682461..c22e0246 100644 --- a/astroid/tests/unittest_scoped_nodes.py +++ b/astroid/tests/unittest_scoped_nodes.py @@ -795,7 +795,7 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase): self.assertSetEqual(expected_methods, methods) klass2 = self.module2['Specialization'] methods = {m.name for m in klass2.mymethods()} - self.assertSetEqual(set([]), methods) + self.assertSetEqual(set(), methods) method_locals = klass2.local_attr('method') self.assertEqual(len(method_locals), 1) self.assertEqual(method_locals[0].name, 'method') @@ -1317,7 +1317,7 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase): ''') cls = module['Third'] slots = cls.slots() - self.assertEqual(sorted(set(slot.value for slot in slots)), + self.assertEqual(sorted({slot.value for slot in slots}), ['a', 'b', 'c', 'd', 'e']) def test_all_ancestors_need_slots(self): diff --git a/doc/conf.py b/doc/conf.py index 9343804b..f214b6c9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -48,9 +48,9 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Astroid' +project = 'Astroid' current_year = datetime.utcnow().year -copyright = u'2003-{year}, Logilab, PyCQA and contributors'.format(year=current_year) +copyright = '2003-{year}, Logilab, PyCQA and contributors'.format(year=current_year) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -192,8 +192,8 @@ htmlhelp_basename = 'Pylintdoc' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Astroid.tex', u'Astroid Documentation', - u'Logilab, PyCQA and contributors', 'manual'), + ('index', 'Astroid.tex', 'Astroid Documentation', + 'Logilab, PyCQA and contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -225,8 +225,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'astroid', u'Astroid Documentation', - [u'Logilab, PyCQA and contributors'], 1) + ('index', 'astroid', 'Astroid Documentation', + ['Logilab, PyCQA and contributors'], 1) ] autodoc_default_flags = ['members', 'undoc-members', 'show-inheritance'] |