Skip to content

Commit

Permalink
second commit
Browse files Browse the repository at this point in the history
  • Loading branch information
p-baleine committed Jan 7, 2021
1 parent 19f5e9d commit 420c9fc
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.idea
*.log
tmp/

*.py[cod]
*.egg
build
htmlcov
__pycache__
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test:
$(MAKE) mypy

mypy:
poetry run mypy examples
Empty file added examples/__init__.py
Empty file.
10 changes: 2 additions & 8 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@
# )
# ]
# )
from naivesearch import InvertedIndex


def split_sentence(s):
return list(s)


class InvertedIndex:
def __init__(self, path_to_file, chunkers):
pass

def __getitem__(self, q):
return ['hoge', 'hoo']


index = InvertedIndex(
'/path/to/file', # FileReader('/path/to/file')
[
Expand Down
8 changes: 8 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[mypy]
check_untyped_defs = True
ignore_errors = False
ignore_missing_imports = True
strict_optional = True
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True
15 changes: 15 additions & 0 deletions naivesearch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import List, Optional, Protocol

class Chunker(Protocol):
def __call__(self, inputs: str) -> List[str]:
...


class InvertedIndex:
def __init__(self, path_to_file: str, chunkers: List[Chunker]):
pass

def __getitem__(self, q):
return ['hoge', 'hoo']


103 changes: 103 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ authors = ["Your Name <[email protected]>"]
python = "3.8.6"

[tool.poetry.dev-dependencies]
mypy = "^0.790"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit 420c9fc

Please sign in to comment.