Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
senpy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
senpy
senpy
Commits
b484b453
Commit
b484b453
authored
Sep 29, 2015
by
J. Fernando Sánchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added indentation and default plugins
* setup.py:
parent
7c2e0dde
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
13 deletions
+17
-13
senpy/__init__.py
senpy/__init__.py
+0
-4
senpy/__main__.py
senpy/__main__.py
+8
-4
senpy/extensions.py
senpy/extensions.py
+2
-2
senpy/models.py
senpy/models.py
+1
-1
setup.py
setup.py
+2
-1
test-requirements.txt
test-requirements.txt
+3
-0
tests/extensions_test/__init__.py
tests/extensions_test/__init__.py
+1
-1
No files found.
senpy/__init__.py
View file @
b484b453
...
...
@@ -17,7 +17,3 @@
"""
Sentiment analysis server in Python
"""
import
extensions
import
blueprints
import
plugins
senpy/__main__.py
View file @
b484b453
...
...
@@ -44,6 +44,10 @@ if __name__ == '__main__':
action
=
'store_true'
,
default
=
False
,
help
=
'Run the application in debug mode'
)
parser
.
add_argument
(
'--default-plugins'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Run the application in debug mode'
)
parser
.
add_argument
(
'--host'
,
type
=
str
,
default
=
"127.0.0.1"
,
...
...
@@ -62,14 +66,14 @@ if __name__ == '__main__':
logging
.
basicConfig
(
level
=
getattr
(
logging
,
args
.
level
))
app
=
Flask
(
__name__
)
app
.
debug
=
args
.
debug
sp
=
Senpy
(
app
,
args
.
plugins_folder
)
sp
=
Senpy
(
app
,
args
.
plugins_folder
,
default_plugins
=
args
.
default_plugins
)
sp
.
activate_all
()
import
logging
http_server
=
WSGIServer
((
args
.
host
,
args
.
port
),
app
)
try
:
print
"Server running on port %s:%d. Ctrl+C to quit"
%
(
args
.
host
,
args
.
port
)
print
(
"Server running on port %s:%d. Ctrl+C to quit"
%
(
args
.
host
,
args
.
port
)
)
http_server
.
serve_forever
()
except
KeyboardInterrupt
:
http_server
.
stop
()
print
"Bye!"
print
(
"Bye!"
)
senpy/extensions.py
View file @
b484b453
...
...
@@ -27,14 +27,14 @@ class Senpy(object):
""" Default Senpy extension for Flask """
def
__init__
(
self
,
app
=
None
,
plugin_folder
=
"plugins"
,
base_plugins
=
Tru
e
):
def
__init__
(
self
,
app
=
None
,
plugin_folder
=
"plugins"
,
default_plugins
=
Fals
e
):
self
.
app
=
app
self
.
_search_folders
=
set
()
self
.
_outdated
=
True
self
.
add_folder
(
plugin_folder
)
if
base
_plugins
:
if
default
_plugins
:
base_folder
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"plugins"
)
self
.
add_folder
(
base_folder
)
...
...
senpy/models.py
View file @
b484b453
...
...
@@ -154,7 +154,7 @@ class Leaf(dict):
' type="application/ld+json"'
%
url
)
}
del
js
[
"@context"
]
return
FlaskResponse
(
json
.
dumps
(
js
),
return
FlaskResponse
(
json
.
dumps
(
js
,
indent
=
4
),
status
=
self
.
get
(
"status"
,
200
),
headers
=
headers
,
mimetype
=
"application/json"
)
...
...
setup.py
View file @
b484b453
...
...
@@ -15,7 +15,7 @@ except AttributeError:
install_reqs
=
[
str
(
ir
.
req
)
for
ir
in
install_reqs
]
test_reqs
=
[
str
(
ir
.
req
)
for
ir
in
test_reqs
]
VERSION
=
"0.4.
6
"
VERSION
=
"0.4.
7
"
setup
(
name
=
'senpy'
,
...
...
@@ -34,5 +34,6 @@ extendable, so new algorithms and sources can be used.
classifiers
=
[],
install_requires
=
install_reqs
,
tests_require
=
test_reqs
,
test_suite
=
"nose.collector"
,
include_package_data
=
True
,
)
test-requirements.txt
View file @
b484b453
nose
mock
pbr
tests/extensions_test/__init__.py
View file @
b484b453
...
...
@@ -15,7 +15,7 @@ class ExtensionsTest(TestCase):
def
create_app
(
self
):
self
.
app
=
Flask
(
"test_extensions"
)
self
.
dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
".."
)
self
.
senpy
=
Senpy
(
plugin_folder
=
self
.
dir
,
base
_plugins
=
False
)
self
.
senpy
=
Senpy
(
plugin_folder
=
self
.
dir
,
default
_plugins
=
False
)
self
.
senpy
.
init_app
(
self
.
app
)
self
.
senpy
.
activate_plugin
(
"Dummy"
,
sync
=
True
)
return
self
.
app
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment