-
-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port backend/jvm #6092
Port backend/jvm #6092
Changes from 3 commits
a136697
4114770
dd5bd45
6eacc04
1f92395
3a0ce56
343c39c
71059dc
e456a75
3afd237
6c1b037
2fc43c8
0f8dd8b
d10fa27
b218681
c88c721
1159a63
dbaaebd
aea9fc4
0bdbbbb
0573294
d0d2089
3ad9956
a82e4fd
762f9b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
unicode_literals, with_statement) | ||
|
||
import os | ||
from builtins import object | ||
|
||
|
||
class Repository(object): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
unicode_literals, with_statement) | ||
|
||
import logging | ||
from builtins import map, next, object | ||
from collections import defaultdict | ||
from textwrap import dedent | ||
|
||
|
@@ -255,7 +256,7 @@ def __iter__(self): | |
def __len__(self): | ||
return len(self._artifacts_to_versions) | ||
|
||
def __nonzero__(self): | ||
def __bool__(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found through porting another module that this automatic implementation of I think it’s likely safe to assume this won’t be subclassesed by something other than object anytime soon, but I can remove this deletion if we prefer to use the more explicit implementation of both |
||
return len(self) > 0 | ||
|
||
def __contains__(self, artifact): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
unicode_literals, with_statement) | ||
|
||
import logging | ||
from builtins import object, str | ||
from functools import total_ordering | ||
|
||
from pants.base.exceptions import TaskError | ||
from pants.base.revision import Revision | ||
|
@@ -185,6 +187,7 @@ def parse_java_version(cls, version): | |
return Revision(*version.components[:2]) | ||
|
||
|
||
@total_ordering | ||
class JvmPlatformSettings(object): | ||
"""Simple information holder to keep track of common arguments to java compilers.""" | ||
|
||
|
@@ -231,15 +234,13 @@ def __iter__(self): | |
def __eq__(self, other): | ||
return tuple(self) == tuple(other) | ||
|
||
def __ne__(self, other): | ||
return not self.__eq__(other) | ||
# TODO(python3port): decide if this should raise NotImplemented on invalid comparisons | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto on replacing Same semantics as before |
||
def __lt__(self, other): | ||
return tuple(self) < tuple(other) | ||
|
||
def __hash__(self): | ||
return hash(tuple(self)) | ||
|
||
def __cmp__(self, other): | ||
return cmp(tuple(self), tuple(other)) | ||
|
||
def __str__(self): | ||
return 'source={source},target={target},args=({args})'.format( | ||
source=self.source_level, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced
__cmp__
with rich comparisons, which are auto-generated from the@total_ordering
annotation.Same semantics as before