Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adham Hashibon
force-bdss
Commits
f816ba15
Commit
f816ba15
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Removed ZMQSocketURL as it's now only living in the UI
parent
3fde61c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!92
Removed ZMQSocketURL as it's now only living in the UI
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
force_bdss/api.py
+1
-1
1 addition, 1 deletion
force_bdss/api.py
force_bdss/local_traits.py
+1
-23
1 addition, 23 deletions
force_bdss/local_traits.py
force_bdss/tests/test_local_traits.py
+1
-21
1 addition, 21 deletions
force_bdss/tests/test_local_traits.py
with
3 additions
and
45 deletions
force_bdss/api.py
+
1
−
1
View file @
f816ba15
...
...
@@ -28,4 +28,4 @@ from .notification_listeners.base_notification_listener import BaseNotificationL
from
.notification_listeners.base_notification_listener_factory
import
BaseNotificationListenerFactory
# noqa
from
.notification_listeners.base_notification_listener_model
import
BaseNotificationListenerModel
# noqa
from
.local_traits
import
(
ZMQSocketURL
,
Identifier
)
# noqa
from
.local_traits
import
Identifier
# noqa
This diff is collapsed.
Click to expand it.
force_bdss/local_traits.py
+
1
−
23
View file @
f816ba15
import
re
from
traits.api
import
Regex
,
BaseStr
,
String
from
traits.api
import
Regex
,
String
#: Used for variable names, but allow also empty string as it's the default
#: case and it will be present if the workflow is saved before actually
#: specifying the value.
Identifier
=
Regex
(
regex
=
"
(^[^\d\W]\w*\Z|^\Z)
"
)
class
ZMQSocketURL
(
BaseStr
):
def
validate
(
self
,
object
,
name
,
value
):
super
(
ZMQSocketURL
,
self
).
validate
(
object
,
name
,
value
)
m
=
re
.
match
(
"
tcp://(
\\
d{1,3})\.(
\\
d{1,3})\.(
\\
d{1,3})\.(
\\
d{1,3}):(
\\
d+)
"
,
value
)
if
m
is
None
:
self
.
error
(
object
,
name
,
value
)
a
,
b
,
c
,
d
,
port
=
m
.
groups
()
if
not
all
(
map
(
lambda
x
:
0
<=
int
(
x
)
<=
255
,
(
a
,
b
,
c
,
d
))):
self
.
error
(
object
,
name
,
value
)
if
not
(
1
<=
int
(
port
)
<=
65535
):
self
.
error
(
object
,
name
,
value
)
return
value
#: Identifies a CUBA type with its key. At the moment a String with
#: no validation, but will come later.
CUBAType
=
String
()
This diff is collapsed.
Click to expand it.
force_bdss/tests/test_local_traits.py
+
1
−
21
View file @
f816ba15
import
unittest
from
traits.api
import
HasStrictTraits
,
TraitError
from
force_bdss.local_traits
import
Identifier
,
CUBAType
,
ZMQSocketURL
from
force_bdss.local_traits
import
Identifier
,
CUBAType
class
Traited
(
HasStrictTraits
):
val
=
Identifier
()
cuba
=
CUBAType
()
socket_url
=
ZMQSocketURL
()
class
TestLocalTraits
(
unittest
.
TestCase
):
...
...
@@ -26,22 +25,3 @@ class TestLocalTraits(unittest.TestCase):
c
=
Traited
()
c
.
cuba
=
"
PRESSURE
"
self
.
assertEqual
(
c
.
cuba
,
"
PRESSURE
"
)
def
test_zmq_socket_url
(
self
):
c
=
Traited
()
for
working
in
[
"
tcp://127.0.0.1:12345
"
,
"
tcp://255.255.255.255:65535
"
,
"
tcp://1.1.1.1:65535
"
]:
c
.
socket_url
=
working
self
.
assertEqual
(
c
.
socket_url
,
working
)
for
broken
in
[
"
tcp://270.0.0.1:12345
"
,
"
tcp://0.270.0.1:12345
"
,
"
tcp://0.0.270.1:12345
"
,
"
tcp://0.0.0.270:12345
"
,
"
url://255.255.255.255:65535
"
,
"
whatever
"
,
"
tcp://1.1.1.1:100000
"
]:
with
self
.
assertRaises
(
TraitError
):
c
.
socket_url
=
broken
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment