Skip to content

Commit efacc1a

Browse files
committed
Rename to TryEnsurePathString and EnsurePathString
1 parent 44d0b8f commit efacc1a

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/include/duckdb_python/path_like.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace duckdb {
99

1010
struct DuckDBPyConnection;
1111

12-
bool TryDecodePath(const nb::object &object, string &result);
13-
string PathToString(const nb::object &object);
12+
bool TryEnsurePathString(const nb::object &object, string &result);
13+
string EnsurePathString(const nb::object &object);
1414

1515
struct PathLike {
1616
static PathLike Create(const nb::object &object, DuckDBPyConnection &connection);

src/path_like.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct PathLikeProcessor {
3434
vector<string> fs_files;
3535
};
3636

37-
bool TryDecodePath(const nb::object &object, string &result) {
37+
bool TryEnsurePathString(const nb::object &object, string &result) {
3838
if (nb::isinstance<nb::str>(object)) {
3939
result = nb::cast<string>(object);
4040
return true;
@@ -48,9 +48,9 @@ bool TryDecodePath(const nb::object &object, string &result) {
4848
return false;
4949
}
5050

51-
string PathToString(const nb::object &object) {
51+
string EnsurePathString(const nb::object &object) {
5252
string result;
53-
if (!TryDecodePath(object, result)) {
53+
if (!TryEnsurePathString(object, result)) {
5454
throw InvalidInputException("Expected a str, bytes, or os.PathLike object for the file path, not '%s'",
5555
Py_TYPE(object.ptr())->tp_name);
5656
}
@@ -59,7 +59,7 @@ string PathToString(const nb::object &object) {
5959

6060
void PathLikeProcessor::AddFile(const nb::object &object) {
6161
string decoded;
62-
if (TryDecodePath(object, decoded)) {
62+
if (TryEnsurePathString(object, decoded)) {
6363
all_files.push_back(std::move(decoded));
6464
return;
6565
}

src/pyrelation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ void DuckDBPyRelation::ToParquet(const nb::object &file_name, const nb::object &
12611261
const nb::object &partition_by, const nb::object &write_partition_columns,
12621262
const nb::object &append, const nb::object &filename_pattern,
12631263
const nb::object &file_size_bytes) {
1264-
auto filename = PathToString(file_name);
1264+
auto filename = EnsurePathString(file_name);
12651265
case_insensitive_map_t<vector<Value>> options;
12661266

12671267
if (!nb::none().is(compression)) {
@@ -1381,7 +1381,7 @@ void DuckDBPyRelation::ToCSV(const nb::object &file_name, const nb::object &sep,
13811381
const nb::object &overwrite, const nb::object &per_thread_output,
13821382
const nb::object &use_tmp_file, const nb::object &partition_by,
13831383
const nb::object &write_partition_columns) {
1384-
auto filename = PathToString(file_name);
1384+
auto filename = EnsurePathString(file_name);
13851385
case_insensitive_map_t<vector<Value>> options;
13861386

13871387
if (!nb::none().is(sep)) {

0 commit comments

Comments
 (0)