Giter Site home page Giter Site logo

ranker_writer's Introduction

Script to get a json key_tree by key and saving the content of the key by key_tree

  • yet another parser (not searched the www for scripts that may solve my task)
{"a": 1, "b": 2, "d": {"c": 3}}		# 'root -> d -> c'
{"a": 1, "b": 2, "d": [{"c": 3}]}	# 'root -> d -> c'

Dependencies

pip -V		# 22.1.1
python -V	# 3.10.5
pytest -V	# 6.2.5

Start

python -m venv env && source env/bin/activate
pip install -r requirements.txt

# check functions if necessary
pytest .

# run script
python src/run.py

Script structure

.
├── src
│   ├── __init__.py
│   └── run.py
├── tests
│   ├── __init__.py
│   ├── test_get_page_data.py
│   └── test_page_data_tree.py
├── data
│   ├── key_content-ignore_me.json
│   └── ranker_writer-ignore_me.json
├── README.md
├── CONTRIBUTORS.md
└── requirements.txt

TODO

  • nested json
  • json in the list
  • check for multiple keys
    • return multiple keys (iterable result)
    • unique multiple keys (not every single item in the list)
  • check for keys by value
  • access to the data in the list
    • added default index = 0
    • add and get the index from key_tree
  • handle errors on searching for a non string key
  • handle errors on request and parsing
    • check for no url
  • fix errors on reading and writing to the json file without filename
    • add tests

Coding process: https://youtu.be/DkBAIKMN7x0

ranker_writer's People

Contributors

ames0k0 avatar

Forkers

ames0k0

ranker_writer's Issues

Similar projects (scripts) to look at

>>> cat tests/data/one.json | gron
< json = {};
< json.abool = true;
>>> cat test.json | gron | grep language
< [glossary][GlossDiv][GlossList][GlossEntry][GlossDef][para]->A meta-markup language
>>> cat numbers.txt | jg "{\"id\":\"^2.*$\",\"attr.*\":{\"gender\":\"female\"}}"
< [
< 	{
< 		"id": 2001,
< 		"phone": 113,
< 		"attributes": {
< 			"gender:": "female"
< 		}
< 	}
< ]
>>> cat my.json | jgrep "[foo.bar1=1 and foo.bar2=2]"
< [
< 	{
< 		"foo": [
< 			{
< 				"bar1": 1
< 			},
< 			{
< 				"bar2": 2
< 			}
< 		]
< 	}
< ]
>>> rj '.*es.*/cit' test.json
< address/city = "London"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.