You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

antipathy

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antipathy - pypi Package Compare versions

Comparing version
0.83.10
to
0.84.0
+1
-1
antipathy.egg-info/PKG-INFO
Metadata-Version: 1.1
Name: antipathy
Version: 0.83.10
Version: 0.84.0
Summary: oo view of file paths and names, subclassed from bytes/str/unicode

@@ -5,0 +5,0 @@ Home-page: https://github.com/ethanfurman/antipathy

@@ -1,4 +0,4 @@

version = 0, 83, 10
version = 0, 84, 0
from antipathy.path import *
from .path import *
import antipathy.path as _path

@@ -5,0 +5,0 @@

@@ -0,1 +1,17 @@

0.84.00
=======
add commonpath
add commonprefix
add isabs
add relpath
BACKWARDS INCOMPATIBLE CHANGE
-----------------------------
url support removed
addition of paths ignores a trailing slash:
Path('/home/user/') + 'adron' == Path('/home/useradron')
0.83.09

@@ -2,0 +18,0 @@ =======

@@ -31,2 +31,4 @@ """

system_sep = _os.path.sep
system_alt = _os.path.altsep or system_sep
system_ext = _os.path.extsep

@@ -36,8 +38,8 @@ _is_win = _os.path.__name__ == 'ntpath'

class Path(object):
"""\
"""
vol = [ c: | //node/sharepoint | '' ]
dirs = [ / | ./ ] + path/to/somewhere/
filename = filename.part1.ext
base = filename
ext = .part1.ext
base = filename.part1
ext = .ext
"""

@@ -118,3 +120,3 @@

def chflags(cls, flags, files):
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -127,3 +129,3 @@ for file in files:

"thin wrapper around os.chmod"
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -136,3 +138,3 @@ for file in files:

"thin wrapper around os.chown"
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -148,12 +150,18 @@ for file in files:

@staticmethod
def commonprefix(*paths):
def commonpath(*paths):
if len(paths) == 1 and isinstance(paths[0], (list, tuple)):
[paths] = paths
if not paths:
return Path(unicode())
elif len(paths) == 1 and not isinstance(paths[0], list):
return Path()
elif len(paths) == 1:
return Path(paths[0])
elif (
len(paths) > 1 and isinstance(paths[0], list) or
not all_equal(paths, test=lambda x: type(x))
):
raise TypeError('invalid path types: %r' % ([type(p) for p in paths], ))
elif any(isinstance(p, list) for p in paths):
raise ValueError('paths should be a single list or a sequence of paths, not both')
elif not all_equal(paths, test=lambda x: type(x)):
raise TypeError('paths should all be bytes or all be strings: %r' % ([type(p) for p in paths], ))
elif not all_equal([
p[0] in (uPath._SYS_SEP, uPath._ALT_SEP, bPath._SYS_SEP, bPath._ALT_SEP)
for p in paths
]):
raise ValueError('all paths must be either relative or absolute: %r' % (paths, ))
else:

@@ -169,2 +177,6 @@ paths = [Path(p).elements for p in paths]

@staticmethod
def commonprefix(*paths):
return Path(_os.path.commonprefix(list(paths)))
@classmethod

@@ -175,3 +187,3 @@ def copy(cls, files, dst):

"""
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -204,3 +216,3 @@ for file in files:

'thin wrapper os.path.isabs()'
raise NotImplementedError()
return Path(_os.path.isabs(name))

@@ -240,3 +252,3 @@ @staticmethod

def lchmod(cls, mode, files):
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -250,3 +262,3 @@ for file in files:

def lchflags(cls, files, flags):
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -260,3 +272,3 @@ for file in files:

def lchown(cls, files, uid, gid):
if isinstance(files, cls.basecls):
if isinstance(files, cls.base_types):
files = Path.glob(files)

@@ -299,3 +311,3 @@ for file in files:

dst = Path(dst)
if isinstance(sources, cls.basecls):
if isinstance(sources, cls.base_types):
sources = Path.glob(sources)

@@ -335,5 +347,9 @@ for source in sources:

@staticmethod
def relpath(path, start='.'):
return Path(_os.path.relpath(path, start))
@classmethod
def removedirs(cls, subdirs):
if isinstance(subdirs, cls.basecls):
if isinstance(subdirs, cls.base_types):
subdirs = Path.glob(subdirs)

@@ -353,3 +369,3 @@ for subdir in subdirs:

def rmdir(cls, subdirs):
if isinstance(subdirs, cls.basecls):
if isinstance(subdirs, cls.base_types):
subdirs = Path.glob(subdirs)

@@ -361,3 +377,3 @@ for subdir in subdirs:

def rmtree(cls, subdirs, ignore_errors=None, onerror=None):
if isinstance(subdirs, cls.basecls):
if isinstance(subdirs, cls.base_types):
subdirs = Path.glob(subdirs)

@@ -387,3 +403,3 @@ for subdir in subdirs:

def touch(cls, names, times=None, no_create=False, reference=None):
if isinstance(names, cls.basecls):
if isinstance(names, cls.base_types):
names = Path.glob(names) or [names]

@@ -396,3 +412,3 @@ for name in names:

def unlink(cls, names):
if isinstance(names, cls.basecls):
if isinstance(names, cls.base_types):
names = Path.glob(names)

@@ -404,3 +420,3 @@ for name in names:

def utime(cls, names, times):
if isinstance(names, cls.basecls):
if isinstance(names, cls.base_types):
names = Path.glob(names)

@@ -429,3 +445,3 @@ for name in names:

yield dirpath, dirnames, filenames
Path.basecls = bytes, str, unicode
Path.base_types = bytes, str, unicode

@@ -435,21 +451,38 @@ class Methods(object):

def __new__(cls, *paths):
base_cls = cls.basecls[1] # bytes or unicode
slash = cls._SLASH
if not paths:
paths = (base_cls(), )
paths = (cls._EMPTY, )
elif len(paths) == 1:
if isinstance(paths[0], Path):
paths = (paths[0]._value_, )
elif len(paths) > 1:
# convert sys_sep to '/' (no-op unless on windows)
paths = tuple([
(p._value_ if isinstance(p, Path) else p)
.replace(cls._SYS_SEP, slash)
for p in paths
])
new_paths = []
abs_path = False
if paths[0].startswith(slash):
abs_path = True
for first, second in zip(paths[:-1], paths[1:]):
if second.startswith(('/', cls._SYS_SEP)):
if second.startswith(slash):
new_paths[:] = []
abs_path = True
continue
new_paths.append(first.rstrip('/'))
new_paths.append(second)
if abs_path:
if new_paths[0] == slash:
new_paths[0] == cls._EMPTY
elif new_paths[0] != cls._EMPTY:
new_paths.insert(0, cls._EMPTY)
paths = tuple(new_paths)
slash = cls._SLASH
string = slash.join(paths)
vol = dirs = filename = base = ext = scheme = host = site = params = fragments = base_cls()
if cls._SYS_SEP != '/':
string = string.replace(cls._SYS_SEP, slash)
pieces = string.split(slash)
if string[:2] == slash+slash and string[2:3] != slash: # usually '//'
vol = dirs = filename = base = ext = cls._EMPTY
# separate out the ...
if string[:2] == slash+slash and string[2:3] != slash: # usually '//'
# ... share point
if len(pieces) < 4:

@@ -461,28 +494,19 @@ raise ValueError('bad path: %r' % string)

pieces.insert(0, cls._EMPTY)
elif string[1:2] == cls._COLON and _os.path.__name__ == 'ntpath':
elif string[1:2] == cls._COLON and _is_win:
# ... drive
vol = pieces.pop(0)
else:
vol = cls._EMPTY
if len(pieces) > 2 and pieces[0].endswith(cls._COLON) and not pieces[1]:
scheme = pieces[0] + cls._SLASH + cls._SLASH
if len(pieces) > 3:
host = pieces[2]
site = scheme + host
pieces = pieces[2:]
if cls._QUESTION in string:
params = string.split(cls._QUESTION)[1].split(cls._HASHTAG)[0]
params = params.split(cls._AMPERSAND)
params = dict([p.split(cls._EQUALS) for p in params])
if cls._HASHTAG in string:
fragments = tuple(string.split(cls._HASHTAG)[1].split(cls._AMPERSAND))
if len(pieces) > 2:
# remove any internal empty components
pieces = pieces[:1] + [p for p in pieces[1:-1] if p] + pieces[-1:]
if pieces:
if pieces[-1] in (cls._CUR_DIR, cls._PREV_DIR, cls._EMPTY):
dirs = slash.join(pieces)
# separate directory from file name
if pieces[-1] in (cls._CUR_DIR, cls._PREV_DIR):
pass
else:
dirs = slash.join(pieces[:-1])
if pieces[:-1]:
dirs += slash
filename = pieces[-1]
filename = pieces.pop()
if pieces == [cls._EMPTY]:
# make sure we have our initial slash
pieces = [slash]
dirs = slash.join(pieces)
if filename:
ext_start = filename.rfind(cls._DOT)

@@ -493,3 +517,8 @@ if ext_start != -1:

base = filename
p = base_cls.__new__(cls, scheme + vol + dirs + filename)
df_sep = cls._EMPTY
if len(dirs) > 1 and filename:
df_sep = slash
value = vol + dirs + df_sep + filename
p = cls.data_type.__new__(cls, value)
p._value_ = value
p._vol = vol

@@ -501,34 +530,5 @@ p._dirs = dirs

p._ext = ext
p._scheme = scheme
p._host = host
p._site = site
p._parameters = params
p._fragments = fragments
return p
@property
def protocol(self):
return self.__class__(self._scheme[:-3])
@property
def scheme(self):
return self.__class__(self._scheme)
@property
def host(self):
return self.__class__(self._host)
@property
def site(self):
return self.__class__(self._site)
@property
def parameters(self):
return self._parameters
@property
def fragments(self):
return self._fragments
@property
def vol(self):

@@ -542,3 +542,3 @@ 'volume/drive of path'

if self._dirs[:1] == self._SLASH or self._vol[:1] == self._SLASH:
return self.__class__(self._SLASH)
return self._SLASH
else:

@@ -556,4 +556,2 @@ return self._EMPTY

result = self.__class__(self._dirs)
if len(result) > 1:
result = result.rstrip(self._SLASH)
return result

@@ -564,3 +562,3 @@

'first half of os.path.split(...)'
return self.__class__(self._vol + self._dirs)
return self.__class__(self._dirname)
dirname = parent

@@ -603,39 +601,41 @@

def __add__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
return Path(self._scheme + self._dirname + self._filename + other)
elif isinstance(other, self.data_types):
other = Path(other)
return Path(self._value_ + other._value_)
def __contains__(self, text):
text = text.replace(self._SYS_SEP, self._SLASH)
return text in self._scheme+self._dirname+self._filename
return text in self._value_
def __div__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
current = self.__class__()
if other._vol or other._scheme:
elif isinstance(other, self.data_types):
other = Path(other)
if other._vol:
if self:
raise ValueError("Cannot combine %r and %r" % (self, other))
# current = other._vol
current += self._scheme + self._dirname + self._filename
if current[-1:] == self._SLASH:
current = current[:-1]
next = other._dirs + other._filename
if next[:1] == self._SLASH:
next = next[1:]
return Path(current + self._SLASH + next)
t_slash = len(other._dirname) > 1 and not other._filename and self._SLASH or self._EMPTY
return self.__class__(
self._value_.rstrip(self._SLASH) +
self._SLASH +
other._value_.lstrip(self._SLASH) +
t_slash
)
__truediv__ = __div__
def __eq__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
return self._scheme == other._scheme and self._dirname == other._dirname and self._filename == other._filename
elif isinstance(other, self.data_types):
other = Path(other)
return self._value_ == other._value_
def __hash__(self):
return (self._scheme + self._dirname + self._filename).__hash__()
return self._value_.__hash__()
def __mod__(self, other):
return Path((self._scheme + self._dirname + self._filename) % other)
return Path(self._value_ % other)

@@ -647,5 +647,6 @@ def __mul__(self, other):

"""
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
elif isinstance(other, self.data_types):
other = Path(other)
if other._vol:

@@ -655,3 +656,2 @@ vol = other._vol

else:
scheme = self._scheme
vol = self._vol

@@ -684,58 +684,66 @@ current = self.dir_elements

dirs = self._SLASH + dirs
return Path(self._EMPTY.join([vol or scheme, dirs, filename]))
return Path(self._EMPTY.join([vol, dirs, filename]))
def __ne__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
return not self == other
elif isinstance(other, self.data_types):
other = Path(other)
return self._value_ != other._value_
def __radd__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
return Path(other + self._scheme + self._dirname + self._filename)
elif isinstance(other, self.data_types):
other = Path(other)
return Path(other._value_ + self._value_)
def __rdiv__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
return other / self
elif isinstance(other, self.data_types):
other = Path(other)
if self._dirs and not self._filename:
return other / self / self._EMPTY
else:
return other / self
__rtruediv__ = __rdiv__
def __repr__(self):
string = self._scheme + self._dirname + self._filename
return "Path(%r)" % string
return "Path(%r)" % self._value_
def __rmod__(self, other):
return other % (self._scheme + self._dirname + self._filename)
return other % (self._value_)
def __rmul__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
elif isinstance(other, self.data_types):
other = Path(other)
return other * self
def __rsub__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
elif isinstance(other, self.data_types):
other = Path(other)
return other - self
def __str__(self):
string = self._scheme + self._dirname + self._filename
return string
return self.data_type.__str__(self)
def __sub__(self, other):
if not isinstance(other, self.basecls):
if not isinstance(other, self.base_types):
return NotImplemented
other = Path(other)
if other == self._EMPTY:
return self
if other._vol != self._vol or other._scheme != self._scheme:
raise ValueError("cannot subtract %r from %r" % (other, self))
vol = self._EMPTY
o = other._dirs + other._filename
s = self._dirs + self._filename
elif isinstance(other, self.data_types):
other = Path(other)
s = self._value_
if len(self._dirs) > 1 and not self._filename:
s += self._SLASH
o = other._value_
if len(other._dirs) > 1 and not other._filename:
o += other._SLASH
if not s.startswith(o):
raise ValueError("cannot subtract %r from %r" % (other, self))
return Path(vol+s[len(o):])
return Path(s[len(o):])

@@ -748,3 +756,3 @@ def access(self, file_name, mode=None):

file_name = self/file_name
file_name = base_class(file_name)
file_name = self.data_type(file_name)
return _os.access(file_name, mode)

@@ -754,3 +762,3 @@

pieces = self.elements
absolute = self[0:1] == self._SYS_SEP
absolute = self[0:1] == self._SLASH
lead = None

@@ -760,3 +768,3 @@ if absolute:

while len(pieces) > 1:
yield self.__class__(self._SYS_SEP.join(pieces))
yield self.__class__(self._SLASH.join(pieces))
pieces.pop()

@@ -771,3 +779,3 @@ if absolute:

subdir = self/subdir
subdir = base_class(subdir)
subdir = self.data_type(subdir)
_os.chdir(subdir)

@@ -781,3 +789,3 @@ return subdir

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -787,3 +795,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.chflags(file, flags)

@@ -796,3 +804,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -802,3 +810,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
if follow_symlinks == True:

@@ -817,3 +825,3 @@ _os.chflags(file, flags)

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -823,3 +831,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.chmod(file, mode)

@@ -833,3 +841,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -839,3 +847,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
if follow_symlinks == True:

@@ -854,3 +862,3 @@ _os.chmod(file, mode)

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -860,3 +868,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.chown(file, uid, gid)

@@ -870,3 +878,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -876,3 +884,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
if follow_symlinks == True:

@@ -894,2 +902,10 @@ _os.chown(file, uid, gid)

def commonpath(self, *paths):
paths = (self, ) + paths
return Path.commonpath(*paths)
def commonprefix(self, *paths):
paths = (self, ) + paths
return Path.commonprefix(*paths)
def copy(self, files, dst=None):

@@ -903,9 +919,9 @@ """

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)
else:
files = [f for fs in files for f in self.glob(fs)]
dst = base_class(dst)
dst = self.data_type(dst)
for file in files:
src = base_class(file)
src = self.data_type(file)
_shutil.copy2(src, dst)

@@ -931,3 +947,3 @@

end = end or len(self)
return (self._scheme + self._dirname + self._filename).count(new_sub)
return (self._value_).count(new_sub)

@@ -945,3 +961,3 @@ def descend(self):

def endswith(self, suffix, start=None, end=None):
if isinstance(suffix, self.basecls):
if isinstance(suffix, self.base_types):
new_suffix = suffix.replace(self._SYS_SEP, self._SLASH)

@@ -955,3 +971,3 @@ else:

end = end or len(self)
return (self._scheme + self._dirname + self._filename).endswith(new_suffix, start, end)
return (self._value_).endswith(new_suffix, start, end)

@@ -961,3 +977,3 @@ def exists(self, name=None):

self /= name
self = base_class(self)
self = self.data_type(self)
return _os.path.exists(self)

@@ -969,3 +985,3 @@

end = end or len(self)
return (self._scheme + self._dirname + self._filename).find(new_sub)
return (self._value_).find(new_sub)

@@ -997,6 +1013,9 @@ def format(self, other):

def isabs(self):
return _os.path.isabs(self.data_type(self))
def isdir(self, name=None):
if name is not None:
self /= name
self = base_class(self)
self = self.data_type(self)
return _os.path.isdir(self)

@@ -1007,3 +1026,3 @@

self /= name
self = base_class(self)
self = self.data_type(self)
return _os.path.isfile(self)

@@ -1014,3 +1033,3 @@

self /= name
self = base_class(self)
self = self.data_type(self)
return _os.path.islink(self)

@@ -1021,3 +1040,3 @@

self /= name
self = base_class(self)
self = self.data_type(self)
return _os.path.ismount(self)

@@ -1053,3 +1072,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -1059,3 +1078,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.chflags(file, flags)

@@ -1068,3 +1087,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -1074,3 +1093,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.lchmod(file, mode)

@@ -1083,3 +1102,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -1089,3 +1108,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.lchown(file, uid, gid)

@@ -1098,3 +1117,3 @@

self /= file_name
self = base_class(self)
self = self.data_type(self)
return _os.path.lexists(self)

@@ -1129,3 +1148,3 @@

self /= file_name
self = base_class(self)
self = self.data_type(self)
return _os.lstat(self)

@@ -1136,3 +1155,3 @@

chars = chars.replace(self._SYS_SEP, self._SLASH)
return self.__class__((self._scheme + self._dirname + self._filename).lstrip(chars))
return self.__class__((self._value_).lstrip(chars))

@@ -1147,3 +1166,3 @@ if hasattr(_os, 'mkfifo'):

name = self/name
name = base_class(name)
name = self.data_type(name)
return _os.mkfifo(name, mode)

@@ -1155,3 +1174,3 @@

"""
if subdirs is not None and not isinstance(subdirs, self.basecls):
if subdirs is not None and not isinstance(subdirs, self.base_types):
if mode and owner:

@@ -1165,3 +1184,3 @@ raise ValueError('subdirs should be a string or Path instance, not %r' % type(subdirs))

subdirs = [self]
elif isinstance(subdirs, self.basecls):
elif isinstance(subdirs, self.base_types):
subdirs = [self/subdirs]

@@ -1172,3 +1191,3 @@ else:

for subdir in subdirs:
subdir = base_class(subdir)
subdir = self.data_type(subdir)
_os.mkdir(subdir)

@@ -1179,3 +1198,3 @@ if owner is not None:

for subdir in subdirs:
subdir = base_class(subdir)
subdir = self.data_type(subdir)
_os.mkdir(subdir, mode)

@@ -1189,3 +1208,3 @@ if owner is not None:

"""
if subdirs is not None and not isinstance(subdirs, self.basecls):
if subdirs is not None and not isinstance(subdirs, self.base_types):
if mode and owner:

@@ -1199,3 +1218,3 @@ raise ValueError('subdirs should be a string or Path instance, not %r' % type(subdirs))

subdirs = [self]
elif isinstance(subdirs, self.basecls):
elif isinstance(subdirs, self.base_types):
subdirs = [self/subdirs]

@@ -1208,3 +1227,3 @@ else:

elements = subdir.elements
for dir in elements:
for i, dir in enumerate(elements, start=4):
path /= dir

@@ -1222,9 +1241,9 @@ if not path.exists():

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)
else:
files = [f for fs in files for f in self.glob(fs)]
dst = base_class(dst)
dst = self.data_type(dst)
for file in files:
src = base_class(file)
src = self.data_type(file)
_shutil.move(src, dst)

@@ -1252,3 +1271,3 @@ return dst

file_name = self/file_name
file_name = base_class(file_name)
file_name = self.data_type(file_name)
if mode is None:

@@ -1272,3 +1291,3 @@ mode = 'r'

self /= name
self = base_class(self)
self = self.data_type(self)
return _os.pathconf(self, conf_name)

@@ -1279,9 +1298,12 @@

def readlink(self):
self = base_class(self)
self = self.data_type(self)
return _os.readlink(self)
def relpath(self, start='.'):
return Path(_os.path.relpath(self._value_, start))
def removedirs(self, subdirs=None):
if subdirs is None:
subdirs = [self]
elif isinstance(subdirs, self.basecls):
elif isinstance(subdirs, self.base_types):
subdirs = self.glob(subdirs)

@@ -1291,3 +1313,3 @@ else:

for subdir in subdirs:
subdir = base_class(subdir)
subdir = self.data_type(subdir)
_os.removedirs(subdir)

@@ -1319,5 +1341,5 @@

if count:
return self.__class__((self._scheme + self._dirname + self._filename).replace(old, new, count))
return self.__class__((self._value_).replace(old, new, count))
else:
return self.__class__((self._scheme + self._dirname + self._filename).replace(old, new))
return self.__class__((self._value_).replace(old, new))

@@ -1328,3 +1350,3 @@ def rmdir(self, subdirs=None):

subdirs = [self]
elif isinstance(subdirs, self.basecls):
elif isinstance(subdirs, self.base_types):
subdirs = self.glob(subdirs)

@@ -1334,3 +1356,3 @@ else:

for subdir in subdirs:
subdir = base_class(subdir)
subdir = self.data_type(subdir)
_os.rmdir(subdir)

@@ -1340,3 +1362,3 @@

'thin wrapper around shutil.rmtree'
if subdirs is not None and not isinstance(subdirs, self.basecls):
if subdirs is not None and not isinstance(subdirs, self.base_types):
if ignore_errors and onerror:

@@ -1350,3 +1372,3 @@ raise ValueError('subdirs should be a string or Path instance, not %r' % type(subdirs))

subdirs = [self]
elif isinstance(subdirs, self.basecls):
elif isinstance(subdirs, self.base_types):
subdirs = self.glob(subdirs)

@@ -1356,3 +1378,3 @@ else:

for target in subdirs:
target = base_class(target)
target = self.data_type(target)
if ignore_errors is None and onerror is None:

@@ -1368,6 +1390,6 @@ _shutil.rmtree(target)

chars = chars.replace(self._SYS_SEP, self._SLASH)
return self.__class__((self._scheme + self._dirname + self._filename).rstrip(chars))
return self.__class__((self._value_).rstrip(chars))
def startswith(self, prefix, start=None, end=None):
if isinstance(prefix, self.basecls):
if isinstance(prefix, self.base_types):
new_prefix = prefix.replace(self._SYS_SEP, self._SLASH)

@@ -1381,3 +1403,3 @@ else:

end = end or len(self)
return (self._scheme + self._dirname + self._filename).startswith(new_prefix, start, end)
return (self._value_).startswith(new_prefix, start, end)

@@ -1387,3 +1409,3 @@ def stat(self, file_name=None):

self /= file_name
self = base_class(self)
self = self.data_type(self)
return _os.stat(self)

@@ -1396,3 +1418,3 @@

self /= name
self = base_class(self)
self = self.data_type(self)
return _os.statvfs(self)

@@ -1403,3 +1425,3 @@

chars = chars.replace(self._SYS_SEP, self._SLASH)
return self.__class__((self._scheme + self._dirname + self._filename).strip(chars))
return self.__class__((self._value_).strip(chars))

@@ -1413,3 +1435,3 @@ def strip_ext(self, remove=1):

remove -= 1
self = self.__class__(self._scheme + self._dirname + self._base)
self = self.__class__(self._value_[:-len(self._ext)])
return self

@@ -1464,3 +1486,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files) or [self/files]

@@ -1474,3 +1496,3 @@ else:

else:
file = base_class(file)
file = self.data_type(file)
with open(file, 'w') as fh:

@@ -1481,3 +1503,3 @@ pass

else:
file = base_class(file)
file = self.data_type(file)
_os.utime(file, times)

@@ -1490,3 +1512,3 @@

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -1496,3 +1518,3 @@ else:

for target in files:
target = base_class(target)
target = self.data_type(target)
_os.unlink(target)

@@ -1508,3 +1530,3 @@ remove = unlink

files = [self]
elif isinstance(files, self.basecls):
elif isinstance(files, self.base_types):
files = self.glob(files)

@@ -1514,3 +1536,3 @@ else:

for file in files:
file = base_class(file)
file = self.data_type(file)
_os.utime(file, times)

@@ -1523,3 +1545,3 @@

p = self.__class__
self = base_class(self)
self = self.data_type(self)
for dirpath, dirnames, filenames in _os.walk(self, topdown, onerror, followlinks):

@@ -1535,3 +1557,3 @@ dirpath = p(dirpath)

p = self.__class__
self = base_class(self)
self = self.data_type(self)
for dirpath, dirnames, filenames in _os.walk(self, topdown, onerror):

@@ -1551,2 +1573,4 @@ dirpath = p(dirpath)

_SYS_SEP = system_sep.encode('ascii')
_ALT_SEP = system_alt.encode('ascii')
_EXT_SEP = system_ext.encode('ascii')
_QUESTION = '?'.encode('ascii')

@@ -1566,2 +1590,4 @@ _HASHTAG = '#'.encode('ascii')

_SYS_SEP = unicode(system_sep)
_ALT_SEP = unicode(system_alt)
_EXT_SEP = unicode(system_ext)
_QUESTION = unicode('?')

@@ -1574,7 +1600,15 @@ _HASHTAG = unicode('#')

if _py_ver < (3, 0):
bPath.basecls = bPath, bytes, uPath, unicode
uPath.basecls = uPath, unicode, bPath, bytes
bPath.base_types = bPath, bytes, uPath, unicode
bPath.data_types = bytes, unicode
bPath.data_type = bytes
uPath.base_types = uPath, unicode, bPath, bytes
uPath.data_types = unicode, bytes
uPath.data_type = unicode
else:
bPath.basecls = bPath, bytes
uPath.basecls = uPath, unicode
bPath.base_types = bPath, bytes
bPath.data_types = (bytes, )
bPath.data_type = bytes
uPath.base_types = uPath, unicode
uPath.data_types = (unicode, )
uPath.data_type = unicode

@@ -1581,0 +1615,0 @@ if _py_ver < (3, 0):

Metadata-Version: 1.1
Name: antipathy
Version: 0.83.10
Version: 0.84.0
Summary: oo view of file paths and names, subclassed from bytes/str/unicode

@@ -5,0 +5,0 @@ Home-page: https://github.com/ethanfurman/antipathy

@@ -53,3 +53,3 @@ import setuptools

name='antipathy',
version='0.83.10',
version='0.84.0',
license='BSD License',

@@ -56,0 +56,0 @@ description='oo view of file paths and names, subclassed from bytes/str/unicode',

Sorry, the diff of this file is too big to display