Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
~\AppData\Local\pip\Cache
key: ${{ runner.os }}-build-${{ matrix.python-version }}
- name: install-reqs
run: python -m pip install --upgrade tox virtualenv setuptools pip -r --pre requirements-dev.txt
run: python -m pip install --pre --upgrade tox virtualenv setuptools pip -r requirements-dev.txt
- name: Run pytest
run: pytest tests --cov=dataframe_api_compat --cov=tests --cov-fail-under=50
# todo: add mypy here too!
Expand Down
16 changes: 8 additions & 8 deletions dataframe_api_compat/pandas_standard/scalar_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _materialise(self) -> Any:
def persist(self) -> Scalar:
return Scalar(
self._value,
df=self._df,
df=None,
api_version=self._api_version,
is_persisted=True,
)
Expand Down Expand Up @@ -110,7 +110,7 @@ def __radd__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__radd__(other))
return self._from_scalar(other + self._value)

def __sub__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -122,7 +122,7 @@ def __rsub__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rsub__(other))
return self._from_scalar(other - self._value)

def __mul__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -134,7 +134,7 @@ def __rmul__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rmul__(other))
return self._from_scalar(other * self._value)

def __mod__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -146,7 +146,7 @@ def __rmod__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rmod__(other))
return self._from_scalar(other % self._value)

def __pow__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -158,7 +158,7 @@ def __rpow__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rpow__(other))
return self._from_scalar(other**self._value)

def __floordiv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -170,7 +170,7 @@ def __rfloordiv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rfloordiv__(other))
return self._from_scalar(other // self._value)

def __truediv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -182,7 +182,7 @@ def __rtruediv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rtruediv__(other))
return self._from_scalar(other / self._value)

def __neg__(self) -> Scalar:
return self._from_scalar(self._value.__neg__())
Expand Down
16 changes: 8 additions & 8 deletions dataframe_api_compat/polars_standard/scalar_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def persist(self) -> Scalar:
value = df.get_column(df.columns[0]).item()
return Scalar(
value,
df=self._df,
df=None,
api_version=self._api_version,
is_persisted=True,
)
Expand Down Expand Up @@ -122,7 +122,7 @@ def __radd__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__radd__(other))
return self._from_scalar(other + self._value)

def __sub__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -134,7 +134,7 @@ def __rsub__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rsub__(other))
return self._from_scalar(other - self._value)

def __mul__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -146,7 +146,7 @@ def __rmul__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rmul__(other))
return self._from_scalar(other * self._value)

def __mod__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -158,7 +158,7 @@ def __rmod__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rmod__(other))
return self._from_scalar(other % self._value)

def __pow__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -170,7 +170,7 @@ def __rpow__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rpow__(other))
return self._from_scalar(other**self._value)

def __floordiv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -182,7 +182,7 @@ def __rfloordiv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rfloordiv__(other))
return self._from_scalar(other // self._value)

def __truediv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
Expand All @@ -194,7 +194,7 @@ def __rtruediv__(self, other: Any) -> Scalar:
other = validate_comparand(self, other)
if other is NotImplemented:
return NotImplemented
return self._from_scalar(self._value.__rtruediv__(other))
return self._from_scalar(other / self._value)

def __neg__(self) -> Scalar:
return self._from_scalar(self._value.__neg__())
Expand Down