Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Commit

Permalink
Merge pull request #836 from BPYap/convert-bool-contruction-to-get-bool
Browse files Browse the repository at this point in the history
Changed Bool construction to use getBool instead
  • Loading branch information
freakboy3742 committed Jun 11, 2018
2 parents 80e09f4 + b855885 commit 91ee9f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions python/common/org/python/types/DictItems.java
Expand Up @@ -111,7 +111,7 @@ public org.python.Object __invert__() {
__doc__ = ""
)
public org.python.Object __bool__() {
return new org.python.types.Bool(!this.value.isEmpty());
return org.python.types.Bool.getBool(!this.value.isEmpty());
}

@org.python.Method(
Expand Down Expand Up @@ -198,7 +198,7 @@ public org.python.Object __not_contains__(org.python.Object other) {
public org.python.Object __lt__(org.python.Object other) {
if (other instanceof org.python.types.DictItems) {
org.python.types.DictItems otherItems = (org.python.types.DictItems) other;
return new org.python.types.Bool(otherItems.value.containsAll(this.value) && !this.value.equals(otherItems.value));
return org.python.types.Bool.getBool(otherItems.value.containsAll(this.value) && !this.value.equals(otherItems.value));
}
return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
}
Expand All @@ -210,7 +210,7 @@ public org.python.Object __lt__(org.python.Object other) {
public org.python.Object __le__(org.python.Object other) {
if (other instanceof org.python.types.DictItems) {
org.python.types.DictItems otherItems = (org.python.types.DictItems) other;
return new org.python.types.Bool(otherItems.value.containsAll(this.value));
return org.python.types.Bool.getBool(otherItems.value.containsAll(this.value));
}
return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
}
Expand All @@ -222,7 +222,7 @@ public org.python.Object __le__(org.python.Object other) {
public org.python.Object __eq__(org.python.Object other) {
if (other instanceof org.python.types.DictItems) {
org.python.types.DictItems otherItems = (org.python.types.DictItems) other;
return new org.python.types.Bool(this.value.equals(otherItems.value));
return org.python.types.Bool.getBool(this.value.equals(otherItems.value));
}
return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
}
Expand All @@ -234,7 +234,7 @@ public org.python.Object __eq__(org.python.Object other) {
public org.python.Object __gt__(org.python.Object other) {
if (other instanceof org.python.types.DictItems) {
org.python.types.DictItems otherItems = (org.python.types.DictItems) other;
return new org.python.types.Bool(this.value.containsAll(otherItems.value) && !this.value.equals(otherItems.value));
return org.python.types.Bool.getBool(this.value.containsAll(otherItems.value) && !this.value.equals(otherItems.value));
}
return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
}
Expand All @@ -246,7 +246,7 @@ public org.python.Object __gt__(org.python.Object other) {
public org.python.Object __ge__(org.python.Object other) {
if (other instanceof org.python.types.DictItems) {
org.python.types.DictItems otherItems = (org.python.types.DictItems) other;
return new org.python.types.Bool(this.value.containsAll(otherItems.value));
return org.python.types.Bool.getBool(this.value.containsAll(otherItems.value));
}
return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
}
Expand Down Expand Up @@ -331,6 +331,6 @@ public org.python.types.Set __rsub__(org.python.Object other) {
public org.python.Object isdisjoint(org.python.Object other) {
java.util.Set<org.python.Object> generated = this.fromIter(other);
generated.retainAll(this.value);
return new org.python.types.Bool(generated.size() > 0);
return org.python.types.Bool.getBool(generated.size() > 0);
}
}
}
2 changes: 1 addition & 1 deletion python/common/org/python/types/DictKeys.java
Expand Up @@ -221,7 +221,7 @@ public org.python.Object isdisjoint(org.python.Object other) {
} catch (org.python.exceptions.StopIteration si) {
}
generated.retainAll(this.value);
return new org.python.types.Bool(generated.size() > 0);
return org.python.types.Bool.getBool(generated.size() > 0);
}
/**
* The following methods are not present in Python's dict_keys but are present in DictKeys (inherited from FrozenSet)
Expand Down
6 changes: 3 additions & 3 deletions python/common/org/python/types/DictValues.java
Expand Up @@ -101,7 +101,7 @@ public org.python.Object __invert__() {
__doc__ = ""
)
public org.python.Object __bool__() {
return new org.python.types.Bool(!this.value.isEmpty());
return org.python.types.Bool.getBool(!this.value.isEmpty());
}

@org.python.Method(
Expand Down Expand Up @@ -168,14 +168,14 @@ public void __delitem__(org.python.Object item) {
args = {"item"}
)
public org.python.Object __contains__(org.python.Object item) {
return new org.python.types.Bool(this.value.contains(item));
return org.python.types.Bool.getBool(this.value.contains(item));
}

@org.python.Method(
__doc__ = "",
args = {"item"}
)
public org.python.Object __not_contains__(org.python.Object item) {
return new org.python.types.Bool(!this.value.contains(item));
return org.python.types.Bool.getBool(!this.value.contains(item));
}
}

0 comments on commit 91ee9f7

Please sign in to comment.