From 8cf708d0d4584e9edee48461b9eba0983d7a3419 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 4 Jan 2018 16:32:52 +0200 Subject: [PATCH] Remove redundant parentheses --- jedi/_compatibility.py | 2 +- jedi/api/classes.py | 2 +- jedi/evaluate/compiled/__init__.py | 2 +- jedi/evaluate/compiled/getattr_static.py | 4 +-- jedi/evaluate/compiled/mixed.py | 2 +- test/completion/arrays.py | 30 ++++++++--------- test/completion/async_.py | 2 +- test/completion/basic.py | 10 +++--- test/completion/classes.py | 32 +++++++++---------- test/completion/comprehensions.py | 2 +- test/completion/context.py | 4 +-- test/completion/decorators.py | 14 ++++---- test/completion/descriptors.py | 8 ++--- test/completion/docstring.py | 10 +++--- test/completion/dynamic_arrays.py | 8 ++--- test/completion/dynamic_params.py | 4 +-- test/completion/flow_analysis.py | 4 +-- test/completion/functions.py | 2 +- test/completion/generators.py | 2 +- test/completion/goto.py | 10 +++--- test/completion/import_tree/classes.py | 4 +-- test/completion/invalid.py | 2 +- test/completion/isinstance.py | 2 +- test/completion/lambdas.py | 2 +- test/completion/ordering.py | 2 +- test/completion/parser.py | 2 +- test/completion/pep0484_basic.py | 2 +- test/completion/recursion.py | 4 +-- test/completion/stdlib.py | 2 +- test/completion/usages.py | 8 ++--- test/conftest.py | 4 +-- test/static_analysis/attribute_error.py | 4 +-- test/static_analysis/attribute_warnings.py | 4 +-- test/static_analysis/class_simple.py | 2 +- test/static_analysis/descriptors.py | 2 +- test/static_analysis/normal_arguments.py | 2 +- test/static_analysis/star_arguments.py | 2 +- test/static_analysis/try_except.py | 2 +- test/test_api/test_interpreter.py | 14 ++++---- .../test_parser_utils.py | 2 +- test/test_speed.py | 2 +- 41 files changed, 112 insertions(+), 112 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 809f64f1..1c00d74b 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -132,7 +132,7 @@ def find_module_pre_py33(string, path=None, fullname=None): file = None if not is_package or is_archive: file = DummyFile(loader, string) - return (file, module_path, is_package) + return file, module_path, is_package except ImportError: pass raise ImportError("No module named {}".format(string)) diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 1937cc60..ebb1ca05 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -555,7 +555,7 @@ class Definition(BaseDefinition): .. todo:: Add full path. This function is should return a `module.class.function` path. """ - position = '' if self.in_builtin_module else '@%s' % (self.line) + position = '' if self.in_builtin_module else '@%s' % self.line return "%s:%s%s" % (self.module_name, self.description, position) @memoize_method diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index f9f2e078..9c2b6424 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -432,7 +432,7 @@ def dotted_from_fs_path(fs_path, sys_path): # C:\path\to\Lib path = '' for s in sys_path: - if (fs_path.startswith(s) and len(path) < len(s)): + if fs_path.startswith(s) and len(path) < len(s): path = s # - Window diff --git a/jedi/evaluate/compiled/getattr_static.py b/jedi/evaluate/compiled/getattr_static.py index 9f8cd8a8..65eddad9 100644 --- a/jedi/evaluate/compiled/getattr_static.py +++ b/jedi/evaluate/compiled/getattr_static.py @@ -87,7 +87,7 @@ else: return getattr(klass, '__dict__', _sentinel) return _shadowed_dict_newstyle(klass) - class _OldStyleClass(): + class _OldStyleClass: pass _oldstyle_instance_type = type(_OldStyleClass()) @@ -122,7 +122,7 @@ def _safe_hasattr(obj, name): def _safe_is_data_descriptor(obj): - return (_safe_hasattr(obj, '__set__') or _safe_hasattr(obj, '__delete__')) + return _safe_hasattr(obj, '__set__') or _safe_hasattr(obj, '__delete__') def getattr_static(obj, attr, default=_sentinel): diff --git a/jedi/evaluate/compiled/mixed.py b/jedi/evaluate/compiled/mixed.py index ac0f6dd6..462ac7d5 100644 --- a/jedi/evaluate/compiled/mixed.py +++ b/jedi/evaluate/compiled/mixed.py @@ -64,7 +64,7 @@ class MixedName(compiled.CompiledName): contexts = list(self.infer()) if not contexts: # This means a start_pos that doesn't exist (compiled objects). - return (0, 0) + return 0, 0 return contexts[0].name.start_pos @start_pos.setter diff --git a/test/completion/arrays.py b/test/completion/arrays.py index e44a0671..19c6222f 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -43,7 +43,7 @@ b[int():] b[:] -class _StrangeSlice(): +class _StrangeSlice: def __getitem__(self, sliced): return sliced @@ -128,25 +128,25 @@ f # ----------------- # unnessecary braces # ----------------- -a = (1) +a = 1 #? int() a #? int() +1 +#? int() (1) #? int() -((1)) -#? int() -((1)+1) +(1 + 1) u, v = 1, "" #? int() u -((u1, v1)) = 1, "" +(u1, v1) = 1, "" #? int() u1 #? int() -(u1) +u1 (a), b = 1, '' #? int() @@ -154,15 +154,15 @@ a def a(): return '' #? str() -(a)() +a() #? str() -(a)().replace() +a().replace() #? int() -(tuple).index() +tuple.index() #? int() -(tuple)().index() +tuple().index() -class C(): +class C: def __init__(self): self.a = (str()).upper() @@ -283,14 +283,14 @@ dic2[index] # __getitem__ # ----------------- -class GetItem(): +class GetItem: def __getitem__(self, index): return 1.0 #? float() GetItem()[0] -class GetItem(): +class GetItem: def __init__(self, el): self.el = el @@ -300,7 +300,7 @@ class GetItem(): #? str() GetItem("")[1] -class GetItemWithList(): +class GetItemWithList: def __getitem__(self, index): return [1, 1.0, 's'][index] diff --git a/test/completion/async_.py b/test/completion/async_.py index b2202137..a63e93ab 100644 --- a/test/completion/async_.py +++ b/test/completion/async_.py @@ -24,7 +24,7 @@ async def x2(): #? ['readlines'] f.readlines -class A(): +class A: @staticmethod async def b(c=1, d=2): return 1 diff --git a/test/completion/basic.py b/test/completion/basic.py index d79a15ed..efe30c78 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -23,9 +23,9 @@ a(0):. # if/else/elif # ----------------- -if (random.choice([0, 1])): +if random.choice([0, 1]): 1 -elif(random.choice([0, 1])): +elif random.choice([0, 1]): a = 3 else: a = '' @@ -34,7 +34,7 @@ a def func(): if random.choice([0, 1]): 1 - elif(random.choice([0, 1])): + elif random.choice([0, 1]): a = 3 else: a = '' @@ -187,7 +187,7 @@ some_word # ----------------- class A(object): pass -class B(): pass +class B: pass #? ['__init__'] A.__init__ @@ -201,7 +201,7 @@ int().__init__ # comments # ----------------- -class A(): +class A: def __init__(self): self.hello = {} # comment shouldn't be a string #? dict() diff --git a/test/completion/classes.py b/test/completion/classes.py index 292cfc36..fa09a038 100644 --- a/test/completion/classes.py +++ b/test/completion/classes.py @@ -6,7 +6,7 @@ def find_class(): #? ['ret'] TestClass.ret -class FindClass(): +class FindClass: #? [] TestClass.ret if a: @@ -125,7 +125,7 @@ strs.second TestClass.var_class.var_class.var_class.var_class # operations (+, *, etc) shouldn't be InstanceElements - #246 -class A(): +class A: def __init__(self): self.addition = 1 + 2 #? int() @@ -219,7 +219,7 @@ class Dude(classgetter()): # __call__ # ----------------- -class CallClass(): +class CallClass: def __call__(self): return 1 @@ -256,7 +256,7 @@ V(1).d() # ----------------- # ordering # ----------------- -class A(): +class A: def b(self): #? int() a_func() @@ -278,8 +278,8 @@ A().a_func() # ----------------- # nested classes # ----------------- -class A(): - class B(): +class A: + class B: pass def b(self): return 1.0 @@ -287,9 +287,9 @@ class A(): #? float() A().b() -class A(): +class A: def b(self): - class B(): + class B: def b(self): return [] return B().b() @@ -304,7 +304,7 @@ A().b() def meth(self): return self.a, self.b -class WithoutMethod(): +class WithoutMethod: a = 1 def __init__(self): self.b = 1.0 @@ -312,7 +312,7 @@ class WithoutMethod(): return self.b m = meth -class B(): +class B: b = '' a = WithoutMethod().m() @@ -348,18 +348,18 @@ getattr(getattr, 1) getattr(str, []) -class Base(): +class Base: def ret(self, b): return b -class Wrapper(): +class Wrapper: def __init__(self, obj): self.obj = obj def __getattr__(self, name): return getattr(self.obj, name) -class Wrapper2(): +class Wrapper2: def __getattribute__(self, name): return getattr(Base(), name) @@ -369,7 +369,7 @@ Wrapper(Base()).ret(3) #? int() Wrapper2(Base()).ret(3) -class GetattrArray(): +class GetattrArray: def __getattr__(self, name): return [1] @@ -380,7 +380,7 @@ GetattrArray().something[0] # ----------------- # private vars # ----------------- -class PrivateVar(): +class PrivateVar: def __init__(self): self.__var = 1 #? int() @@ -517,7 +517,7 @@ Config.mode2 class Foo(object): a = 3 def create_class(self): - class X(): + class X: a = self.a self.b = 3.0 return X diff --git a/test/completion/comprehensions.py b/test/completion/comprehensions.py index 402ef753..db9e3178 100644 --- a/test/completion/comprehensions.py +++ b/test/completion/comprehensions.py @@ -154,7 +154,7 @@ foo[1] # In class # ----------------- -class X(): +class X: def __init__(self, bar): self.bar = bar diff --git a/test/completion/context.py b/test/completion/context.py index d3e79b81..f26ff0a6 100644 --- a/test/completion/context.py +++ b/test/completion/context.py @@ -1,4 +1,4 @@ -class Base(): +class Base: myfoobar = 3 @@ -35,7 +35,7 @@ myfoobar # Inheritance # ----------------- -class Super(): +class Super: enabled = True if enabled: yo_dude = 4 diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 27e455ae..099c12c5 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -106,7 +106,7 @@ def nothing(a,b,c): #? int() nothing("")[0] -class MethodDecoratorAsClass(): +class MethodDecoratorAsClass: class_var = 3 @Decorator def func_without_self(arg, arg2): @@ -124,7 +124,7 @@ MethodDecoratorAsClass().func_without_self('')[1] MethodDecoratorAsClass().func_with_self(1) -class SelfVars(): +class SelfVars: """Init decorator problem as an instance, #247""" @Decorator def __init__(self): @@ -181,7 +181,7 @@ JustAClass.a() # illegal decorators # ----------------- -class DecoratorWithoutCall(): +class DecoratorWithoutCall: def __init__(self, func): self.func = func @@ -200,7 +200,7 @@ f() g() -class X(): +class X: @str def x(self): pass @@ -220,7 +220,7 @@ def dec(f): return f(s) return wrapper -class MethodDecorators(): +class MethodDecorators: _class_var = 1 def __init__(self): self._method_var = '' @@ -245,7 +245,7 @@ MethodDecorators().class_var() MethodDecorators().method_var() -class Base(): +class Base: @not_existing def __init__(self): pass @@ -298,7 +298,7 @@ follow_statement(1) # class decorators should just be ignored @should_ignore -class A(): +class A: def ret(self): return 1 diff --git a/test/completion/descriptors.py b/test/completion/descriptors.py index 3cc01faf..3f1674a4 100644 --- a/test/completion/descriptors.py +++ b/test/completion/descriptors.py @@ -50,7 +50,7 @@ C.just_a_method # ----------------- # properties # ----------------- -class B(): +class B: @property def r(self): return 1 @@ -71,7 +71,7 @@ B().p #? [] B().p(). -class PropClass(): +class PropClass: def __init__(self, a): self.a = a @property @@ -190,7 +190,7 @@ E.u(1) from functools import partial -class Memoize(): +class Memoize: def __init__(self, func): self.func = func @@ -205,7 +205,7 @@ class Memoize(): return self.func(*args, **kwargs) -class MemoizeTest(): +class MemoizeTest: def __init__(self, x): self.x = x diff --git a/test/completion/docstring.py b/test/completion/docstring.py index 88db52d1..1e2d68ed 100644 --- a/test/completion/docstring.py +++ b/test/completion/docstring.py @@ -61,7 +61,7 @@ def sphinxy_param_type_wrapped(a): # local classes -> github #370 -class ProgramNode(): +class ProgramNode: pass def local_classes(node, node2): @@ -75,7 +75,7 @@ def local_classes(node, node2): #? ProgramNode2() node2 -class ProgramNode2(): +class ProgramNode2: pass @@ -193,7 +193,7 @@ d.upper() # class docstrings # ----------------- -class InInit(): +class InInit: def __init__(self, foo): """ :type foo: str @@ -202,7 +202,7 @@ class InInit(): foo -class InClass(): +class InClass: """ :type foo: str """ @@ -211,7 +211,7 @@ class InClass(): foo -class InBoth(): +class InBoth: """ :type foo: str """ diff --git a/test/completion/dynamic_arrays.py b/test/completion/dynamic_arrays.py index 5cb52fc6..e20dde86 100644 --- a/test/completion/dynamic_arrays.py +++ b/test/completion/dynamic_arrays.py @@ -112,9 +112,9 @@ iter(lst)[0] # ----------------- # complex including += # ----------------- -class C(): pass -class D(): pass -class E(): pass +class C: pass +class D: pass +class E: pass lst = [1] lst.append(1.0) lst += [C] @@ -207,7 +207,7 @@ blub()[0] # ----------------- # returns, the same for classes # ----------------- -class C(): +class C: def blub(self, b): if 1: a = [] diff --git a/test/completion/dynamic_params.py b/test/completion/dynamic_params.py index 8af1730c..b274d235 100644 --- a/test/completion/dynamic_params.py +++ b/test/completion/dynamic_params.py @@ -90,14 +90,14 @@ func.sys # classes # ----------------- -class A(): +class A: def __init__(self, a): #? str() a A("s") -class A(): +class A: def __init__(self, a): #? int() a diff --git a/test/completion/flow_analysis.py b/test/completion/flow_analysis.py index af292b47..1b4e742a 100644 --- a/test/completion/flow_analysis.py +++ b/test/completion/flow_analysis.py @@ -191,7 +191,7 @@ a # isinstance # ----------------- -class A(): pass +class A: pass def isinst(x): if isinstance(x, A): @@ -251,7 +251,7 @@ if False: # True objects like modules # ----------------- -class X(): +class X: pass if X: a = 1 diff --git a/test/completion/functions.py b/test/completion/functions.py index 893e4a39..3a1c727e 100644 --- a/test/completion/functions.py +++ b/test/completion/functions.py @@ -285,7 +285,7 @@ def memoize(func): return wrapper -class Something(): +class Something: @memoize def x(self, a, b=1): return a diff --git a/test/completion/generators.py b/test/completion/generators.py index 2327b185..e9840128 100644 --- a/test/completion/generators.py +++ b/test/completion/generators.py @@ -52,7 +52,7 @@ for a in get(): a -class Get(): +class Get: def __iter__(self): if random.choice([0, 1]): yield 1 diff --git a/test/completion/goto.py b/test/completion/goto.py index adff012d..a50693d4 100644 --- a/test/completion/goto.py +++ b/test/completion/goto.py @@ -83,7 +83,7 @@ c c() -class ClassVar(): +class ClassVar: x = 3 #! ['x = 3'] @@ -103,7 +103,7 @@ def f(t=None): t = t or 1 -class X(): +class X: pass #! 3 [] @@ -158,7 +158,7 @@ from . import some_variable # anonymous classes # ----------------- def func(): - class A(): + class A: def b(self): return 1 return A() @@ -171,7 +171,7 @@ func().b() # ----------------- #! 7 ['class ClassDef'] -class ClassDef(): +class ClassDef: """ abc """ pass @@ -216,7 +216,7 @@ def dec(dec_param=3): def y(): pass -class ClassDec(): +class ClassDec: def class_func(func): return func diff --git a/test/completion/import_tree/classes.py b/test/completion/import_tree/classes.py index 23b088c3..ef9a0359 100644 --- a/test/completion/import_tree/classes.py +++ b/test/completion/import_tree/classes.py @@ -1,10 +1,10 @@ blub = 1 -class Config2(): +class Config2: pass -class BaseClass(): +class BaseClass: mode = Config2() if isinstance(whaat, int): mode2 = whaat diff --git a/test/completion/invalid.py b/test/completion/invalid.py index 7c047e66..f489e2bb 100644 --- a/test/completion/invalid.py +++ b/test/completion/invalid.py @@ -193,7 +193,7 @@ invalid # classes # ----------------- -class BrokenPartsOfClass(): +class BrokenPartsOfClass: def foo(self): # This construct contains two places where Jedi with Python 3 can fail. # It should just ignore those constructs and still execute `bar`. diff --git a/test/completion/isinstance.py b/test/completion/isinstance.py index 15fb9a76..45b18e5b 100644 --- a/test/completion/isinstance.py +++ b/test/completion/isinstance.py @@ -78,7 +78,7 @@ def isinstance_func(arr): # Names with multiple indices. # ----------------- -class Test(): +class Test: def __init__(self, testing): if isinstance(testing, str): self.testing = testing diff --git a/test/completion/lambdas.py b/test/completion/lambdas.py index 524df0ce..c5f10686 100644 --- a/test/completion/lambdas.py +++ b/test/completion/lambdas.py @@ -54,7 +54,7 @@ a = lambda: 3 #? ['__closure__'] a.__closure__ -class C(): +class C: def __init__(self, foo=1.0): self.a = lambda: 1 self.foo = foo diff --git a/test/completion/ordering.py b/test/completion/ordering.py index 61eb1928..f3edebcc 100644 --- a/test/completion/ordering.py +++ b/test/completion/ordering.py @@ -157,7 +157,7 @@ a.real a.a a = 3 -class a(): +class a: def __init__(self, a): self.a = a diff --git a/test/completion/parser.py b/test/completion/parser.py index 68793f4f..37f59446 100644 --- a/test/completion/parser.py +++ b/test/completion/parser.py @@ -2,7 +2,7 @@ Issues with the parser and not the type inference should be part of this file. """ -class IndentIssues(): +class IndentIssues: """ issue jedi-vim#288 Which is really a fast parser issue. It used to start a new block at the diff --git a/test/completion/pep0484_basic.py b/test/completion/pep0484_basic.py index 0230d375..33fed348 100644 --- a/test/completion/pep0484_basic.py +++ b/test/completion/pep0484_basic.py @@ -3,7 +3,7 @@ # python >= 3.2 -class A(): +class A: pass diff --git a/test/completion/recursion.py b/test/completion/recursion.py index a3e7670b..a9f013be 100644 --- a/test/completion/recursion.py +++ b/test/completion/recursion.py @@ -14,7 +14,7 @@ Recursion().a Recursion().b -class X(): +class X: def __init__(self): self.recursive = [1, 3] @@ -39,7 +39,7 @@ def recursion1(foo): recursion1([1,2])[0] -class FooListComp(): +class FooListComp: def __init__(self): self.recursive = [1] diff --git a/test/completion/stdlib.py b/test/completion/stdlib.py index b6b739af..623e879c 100644 --- a/test/completion/stdlib.py +++ b/test/completion/stdlib.py @@ -61,7 +61,7 @@ import math import os #? type(os) type(math) -class X(): pass +class X: pass #? type type(X) diff --git a/test/completion/usages.py b/test/completion/usages.py index be27ae51..d0509b32 100644 --- a/test/completion/usages.py +++ b/test/completion/usages.py @@ -29,7 +29,7 @@ abc = 5 Abc = 3 #< 6 (0,6), (2,4), (5,8), (17,0) -class Abc(): +class Abc: #< (-2,6), (0,4), (3,8), (15,0) Abc @@ -132,7 +132,7 @@ class TestClassVar(object): #< (0,8), (-7, 8) class_v -class TestInstanceVar(): +class TestInstanceVar: def a(self): #< 13 (4,13), (0,13) self._instance_var = 3 @@ -145,7 +145,7 @@ class TestInstanceVar(): self() -class NestedClass(): +class NestedClass: def __getattr__(self, name): return self @@ -249,7 +249,7 @@ if isinstance(j, int): # Dynamic Param Search # ----------------- -class DynamicParam(): +class DynamicParam: def foo(self): return diff --git a/test/conftest.py b/test/conftest.py index db2f8260..fcabd38c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -41,9 +41,9 @@ def parse_test_files_option(opt): opt = str(opt) if ':' in opt: (f_name, rest) = opt.split(':', 1) - return (f_name, list(map(int, rest.split(',')))) + return f_name, list(map(int, rest.split(','))) else: - return (opt, []) + return opt, [] def pytest_generate_tests(metafunc): diff --git a/test/static_analysis/attribute_error.py b/test/static_analysis/attribute_error.py index 4b084c11..9747429d 100644 --- a/test/static_analysis/attribute_error.py +++ b/test/static_analysis/attribute_error.py @@ -1,4 +1,4 @@ -class Cls(): +class Cls: class_attr = '' def __init__(self, input): self.instance_attr = 3 @@ -77,7 +77,7 @@ return_one(''.undefined_attribute) [r for r in [1, 2]] # some random error that showed up -class NotCalled(): +class NotCalled: def match_something(self, param): seems_to_need_an_assignment = param return [value.match_something() for value in []] diff --git a/test/static_analysis/attribute_warnings.py b/test/static_analysis/attribute_warnings.py index 0e1e5e95..5630a5b6 100644 --- a/test/static_analysis/attribute_warnings.py +++ b/test/static_analysis/attribute_warnings.py @@ -8,7 +8,7 @@ Jedi issues warnings for possible errors if ``__getattr__``, # ----------------- -class Cls(): +class Cls: def __getattr__(self, name): return getattr(str, name) @@ -32,7 +32,7 @@ Inherited().undefined # ----------------- -class SetattrCls(): +class SetattrCls: def __init__(self, dct): # Jedi doesn't even try to understand such code for k, v in dct.items(): diff --git a/test/static_analysis/class_simple.py b/test/static_analysis/class_simple.py index 3f84fde0..63d6073a 100644 --- a/test/static_analysis/class_simple.py +++ b/test/static_analysis/class_simple.py @@ -1,5 +1,5 @@ class Base(object): - class Nested(): + class Nested: def foo(): pass diff --git a/test/static_analysis/descriptors.py b/test/static_analysis/descriptors.py index 0fc5d159..a17d1b46 100644 --- a/test/static_analysis/descriptors.py +++ b/test/static_analysis/descriptors.py @@ -1,5 +1,5 @@ # classmethod -class TarFile(): +class TarFile: @classmethod def open(cls, name, **kwargs): return cls.taropen(name, **kwargs) diff --git a/test/static_analysis/normal_arguments.py b/test/static_analysis/normal_arguments.py index 2fc8e81d..25729f51 100644 --- a/test/static_analysis/normal_arguments.py +++ b/test/static_analysis/normal_arguments.py @@ -60,7 +60,7 @@ default(x=1) # class arguments # ----------------- -class Instance(): +class Instance: def __init__(self, foo): self.foo = foo diff --git a/test/static_analysis/star_arguments.py b/test/static_analysis/star_arguments.py index 34be43b5..f1f8c78d 100644 --- a/test/static_analysis/star_arguments.py +++ b/test/static_analysis/star_arguments.py @@ -111,7 +111,7 @@ mixed2(3, b=5) simple(1, **[]) #! 12 type-error-star-star simple(1, **1) -class A(): pass +class A: pass #! 12 type-error-star-star simple(1, **A()) diff --git a/test/static_analysis/try_except.py b/test/static_analysis/try_except.py index e6543280..0481de63 100644 --- a/test/static_analysis/try_except.py +++ b/test/static_analysis/try_except.py @@ -44,7 +44,7 @@ except (TypeError, NotImplementedError): pass # ----------------- try: str.not_existing -except ((AttributeError)): pass +except (AttributeError): pass try: #! 4 attribute-error str.not_existing diff --git a/test/test_api/test_interpreter.py b/test/test_api/test_interpreter.py index a4c0311e..8e91e566 100644 --- a/test/test_api/test_interpreter.py +++ b/test/test_api/test_interpreter.py @@ -16,8 +16,8 @@ else: exec source in global_map """, 'blub', 'exec')) -class _GlobalNameSpace(): - class SideEffectContainer(): +class _GlobalNameSpace: + class SideEffectContainer: pass @@ -80,7 +80,7 @@ def test_numpy_like_non_zero(): def test_nested_resolve(): - class XX(): + class XX: def x(): pass @@ -168,7 +168,7 @@ def test_list(): def test_slice(): - class Foo1(): + class Foo1: bar = [] baz = 'xbarx' _assert_interpreter_complete('getattr(Foo1, baz[1:-1]).append', @@ -177,7 +177,7 @@ def test_slice(): def test_getitem_side_effects(): - class Foo2(): + class Foo2: def __getitem__(self, index): # Possible side effects here, should therefore not call this. if True: @@ -190,7 +190,7 @@ def test_getitem_side_effects(): def test_property_error_oldstyle(): lst = [] - class Foo3(): + class Foo3: @property def bar(self): lst.append(1) @@ -269,7 +269,7 @@ def test_more_complex_instances(): def foo(self, other): return self - class Base(): + class Base: def wow(self): return Something() diff --git a/test/test_parso_integration/test_parser_utils.py b/test/test_parso_integration/test_parser_utils.py index e49c3f56..c207fdd6 100644 --- a/test/test_parso_integration/test_parser_utils.py +++ b/test/test_parso_integration/test_parser_utils.py @@ -7,7 +7,7 @@ from parso.python import tree import pytest -class TestCallAndName(): +class TestCallAndName: def get_call(self, source): # Get the simple_stmt and then the first one. node = parse(source).children[0] diff --git a/test/test_speed.py b/test/test_speed.py index 8d5bc9a3..be81d739 100644 --- a/test/test_speed.py +++ b/test/test_speed.py @@ -59,7 +59,7 @@ class TestSpeed(TestCase): unwanted computation of repr(). Exemple : big pandas data. See issue #919. """ - class SlowRepr(): + class SlowRepr: "class to test what happens if __repr__ is very slow." def some_method(self): pass