How can artifact-name patterns use the same case rule on every host?

fnmatchcase matches shell-style patterns without platform-dependent case normalization.

Python example and interpretation

model-A.bin matches the lowercase prefix while Model-A.bin does not. This matches a name string, so directory boundaries need separate handling.

from fnmatch import fnmatchcase
[fnmatchcase(x,'model-*.bin') for x in ['model-A.bin','Model-A.bin']]

Result [True, False]

中文

如何让模型制品名的通配符筛选跨操作系统保持大小写一致?

fnmatchcase 按给定大小写匹配 shell 风格通配符,独立于本机文件系统的大小写处理。

Python 算例与适用条件

model-A.bin 命中 model-*.bin,而 Model-A.bin 不命中。此处检查的是名称字符串,目录边界须由调用方处理。

from fnmatch import fnmatchcase
[fnmatchcase(x,'model-*.bin') for x in ['model-A.bin','Model-A.bin']]

结果 [True, False]

References / 参考来源

Keep reading / 继续阅读