|
40 | 40 | import re |
41 | 41 | from inspect import Parameter |
42 | 42 | import hashlib |
43 | | -import posix |
| 43 | +try: |
| 44 | + import posix |
| 45 | +except ModuleNotFoundError as e: |
| 46 | + posix = None |
44 | 47 |
|
45 | 48 |
|
46 | 49 | TEST_CASES = [ |
|
54 | 57 | (hashlib.md5, '($module, /, string=b\'\', *, usedforsecurity=True)', |
55 | 58 | [('string', Parameter.POSITIONAL_OR_KEYWORD), |
56 | 59 | ('usedforsecurity', Parameter.KEYWORD_ONLY)]), |
57 | | - (posix.open, '($module, /, path, flags, mode=511, *, dir_fd=None)', |
58 | | - [('path', Parameter.POSITIONAL_OR_KEYWORD), |
59 | | - ('flags', Parameter.POSITIONAL_OR_KEYWORD), |
60 | | - ('mode', Parameter.POSITIONAL_OR_KEYWORD), |
61 | | - ('dir_fd', Parameter.KEYWORD_ONLY)]), |
62 | 60 | (abs, '($module, x, /)', |
63 | 61 | [('x', Parameter.POSITIONAL_ONLY)]), |
64 | 62 | (pow, '($module, /, base, exp, mod=None)', |
|
67 | 65 | ('mod', Parameter.POSITIONAL_OR_KEYWORD)]), |
68 | 66 | ] |
69 | 67 |
|
| 68 | +if posix: |
| 69 | + TEST_CASES += [ |
| 70 | + (posix.open, '($module, /, path, flags, mode=511, *, dir_fd=None)', |
| 71 | + [('path', Parameter.POSITIONAL_OR_KEYWORD), |
| 72 | + ('flags', Parameter.POSITIONAL_OR_KEYWORD), |
| 73 | + ('mode', Parameter.POSITIONAL_OR_KEYWORD), |
| 74 | + ('dir_fd', Parameter.KEYWORD_ONLY)])] |
| 75 | + |
70 | 76 |
|
71 | 77 | def normalize_signature_text(text): |
72 | 78 | # For the time being: |
|
0 commit comments