Skip to content

Commit c322b24

Browse files
authored
CI/STYLE Fix misspellings exposed by codespell (pandas-dev#39264)
1 parent 412554b commit c322b24

File tree

11 files changed

+20
-18
lines changed

11 files changed

+20
-18
lines changed

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ repos:
189189
hooks:
190190
- id: codespell
191191
types_or: [python, rst, markdown]
192-
files: ^pandas/core/
192+
files: ^pandas/
193+
exclude: ^pandas/tests/
193194
- repo: https://github.com/MarcoGorelli/no-string-hints
194195
rev: v0.1.5
195196
hooks:

pandas/_testing/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def makeCustomDataframe(
679679
# 4-level multindex on rows with names provided, 2-level multindex
680680
# on columns with default labels and default names.
681681
>> a=makeCustomDataframe(5,3,r_idx_nlevels=4,
682-
r_idx_names=["FEE","FI","FO","FAM"],
682+
r_idx_names=["FEE","FIH","FOH","FUM"],
683683
c_idx_nlevels=2)
684684
685685
>> a=mkdf(5,3,r_idx_nlevels=2,c_idx_nlevels=4)

pandas/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
293293
# TAG-NUM-gHEX
294294
mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe)
295295
if not mo:
296-
# unparseable. Maybe git-describe is misbehaving?
296+
# unparsable. Maybe git-describe is misbehaving?
297297
pieces["error"] = "unable to parse git-describe output: '%s'" % describe_out
298298
return pieces
299299

pandas/io/clipboard/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,12 @@ def copy_dev_clipboard(text):
271271
if "\r" in text:
272272
warnings.warn("Pyperclip cannot handle \\r characters on Cygwin.")
273273

274-
with open("/dev/clipboard", "wt") as fo:
275-
fo.write(text)
274+
with open("/dev/clipboard", "wt") as fd:
275+
fd.write(text)
276276

277277
def paste_dev_clipboard() -> str:
278-
with open("/dev/clipboard") as fo:
279-
content = fo.read()
278+
with open("/dev/clipboard") as fd:
279+
content = fd.read()
280280
return content
281281

282282
return copy_dev_clipboard, paste_dev_clipboard

pandas/io/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def _get_filepath_or_buffer(
292292
# urlopen function defined elsewhere in this module
293293
import urllib.request
294294

295-
# assuming storage_options is to be interpretted as headers
295+
# assuming storage_options is to be interpreted as headers
296296
req_info = urllib.request.Request(filepath_or_buffer, headers=storage_options)
297297
with urlopen(req_info) as req:
298298
content_encoding = req.headers.get("Content-Encoding", None)

pandas/io/excel/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
* dict, e.g. {'foo' : [1, 3]} -> parse columns 1, 3 as date and call
191191
result 'foo'
192192
193-
If a column or index contains an unparseable date, the entire column or
193+
If a column or index contains an unparsable date, the entire column or
194194
index will be returned unaltered as an object data type. If you don`t want to
195195
parse some cells as date just change their type in Excel to "Text".
196196
For non-standard datetime parsing, use ``pd.to_datetime`` after ``pd.read_excel``.

pandas/io/formats/format.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ class DataFrameRenderer:
919919
Parameters
920920
----------
921921
fmt : DataFrameFormatter
922-
Formatter with the formating options.
922+
Formatter with the formatting options.
923923
"""
924924

925925
def __init__(self, fmt: DataFrameFormatter):

pandas/io/formats/info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ def _gen_columns(self) -> Iterator[str]:
683683

684684
def _get_dataframe_dtype_counts(df: DataFrame) -> Mapping[str, int]:
685685
"""
686-
Create mapping between datatypes and their number of occurences.
686+
Create mapping between datatypes and their number of occurrences.
687687
"""
688688
# groupby dtype.name to collect e.g. Categorical columns
689689
return df.dtypes.value_counts().groupby(lambda x: x.name).sum()

pandas/io/formats/style.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ def from_custom_template(cls, searchpath, name):
16971697
"""
16981698
loader = jinja2.ChoiceLoader([jinja2.FileSystemLoader(searchpath), cls.loader])
16991699

1700-
# mypy doesnt like dynamically-defined class
1700+
# mypy doesn't like dynamically-defined classes
17011701
# error: Variable "cls" is not valid as a type [valid-type]
17021702
# error: Invalid base class "cls" [misc]
17031703
class MyStyler(cls): # type:ignore[valid-type,misc]

pandas/io/json/_normalize.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -162,40 +162,40 @@ def _json_normalize(
162162
Examples
163163
--------
164164
>>> data = [{'id': 1, 'name': {'first': 'Coleen', 'last': 'Volk'}},
165-
... {'name': {'given': 'Mose', 'family': 'Regner'}},
165+
... {'name': {'given': 'Mark', 'family': 'Regner'}},
166166
... {'id': 2, 'name': 'Faye Raker'}]
167167
>>> pd.json_normalize(data)
168168
id name.first name.last name.given name.family name
169169
0 1.0 Coleen Volk NaN NaN NaN
170-
1 NaN NaN NaN Mose Regner NaN
170+
1 NaN NaN NaN Mark Regner NaN
171171
2 2.0 NaN NaN NaN NaN Faye Raker
172172
173173
>>> data = [{'id': 1,
174174
... 'name': "Cole Volk",
175175
... 'fitness': {'height': 130, 'weight': 60}},
176-
... {'name': "Mose Reg",
176+
... {'name': "Mark Reg",
177177
... 'fitness': {'height': 130, 'weight': 60}},
178178
... {'id': 2, 'name': 'Faye Raker',
179179
... 'fitness': {'height': 130, 'weight': 60}}]
180180
>>> pd.json_normalize(data, max_level=0)
181181
id name fitness
182182
0 1.0 Cole Volk {'height': 130, 'weight': 60}
183-
1 NaN Mose Reg {'height': 130, 'weight': 60}
183+
1 NaN Mark Reg {'height': 130, 'weight': 60}
184184
2 2.0 Faye Raker {'height': 130, 'weight': 60}
185185
186186
Normalizes nested data up to level 1.
187187
188188
>>> data = [{'id': 1,
189189
... 'name': "Cole Volk",
190190
... 'fitness': {'height': 130, 'weight': 60}},
191-
... {'name': "Mose Reg",
191+
... {'name': "Mark Reg",
192192
... 'fitness': {'height': 130, 'weight': 60}},
193193
... {'id': 2, 'name': 'Faye Raker',
194194
... 'fitness': {'height': 130, 'weight': 60}}]
195195
>>> pd.json_normalize(data, max_level=1)
196196
id name fitness.height fitness.weight
197197
0 1.0 Cole Volk 130 60
198-
1 NaN Mose Reg 130 60
198+
1 NaN Mark Reg 130 60
199199
2 2.0 Faye Raker 130 60
200200
201201
>>> data = [{'state': 'Florida',

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ junit_family=xunit2
6868

6969
[codespell]
7070
ignore-words-list=ba,blocs,coo,hist,nd,ser
71+
ignore-regex=https://(\w+\.)+
7172

7273
[coverage:run]
7374
branch = False

0 commit comments

Comments
 (0)