Skip to content

Commit c979bd8

Browse files
authored
Fixed all warning.warn messages for space,full-stop etc issues (#43163)
* Fixed all warning.warn messages for space,fullstop etc issues * fix ppe 8 issues reported * fix ppe 8 issues reported * fix ppe 8 issues reported * After precommit * fixed the expected variable * fixed flake8
1 parent e218f05 commit c979bd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+89
-85
lines changed

pandas/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __getattr__(name):
207207
warnings.warn(
208208
"The pandas.np module is deprecated "
209209
"and will be removed from pandas in a future version. "
210-
"Import numpy directly instead",
210+
"Import numpy directly instead.",
211211
FutureWarning,
212212
stacklevel=2,
213213
)
@@ -218,7 +218,7 @@ def __getattr__(name):
218218
elif name in {"SparseSeries", "SparseDataFrame"}:
219219
warnings.warn(
220220
f"The {name} class is removed from pandas. Accessing it from "
221-
"the top-level namespace will also be removed in the next version",
221+
"the top-level namespace will also be removed in the next version.",
222222
FutureWarning,
223223
stacklevel=2,
224224
)

pandas/_libs/parsers.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ cdef class TextReader:
10001000
if col_dtype is not None:
10011001
warnings.warn((f"Both a converter and dtype were specified "
10021002
f"for column {name} - only the converter will "
1003-
f"be used"), ParserWarning,
1003+
f"be used."), ParserWarning,
10041004
stacklevel=5)
10051005
results[i] = _apply_converter(conv, self.parser, i, start, end)
10061006
continue

pandas/_libs/tslibs/nattype.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ cdef class _NaT(datetime):
143143
return True
144144
warnings.warn(
145145
"Comparison of NaT with datetime.date is deprecated in "
146-
"order to match the standard library behavior. "
146+
"order to match the standard library behavior. "
147147
"In a future version these will be considered non-comparable.",
148148
FutureWarning,
149149
stacklevel=1,

pandas/_libs/tslibs/offsets.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,15 +696,15 @@ cdef class BaseOffset:
696696

697697
def onOffset(self, dt) -> bool:
698698
warnings.warn(
699-
"onOffset is a deprecated, use is_on_offset instead",
699+
"onOffset is a deprecated, use is_on_offset instead.",
700700
FutureWarning,
701701
stacklevel=1,
702702
)
703703
return self.is_on_offset(dt)
704704

705705
def isAnchored(self) -> bool:
706706
warnings.warn(
707-
"isAnchored is a deprecated, use is_anchored instead",
707+
"isAnchored is a deprecated, use is_anchored instead.",
708708
FutureWarning,
709709
stacklevel=1,
710710
)

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ cdef inline timedelta_from_spec(object number, object frac, object unit):
571571
if unit in ["M", "Y", "y"]:
572572
warnings.warn(
573573
"Units 'M', 'Y' and 'y' do not represent unambiguous "
574-
"timedelta values and will be removed in a future version",
574+
"timedelta values and will be removed in a future version.",
575575
FutureWarning,
576576
stacklevel=2,
577577
)

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ cdef class _Timestamp(ABCTimestamp):
171171
@property
172172
def freq(self):
173173
warnings.warn(
174-
"Timestamp.freq is deprecated and will be removed in a future version",
174+
"Timestamp.freq is deprecated and will be removed in a future version.",
175175
FutureWarning,
176176
stacklevel=1,
177177
)
@@ -235,8 +235,8 @@ cdef class _Timestamp(ABCTimestamp):
235235
# We follow the stdlib datetime behavior of never being equal
236236
warnings.warn(
237237
"Comparison of Timestamp with datetime.date is deprecated in "
238-
"order to match the standard library behavior. "
239-
"In a future version these will be considered non-comparable."
238+
"order to match the standard library behavior. "
239+
"In a future version these will be considered non-comparable. "
240240
"Use 'ts == pd.Timestamp(date)' or 'ts.date() == date' instead.",
241241
FutureWarning,
242242
stacklevel=1,
@@ -425,7 +425,7 @@ cdef class _Timestamp(ABCTimestamp):
425425
warnings.warn(
426426
"Timestamp.freq is deprecated and will be removed in a future "
427427
"version. When you have a freq, use "
428-
f"freq.{field}(timestamp) instead",
428+
f"freq.{field}(timestamp) instead.",
429429
FutureWarning,
430430
stacklevel=1,
431431
)
@@ -858,7 +858,7 @@ cdef class _Timestamp(ABCTimestamp):
858858
NaT
859859
"""
860860
if self.nanosecond != 0 and warn:
861-
warnings.warn("Discarding nonzero nanoseconds in conversion",
861+
warnings.warn("Discarding nonzero nanoseconds in conversion.",
862862
UserWarning, stacklevel=2)
863863

864864
return datetime(self.year, self.month, self.day,

pandas/core/arrays/datetimelike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ def _addsub_object_array(self, other: np.ndarray, op):
11861186

11871187
warnings.warn(
11881188
"Adding/subtracting object-dtype array to "
1189-
f"{type(self).__name__} not vectorized",
1189+
f"{type(self).__name__} not vectorized.",
11901190
PerformanceWarning,
11911191
)
11921192

pandas/core/arrays/datetimes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ def _add_offset(self, offset) -> DatetimeArray:
744744

745745
except NotImplementedError:
746746
warnings.warn(
747-
"Non-vectorized DateOffset being applied to Series or DatetimeIndex",
747+
"Non-vectorized DateOffset being applied to Series or DatetimeIndex.",
748748
PerformanceWarning,
749749
)
750750
result = self.astype("O") + offset
@@ -1186,8 +1186,8 @@ def to_perioddelta(self, freq) -> TimedeltaArray:
11861186
# Deprecaation GH#34853
11871187
warnings.warn(
11881188
"to_perioddelta is deprecated and will be removed in a "
1189-
"future version. "
1190-
"Use `dtindex - dtindex.to_period(freq).to_timestamp()` instead",
1189+
"future version. "
1190+
"Use `dtindex - dtindex.to_period(freq).to_timestamp()` instead.",
11911191
FutureWarning,
11921192
# stacklevel chosen to be correct for when called from DatetimeIndex
11931193
stacklevel=3,
@@ -1353,7 +1353,7 @@ def weekofyear(self):
13531353
warnings.warn(
13541354
"weekofyear and week have been deprecated, please use "
13551355
"DatetimeIndex.isocalendar().week instead, which returns "
1356-
"a Series. To exactly reproduce the behavior of week and "
1356+
"a Series. To exactly reproduce the behavior of week and "
13571357
"weekofyear and return an Index, you may call "
13581358
"pd.Int64Index(idx.isocalendar().week)",
13591359
FutureWarning,

pandas/core/arrays/sparse/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def __init__(
407407
if is_datetime64tz_dtype(data.dtype):
408408
warnings.warn(
409409
f"Creating SparseArray from {data.dtype} data "
410-
"loses timezone information. Cast to object before "
410+
"loses timezone information. Cast to object before "
411411
"sparse to retain timezone information.",
412412
UserWarning,
413413
stacklevel=2,

pandas/core/computation/align.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _align_core(terms):
124124
w = (
125125
f"Alignment difference on axis {axis} is larger "
126126
f"than an order of magnitude on term {repr(terms[i].name)}, "
127-
f"by more than {ordm:.4g}; performance may suffer"
127+
f"by more than {ordm:.4g}; performance may suffer."
128128
)
129129
warnings.warn(w, category=PerformanceWarning, stacklevel=6)
130130

0 commit comments

Comments
 (0)