Skip to content

Commit d4d3b33

Browse files
jbrockmendelharisbal
authored and
harisbal
committed
remove unused (pandas-dev#19466)
1 parent ae64e59 commit d4d3b33

File tree

4 files changed

+0
-54
lines changed

4 files changed

+0
-54
lines changed

pandas/_libs/src/period_helper.c

-32
Original file line numberDiff line numberDiff line change
@@ -1275,38 +1275,6 @@ npy_int64 get_python_ordinal(npy_int64 period_ordinal, int freq) {
12751275
return toDaily(period_ordinal, 'E', &af_info) + ORD_OFFSET;
12761276
}
12771277

1278-
char *str_replace(const char *s, const char *old, const char *new) {
1279-
char *ret;
1280-
int i, count = 0;
1281-
size_t newlen = strlen(new);
1282-
size_t oldlen = strlen(old);
1283-
1284-
for (i = 0; s[i] != '\0'; i++) {
1285-
if (strstr(&s[i], old) == &s[i]) {
1286-
count++;
1287-
i += oldlen - 1;
1288-
}
1289-
}
1290-
1291-
ret = PyArray_malloc(i + 1 + count * (newlen - oldlen));
1292-
if (ret == NULL) {
1293-
return (char *)PyErr_NoMemory();
1294-
}
1295-
1296-
i = 0;
1297-
while (*s) {
1298-
if (strstr(s, old) == s) {
1299-
strncpy(&ret[i], new, sizeof(char) * newlen);
1300-
i += newlen;
1301-
s += oldlen;
1302-
} else {
1303-
ret[i++] = *s++;
1304-
}
1305-
}
1306-
ret[i] = '\0';
1307-
1308-
return ret;
1309-
}
13101278

13111279
// function to generate a nice string representation of the period
13121280
// object, originally from DateObject_strftime

pandas/_libs/src/period_helper.h

-10
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,6 @@ frequency conversion routines.
112112

113113
#define INT_ERR_CODE INT32_MIN
114114

115-
#define MEM_CHECK(item) \
116-
if (item == NULL) { \
117-
return PyErr_NoMemory(); \
118-
}
119-
#define ERR_CHECK(item) \
120-
if (item == NULL) { \
121-
return NULL; \
122-
}
123-
124115
typedef struct asfreq_info {
125116
int from_week_end; // day the week ends on in the "from" frequency
126117
int to_week_end; // day the week ends on in the "to" frequency
@@ -182,7 +173,6 @@ int pminute(npy_int64 ordinal, int freq);
182173
int psecond(npy_int64 ordinal, int freq);
183174
int pdays_in_month(npy_int64 ordinal, int freq);
184175

185-
double getAbsTime(int freq, npy_int64 dailyDate, npy_int64 originalDate);
186176
char *c_strftime(struct date_info *dinfo, char *fmt);
187177
int get_yq(npy_int64 ordinal, int freq, int *quarter, int *year);
188178

pandas/_libs/tslibs/period.pyx

-9
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,6 @@ cdef object _period_strftime(int64_t value, int freq, object fmt):
372372
ctypedef int (*accessor)(int64_t ordinal, int freq) except INT32_MIN
373373

374374

375-
def get_period_field(int code, int64_t value, int freq):
376-
cdef accessor f = _get_accessor_func(code)
377-
if f is NULL:
378-
raise ValueError('Unrecognized period code: %d' % code)
379-
if value == iNaT:
380-
return np.nan
381-
return f(value, freq)
382-
383-
384375
def get_period_field_arr(int code, ndarray[int64_t] arr, int freq):
385376
cdef:
386377
Py_ssize_t i, sz

pandas/tests/scalar/test_period.py

-3
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,6 @@ def test_round_trip(self):
914914

915915
class TestPeriodField(object):
916916

917-
def test_get_period_field_raises_on_out_of_range(self):
918-
pytest.raises(ValueError, libperiod.get_period_field, -1, 0, 0)
919-
920917
def test_get_period_field_array_raises_on_out_of_range(self):
921918
pytest.raises(ValueError, libperiod.get_period_field_arr, -1,
922919
np.empty(1), 0)

0 commit comments

Comments
 (0)