Skip to content

Commit dedf328

Browse files
committed
fnmatch: Remove dependency on posixpath module.
In micropython-lib, os.path.normcase is already a no-op. Signed-off-by: Damien George <damien@micropython.org>
1 parent 6b985bb commit dedf328

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

fnmatch/fnmatch.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"""
1212
import os
1313
import os.path
14-
import posixpath
1514
import re
1615
#import functools
1716

@@ -51,15 +50,9 @@ def filter(names, pat):
5150
result = []
5251
pat = os.path.normcase(pat)
5352
match = _compile_pattern(pat)
54-
if os.path is posixpath:
55-
# normcase on posix is NOP. Optimize it away from the loop.
56-
for name in names:
57-
if match(name):
58-
result.append(name)
59-
else:
60-
for name in names:
61-
if match(os.path.normcase(name)):
62-
result.append(name)
53+
for name in names:
54+
if match(os.path.normcase(name)):
55+
result.append(name)
6356
return result
6457

6558
def fnmatchcase(name, pat):

fnmatch/metadata.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
srctype = cpython
22
type = module
33
version = 0.5.2
4-
depends = os, os.path, posixpath, re-pcre
4+
depends = os, os.path, re-pcre

fnmatch/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
license='Python',
1919
cmdclass={'sdist': sdist_upip.sdist},
2020
py_modules=['fnmatch'],
21-
install_requires=['micropython-os', 'micropython-os.path', 'micropython-posixpath', 'micropython-re-pcre'])
21+
install_requires=['micropython-os', 'micropython-os.path', 'micropython-re-pcre'])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy