greole / owls

A data exploration library written in python for (OpenFOAM) CFD data
http://greole.github.io
32 stars 11 forks source link

Deprecation warning: Invalid Escape Sequence #26

Open lupeterm opened 1 year ago

lupeterm commented 1 year ago

For example, in test_findermethods.py:92, regular expressions use invalid escaping:

eulerian_decomp = io.find_datafolders(
    regex="processor[0-9]\/" + io.FPNUMBER, path=fold, slice_="all"
)                        ^  DeprecationWarning: invalid escape sequence \/

Also, please note that any invalid escape sequences in Python’s usage of the backslash in string literals now generate a DeprecationWarning and in the future this will become a SyntaxError. (Source)

Should be easily fixed by declaring regular expressions as raw strings, e.g.,

eulerian_decomp = io.find_datafolders(
    regex=r"processor[0-9]\/" + io.FPNUMBER, path=fold, slice_="all"
) 

edit: corrected misinformation on my part

greole commented 1 year ago

If you prepare a PR to fix the issues with missing Origin and other type info you could a fix for this issue!

lupeterm commented 1 year ago

If you are referring to the previously removed Origin class, I already worked on that in commit 4f67d1fea01fd57fa63e35c470ba4ba987dce470 of the pipeline-fixes branch. As per the type annotations, I would probably create a separate branch for that.