Skip to content

Commit

Permalink
Merge pull request #52 from thombashi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
thombashi committed Nov 5, 2016
2 parents 660c352 + 356448b commit 2d9a9c0
Show file tree
Hide file tree
Showing 12 changed files with 498 additions and 1,358 deletions.
1 change: 0 additions & 1 deletion docs/pages/reference/converter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ RecordConvertor class
.. autoclass:: simplesqlite.converter.RecordConvertor
:members:
:undoc-members:
:show-inheritance:
4 changes: 0 additions & 4 deletions docs/pages/reference/function.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Functions
----------------------------

.. autofunction:: simplesqlite.validate_table_name

.. autofunction:: simplesqlite.validate_attr_name

.. autofunction:: simplesqlite.append_table

.. autofunction:: simplesqlite.connect_sqlite_db_mem
4 changes: 1 addition & 3 deletions docs/pages/reference/loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ GoogleSheetsTableLoader class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: simplesqlite.loader.GoogleSheetsTableLoader
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
1 change: 0 additions & 1 deletion docs/pages/reference/simplesqlite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ SimpleSQLite class
.. autoclass:: simplesqlite.SimpleSQLite
:members:
:undoc-members:
:show-inheritance:
4 changes: 2 additions & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
beautifulsoup4
DataProperty>=0.10.1
DataProperty>=0.11.2
jsonschema
pathvalidate>=0.8.3
pytablereader>=0.3.0
pytablereader>=0.4.2
path.py
six
xlrd
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setuptools.setup(
name="SimpleSQLite",
version="0.6.1",
version="0.6.2",
url="https://github.com/thombashi/SimpleSQLite",
bugtrack_url="https://github.com/thombashi/SimpleSQLite/issues",

Expand Down
27 changes: 15 additions & 12 deletions simplesqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@

import simplesqlite.loader
from .core import SimpleSQLite
from ._error import NullDatabaseConnectionError
from ._error import TableNotFoundError
from ._error import AttributeNotFoundError
from ._error import InvalidTableNameError
from ._error import InvalidAttributeNameError
from ._error import SqlSyntaxError
from ._error import OperationalError

from ._func import validate_table_name
from ._func import validate_attr_name
from ._func import append_table
from ._func import connect_sqlite_db_mem
from ._error import (
NullDatabaseConnectionError,
TableNotFoundError,
AttributeNotFoundError,
InvalidTableNameError,
InvalidAttributeNameError,
SqlSyntaxError,
OperationalError
)
from ._func import (
validate_table_name,
validate_attr_name,
append_table,
connect_sqlite_db_mem
)
24 changes: 14 additions & 10 deletions simplesqlite/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@

from .sqlquery import SqlQuery
from .converter import RecordConvertor
from ._error import AttributeNotFoundError
from ._error import NullDatabaseConnectionError
from ._error import TableNotFoundError
from ._error import InvalidTableNameError
from ._error import InvalidAttributeNameError
from ._error import OperationalError
from ._func import connect_sqlite_db_mem
from ._func import validate_table_name
from ._func import validate_attr_name
from ._func import MEMORY_DB_NAME
from ._error import (
AttributeNotFoundError,
NullDatabaseConnectionError,
TableNotFoundError,
InvalidTableNameError,
InvalidAttributeNameError,
OperationalError
)
from ._func import (
connect_sqlite_db_mem,
validate_table_name,
validate_attr_name,
MEMORY_DB_NAME
)


class SimpleSQLite(object):
Expand Down
8 changes: 4 additions & 4 deletions simplesqlite/sqlquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ def to_value_str(cls, value):
>>> SqlQuery.to_value_str(None)
'NULL'
"""
from dataproperty.type import IntegerTypeChecker
from dataproperty.type import FloatTypeChecker

from dataproperty import (IntegerType, FloatType)

if value is None:
return "NULL"

if any([
IntegerTypeChecker(value).is_type(),
FloatTypeChecker(value).is_type()
IntegerType(value).is_type(),
FloatType(value).is_type()
]):
return str(value)

Expand Down
1,316 changes: 0 additions & 1,316 deletions test/data/Python (programming language) - Wikipedia, the free encyclopedia.html

This file was deleted.

457 changes: 457 additions & 0 deletions test/data/python - Wiktionary.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/test_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class Test_SimpleSQLite_create_table_from_tabledata:

@pytest.mark.parametrize(["filename"], [
["Python (programming language) - Wikipedia, the free encyclopedia.html"],
["python - Wiktionary.html"],
])
def test_smoke(self, tmpdir, filename):
p = tmpdir.join("tmp.db")
Expand All @@ -25,7 +25,7 @@ def test_smoke(self, tmpdir, filename):
test_data_file_path = os.path.join(
os.path.dirname(__file__), "data", filename)
loader_factory = ptr.TableFileLoaderFactory(test_data_file_path)
loader = loader_factory.create_from_file_path()
loader = loader_factory.create_from_path()

success_count = 0

Expand All @@ -39,8 +39,8 @@ def test_smoke(self, tmpdir, filename):
con.create_table_from_tabledata(
ptr.SQLiteTableDataSanitizer(tabledata).sanitize())
success_count += 1
except ValueError:
pass
except ValueError as e:
print(e)

con.commit()

Expand Down

0 comments on commit 2d9a9c0

Please sign in to comment.