Skip to content

Commit

Permalink
[WS] Fix extra/missing lines
Browse files Browse the repository at this point in the history
RB created by running:

for file in `./pants python-style --no-python-style-fail --python-style-enable=PEP8Checker :: 2>/dev/null | egrep ERROR |~/molsen_bin/pyp 'w|p[1]|c|p[0]|pp.uniq()|p'`; do autopep8 --select E309,E304,E303 $file > ~/tmp; mv ~/tmp $file; done

python-style is currently not checked in, this is the in progress python style checker.

Testing Done:
CI is out: https://travis-ci.org/pantsbuild/pants/builds/73635064

Bugs closed: 1905

Reviewed at https://rbcommons.com/s/twitter/r/2557/
  • Loading branch information
digwanderlust authored and jsirois committed Aug 1, 2015
1 parent e0248e0 commit 8f3df84
Show file tree
Hide file tree
Showing 114 changed files with 142 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def is_ignored_line(line):
'Build file was: {build_file}. Line number was: {lineno}'
.format(build_file=build_file, lineno=keyword.value.lineno))


# Same setup as for getting the target's interval
target_call_intervals = [t.value.lineno - target_call.lineno for t in target_call.keywords]
target_call_intervals.append(len(target_source_lines))
Expand Down Expand Up @@ -239,7 +238,6 @@ def is_ignored_line(line):
# print('\n\n')
# print(target_call_intervals)


def get_dependencies_node(target_call):
for keyword in target_call.keywords:
if keyword.arg == 'dependencies':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


class BuildFileManipulatorTest(BaseTest):

def setUp(self):
super(BuildFileManipulatorTest, self).setUp()
self.complicated_dep_comments = dedent(
Expand Down Expand Up @@ -64,7 +65,6 @@ def setUp(self):
# Also this one though it's weird"""
)


def test_malformed_targets(self):
bad_targets = dedent(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class DepLookupError(AddressLookupError):
pass

class PartialCmd(namedtuple('PC', ['language', 'rpc_style', 'namespace_map'])):

@property
def relative_outdir(self):
namespace_sig = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class ThriftLinterTest(PantsRunIntegrationTest):

@staticmethod
def thrift_test_target(name):
return 'contrib/scrooge/tests/thrift/org/pantsbuild/contrib/scrooge/thrift_linter:' + name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def __init__(self, context, workdir):
# Constructor for custom task. Setup things that you need at pants initialization time.
super(ExtraTestJarExample, self).__init__(context, workdir)


# This method is called by pants, when the RoundEngine gets to the phase where your task is
# attached.
def execute(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@


class AllTheThingsTestCase(unittest.TestCase):

def setUp(self):
self.config = json.loads(CONFIG_JSON)
self.soups = {
Expand Down Expand Up @@ -133,7 +134,6 @@ def test_find_title(self):
self.assertEqual(p1_html, u'東京 is Tokyo',
"""Didn't find correct non-ASCII title""")


def test_page_toc(self):
# One of our "pages" has a couple of basic headings.
# Do we get the correct info from that to generate
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/android/tasks/dx_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def _compile_dex(self, args, build_tools_version):
return self.runjava(classpath=classpath, jvm_options=jvm_options, main=java_main,
args=args, workunit_name='dx')


def _filter_unpacked_dir(self, target, unpacked_dir, class_files):
# The Dx tool returns failure if more than one copy of a class is packed into the dex file and
# it is easy to fetch duplicate libraries (as well as conflicting versions) from the SDK repos.
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/android/tasks/unpack_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def create_classes_jar_target(self, target, archive, jar_file):
derived_from=target)
return new_target


def create_resource_target(self, target, archive, manifest, resource_dir):
"""Create an AndroidResources target.
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/codegen/tasks/jaxb_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _sources_to_be_generated(self, package, path):
outdir = package.replace('.', '/')
return [os.path.join(outdir, '{}.java'.format(name)) for name in names]


class JaxbGlobalCodegenStrategy(SimpleCodegenTask.GlobalCodegenStrategy):

def find_sources(self, target):
return self._task.sources_generated_by_target(target)
2 changes: 1 addition & 1 deletion src/python/pants/backend/codegen/tasks/protobuf_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ def calculate_java_genfiles(self, protobuf_parse):
for classname in classnames:
yield os.path.join(basepath, '{0}.java'.format(classname))


class ProtobufGlobalCodegenStrategy(SimpleCodegenTask.GlobalCodegenStrategy):

def find_sources(self, target):
return self._task.sources_generated_by_target(target)

Expand Down
5 changes: 0 additions & 5 deletions src/python/pants/backend/codegen/tasks/simple_codegen_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ def resolve_deps(self, unresolved_deps):
raise self.DepLookupError('{message}\n on dependency {dep}'.format(message=e, dep=dep))
return deps


class CodegenStrategy(AbstractClass):
"""Abstract strategies for running codegen.
Expand Down Expand Up @@ -325,7 +324,6 @@ def codegen_workdir_suffix(self, target):
def __str__(self):
return self.name()


class GlobalCodegenStrategy(CodegenStrategy):
"""Code generation strategy which generates all code together, in base directory."""

Expand Down Expand Up @@ -353,7 +351,6 @@ def find_sources(self, target):
def codegen_workdir_suffix(self, target):
return self.name()


class IsolatedCodegenStrategy(CodegenStrategy):
"""Code generate strategy which generates the code for each target separately.
Expand Down Expand Up @@ -459,13 +456,11 @@ def record_duplicates(dep):
self._generated_sources_cache[target.id] = strict
return strict


class DuplicateSourceError(TaskError):
"""A target generated the same code that was generated by one of its dependencies.
This is only thrown when --allow-dups=False.
"""


class UnsupportedStrategyError(TaskError):
"""Generated when there is no strategy for a given name."""
1 change: 1 addition & 0 deletions src/python/pants/backend/codegen/tasks/wire_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


class WireGen(JvmToolTaskMixin, SimpleCodegenTask):

@classmethod
def register_options(cls, register):
super(WireGen, cls).register_options(register)
Expand Down
2 changes: 0 additions & 2 deletions src/python/pants/backend/core/tasks/dependees.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def register_options(cls, register):
"can be specified at once in a comma separated list or else by "
"using multiple instances of this flag.")


def __init__(self, *args, **kwargs):
super(ReverseDepmap, self).__init__(*args, **kwargs)

Expand All @@ -40,7 +39,6 @@ def __init__(self, *args, **kwargs):
self._dependees_type = self.get_options().type
self._spec_excludes = self.get_options().spec_excludes


def console_output(self, _):
buildfiles = OrderedSet()
address_mapper = self.context.address_mapper
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/core/tasks/group_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


class GroupMember(TaskBase):

@classmethod
def name(cls):
"""Returns a name for this group for display purposes.
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/core/tasks/run_prep_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


class RunPrepCommand(Task):

def execute(self):
targets = self.context.targets(postorder=True)
Cmdline = namedtuple('Cmdline', ['cmdline', 'environ'])
Expand Down
2 changes: 2 additions & 0 deletions src/python/pants/backend/core/tasks/scm_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


class Version(object):

@staticmethod
def parse(version):
"""Attempts to parse the given string as Semver, then falls back to Namedver."""
Expand Down Expand Up @@ -61,6 +62,7 @@ def __repr__(self):


class Semver(Version):

@staticmethod
def parse(version):
components = version.split('.', 3)
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/core/wrapped_globs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __getitem__(self, index):


class FilesetRelPathWrapper(object):

def __init__(self, parse_context):
self.rel_path = parse_context.rel_path

Expand Down
2 changes: 2 additions & 0 deletions src/python/pants/backend/jvm/ivy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@


class IvyModuleRef(object):

def __init__(self, org, name, rev):
self.org = org
self.name = name
Expand All @@ -62,6 +63,7 @@ def unversioned(self):


class IvyInfo(object):

def __init__(self):
self.modules_by_ref = {} # Map from ref to referenced module.
# Map from ref of caller to refs of modules required by that caller.
Expand Down
2 changes: 0 additions & 2 deletions src/python/pants/backend/jvm/targets/jar_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ def __repr__(self):
.format(self.name, self.type_, self.ext, self.conf, self.url, self.classifier))



class JarDependency(object):
"""A pre-built Maven repository dependency."""


_HASH_KEYS = (
'org',
'name',
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/jvm/targets/jvm_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


class JarRule(FingerprintedMixin, AbstractClass):

def __init__(self, apply_pattern, payload=None):
self.payload = payload or Payload()
if not isinstance(apply_pattern, string_types):
Expand Down Expand Up @@ -116,7 +117,6 @@ def __init__(self, apply_pattern, action):
})
super(Duplicate, self).__init__(apply_pattern, payload=payload)


@property
def action(self):
"""The action to take for any duplicate entries that match this rule's ``apply_pattern``."""
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/jvm/tasks/bundle_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class BundleCreate(JvmBinaryTask):

@classmethod
def register_options(cls, register):
super(BundleCreate, cls).register_options(register)
Expand Down
3 changes: 3 additions & 0 deletions src/python/pants/backend/jvm/tasks/jar_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@


class PushDb(object):

@staticmethod
def load(path):
"""Loads a pushdb maintained in a properties file at the given path."""
Expand All @@ -48,6 +49,7 @@ def load(path):
return PushDb(properties)

class Entry(object):

def __init__(self, sem_ver, named_ver, named_is_latest, sha, fingerprint):
"""Records the most recent push/release of an artifact.
Expand Down Expand Up @@ -211,6 +213,7 @@ def jardep(self, jar_dependency, classifier=None):


class PomWriter(DependencyWriter):

def __init__(self, get_db, tag):
super(PomWriter, self).__init__(
get_db,
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/jvm/tasks/jar_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def __init__(self, context, jar):
self._jar = jar
self._manifest = Manifest()


def add_target(self, target, recursive=False):
"""Adds the classes and resources for a target to an open jar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def _random_base64_string():
n = random.randint(20, 200)
return base64.b64encode(os.urandom(n))


# Break on delimiters (digits, space, forward slash, dash, underscore, dollar, period) and on
# upper-case letters.
_DELIMITER = r'\d|\s|/|-|_|\$|\.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def compile(self, args, classpath, sources, classes_output_dir, upstream_analysi
raise TaskError("Set the target JVM version with the 'target' option or with the jvm "
"platform, not in 'args'.")


if self.get_options().source or self.get_options().target:
self.context.log.warn('--compile-java-source and --compile-java-target trample and override '
'target jvm platform settings, and probably should not be used except '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def invalidation_hints(self, relevant_targets):

return (self._partition_size_hint, locally_changed_targets)


def ordered_compile_settings_and_targets(self, relevant_targets):
"""Groups the targets into ordered chunks, dependencies before dependees.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


class JvmDependencyAnalyzer(object):

def __init__(self,
context,
check_missing_deps,
Expand Down Expand Up @@ -170,7 +171,6 @@ def filter_whitelisted(missing_deps):
if self._check_missing_deps == 'fatal':
raise TaskError('Missing deps.')


missing_direct_tgt_deps = filter_whitelisted(missing_direct_tgt_deps)

if self._check_missing_direct_deps and missing_direct_tgt_deps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def compile(self, args, classpath, sources, classes_output_dir, upstream_analysi
zinc_args.extend(['-analysis-map',
','.join('{}:{}'.format(*kv) for kv in upstream_analysis.items())])


zinc_args += args

zinc_args.extend([
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/jvm/tasks/jvmdoc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


class JvmdocGen(JvmTask):

@classmethod
def jvmdoc(cls):
"""Subclasses should return their Jvmdoc configuration."""
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/project_info/tasks/ide_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class Error(TaskError):
"""IdeGen Error."""

class TargetUtil(object):

def __init__(self, context):
self.context = context

Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/project_info/tasks/idea_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def register_options(cls, register):
],
help='Adds folders to be excluded from the project configuration.')


def __init__(self, *args, **kwargs):
super(IdeaGen, self).__init__(*args, **kwargs)

Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/python/python_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
class PythonArtifact(PayloadField):
"""Represents a Python setup.py-based project."""
class MissingArgument(Exception): pass

class UnsupportedArgument(Exception): pass

UNSUPPORTED_ARGS = frozenset([
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/python/thrift_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
class PythonThriftBuilder(CodeGenerator):
"""Generate Python code from thrift IDL files."""
class UnknownPlatformException(CodeGenerator.Error):

def __init__(self, platform):
super(PythonThriftBuilder.UnknownPlatformException, self).__init__(
'Unknown platform: {}!'.format(str(platform)))
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/base/cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def _partition_versioned_targets(cls, versioned_targets, partition_size_hint, vt

# Hack around the python outer scope problem.
class VtGroup(object):

def __init__(self):
self.vts = []
self.total_chunking_units = 0
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/base/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def is_other_lang(target):
@classmethod
def get_addressable_type(target_cls):
class ConcreteTargetAddressable(TargetAddressable):

@classmethod
def get_target_type(cls):
return target_cls
Expand Down
Loading

0 comments on commit 8f3df84

Please sign in to comment.