Skip to content

Commit

Permalink
Merge pull request #10 from 2018-11-27/master
Browse files Browse the repository at this point in the history
1.0.14
  • Loading branch information
2018-11-27 authored May 20, 2024
2 parents 46ed510 + 5aadc31 commit eae6bfa
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2022, 2023 GQYLPY <http://gqylpy.com>. All rights reserved.
Copyright (c) 2022-2024 GQYLPY <http://gqylpy.com>. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
long_description=open('README.md', encoding='utf8').read(),
long_description_content_type='text/markdown',
packages=[i.__name__],
python_requires='>=3.8, <4',
python_requires='>=3.8',
install_requires=[x.decode() for x in Content('requirements.txt') if x],
classifiers=[
'Development Status :: 4 - Beta',
Expand All @@ -45,6 +45,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12'
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13'
]
)
23 changes: 10 additions & 13 deletions systempath/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
>>> file.open.rb().read()
b'GQYLPY \xe6\x94\xb9\xe5\x8f\x98\xe4\xb8\x96\xe7\x95\x8c'
@version: 1.0.13
@version: 1.0.14
@author: 竹永康 <gqylpy@outlook.com>
@source: https://github.com/gqylpy/systempath
────────────────────────────────────────────────────────────────────────────────
Copyright (c) 2022, 2023 GQYLPY <http://gqylpy.com>. All rights reserved.
Copyright (c) 2022-2024 GQYLPY <http://gqylpy.com>. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -571,8 +571,8 @@ def lchown(self, uid: int, gid: int) -> None:

def chflags(self, flags: int) -> None:
""""
Set the flag for the file or directory, different flag have different
attributes. Call `os.chflags` internally.
Set the flag for the file or directory, different flag have
different attributes. Call `os.chflags` internally.
@param flags
Specify numeric flag, can be the inclusive-or(`|`) of:
Expand Down Expand Up @@ -1592,12 +1592,9 @@ class _xe6_xad_x8c_xe7_x90_xaa_xe6_x80_xa1_xe7_x8e_xb2_xe8_x90_x8d_xe4_xba_x91:
gcode = __import__(gpath, fromlist=...)

for gname in gpack:
try:
assert gname[0] != '_'
gfunc = getattr(gcode, gname)
assert gfunc.__module__ == gpath
except (AssertionError, AttributeError):
continue
gfunc.__module__ = __package__
gfunc.__doc__ = gpack[gname].__doc__
gpack[gname] = gfunc
if gname[0] != '_':
gfunc = getattr(gcode, gname, None)
if gfunc and getattr(gfunc, '__module__', None) == gpath:
gfunc.__module__ = __package__
gfunc.__doc__ = gpack[gname].__doc__
gpack[gname] = gfunc
29 changes: 21 additions & 8 deletions systempath/i systempath.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (c) 2022, 2023 GQYLPY <http://gqylpy.com>. All rights reserved.
Copyright (c) 2022-2024 GQYLPY <http://gqylpy.com>. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,8 @@
import warnings
import functools

from copy import copy, deepcopy

from os import (
stat, lstat, stat_result,
rename, renames, replace, remove,
Expand Down Expand Up @@ -54,11 +56,11 @@ def getpwuid(_): raise NotImplementedError
__read_bufsize__ = 1024 * 1024

from os.path import (
basename, dirname, abspath, realpath, relpath,
basename, dirname, abspath, realpath, relpath,
normpath, expanduser, expandvars,
join, split, splitext, splitdrive,
isabs, exists, isdir, isfile, islink, ismount,
getctime, getmtime, getatime, getsize
join, split, splitext, splitdrive,
isabs, exists, isdir, isfile, islink, ismount,
getctime, getmtime, getatime, getsize
)

from shutil import move, copyfile, copytree, copystat, copymode, copy2, rmtree
Expand Down Expand Up @@ -142,11 +144,19 @@ def __new__(mcs, __name__: str, __bases__: tuple, __dict__: dict):
return cls

def __hash__(cls) -> int:
if sys._getframe(1).f_code in (deepcopy.__code__, copy.__code__):
return type.__hash__(cls)
return hash(cls.__masquerade_class__)

def __eq__(cls, o) -> bool:
return True if o is cls.__masquerade_class__ else type.__eq__(cls, o)

def __init_subclass__(mcs) -> None:
setattr(builtins, mcs.__name__, mcs)
mcs.__name__ = MasqueradeClass.__name__
mcs.__qualname__ = MasqueradeClass.__qualname__
mcs.__module__ = MasqueradeClass.__module__


MasqueradeClass.__name__ = type.__name__
builtins.MasqueradeClass = MasqueradeClass
Expand Down Expand Up @@ -708,7 +718,9 @@ def utime(

class Directory(Path):

def __new__(cls, name: PathLink = '.', /, strict: bool = False, **kw):
def __new__(
cls, name: PathLink = '.', /, strict: bool = False, **kw
) -> 'Directory':
instance = Path.__new__(cls, name, strict=strict, **kw)

if strict and not isdir(name):
Expand Down Expand Up @@ -1295,8 +1307,9 @@ def __init__(
if downtop is None:
downtop = bottom_up

self.tree = (self.downtop if downtop else self.topdown)\
(dirpath, level=level)
self.tree = (
self.downtop if downtop else self.topdown
)(dirpath, level=level)

self.omit_dir = omit_dir

Expand Down

0 comments on commit eae6bfa

Please sign in to comment.