Skip to content

Commit 65ccafd

Browse files
committed
use pep 8 for class names
1 parent 6e5b5a6 commit 65ccafd

File tree

4 files changed

+57
-57
lines changed

4 files changed

+57
-57
lines changed

pandas/io/sas/sas7bdat.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def _get_subheader_index(self, signature, compression, ptype):
321321
(compression == 0))
322322
f2 = (ptype == const.compressed_subheader_type)
323323
if (self.compression != "") and f1 and f2:
324-
index = const.index.dataSubheaderIndex
324+
index = const.SASIndex.data_subheader_index
325325
else:
326326
self.close()
327327
raise ValueError("Unknown subheader signature")
@@ -360,23 +360,23 @@ def _process_subheader(self, subheader_index, pointer):
360360
offset = pointer.offset
361361
length = pointer.length
362362

363-
if subheader_index == const.index.rowSizeIndex:
363+
if subheader_index == const.SASIndex.row_size_index:
364364
processor = self._process_rowsize_subheader
365-
elif subheader_index == const.index.columnSizeIndex:
365+
elif subheader_index == const.SASIndex.column_size_index:
366366
processor = self._process_columnsize_subheader
367-
elif subheader_index == const.index.columnTextIndex:
367+
elif subheader_index == const.SASIndex.column_text_index:
368368
processor = self._process_columntext_subheader
369-
elif subheader_index == const.index.columnNameIndex:
369+
elif subheader_index == const.SASIndex.column_name_index:
370370
processor = self._process_columnname_subheader
371-
elif subheader_index == const.index.columnAttributesIndex:
371+
elif subheader_index == const.SASIndex.column_attributes_index:
372372
processor = self._process_columnattributes_subheader
373-
elif subheader_index == const.index.formatAndLabelIndex:
373+
elif subheader_index == const.SASIndex.format_and_label_index:
374374
processor = self._process_format_subheader
375-
elif subheader_index == const.index.columnListIndex:
375+
elif subheader_index == const.SASIndex.column_list_index:
376376
processor = self._process_columnlist_subheader
377-
elif subheader_index == const.index.subheaderCountsIndex:
377+
elif subheader_index == const.SASIndex.subheader_counts_index:
378378
processor = self._process_subheader_counts
379-
elif subheader_index == const.index.dataSubheaderIndex:
379+
elif subheader_index == const.SASIndex.data_subheader_index:
380380
self._current_page_data_subheader_pointers.append(pointer)
381381
return
382382
else:

pandas/io/sas/sas_constants.py

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -102,49 +102,49 @@
102102
61: "wcyrillic", 62: "wlatin1", 90: "ebcdic870"}
103103

104104

105-
class index(object):
106-
rowSizeIndex = 0
107-
columnSizeIndex = 1
108-
subheaderCountsIndex = 2
109-
columnTextIndex = 3
110-
columnNameIndex = 4
111-
columnAttributesIndex = 5
112-
formatAndLabelIndex = 6
113-
columnListIndex = 7
114-
dataSubheaderIndex = 8
105+
class SASIndex(object):
106+
row_size_index = 0
107+
column_size_index = 1
108+
subheader_counts_index = 2
109+
column_text_index = 3
110+
column_name_index = 4
111+
column_attributes_index = 5
112+
format_and_label_index = 6
113+
column_list_index = 7
114+
data_subheader_index = 8
115115

116116

117117
subheader_signature_to_index = {
118-
b"\xF7\xF7\xF7\xF7": index.rowSizeIndex,
119-
b"\x00\x00\x00\x00\xF7\xF7\xF7\xF7": index.rowSizeIndex,
120-
b"\xF7\xF7\xF7\xF7\x00\x00\x00\x00": index.rowSizeIndex,
121-
b"\xF7\xF7\xF7\xF7\xFF\xFF\xFB\xFE": index.rowSizeIndex,
122-
b"\xF6\xF6\xF6\xF6": index.columnSizeIndex,
123-
b"\x00\x00\x00\x00\xF6\xF6\xF6\xF6": index.columnSizeIndex,
124-
b"\xF6\xF6\xF6\xF6\x00\x00\x00\x00": index.columnSizeIndex,
125-
b"\xF6\xF6\xF6\xF6\xFF\xFF\xFB\xFE": index.columnSizeIndex,
126-
b"\x00\xFC\xFF\xFF": index.subheaderCountsIndex,
127-
b"\xFF\xFF\xFC\x00": index.subheaderCountsIndex,
128-
b"\x00\xFC\xFF\xFF\xFF\xFF\xFF\xFF": index.subheaderCountsIndex,
129-
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFC\x00": index.subheaderCountsIndex,
130-
b"\xFD\xFF\xFF\xFF": index.columnTextIndex,
131-
b"\xFF\xFF\xFF\xFD": index.columnTextIndex,
132-
b"\xFD\xFF\xFF\xFF\xFF\xFF\xFF\xFF": index.columnTextIndex,
133-
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD": index.columnTextIndex,
134-
b"\xFF\xFF\xFF\xFF": index.columnNameIndex,
135-
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF": index.columnNameIndex,
136-
b"\xFC\xFF\xFF\xFF": index.columnAttributesIndex,
137-
b"\xFF\xFF\xFF\xFC": index.columnAttributesIndex,
138-
b"\xFC\xFF\xFF\xFF\xFF\xFF\xFF\xFF": index.columnAttributesIndex,
139-
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFC": index.columnAttributesIndex,
140-
b"\xFE\xFB\xFF\xFF": index.formatAndLabelIndex,
141-
b"\xFF\xFF\xFB\xFE": index.formatAndLabelIndex,
142-
b"\xFE\xFB\xFF\xFF\xFF\xFF\xFF\xFF": index.formatAndLabelIndex,
143-
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFB\xFE": index.formatAndLabelIndex,
144-
b"\xFE\xFF\xFF\xFF": index.columnListIndex,
145-
b"\xFF\xFF\xFF\xFE": index.columnListIndex,
146-
b"\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF": index.columnListIndex,
147-
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE": index.columnListIndex}
118+
b"\xF7\xF7\xF7\xF7": SASIndex.row_size_index,
119+
b"\x00\x00\x00\x00\xF7\xF7\xF7\xF7": SASIndex.row_size_index,
120+
b"\xF7\xF7\xF7\xF7\x00\x00\x00\x00": SASIndex.row_size_index,
121+
b"\xF7\xF7\xF7\xF7\xFF\xFF\xFB\xFE": SASIndex.row_size_index,
122+
b"\xF6\xF6\xF6\xF6": SASIndex.column_size_index,
123+
b"\x00\x00\x00\x00\xF6\xF6\xF6\xF6": SASIndex.column_size_index,
124+
b"\xF6\xF6\xF6\xF6\x00\x00\x00\x00": SASIndex.column_size_index,
125+
b"\xF6\xF6\xF6\xF6\xFF\xFF\xFB\xFE": SASIndex.column_size_index,
126+
b"\x00\xFC\xFF\xFF": SASIndex.subheader_counts_index,
127+
b"\xFF\xFF\xFC\x00": SASIndex.subheader_counts_index,
128+
b"\x00\xFC\xFF\xFF\xFF\xFF\xFF\xFF": SASIndex.subheader_counts_index,
129+
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFC\x00": SASIndex.subheader_counts_index,
130+
b"\xFD\xFF\xFF\xFF": SASIndex.column_text_index,
131+
b"\xFF\xFF\xFF\xFD": SASIndex.column_text_index,
132+
b"\xFD\xFF\xFF\xFF\xFF\xFF\xFF\xFF": SASIndex.column_text_index,
133+
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD": SASIndex.column_text_index,
134+
b"\xFF\xFF\xFF\xFF": SASIndex.column_name_index,
135+
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF": SASIndex.column_name_index,
136+
b"\xFC\xFF\xFF\xFF": SASIndex.column_attributes_index,
137+
b"\xFF\xFF\xFF\xFC": SASIndex.column_attributes_index,
138+
b"\xFC\xFF\xFF\xFF\xFF\xFF\xFF\xFF": SASIndex.column_attributes_index,
139+
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFC": SASIndex.column_attributes_index,
140+
b"\xFE\xFB\xFF\xFF": SASIndex.format_and_label_index,
141+
b"\xFF\xFF\xFB\xFE": SASIndex.format_and_label_index,
142+
b"\xFE\xFB\xFF\xFF\xFF\xFF\xFF\xFF": SASIndex.format_and_label_index,
143+
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFB\xFE": SASIndex.format_and_label_index,
144+
b"\xFE\xFF\xFF\xFF": SASIndex.column_list_index,
145+
b"\xFF\xFF\xFF\xFE": SASIndex.column_list_index,
146+
b"\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF": SASIndex.column_list_index,
147+
b"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE": SASIndex.column_list_index}
148148

149149

150150
# List of frequently used SAS date and datetime formats

pandas/tests/io/json/test_ujson.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,14 @@ def test_dumpToFile(self):
772772
assert "[1,2,3]" == f.getvalue()
773773

774774
def test_dumpToFileLikeObject(self):
775-
class filelike(object):
775+
class FileLike(object):
776776

777777
def __init__(self):
778778
self.bytes = ''
779779

780780
def write(self, bytes):
781781
self.bytes += bytes
782-
f = filelike()
782+
f = FileLike()
783783
ujson.dump([1, 2, 3], f)
784784
assert "[1,2,3]" == f.bytes
785785

@@ -800,18 +800,18 @@ def test_loadFile(self):
800800
np.array([1, 2, 3, 4]), ujson.load(f, numpy=True))
801801

802802
def test_loadFileLikeObject(self):
803-
class filelike(object):
803+
class FileLike(object):
804804

805805
def read(self):
806806
try:
807807
self.end
808808
except AttributeError:
809809
self.end = True
810810
return "[1,2,3,4]"
811-
f = filelike()
811+
f = FileLike()
812812
assert [1, 2, 3, 4] == ujson.load(f)
813813

814-
f = filelike()
814+
f = FileLike()
815815
tm.assert_numpy_array_equal(
816816
np.array([1, 2, 3, 4]), ujson.load(f, numpy=True))
817817

pandas/tests/test_resample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ def test_resample_how_callables(self):
10821082
def fn(x, a=1):
10831083
return str(type(x))
10841084

1085-
class fn_class(object):
1085+
class FnClass(object):
10861086

10871087
def __call__(self, x):
10881088
return str(type(x))
@@ -1091,7 +1091,7 @@ def __call__(self, x):
10911091
df_lambda = df.resample("M").apply(lambda x: str(type(x)))
10921092
df_partial = df.resample("M").apply(partial(fn))
10931093
df_partial2 = df.resample("M").apply(partial(fn, a=2))
1094-
df_class = df.resample("M").apply(fn_class())
1094+
df_class = df.resample("M").apply(FnClass())
10951095

10961096
assert_frame_equal(df_standard, df_lambda)
10971097
assert_frame_equal(df_standard, df_partial)

0 commit comments

Comments
 (0)