9
9
.. image :: https://coveralls.io/repos/github/jwodder/inplace/badge.svg?branch=master
10
10
:target: https://coveralls.io/github/jwodder/inplace?branch=master
11
11
12
- .. image :: https://img.shields.io/pypi/pyversions/inplace .svg
12
+ .. image :: https://img.shields.io/pypi/pyversions/in_place .svg
13
13
14
- .. image :: https://img.shields.io/github/license/jwodder/inplace .svg?maxAge=2592000
14
+ .. image :: https://img.shields.io/github/license/jwodder/in_place .svg?maxAge=2592000
15
15
:target: https://opensource.org/licenses/MIT
16
16
:alt: MIT License
17
17
18
18
`GitHub <https://github.com/jwodder/inplace >`_
19
- | `PyPI <https://pypi.python.org/pypi/inplace >`_
19
+ | `PyPI <https://pypi.python.org/pypi/in_place >`_
20
20
| `Issues <https://github.com/jwodder/inplace/issues>`_
21
21
22
- The ``inplace `` module provides Python classes for reading & writing a file
22
+ The ``in_place `` module provides Python classes for reading & writing a file
23
23
"in-place": data that you write ends up at the same filepath that you read
24
- from, and ``inplace `` takes care of all the necessary mucking about with
24
+ from, and ``in_place `` takes care of all the necessary mucking about with
25
25
temporary files for you.
26
26
27
27
For example, given the file ``somefile.txt ``::
@@ -33,9 +33,9 @@ For example, given the file ``somefile.txt``::
33
33
34
34
and the program ``disemvowel.py ``::
35
35
36
- import inplace
36
+ import in_place
37
37
38
- with inplace .InPlace('somefile.txt') as fp:
38
+ with in_place .InPlace('somefile.txt') as fp:
39
39
for line in fp:
40
40
fp.write(''.join(c for c in line if c not in 'AEIOUaeiou'))
41
41
@@ -51,14 +51,14 @@ and no sign of those pesky vowels remains! If you want a sign of those pesky
51
51
vowels to remain, you can instead save the file's original contents in, say,
52
52
``somefile.txt~ `` by constructing the filehandle with::
53
53
54
- inplace .InPlace('somefile.txt', backup_ext='~')
54
+ in_place .InPlace('somefile.txt', backup_ext='~')
55
55
56
56
or save to ``someotherfile.txt `` with::
57
57
58
- inplace .InPlace('somefile.txt', backup='someotherfile.txt')
58
+ in_place .InPlace('somefile.txt', backup='someotherfile.txt')
59
59
60
60
Compared to the in-place filtering implemented by the Python standard library's
61
- |fileinput |_ module, ``inplace `` offers the following benefits:
61
+ |fileinput |_ module, ``in_place `` offers the following benefits:
62
62
63
63
- Instead of hijacking ``sys.stdout ``, a new filehandle is returned for
64
64
writing.
@@ -69,8 +69,8 @@ Compared to the in-place filtering implemented by the Python standard library's
69
69
binary mode, and these options apply to both input and output.
70
70
- The complete filename of the backup file can be specified; you aren't
71
71
constrained to just adding an extension.
72
- - When used as a context manager, ``inplace `` will restore the original file if
73
- an exception occurs.
72
+ - When used as a context manager, ``in_place `` will restore the original file
73
+ if an exception occurs.
74
74
- The creation of temporary files won't silently clobber innocent bystander
75
75
files.
76
76
@@ -81,14 +81,14 @@ Compared to the in-place filtering implemented by the Python standard library's
81
81
Installation
82
82
============
83
83
Just use `pip <https://pip.pypa.io >`_ (You have pip, right?) to install
84
- ``inplace `` and its dependencies::
84
+ ``in_place `` and its dependencies::
85
85
86
- pip install inplace
86
+ pip install in_place
87
87
88
88
89
89
Basic Usage
90
90
===========
91
- ``inplace `` provides two classes: ``InPlace ``, for working with text files
91
+ ``in_place `` provides two classes: ``InPlace ``, for working with text files
92
92
(reading & writing ``unicode `` objects in Python 2, ``str `` objects in Python
93
93
3); and ``InPlaceBytes ``, for working with binary files (reading & writing
94
94
``str `` objects in Python 2, ``bytes `` objects in Python 3). Both classes'
0 commit comments