Skip to content

CLN: Remove inheritance from object in pyx-files #26217

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

Merged
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 asv_bench/benchmarks/index_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def time_get_loc(self):
self.ind.get_loc(0)


class IntervalIndexMethod(object):
class IntervalIndexMethod:
# GH 24813
params = [10**3, 10**5]

Expand Down
2 changes: 1 addition & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Check for python2 new-style classes' ; echo $MSG
invgrep -R --include="*.py" -E "class\s\S*\(object\):" pandas scripts
invgrep -R --include="*.py" --include="*.pyx" -E "class\s\S*\(object\):" pandas scripts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would make sense to just have one include flag like in the other PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows the conventions of the code_checks.sh file. I also find it more readable than the other convention...

RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Check for backticks incorrectly rendering because of missing spaces' ; echo $MSG
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/algos.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cdef inline bint are_diff(object left, object right):
return left != right


class Infinity(object):
class Infinity:
""" provide a positive Infinity comparison method for ranking """

__lt__ = lambda self, other: False
Expand All @@ -62,7 +62,7 @@ class Infinity(object):
__ge__ = lambda self, other: not missing.checknull(other)


class NegInfinity(object):
class NegInfinity:
""" provide a negative Infinity comparison method for ranking """

__lt__ = lambda self, other: (not isinstance(other, NegInfinity) and
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/interval.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ from pandas._libs.tslibs.timezones cimport tz_compare
_VALID_CLOSED = frozenset(['left', 'right', 'both', 'neither'])


cdef class IntervalMixin(object):
cdef class IntervalMixin:

@property
def closed_left(self):
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ except AttributeError:
pass


cdef class Seen(object):
cdef class Seen:
"""
Class for keeping track of the types of elements
encountered when trying to perform type conversions.
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/properties.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from cpython cimport (
PyDict_Contains, PyDict_GetItem, PyDict_SetItem)


cdef class CachedProperty(object):
cdef class CachedProperty:

cdef readonly:
object func, name, __doc__
Expand Down Expand Up @@ -44,7 +44,7 @@ cdef class CachedProperty(object):
cache_readonly = CachedProperty


cdef class AxisProperty(object):
cdef class AxisProperty:

cdef readonly:
Py_ssize_t axis
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/sparse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ cdef class BlockIndex(SparseIndex):
pass


cdef class BlockMerge(object):
cdef class BlockMerge:
"""
Object-oriented approach makes sharing state between recursive functions a
lot easier and reduces code duplication
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/frequencies.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INVALID_FREQ_ERR_MSG = "Invalid frequency: {0}"
# Period codes


class FreqGroup(object):
class FreqGroup:
FR_ANN = 1000
FR_QTR = 2000
FR_MTH = 3000
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class ApplyTypeError(TypeError):
# ---------------------------------------------------------------------
# Base Classes

class _BaseOffset(object):
class _BaseOffset:
"""
Base class for DateOffset methods that are not overridden by subclasses
and will (after pickle errors are resolved) go into a cdef class.
Expand Down Expand Up @@ -533,7 +533,7 @@ class BaseOffset(_BaseOffset):
return -self + other


class _Tick(object):
class _Tick:
"""
dummy class to mix into tseries.offsets.Tick so that in tslibs.period we
can do isinstance checks on _Tick and avoid importing tseries.offsets
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def try_parse_datetime_components(object[:] years,
# Thus, we port the class over so that both issues are resolved.
#
# Copyright (c) 2017 - dateutil contributors
class _timelex(object):
class _timelex:
def __init__(self, instream):
if getattr(instream, 'decode', None) is not None:
instream = instream.decode()
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ class IncompatibleFrequency(ValueError):
pass


cdef class _Period(object):
cdef class _Period:

cdef readonly:
int64_t ordinal
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/resolution.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_freq_group(freq):
return (freq // 1000) * 1000


class Resolution(object):
class Resolution:

# Note: cython won't allow us to reference the cdef versions at the
# module level
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/strptime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _getlang():
return locale.getlocale(locale.LC_TIME)


class LocaleTime(object):
class LocaleTime:
"""Stores and handles locale-specific information related to time.

ATTRIBUTES:
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cdef inline object create_timestamp_from_ts(int64_t value,
return ts_base


class RoundTo(object):
class RoundTo:
"""
enumeration defining the available rounding modes

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/msgpack/_packer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cdef extern from "../../src/msgpack/pack.h":
cdef int DEFAULT_RECURSE_LIMIT=511


cdef class Packer(object):
cdef class Packer:
"""
MessagePack Packer

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/msgpack/_unpacker.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def unpack(object stream, object object_hook=None, object list_hook=None,
encoding=encoding, unicode_errors=unicode_errors)


cdef class Unpacker(object):
cdef class Unpacker:
"""Streaming unpacker.

arguments:
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/sas/sas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ cdef:
int subheader_pointers_offset = const.subheader_pointers_offset


cdef class Parser(object):
cdef class Parser:

cdef:
int column_count
Expand Down