Skip to content

Commit

Permalink
fix(python): fixed a few accidental copy/paste gremlins in conversion…
Browse files Browse the repository at this point in the history
… error messages (pola-rs#11065)
  • Loading branch information
alexander-beedie authored Sep 12, 2023
1 parent 65c59a6 commit 7de05a9
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions py-polars/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ impl FromPyObject<'_> for Wrap<AsofStrategy> {
"nearest" => AsofStrategy::Nearest,
v => {
return Err(PyValueError::new_err(format!(
"strategy must be one of {{'backward', 'forward', 'nearest'}}, got {v}",
"asof `strategy` must be one of {{'backward', 'forward', 'nearest'}}, got {v}",
)))
},
};
Expand All @@ -1083,7 +1083,7 @@ impl FromPyObject<'_> for Wrap<InterpolationMethod> {
"nearest" => InterpolationMethod::Nearest,
v => {
return Err(PyValueError::new_err(format!(
"method must be one of {{'linear', 'nearest'}}, got {v}",
"interpolation `method` must be one of {{'linear', 'nearest'}}, got {v}",
)))
},
};
Expand All @@ -1100,8 +1100,8 @@ impl FromPyObject<'_> for Wrap<Option<AvroCompression>> {
"deflate" => Some(AvroCompression::Deflate),
v => {
return Err(PyValueError::new_err(format!(
"compression must be one of {{'uncompressed', 'snappy', 'deflate'}}, got {v}",
)))
"avro `compression` must be one of {{'uncompressed', 'snappy', 'deflate'}}, got {v}",
)))
},
};
Ok(Wrap(parsed))
Expand All @@ -1115,7 +1115,7 @@ impl FromPyObject<'_> for Wrap<CategoricalOrdering> {
"lexical" => CategoricalOrdering::Lexical,
v => {
return Err(PyValueError::new_err(format!(
"ordering must be one of {{'physical', 'lexical'}}, got {v}",
"categorical `ordering` must be one of {{'physical', 'lexical'}}, got {v}",
)))
},
};
Expand All @@ -1137,7 +1137,7 @@ impl FromPyObject<'_> for Wrap<StartBy> {
"sunday" => StartBy::Sunday,
v => {
return Err(PyValueError::new_err(format!(
"closed must be one of {{'window', 'datapoint', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'}}, got {v}",
"`start_by` must be one of {{'window', 'datapoint', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'}}, got {v}",
)))
}
};
Expand All @@ -1154,7 +1154,7 @@ impl FromPyObject<'_> for Wrap<ClosedWindow> {
"none" => ClosedWindow::None,
v => {
return Err(PyValueError::new_err(format!(
"closed must be one of {{'left', 'right', 'both', 'none'}}, got {v}",
"`closed` must be one of {{'left', 'right', 'both', 'none'}}, got {v}",
)))
},
};
Expand All @@ -1169,7 +1169,7 @@ impl FromPyObject<'_> for Wrap<CsvEncoding> {
"utf8-lossy" => CsvEncoding::LossyUtf8,
v => {
return Err(PyValueError::new_err(format!(
"encoding must be one of {{'utf8', 'utf8-lossy'}}, got {v}",
"csv `encoding` must be one of {{'utf8', 'utf8-lossy'}}, got {v}",
)))
},
};
Expand All @@ -1186,7 +1186,7 @@ impl FromPyObject<'_> for Wrap<Option<IpcCompression>> {
"zstd" => Some(IpcCompression::ZSTD),
v => {
return Err(PyValueError::new_err(format!(
"compression must be one of {{'uncompressed', 'lz4', 'zstd'}}, got {v}",
"ipc `compression` must be one of {{'uncompressed', 'lz4', 'zstd'}}, got {v}",
)))
},
};
Expand All @@ -1206,7 +1206,7 @@ impl FromPyObject<'_> for Wrap<JoinType> {
"cross" => JoinType::Cross,
v => {
return Err(PyValueError::new_err(format!(
"how must be one of {{'inner', 'left', 'outer', 'semi', 'anti', 'cross'}}, got {v}",
"`how` must be one of {{'inner', 'left', 'outer', 'semi', 'anti', 'cross'}}, got {v}",
)))
},
};
Expand All @@ -1221,7 +1221,7 @@ impl FromPyObject<'_> for Wrap<ListToStructWidthStrategy> {
"max_width" => ListToStructWidthStrategy::MaxWidth,
v => {
return Err(PyValueError::new_err(format!(
"n_field_strategy must be one of {{'first_non_null', 'max_width'}}, got {v}",
"`n_field_strategy` must be one of {{'first_non_null', 'max_width'}}, got {v}",
)))
},
};
Expand All @@ -1236,7 +1236,7 @@ impl FromPyObject<'_> for Wrap<NullBehavior> {
"ignore" => NullBehavior::Ignore,
v => {
return Err(PyValueError::new_err(format!(
"null behavior must be one of {{'drop', 'ignore'}}, got {v}",
"`null_behavior` must be one of {{'drop', 'ignore'}}, got {v}",
)))
},
};
Expand All @@ -1251,7 +1251,7 @@ impl FromPyObject<'_> for Wrap<NullStrategy> {
"propagate" => NullStrategy::Propagate,
v => {
return Err(PyValueError::new_err(format!(
"null strategy must be one of {{'ignore', 'propagate'}}, got {v}",
"`null_strategy` must be one of {{'ignore', 'propagate'}}, got {v}",
)))
},
};
Expand All @@ -1269,8 +1269,8 @@ impl FromPyObject<'_> for Wrap<ParallelStrategy> {
"none" => ParallelStrategy::None,
v => {
return Err(PyValueError::new_err(format!(
"parallel must be one of {{'auto', 'columns', 'row_groups', 'none'}}, got {v}",
)))
"`parallel` must be one of {{'auto', 'columns', 'row_groups', 'none'}}, got {v}",
)))
},
};
Ok(Wrap(parsed))
Expand All @@ -1284,7 +1284,7 @@ impl FromPyObject<'_> for Wrap<IndexOrder> {
"c" => IndexOrder::C,
v => {
return Err(PyValueError::new_err(format!(
"order must be one of {{'fortran', 'c'}}, got {v}",
"`order` must be one of {{'fortran', 'c'}}, got {v}",
)))
},
};
Expand All @@ -1302,7 +1302,7 @@ impl FromPyObject<'_> for Wrap<QuantileInterpolOptions> {
"midpoint" => QuantileInterpolOptions::Midpoint,
v => {
return Err(PyValueError::new_err(format!(
"interpolation must be one of {{'lower', 'higher', 'nearest', 'linear', 'midpoint'}}, got {v}",
"`interpolation` must be one of {{'lower', 'higher', 'nearest', 'linear', 'midpoint'}}, got {v}",
)))
}
};
Expand All @@ -1321,7 +1321,7 @@ impl FromPyObject<'_> for Wrap<RankMethod> {
"random" => RankMethod::Random,
v => {
return Err(PyValueError::new_err(format!(
"method must be one of {{'min', 'max', 'average', 'dense', 'ordinal', 'random'}}, got {v}",
"rank `method` must be one of {{'min', 'max', 'average', 'dense', 'ordinal', 'random'}}, got {v}",
)))
}
};
Expand All @@ -1337,7 +1337,7 @@ impl FromPyObject<'_> for Wrap<TimeUnit> {
"ms" => TimeUnit::Milliseconds,
v => {
return Err(PyValueError::new_err(format!(
"time unit must be one of {{'ns', 'us', 'ms'}}, got {v}",
"`time_unit` must be one of {{'ns', 'us', 'ms'}}, got {v}",
)))
},
};
Expand All @@ -1354,7 +1354,7 @@ impl FromPyObject<'_> for Wrap<UniqueKeepStrategy> {
"any" => UniqueKeepStrategy::Any,
v => {
return Err(PyValueError::new_err(format!(
"keep must be one of {{'first', 'last', 'any', 'none'}}, got {v}",
"`keep` must be one of {{'first', 'last', 'any', 'none'}}, got {v}",
)))
},
};
Expand All @@ -1370,7 +1370,7 @@ impl FromPyObject<'_> for Wrap<IpcCompression> {
"lz4" => IpcCompression::LZ4,
v => {
return Err(PyValueError::new_err(format!(
"compression must be one of {{'zstd', 'lz4'}}, got {v}",
"ipc `compression` must be one of {{'zstd', 'lz4'}}, got {v}",
)))
},
};
Expand All @@ -1386,7 +1386,7 @@ impl FromPyObject<'_> for Wrap<SearchSortedSide> {
"right" => SearchSortedSide::Right,
v => {
return Err(PyValueError::new_err(format!(
"side must be one of {{'any', 'left', 'right'}}, got {v}",
"sorted `side` must be one of {{'any', 'left', 'right'}}, got {v}",
)))
},
};
Expand All @@ -1402,8 +1402,8 @@ impl FromPyObject<'_> for Wrap<WindowMapping> {
"explode" => WindowMapping::Explode,
v => {
return Err(PyValueError::new_err(format!(
"side must be one of {{'group_to_rows', 'join', 'explode'}}, got {v}",
)))
"`mapping_strategy` must be one of {{'group_to_rows', 'join', 'explode'}}, got {v}",
)))
},
};
Ok(Wrap(parsed))
Expand All @@ -1419,7 +1419,7 @@ impl FromPyObject<'_> for Wrap<JoinValidation> {
"m:1" => JoinValidation::ManyToOne,
v => {
return Err(PyValueError::new_err(format!(
"validate must be one of {{'m:m', 'm:1', '1:m', '1:1'}}, got {v}",
"`validate` must be one of {{'m:m', 'm:1', '1:m', '1:1'}}, got {v}",
)))
},
};
Expand All @@ -1436,7 +1436,7 @@ impl FromPyObject<'_> for Wrap<QuoteStyle> {
"never" => QuoteStyle::Never,
v => {
return Err(PyValueError::new_err(format!(
"validate must be one of {{'always', 'necessary', 'non_numeric'}}, got {v}",
"`quote_style` must be one of {{'always', 'necessary', 'non_numeric', 'never'}}, got {v}",
)))
},
};
Expand All @@ -1454,7 +1454,7 @@ impl FromPyObject<'_> for Wrap<SetOperation> {
"symmetric_difference" => SetOperation::SymmetricDifference,
v => {
return Err(PyValueError::new_err(format!(
"validate must be one of {{'union', 'difference', 'intersection', 'symmetric_difference'}}, got {v}",
"set operation must be one of {{'union', 'difference', 'intersection', 'symmetric_difference'}}, got {v}",
)))
}
};
Expand All @@ -1476,7 +1476,7 @@ pub(crate) fn parse_fill_null_strategy(
"one" => FillNullStrategy::One,
e => {
return Err(PyValueError::new_err(format!(
"strategy must be one of {{'forward', 'backward', 'min', 'max', 'mean', 'zero', 'one'}}, got {e}",
"`strategy` must be one of {{'forward', 'backward', 'min', 'max', 'mean', 'zero', 'one'}}, got {e}",
)))
}
};
Expand Down Expand Up @@ -1519,7 +1519,7 @@ pub(crate) fn parse_parquet_compression(
),
e => {
return Err(PyValueError::new_err(format!(
"compression must be one of {{'uncompressed', 'snappy', 'gzip', 'lzo', 'brotli', 'lz4', 'zstd'}}, got {e}",
"parquet `compression` must be one of {{'uncompressed', 'snappy', 'gzip', 'lzo', 'brotli', 'lz4', 'zstd'}}, got {e}",
)))
}
};
Expand Down

0 comments on commit 7de05a9

Please sign in to comment.