Skip to content

Commit d59078c

Browse files
committed
init commit
1 parent dcaec83 commit d59078c

File tree

12 files changed

+517
-12
lines changed

12 files changed

+517
-12
lines changed

.gitignore

Lines changed: 126 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,132 @@ $RECYCLE.BIN/
3939
.Trashes
4040
.VolumeIcon.icns
4141

42+
# Byte-compiled / optimized / DLL files
43+
__pycache__/
44+
*.py[cod]
45+
*$py.class
46+
47+
# C extensions
48+
*.so
49+
50+
# Distribution / packaging
51+
.Python
52+
build/
53+
develop-eggs/
54+
dist/
55+
downloads/
56+
eggs/
57+
.eggs/
58+
lib/
59+
lib64/
60+
parts/
61+
sdist/
62+
var/
63+
wheels/
64+
pip-wheel-metadata/
65+
share/python-wheels/
66+
*.egg-info/
67+
.installed.cfg
68+
*.egg
69+
MANIFEST
70+
71+
# PyInstaller
72+
# Usually these files are written by a python script from a template
73+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
74+
*.manifest
75+
*.spec
76+
77+
# Installer logs
78+
pip-log.txt
79+
pip-delete-this-directory.txt
80+
81+
# Unit test / coverage reports
82+
htmlcov/
83+
.tox/
84+
.nox/
85+
.coverage
86+
.coverage.*
87+
.cache
88+
nosetests.xml
89+
coverage.xml
90+
*.cover
91+
*.py,cover
92+
.hypothesis/
93+
.pytest_cache/
94+
95+
# Translations
96+
*.mo
97+
*.pot
98+
99+
# Django stuff:
100+
*.log
101+
local_settings.py
102+
db.sqlite3
103+
db.sqlite3-journal
104+
105+
# Flask stuff:
106+
instance/
107+
.webassets-cache
108+
109+
# Scrapy stuff:
110+
.scrapy
111+
112+
# Sphinx documentation
113+
docs/_build/
114+
115+
# PyBuilder
116+
target/
117+
118+
# Jupyter Notebook
119+
.ipynb_checkpoints
120+
121+
# IPython
122+
profile_default/
123+
ipython_config.py
124+
125+
# pyenv
126+
.python-version
127+
128+
# pipenv
129+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
130+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
131+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
132+
# install all needed dependencies.
133+
#Pipfile.lock
134+
135+
# celery beat schedule file
136+
celerybeat-schedule
137+
138+
# SageMath parsed files
139+
*.sage.py
140+
141+
# Environments
142+
.env
143+
.venv
144+
env/
145+
venv/
146+
ENV/
147+
env.bak/
148+
venv.bak/
149+
150+
# Spyder project settings
151+
.spyderproject
152+
.spyproject
153+
154+
# Rope project settings
155+
.ropeproject
156+
157+
# mkdocs documentation
158+
/site
159+
160+
# mypy
161+
.mypy_cache/
162+
.dmypy.json
163+
dmypy.json
164+
165+
# Pyre type checker
166+
.pyre/
167+
42168
# Directories potentially created on remote AFP share
43169
.AppleDB
44170
.AppleDesktop
@@ -55,15 +181,3 @@ local/*
55181
*.json
56182
createItemMetadataFromCSV_*
57183
*.txt
58-
59-
# Environments
60-
.env
61-
.venv
62-
env/
63-
venv/
64-
ENV/
65-
env.bak/
66-
venv.bak/
67-
68-
# Rope project settings
69-
.ropeproject

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2019 MIT Libraries
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include LICENSE

Pipfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
pytest = "*"
8+
9+
[packages]
10+
requests = "*"
11+
structlog = "*"
12+
13+
[requires]
14+
python_version = "3.7"

Pipfile.lock

Lines changed: 159 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# dsaps

dsaps/__init__.py

Whitespace-only changes.

dsaps/cli.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import time
2+
3+
import click
4+
5+
from dsaps import models
6+
7+
8+
@click.group()
9+
@click.option('--url', envvar='DSPACE_URL')
10+
@click.option('-e', '--email', prompt='Enter email',
11+
help='The email of the user for authentication.')
12+
@click.option('-p', '--password', prompt='Enter password',
13+
envvar='TEST_PASS', hide_input=True,
14+
help='The password for authentication.')
15+
@click.pass_context
16+
def main(ctx, url, email, password):
17+
ctx.obj = {}
18+
print('Application start')
19+
client = models.Client(url, email, password)
20+
start_time = time.time()
21+
ctx.obj['client'] = client
22+
ctx.obj['start_time'] = start_time
23+
24+
25+
@main.command()
26+
@click.option('-f', '--field', prompt='Enter the field to be searched',
27+
help='The field to search.')
28+
@click.option('-s', '--string', prompt='Enter the string',
29+
help='The field to search.')
30+
@click.option('-t', '--search_type', prompt='Enter the type of search',
31+
help='The type of search.',
32+
type=click.Choice(['exists', 'doesnt_exist', 'equals',
33+
'not_equals', 'contains', 'doesnt_contain']),
34+
default='contains')
35+
@click.pass_context
36+
def search(ctx, field, string, search_type):
37+
# Temp function for testing
38+
client = ctx.obj['client']
39+
start_time = ctx.obj['start_time']
40+
item_links = client.filtered_item_search(field, string, search_type)
41+
print(item_links)
42+
models.elapsed_time(start_time, 'Elapsed time')
43+
44+
45+
if __name__ == '__main__':
46+
main()

0 commit comments

Comments
 (0)