Skip to content

Commit

Permalink
Version 0.1.1 — Rename to "in_place"
Browse files Browse the repository at this point in the history
I could have sworn I had already checked PyPI for name conflicts...
  • Loading branch information
jwodder committed Jan 27, 2017
1 parent 26a2dd7 commit 479b8a6
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 42 deletions.
30 changes: 15 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
.. image:: https://coveralls.io/repos/github/jwodder/inplace/badge.svg?branch=master
:target: https://coveralls.io/github/jwodder/inplace?branch=master

.. image:: https://img.shields.io/pypi/pyversions/inplace.svg
.. image:: https://img.shields.io/pypi/pyversions/in_place.svg

.. image:: https://img.shields.io/github/license/jwodder/inplace.svg?maxAge=2592000
.. image:: https://img.shields.io/github/license/jwodder/in_place.svg?maxAge=2592000
:target: https://opensource.org/licenses/MIT
:alt: MIT License

`GitHub <https://github.com/jwodder/inplace>`_
| `PyPI <https://pypi.python.org/pypi/inplace>`_
| `PyPI <https://pypi.python.org/pypi/in_place>`_
| `Issues <https://github.com/jwodder/inplace/issues>`_
The ``inplace`` module provides Python classes for reading & writing a file
The ``in_place`` module provides Python classes for reading & writing a file
"in-place": data that you write ends up at the same filepath that you read
from, and ``inplace`` takes care of all the necessary mucking about with
from, and ``in_place`` takes care of all the necessary mucking about with
temporary files for you.

For example, given the file ``somefile.txt``::
Expand All @@ -33,9 +33,9 @@ For example, given the file ``somefile.txt``::

and the program ``disemvowel.py``::

import inplace
import in_place

with inplace.InPlace('somefile.txt') as fp:
with in_place.InPlace('somefile.txt') as fp:
for line in fp:
fp.write(''.join(c for c in line if c not in 'AEIOUaeiou'))

Expand All @@ -51,14 +51,14 @@ and no sign of those pesky vowels remains! If you want a sign of those pesky
vowels to remain, you can instead save the file's original contents in, say,
``somefile.txt~`` by constructing the filehandle with::

inplace.InPlace('somefile.txt', backup_ext='~')
in_place.InPlace('somefile.txt', backup_ext='~')

or save to ``someotherfile.txt`` with::

inplace.InPlace('somefile.txt', backup='someotherfile.txt')
in_place.InPlace('somefile.txt', backup='someotherfile.txt')

Compared to the in-place filtering implemented by the Python standard library's
|fileinput|_ module, ``inplace`` offers the following benefits:
|fileinput|_ module, ``in_place`` offers the following benefits:

- Instead of hijacking ``sys.stdout``, a new filehandle is returned for
writing.
Expand All @@ -69,8 +69,8 @@ Compared to the in-place filtering implemented by the Python standard library's
binary mode, and these options apply to both input and output.
- The complete filename of the backup file can be specified; you aren't
constrained to just adding an extension.
- When used as a context manager, ``inplace`` will restore the original file if
an exception occurs.
- When used as a context manager, ``in_place`` will restore the original file
if an exception occurs.
- The creation of temporary files won't silently clobber innocent bystander
files.

Expand All @@ -81,14 +81,14 @@ Compared to the in-place filtering implemented by the Python standard library's
Installation
============
Just use `pip <https://pip.pypa.io>`_ (You have pip, right?) to install
``inplace`` and its dependencies::
``in_place`` and its dependencies::

pip install inplace
pip install in_place


Basic Usage
===========
``inplace`` provides two classes: ``InPlace``, for working with text files
``in_place`` provides two classes: ``InPlace``, for working with text files
(reading & writing ``unicode`` objects in Python 2, ``str`` objects in Python
3); and ``InPlaceBytes``, for working with binary files (reading & writing
``str`` objects in Python 2, ``bytes`` objects in Python 3). Both classes'
Expand Down
8 changes: 4 additions & 4 deletions inplace.py → in_place.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
In-place file processing
The ``inplace`` module provides Python classes for reading & writing a file
The ``in_place`` module provides Python classes for reading & writing a file
"in-place": data that you write ends up at the same filepath that you read
from, and ``inplace`` takes care of all the necessary mucking about with
from, and ``in_place`` takes care of all the necessary mucking about with
temporary files for you.
Visit <https://github.com/jwodder/inplace> for more information.
"""

__version__ = '0.1.0'
__version__ = '0.1.1'
__author__ = 'John Thorvald Wodder II'
__author_email__ = '[email protected]'
__license__ = 'MIT'
Expand Down Expand Up @@ -123,7 +123,7 @@ def _mktemp(self, filepath):
"""
fd, tmppath = tempfile.mkstemp(
dir=os.path.dirname(filepath),
prefix='._inplace-',
prefix='._in_place-',
)
os.close(fd)
return tmppath
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
from setuptools import setup

with open(join(dirname(__file__), 'inplace.py')) as fp:
with open(join(dirname(__file__), 'in_place.py')) as fp:
for line in fp:
m = re.search(r'^\s*__version__\s*=\s*([\'"])([^\'"]+)\1\s*$', line)
if m:
Expand All @@ -15,9 +15,9 @@
long_desc = fp.read()

setup(
name='inplace',
name='in_place',
version=version,
py_modules=['inplace'],
py_modules=['in_place'],
license='MIT',
author='John Thorvald Wodder II',
author_email='[email protected]',
Expand Down
6 changes: 3 additions & 3 deletions test/test_bytes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from six import binary_type
from inplace import InPlaceBytes
from test_inplace_util import UNICODE, pylistdir
from six import binary_type
from in_place import InPlaceBytes
from test_in_place_util import UNICODE, pylistdir

def test_bytes_iconv_nobackup(tmpdir):
assert pylistdir(tmpdir) == []
Expand Down
8 changes: 4 additions & 4 deletions test/test_encoding.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unicodedata import normalize
from six import text_type
from unicodedata import normalize
from six import text_type
import pytest
from inplace import InPlace
from test_inplace_util import UNICODE, pylistdir
from in_place import InPlace
from test_in_place_util import UNICODE, pylistdir

def test_utf8_nobackup(tmpdir):
assert pylistdir(tmpdir) == []
Expand Down
6 changes: 3 additions & 3 deletions test/test_general.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import print_function
from __future__ import print_function
import os
import pytest
from inplace import InPlace
from test_inplace_util import TEXT, pylistdir
from in_place import InPlace
from test_in_place_util import TEXT, pylistdir

def test_nobackup(tmpdir):
assert pylistdir(tmpdir) == []
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/test_io_methods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import print_function
from inplace import InPlace, InPlaceBytes
from test_inplace_util import TEXT, UNICODE, pylistdir
from __future__ import print_function
from in_place import InPlace, InPlaceBytes
from test_in_place_util import TEXT, UNICODE, pylistdir

def test_print_backup(tmpdir):
assert pylistdir(tmpdir) == []
Expand Down
6 changes: 3 additions & 3 deletions test/test_move_first.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import print_function
from __future__ import print_function
import os
import pytest
from inplace import InPlace
from test_inplace_util import TEXT, pylistdir
from in_place import InPlace
from test_in_place_util import TEXT, pylistdir

def test_move_first_nobackup(tmpdir):
assert pylistdir(tmpdir) == []
Expand Down
4 changes: 2 additions & 2 deletions test/test_py2print.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import pytest
from inplace import InPlaceBytes
from test_inplace_util import TEXT, pylistdir
from in_place import InPlaceBytes
from test_in_place_util import TEXT, pylistdir

@pytest.mark.skipif(sys.version_info[0] > 2, reason='Python 2 only')
def test_py2print_backup(tmpdir):
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ envlist = py27,py35
commands = python setup.py test

[pytest]
testpaths = inplace.py test
addopts = --cache-clear --cov=inplace --cov-report term-missing --flakes
testpaths = in_place.py test
addopts = --cache-clear --cov=in_place --cov-report term-missing --flakes

0 comments on commit 479b8a6

Please sign in to comment.