These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | # pyre-strict |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | from pprint import pprint |
||
0 ignored issues
–
show
|
|||
4 | from re import sub, compile |
||
0 ignored issues
–
show
|
|||
5 | from typing import List, Any |
||
6 | |||
7 | import iso4217parse |
||
0 ignored issues
–
show
|
|||
8 | |||
9 | |||
10 | class PaymentText: |
||
1 ignored issue
–
show
This class should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
11 | text: str = '' |
||
1 ignored issue
–
show
|
|||
12 | |||
13 | def __init__(self, text: str) -> None: |
||
1 ignored issue
–
show
|
|||
14 | self.text = text |
||
1 ignored issue
–
show
|
|||
15 | |||
16 | def __repr__(self) -> str: |
||
1 ignored issue
–
show
|
|||
17 | return self.text |
||
1 ignored issue
–
show
|
|||
18 | |||
19 | def clean(self) -> None: |
||
1 ignored issue
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
20 | parts: List[str] = self.text.split() |
||
1 ignored issue
–
show
|
|||
21 | |||
22 | # pprint(parts) |
||
23 | |||
24 | pattern = compile('\*\d{4}') |
||
1 ignored issue
–
show
A suspicious escape sequence
\* was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() A suspicious escape sequence
\d was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() |
|||
25 | |||
26 | try: |
||
1 ignored issue
–
show
|
|||
27 | if pattern.match(parts[0]): |
||
2 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
28 | del parts[0] |
||
1 ignored issue
–
show
|
|||
29 | except IndexError: |
||
1 ignored issue
–
show
|
|||
30 | return |
||
1 ignored issue
–
show
|
|||
31 | |||
32 | pattern = compile('\d{2}\.\d{2}') |
||
1 ignored issue
–
show
A suspicious escape sequence
\d was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() A suspicious escape sequence
\. was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() |
|||
33 | |||
34 | if pattern.match(parts[0]): |
||
1 ignored issue
–
show
|
|||
35 | del parts[0] |
||
1 ignored issue
–
show
|
|||
36 | |||
37 | currency: Any = iso4217parse.by_alpha3(parts[0]) |
||
1 ignored issue
–
show
|
|||
38 | |||
39 | if isinstance(currency, iso4217parse.Currency): |
||
2 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
40 | del parts[0] |
||
1 ignored issue
–
show
|
|||
41 | del parts[0] |
||
1 ignored issue
–
show
|
|||
42 | |||
43 | pattern = compile('\d{1}\.\d{4}') |
||
1 ignored issue
–
show
A suspicious escape sequence
\d was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() A suspicious escape sequence
\. was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() |
|||
44 | |||
45 | if pattern.match(parts[-1]): |
||
1 ignored issue
–
show
|
|||
46 | del parts[-1] |
||
1 ignored issue
–
show
|
|||
47 | del parts[-1] |
||
1 ignored issue
–
show
|
|||
48 | |||
49 | pattern = compile('\d{2}\.\d{2}\.\d{2}') |
||
1 ignored issue
–
show
A suspicious escape sequence
\d was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() A suspicious escape sequence
\. was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() |
|||
50 | |||
51 | if pattern.match(parts[-1]): |
||
1 ignored issue
–
show
|
|||
52 | del parts[-1] |
||
1 ignored issue
–
show
|
|||
53 | |||
54 | pattern = compile('.+:') |
||
1 ignored issue
–
show
|
|||
55 | |||
56 | if pattern.match(parts[-1]): |
||
1 ignored issue
–
show
|
|||
57 | del parts[-1] |
||
1 ignored issue
–
show
|
|||
58 | |||
59 | pattern = compile('\d+,\d{2}') |
||
1 ignored issue
–
show
A suspicious escape sequence
\d was found. Did you maybe forget to add an r prefix?
Escape sequences in Python are generally interpreted according to rules similar
to standard C. Only if strings are prefixed with The escape sequence that was used indicates that you might have intended to write a regular expression. Learn more about the available escape sequences. in the Python documentation. ![]() |
|||
60 | |||
61 | if pattern.match(parts[-1]): |
||
1 ignored issue
–
show
|
|||
62 | del parts[-1] |
||
1 ignored issue
–
show
|
|||
63 | |||
64 | currency: Any = iso4217parse.by_alpha3(parts[-1]) |
||
1 ignored issue
–
show
|
|||
65 | if isinstance(currency, iso4217parse.Currency): |
||
1 ignored issue
–
show
|
|||
66 | del parts[-1] |
||
1 ignored issue
–
show
|
|||
67 | |||
68 | text = ' '.join(parts) |
||
1 ignored issue
–
show
|
|||
69 | |||
70 | self.text = text |
||
1 ignored issue
–
show
|
|||
71 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.