Skip to content

Commit c7aed86

Browse files
committed
change to package
1 parent 68fce1f commit c7aed86

File tree

15 files changed

+113
-49
lines changed

15 files changed

+113
-49
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 n4n5
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# csv-to-custom-json-python
2+
3+
## License
4+
5+
Licensed under the MIT License - [LICENSE](LICENSE)

csv.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=42",
4+
"wheel"
5+
]
6+
build-backend = "setuptools.build_meta"
7+

setup.cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[metadata]
2+
name = csv-to-custom-json
3+
version = 0.0.1
4+
author = n4n5
5+
author_email = its.just.n4n5@gmail.com
6+
description = Easily convert your CSV to custom JSON
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
url = https://github.com/its-just-nans/csv-to-custom-json-python
10+
project_urls =
11+
Bug Tracker = https://github.com/its-just-nans/csv-to-custom-json-python/issues
12+
classifiers =
13+
Programming Language :: Python :: 3
14+
License :: OSI Approved :: MIT License
15+
Operating System :: OS Independent
16+
17+
[options]
18+
package_dir =
19+
= src
20+
packages = find:
21+
python_requires = >=3.6
22+
23+
[options.packages.find]
24+
where = src

src/csv_to_custom_json/__init__.py

Whitespace-only changes.

main.py renamed to src/csv_to_custom_json/csv_to_custom_json.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def parseFile(pathToFile="", schema=None, optionsUser={}):
77
def checkOptions(optionsUser, attr, defaultValue):
8-
if attr in optionsUser or (attr == "lineCallBack" and callable(optionsUser[attr])):
8+
if attr in optionsUser:
99
return optionsUser[attr]
1010
else:
1111
return defaultValue
@@ -102,7 +102,10 @@ def parseLine(line):
102102
allPath = onePathRow.split(options["privateSeparator"])
103103
currentValue = None
104104
if ('type' not in oneRow) or ('type' in oneRow and oneRow["type"] == None):
105-
schemaValue = oneRow["value"]
105+
if 'value' not in oneRow:
106+
schemaValue = None
107+
else:
108+
schemaValue = oneRow["value"]
106109
index = firstLine.index(oneRow["name"])
107110
if index == -1:
108111
currentValue = schemaValue
@@ -173,9 +176,9 @@ def parsefirstLine():
173176
def dupli(element):
174177
return {
175178
"name": element,
176-
"type": element
179+
"path": element
177180
}
178-
cols = map(dupli, firstLine)
181+
cols = [dupli(x) for x in firstLine]
179182
return cols
180183

181184
def reader():

test.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

tests/__init__.py

Whitespace-only changes.

tests/simple copy.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
num1,num2,num3
2+
1,2,3
3+
4,5,6
4+
7,8,9

0 commit comments

Comments
 (0)