This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

oo view of file paths and names, subclassed from bytes/str/unicode

Project Description

Tired of calling a function for every path manipulation you need to do?

Is:

>>> path, filename = os.path.split(some_name)
>>> basename, ext = os.path.splitext(filename)
>>> basename = basename + '_01'
>>> new_name = os.path.join(path, basename+ext)

wearing on your nerves?

In short, are you filled with antipathy [1] for os.path?

Then get antipathy and work with Path:

>>> from antipathy import Path
>>> some_name = Path('/home/ethan/source/my_file.txt')
>>> backups = Path('/home/ethan/backup/')
>>> print some_name.path
'/home/ethan/source/'
>>> print some_name.ext
'.txt'
>>> print some_name.exists()
True  # (well, if it happens to exist at this moment ;)
>>> backup = backups / some_name.filename + '_01' + some_name.ext
>>> print backup
'/home/ethan/backup/my_file_01.txt'
>>> some_name.copy(backup)

Because Path is a subclass of bytes/str/unicode, it can still be passed to other functions that expect a bytes/str/unicode object and work seamlessly [2].

[1] https://www.google.com/#q=antipathy

[2] in most cases – there are a few places that do a type check instead of an isinstance check.

Release History

Release History

This version
History Node

0.82.5

History Node

0.82.4

History Node

0.82.3

History Node

0.82.2

History Node

0.82.1

History Node

0.82.0

History Node

0.81.9

History Node

0.81.7

History Node

0.81.6

History Node

0.81.05

History Node

0.81.04

History Node

0.81.03

History Node

0.81.01

History Node

0.81.00

History Node

0.80.02

History Node

0.80.01

History Node

0.80.00

History Node

0.77.08

History Node

0.77.07

History Node

0.77.06

History Node

0.77.05

History Node

0.77.04

History Node

0.77.03

History Node

0.77.02

History Node

0.77.01

History Node

0.77.00

History Node

0.76.00

History Node

0.75.02

History Node

0.75.00

History Node

0.73.006

History Node

0.73.005

History Node

0.73.004

History Node

0.73.003

History Node

0.73.002

History Node

0.73.001

History Node

0.73.000

History Node

0.72.000

History Node

0.71.003

History Node

0.37.001

History Node

0.33.001

History Node

0.11.013

History Node

0.07.013

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
antipathy-0.82.5-py2.py3-none-any.whl (18.5 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Feb 27, 2016
antipathy-0.82.5.tar.gz (16.4 kB) Copy SHA256 Checksum SHA256 Source Feb 27, 2016
antipathy-0.82.5.zip (20.0 kB) Copy SHA256 Checksum SHA256 Source Feb 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting