https://github.com/nthe/pythe
Bunch of decorators and function I made during code investigation.
https://github.com/nthe/pythe
Last synced: 8 months ago
JSON representation
Bunch of decorators and function I made during code investigation.
- Host: GitHub
- URL: https://github.com/nthe/pythe
- Owner: nthe
- Created: 2016-08-08T10:39:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-26T21:35:27.000Z (over 9 years ago)
- Last Synced: 2025-08-20T06:31:56.788Z (10 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## pythe
Basic utilities I use.
### __pysk__
Module contains functions for retrieval of values (or lines) from JSON / dictionary or text file. The advantage is that the source file won't be loaded into main memory and may work with invalid JSON(s) / dictionary(ies).
Function `parse` has four parameters:
- source file
- source file type ( options: json | text )
- lookup string
- percentual offset from beginning of file( range: 0 - 100 )
When looking for line(s) in text file, the response is list lines containing lookup string.
```python
import pythe
pythe.parse('source.txt', 'text', 'October 13th', 50)
>>> ['Today is October 13th.', 'Another line with sub-string we\'re looking for. It\'s October 13th']
```
When looking for value(s) or property(ies) of dictionary / JSON, the response is list of values where key == lookup string.
```python
import pythe
pythe.parse('data.json', 'json', 'tags', 10)
>>> [['drama', 'comedy', 'thriller'], ['horror', 'thriller', 'drama'], ['documentary', 'nature']]
```
### __pymin__
Simple Python script minifier.
```python
import pymin
pymin.minify('source.py', 'min_source.py')
```
### __rerun__
Automatic script re-executor. The script is executed every time the file is modified (saved).
```python
python rerun.py .py
```