Skip to content

Commit

Permalink
remove unused (pandas-dev#19466)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and harisbal committed Feb 28, 2018
1 parent ae64e59 commit d4d3b33
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 54 deletions.
32 changes: 0 additions & 32 deletions pandas/_libs/src/period_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,38 +1275,6 @@ npy_int64 get_python_ordinal(npy_int64 period_ordinal, int freq) {
return toDaily(period_ordinal, 'E', &af_info) + ORD_OFFSET;
}

char *str_replace(const char *s, const char *old, const char *new) {
char *ret;
int i, count = 0;
size_t newlen = strlen(new);
size_t oldlen = strlen(old);

for (i = 0; s[i] != '\0'; i++) {
if (strstr(&s[i], old) == &s[i]) {
count++;
i += oldlen - 1;
}
}

ret = PyArray_malloc(i + 1 + count * (newlen - oldlen));
if (ret == NULL) {
return (char *)PyErr_NoMemory();
}

i = 0;
while (*s) {
if (strstr(s, old) == s) {
strncpy(&ret[i], new, sizeof(char) * newlen);
i += newlen;
s += oldlen;
} else {
ret[i++] = *s++;
}
}
ret[i] = '\0';

return ret;
}

// function to generate a nice string representation of the period
// object, originally from DateObject_strftime
Expand Down
10 changes: 0 additions & 10 deletions pandas/_libs/src/period_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ frequency conversion routines.

#define INT_ERR_CODE INT32_MIN

#define MEM_CHECK(item) \
if (item == NULL) { \
return PyErr_NoMemory(); \
}
#define ERR_CHECK(item) \
if (item == NULL) { \
return NULL; \
}

typedef struct asfreq_info {
int from_week_end; // day the week ends on in the "from" frequency
int to_week_end; // day the week ends on in the "to" frequency
Expand Down Expand Up @@ -182,7 +173,6 @@ int pminute(npy_int64 ordinal, int freq);
int psecond(npy_int64 ordinal, int freq);
int pdays_in_month(npy_int64 ordinal, int freq);

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

Expand Down
9 changes: 0 additions & 9 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,6 @@ cdef object _period_strftime(int64_t value, int freq, object fmt):
ctypedef int (*accessor)(int64_t ordinal, int freq) except INT32_MIN


def get_period_field(int code, int64_t value, int freq):
cdef accessor f = _get_accessor_func(code)
if f is NULL:
raise ValueError('Unrecognized period code: %d' % code)
if value == iNaT:
return np.nan
return f(value, freq)


def get_period_field_arr(int code, ndarray[int64_t] arr, int freq):
cdef:
Py_ssize_t i, sz
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/scalar/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,9 +914,6 @@ def test_round_trip(self):

class TestPeriodField(object):

def test_get_period_field_raises_on_out_of_range(self):
pytest.raises(ValueError, libperiod.get_period_field, -1, 0, 0)

def test_get_period_field_array_raises_on_out_of_range(self):
pytest.raises(ValueError, libperiod.get_period_field_arr, -1,
np.empty(1), 0)
Expand Down

0 comments on commit d4d3b33

Please sign in to comment.