Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kodex
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
kodex
Commits
a300fb77
Commit
a300fb77
authored
Mar 19, 2018
by
Yannick Chudy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.6.1 log formating, visualisation url parameters
parent
6402cf81
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
20 deletions
+33
-20
__init__.py
botapad/__init__.py
+13
-8
botapadapp.py
botapadapp.py
+16
-10
setup.py
setup.py
+4
-2
No files found.
botapad/__init__.py
View file @
a300fb77
...
@@ -99,7 +99,7 @@ def namedtuple_with_defaults(typename, field_names, default_values=()):
...
@@ -99,7 +99,7 @@ def namedtuple_with_defaults(typename, field_names, default_values=()):
T
.
__new__
.
__defaults__
=
tuple
(
prototype
)
T
.
__new__
.
__defaults__
=
tuple
(
prototype
)
return
T
return
T
#
""
, text , @ , # , + , % , = , ! , (float) ,[default]
#
label
, text , @ , # , + , % , = , ! , (float) ,[default]
Prop
=
namedtuple_with_defaults
(
'Prop'
,
[
'name'
,
'type'
,
'isref'
,
'isindex'
,
'ismulti'
,
'isproj'
,
'iscliq'
,
'isignored'
,
'direction'
,
'weight'
,
'value'
],
default_values
=
()
)
Prop
=
namedtuple_with_defaults
(
'Prop'
,
[
'name'
,
'type'
,
'isref'
,
'isindex'
,
'ismulti'
,
'isproj'
,
'iscliq'
,
'isignored'
,
'direction'
,
'weight'
,
'value'
],
default_values
=
()
)
...
@@ -208,15 +208,17 @@ class Botapad(object):
...
@@ -208,15 +208,17 @@ class Botapad(object):
try
:
try
:
url
=
convert_url
(
path
)
url
=
convert_url
(
path
)
self
.
log
(
" * Converting url
%
s to
%
s"
%
(
path
,
url
)
)
self
.
log
(
" * Converting url
%
s to
%
s"
%
(
path
,
url
)
)
self
.
log
(
" * Downloading
%
s
%
s
\n
"
%
(
url
,
separator
))
self
.
log
(
" * Downloading
%
s
%
s"
%
(
url
,
separator
))
r
=
requests
.
get
(
url
)
r
=
requests
.
get
(
url
)
print
r
content
=
r
.
text
content
=
r
.
text
self
.
log
(
"
%
s,
%
s
\n
"
%
(
r
,
len
(
content
)))
# bug BOM ggdoc
# bug BOM ggdoc
if
content
[
0
:
1
]
==
u'
\ufeff
'
:
if
content
[
0
:
1
]
==
u'
\ufeff
'
:
content
=
content
[
1
:]
content
=
content
[
1
:]
lines
=
content
.
split
(
'
\n
'
)
lines
=
content
.
split
(
'
\n
'
)
except
:
except
:
raise
raise
BotapadURLError
(
"Can't download
%
s"
%
url
,
url
)
raise
BotapadURLError
(
"Can't download
%
s"
%
url
,
url
)
else
:
else
:
...
@@ -381,7 +383,11 @@ class Botapad(object):
...
@@ -381,7 +383,11 @@ class Botapad(object):
start
=
0
start
=
0
end
=
None
end
=
None
props
=
props
[
start
:
end
]
props
=
props
[
start
:
end
]
print
"props"
,
props
self
.
log
(
"
\n
* @
%
s : Props "
%
label
)
self
.
log
(
" (
%
s)"
%
","
.
join
(
Prop
()
.
_fields
)
)
for
e
in
props
:
self
.
log
(
"
%
s"
%
str
([
v
for
v
in
e
])
)
names
=
[
k
.
name
for
k
in
props
]
names
=
[
k
.
name
for
k
in
props
]
projs
=
[
k
.
name
for
k
in
props
if
k
.
isproj
]
projs
=
[
k
.
name
for
k
in
props
if
k
.
isproj
]
...
@@ -412,7 +418,7 @@ class Botapad(object):
...
@@ -412,7 +418,7 @@ class Botapad(object):
self
.
current
=
(
VERTEX
,
label
,
props
)
self
.
current
=
(
VERTEX
,
label
,
props
)
if
not
label
in
self
.
nodetypes
:
if
not
label
in
self
.
nodetypes
:
self
.
log
(
"
* posting @
%
s [
%
s]"
%
(
label
,
", "
.
join
(
names
))
,
indexes
,
projs
)
self
.
log
(
"
\n
>> posting @
%
s [
%
s] [
%
s] [
%
s]"
%
(
label
,
", "
.
join
(
names
)
,
", "
.
join
(
indexes
),
", "
.
join
(
projs
))
)
self
.
nodetypes
[
label
]
=
self
.
bot
.
post_nodetype
(
self
.
gid
,
label
,
label
,
typeprops
(
props
))
self
.
nodetypes
[
label
]
=
self
.
bot
.
post_nodetype
(
self
.
gid
,
label
,
label
,
typeprops
(
props
))
self
.
node_headers
[
label
]
=
props
self
.
node_headers
[
label
]
=
props
...
@@ -424,7 +430,7 @@ class Botapad(object):
...
@@ -424,7 +430,7 @@ class Botapad(object):
if
"label"
not
in
names
:
props
=
[
Prop
(
name
=
"label"
,
type
=
Text
(),
value
=
""
)]
+
props
if
"label"
not
in
names
:
props
=
[
Prop
(
name
=
"label"
,
type
=
Text
(),
value
=
""
)]
+
props
if
"weight"
not
in
names
:
props
=
[
Prop
(
name
=
"weight"
,
type
=
Numeric
(),
value
=
1.
)]
+
props
if
"weight"
not
in
names
:
props
=
[
Prop
(
name
=
"weight"
,
type
=
Numeric
(),
value
=
1.
)]
+
props
names
=
[
k
.
name
for
k
in
props
]
names
=
[
k
.
name
for
k
in
props
]
self
.
log
(
"
*
posting _
%
s [
%
s]"
%
(
label
,
", "
.
join
(
names
))
)
self
.
log
(
"
>>
posting _
%
s [
%
s]"
%
(
label
,
", "
.
join
(
names
))
)
self
.
edgetypes
[
label
]
=
self
.
bot
.
post_edgetype
(
self
.
gid
,
label
,
""
,
typeprops
(
props
))
self
.
edgetypes
[
label
]
=
self
.
bot
.
post_edgetype
(
self
.
gid
,
label
,
""
,
typeprops
(
props
))
self
.
edge_headers
[
label
]
=
props
self
.
edge_headers
[
label
]
=
props
...
@@ -521,7 +527,7 @@ class Botapad(object):
...
@@ -521,7 +527,7 @@ class Botapad(object):
# post nodes
# post nodes
node
=
None
node
=
None
self
.
log
(
" [POST] @
%
s
%
s
"
%
(
len
(
payload
),
label
)
,
names
,
index_props
)
self
.
log
(
" [POST] @
%
s
%
s
[
%
s] (
%
s)"
%
(
len
(
payload
),
label
,
", "
.
join
(
names
)
,
", "
.
join
([
"
%
s"
%
e
for
e
in
index_props
])
)
)
for
node
,
uuid
in
self
.
bot
.
post_nodes
(
self
.
gid
,
iter
(
payload
)):
for
node
,
uuid
in
self
.
bot
.
post_nodes
(
self
.
gid
,
iter
(
payload
)):
key
=
"
%
s"
%
(
""
.
join
([
node
[
'properties'
][
names
[
i
]]
for
i
in
index_props
]))
key
=
"
%
s"
%
(
""
.
join
([
node
[
'properties'
][
names
[
i
]]
for
i
in
index_props
]))
...
@@ -685,7 +691,6 @@ class Botapad(object):
...
@@ -685,7 +691,6 @@ class Botapad(object):
self
.
log
(
" * [Projector] posting _
%% %
s
%
s
%
s "
%
(
len
(
edges
),
direction
,
etname
)
)
self
.
log
(
" * [Projector] posting _
%% %
s
%
s
%
s "
%
(
len
(
edges
),
direction
,
etname
)
)
for
e
in
self
.
bot
.
post_edges
(
self
.
gid
,
iter
(
edges
),
extra
=
lambda
x
:
etname
)
:
for
e
in
self
.
bot
.
post_edges
(
self
.
gid
,
iter
(
edges
),
extra
=
lambda
x
:
etname
)
:
self
.
debug
(
e
)
self
.
debug
(
e
)
print
(
e
)
def
main
():
def
main
():
...
...
botapadapp.py
View file @
a300fb77
...
@@ -423,7 +423,10 @@ def botimport(repo, padurl, gid, content_type):
...
@@ -423,7 +423,10 @@ def botimport(repo, padurl, gid, content_type):
reader
=
args
.
get
(
"format"
,
"csv"
)
reader
=
args
.
get
(
"format"
,
"csv"
)
args
=
dict
(
request
.
args
)
args
=
dict
(
zip
(
request
.
args
.
keys
(),
request
.
args
.
values
()
))
args
[
's'
]
=
padurl
args
[
's'
]
=
padurl
if
padurl
:
if
padurl
:
...
@@ -442,17 +445,21 @@ def botimport(repo, padurl, gid, content_type):
...
@@ -442,17 +445,21 @@ def botimport(repo, padurl, gid, content_type):
# gviz
# gviz
'el'
:
"#viz"
,
'el'
:
"#viz"
,
'background_color'
:
color
,
'background_color'
:
color
,
'initial_size'
:
16
,
'user_font_size'
:
1
,
# todo check where used
'
user_vtx_size'
:
2
,
'
initial_size'
:
6
,
'vtx_size'
:
args
.
get
(
"vertex_size"
,
2
),
'vtx_size'
:
args
.
get
(
"vertex_size"
,
2
),
'user_font_size'
:
int
(
args
.
get
(
"user_font_size"
,
1
)
),
'user_vtx_size'
:
int
(
args
.
get
(
"user_vtx_size"
,
2
)
),
'show_text'
:
0
if
args
.
get
(
"no_text"
,
None
)
else
1
,
# removes vertex text
'show_text'
:
0
if
args
.
get
(
"no_text"
,
None
)
else
1
,
# removes vertex text
'show_nodes'
:
0
if
args
.
get
(
"no_nodes"
,
None
)
else
1
,
# removes vertex only
'show_nodes'
:
0
if
args
.
get
(
"no_nodes"
,
None
)
else
1
,
# removes vertex only
'show_edges'
:
0
if
args
.
get
(
"no_edges"
,
None
)
else
1
,
# removes edges
'show_edges'
:
0
if
args
.
get
(
"no_edges"
,
None
)
else
1
,
# removes edges
'show_images'
:
0
if
args
.
get
(
"no_images"
,
None
)
else
1
,
# removes vertex images
'show_images'
:
0
if
args
.
get
(
"no_images"
,
None
)
else
1
,
# removes vertex images
'auto_rotate'
:
0
,
'auto_rotate'
:
int
(
args
.
get
(
"auto_rotate"
,
0
))
,
'adaptive_zoom'
:
1
,
'adaptive_zoom'
:
int
(
args
.
get
(
"adaptive_zoom"
,
1
))
,
}
}
...
@@ -503,7 +510,6 @@ def botimport(repo, padurl, gid, content_type):
...
@@ -503,7 +510,6 @@ def botimport(repo, padurl, gid, content_type):
print
pzeros
,
graph
.
summary
()
print
pzeros
,
graph
.
summary
()
graph
=
subgraph
(
graph
,
length
=
length
,
cut
=
cut
,
pzeros
=
pzeros
,
add_loops
=
addloops
,
mode
=
mode
)
graph
=
subgraph
(
graph
,
length
=
length
,
cut
=
cut
,
pzeros
=
pzeros
,
add_loops
=
addloops
,
mode
=
mode
)
print
LENMIN
,
graph
.
summary
()
data
=
export_graph
(
graph
,
id_attribute
=
'uuid'
)
data
=
export_graph
(
graph
,
id_attribute
=
'uuid'
)
...
...
setup.py
View file @
a300fb77
...
@@ -4,6 +4,8 @@ from setuptools import setup, find_packages
...
@@ -4,6 +4,8 @@ from setuptools import setup, find_packages
"""
"""
0.6.1 log formating
visualisation url parameters
0.6 added edge direction with reification > or < where
%
===
%
<
0.6 added edge direction with reification > or < where
%
===
%
<
"""
"""
...
@@ -19,7 +21,7 @@ required = []
...
@@ -19,7 +21,7 @@ required = []
setup
(
setup
(
name
=
'botapad'
,
name
=
'botapad'
,
version
=
'0.6'
,
version
=
'0.6
.1
'
,
description
=
'padagraph pad parser'
,
description
=
'padagraph pad parser'
,
author
=
'ynnk, a-tsioh'
,
author
=
'ynnk, a-tsioh'
,
author_email
=
'contact@padagraph.io'
,
author_email
=
'contact@padagraph.io'
,
...
...
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