Skip to content

Commit

Permalink
0.3.0 Prepared release
Browse files Browse the repository at this point in the history
  • Loading branch information
DolphDev committed Apr 8, 2019
1 parent 53e1481 commit 3d5e2cb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
6 changes: 1 addition & 5 deletions psv/core/objects/apiobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ def __init__(self, csvdict=None, columns=None,
raise ValueError(
msg.badcls.format(Row, cls if isinstance(cls, type) else type(cls)))



if columns:
self.__columnsmap__.update(
column_crunch_repeat(self.__columns__))
else:
rebuild_column_map = True


if csvdict is None:
csvdict = {}
if csvdict:
Expand All @@ -56,11 +53,10 @@ def __init__(self, csvdict=None, columns=None,
self.__rows__ = list(
parser(csvdict, cls, self.__columnsmap__, typetransfer, None, *args, **kwargs))
if rebuild_column_map:
# This is a temporary fix, waiting on the implemention of safe_load() and opencsv()
# This catches mistakes if .load() is used instead of safe_load() / opencsv()
try:
self.__columnsmap__.update(
column_crunch_repeat(self.__rows__[0].keys()))

except AttributeError:
# Errornous Headers - Usually caused by single column
# Spreadsheets that don't have a header
Expand Down
4 changes: 2 additions & 2 deletions psv/core/objects/selections.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def single_find(self, selectionfirstarg_data=None, **kwargs):

def single_find_any(self, selectionfirstarg_data=None, **kwargs):
"""Find a single row based off search criteria given.
Only condition needs to be Trues.
Only one condition needs to be Trues.
will raise error if returns more than one result"""
try:
result = None
Expand Down Expand Up @@ -215,7 +215,7 @@ def find_any(self, selectionfirstarg_data=None, **kwargs):
return None

def fast_find(self, **kwargs):
"""Much faster find
"""Much faster find. Returns the last row the fulfilled any kwargs. Only accept one kwargs.
Note: All keynames must be unique to be used effectively, else latest row will be returned"""
if len(kwargs) != 1:
raise ValueError(msg.badfastfind)
Expand Down
3 changes: 3 additions & 0 deletions psv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def loads(csvdoc, columns=None, cls=Row, delimiter=",", quotechar='"',
def safe_load(f, cls=Row, delimiter=",", quotechar='"', mode='r', buffering=-1,
encoding="utf-8", errors=None, newline=None, closefd=True, opener=None, typetransfer=False,
csv_size_max=None, csv_max_row=None, custom_columns=None, close_file=False):

"""This safetly reads more dirty datasets. It can handle: Duplicate, missing, and unsupported headers.
"""

if csv_size_max:
csv_size_limit(csv_size_max)
Expand Down
6 changes: 6 additions & 0 deletions readmeshort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PSV
----

PSV is a library that allows rapid script development for csv files. This library allows pythonic manipulation of csv (or csv like structures).

This is not a data analysis library rather a data manipulation one, and it is meant to be as light as possbile. For these usecases, consider Pandas. Additionally, CSV files should not be used as any sort of flat file database and this library doesn't actively support that usecase.
15 changes: 11 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
#!/usr/bin/env python
"""
Copyright (c) 2016, 2017, 2018 Joshua Walters
Copyright (c) 2016-2019 Joshua W
"""

from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'readmeshort.md'), encoding='utf-8') as f:
long_description = f.read()

version = '0.2.1'

version = '0.3.0'

from setuptools import setup
setup(name='psv',
install_requires=["tabulate==0.8.2"],
install_requires=["tabulate==0.8.3"],
version=version,
description='CSV Parser',
long_description=long_description,
long_description_content_type='text/markdown'
author='Joshua W',
author_email='[email protected]',
url='https://github.com/Dolphman/PSV',
url='https://github.com/DolphDev/PSV',
packages=['psv', 'psv.core', 'psv.core.objects', 'psv.core.parsing', 'psv.core.output', "psv.core.utils", "psv.core.exceptions"],
package_data={'': ['LICENSE.txt', "readme.md"]},
keywords=['csv', "Comma Separated Values", "Python Separated Values", "psv"],
Expand Down

0 comments on commit 3d5e2cb

Please sign in to comment.