Skip to content

Commit e583bef

Browse files
committed
auto push commit coverage
1 parent fed679a commit e583bef

8 files changed

Lines changed: 175 additions & 172 deletions

File tree

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,56 @@ Pyben Enables fast and easy encoding and decoding of bencoded data.
1111

1212
## Prerequisites
1313

14-
* Python3 installed and enabled
14+
* Python3 installed and enabled
1515

1616
## Installing PyBen
1717

1818
To install PyBen, follow these steps:
1919

2020
Using pip:
2121

22-
```bash
23-
pip install pyben
24-
```
22+
```bash
23+
pip install pyben
24+
```
2525

2626
Using git:
2727

28-
```cmd
29-
git clone https://github.com/alexpdev/pyben.git
30-
```
28+
```cmd
29+
git clone https://github.com/alexpdev/pyben.git
30+
```
3131

3232
## Using PyBen
3333

3434
The API is intentionally designed to mimic Python's json module.
3535

36-
```python
37-
>>> fd = "path/to/file"
38-
>>> data = {"item1": ["item2", 3, [4], {5: "item6"}]}
39-
>>> encoded = pyben.dumps(data)
40-
>>> encoded
41-
b'd5:item1l5:item2i3eli4eedi5e5:item6eee'
42-
>>> decoded = pyben.loads(encoded)
43-
{'item1': ['item2', 3, [4], {5: 'item6'}]}
44-
```
36+
```python
37+
>>> fd = "path/to/file"
38+
>>> data = {"item1": ["item2", 3, [4], {5: "item6"}]}
39+
>>> encoded = pyben.dumps(data)
40+
>>> encoded
41+
b'd5:item1l5:item2i3eli4eedi5e5:item6eee'
42+
>>> decoded = pyben.loads(encoded)
43+
{'item1': ['item2', 3, [4], {5: 'item6'}]}
44+
```
4545

4646
One key difference is that the 'load' and 'dump' methods accept as arguments,
4747
string paths or path objects as well as open iobuffer.
4848

4949
For Example this:
5050

51-
```python
52-
>> with open("encoded.file", "wb") as fd:
53-
... pyben.dump(data, fd)
54-
>> with open("encoded.file", "rb") as fd:
55-
... decoded = pyben.load(fd)
56-
```
51+
```python
52+
>> with open("encoded.file", "wb") as fd:
53+
... pyben.dump(data, fd)
54+
>> with open("encoded.file", "rb") as fd:
55+
... decoded = pyben.load(fd)
56+
```
5757

5858
is the same as doing following.
5959

60-
```python
61-
>>> pyben.dump(data, "encoded.file")
62-
>>> decoded = pyben.load("encoded.file")
63-
```
60+
```python
61+
>>> pyben.dump(data, "encoded.file")
62+
>>> decoded = pyben.load("encoded.file")
63+
```
6464

6565
The full API includes many other functions and classes as well.
6666
See docs for more full API.

0 commit comments

Comments
 (0)