Antipathy -- for those tired of ``os.path``
===========================================
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/ethanfurman/antipathy",
"name": "antipathy",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Ethan Furman",
"author_email": "ethan@stoneleaf.us",
"download_url": "https://files.pythonhosted.org/packages/3b/f5/521943df43aff62607823712874542113346f2c425011a5c8aeea74eb24a/antipathy-0.85.4.tar.gz",
"platform": null,
"description": "Antipathy -- for those tired of ``os.path``\n===========================================\n\nTired of calling a function for every path manipulation you need to do?\n\nIs::\n\n >>> path, filename = os.path.split(some_name)\n >>> basename, ext = os.path.splitext(filename)\n >>> basename = basename + '_01'\n >>> new_name = os.path.join(path, basename+ext)\n\nwearing on your nerves?\n\nIn short, are you filled with antipathy [1] for os.path?\n\nThen get antipathy and work with Path::\n\n >>> from antipathy import Path\n >>> some_name = Path('/home/ethan/source/my_file.txt')\n >>> backups = Path('/home/ethan/backup/')\n >>> print some_name.path\n '/home/ethan/source/'\n >>> print some_name.ext\n '.txt'\n >>> print some_name.exists()\n True # (well, if it happens to exist at this moment ;)\n >>> backup = backups / some_name.filename + '_01' + some_name.ext\n >>> print backup\n '/home/ethan/backup/my_file_01.txt'\n >>> some_name.copy(backup)\n\nBecause 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].\n\n[1] https://www.google.com/#q=antipathy\n\n[2] in most cases -- there are a few places that do a `type` check instead of an `isinstance` check.\n\n\n",
"bugtrack_url": null,
"license": "BSD License",
"summary": "oo view of file paths and names, subclassed from bytes/str/unicode",
"version": "0.85.4",
"project_urls": {
"Homepage": "https://github.com/ethanfurman/antipathy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0fcd1e663f69a9e2db78a48e69998bb325f80369070e44aa2cd93c28bb1879ff",
"md5": "dca81dec5b83647630e1080f3589dda6",
"sha256": "0fad030872aca697b3529530a3d80863603716666f479083cd9e19151ab05319"
},
"downloads": -1,
"filename": "antipathy-0.85.4-py2-none-any.whl",
"has_sig": false,
"md5_digest": "dca81dec5b83647630e1080f3589dda6",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 24795,
"upload_time": "2024-04-04T20:30:49",
"upload_time_iso_8601": "2024-04-04T20:30:49.271844Z",
"url": "https://files.pythonhosted.org/packages/0f/cd/1e663f69a9e2db78a48e69998bb325f80369070e44aa2cd93c28bb1879ff/antipathy-0.85.4-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "62872b28f193e6b74cd71e94dc0fd4f81719bd9d344a4540c5ecef7812f43488",
"md5": "d22316baf1fe189730aba6eb34be7695",
"sha256": "3eecc7cfec2a5162502f60fda4b47b5595fbf41d1dc7808f4882bb447fdd2058"
},
"downloads": -1,
"filename": "antipathy-0.85.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d22316baf1fe189730aba6eb34be7695",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24796,
"upload_time": "2024-04-04T20:30:46",
"upload_time_iso_8601": "2024-04-04T20:30:46.874156Z",
"url": "https://files.pythonhosted.org/packages/62/87/2b28f193e6b74cd71e94dc0fd4f81719bd9d344a4540c5ecef7812f43488/antipathy-0.85.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3bf5521943df43aff62607823712874542113346f2c425011a5c8aeea74eb24a",
"md5": "96c4e4f4a12ed911c05f8d808d857a8d",
"sha256": "c3cd2500f342a08d282be66fb64239a97e893120dcc6ac80818a31d0f4bc3c70"
},
"downloads": -1,
"filename": "antipathy-0.85.4.tar.gz",
"has_sig": false,
"md5_digest": "96c4e4f4a12ed911c05f8d808d857a8d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24225,
"upload_time": "2024-04-04T20:30:51",
"upload_time_iso_8601": "2024-04-04T20:30:51.862347Z",
"url": "https://files.pythonhosted.org/packages/3b/f5/521943df43aff62607823712874542113346f2c425011a5c8aeea74eb24a/antipathy-0.85.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-04 20:30:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ethanfurman",
"github_project": "antipathy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "antipathy"
}