Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
ipaaca
Commits
3b5feab4
Commit
3b5feab4
authored
13 years ago
by
Ramin Yaghoubzadeh
Browse files
Options
Downloads
Patches
Plain Diff
Removed second parameter from IU _modify_links() - it was not used anymore after refactoring.
Fixed ipaacaspam.py test. Improved .gitignore
parent
4579f9cd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+4
-0
4 additions, 0 deletions
.gitignore
python/src/ipaaca.py
+6
-6
6 additions, 6 deletions
python/src/ipaaca.py
python/test/src/ipaacaspam.py
+12
-0
12 additions, 0 deletions
python/test/src/ipaacaspam.py
with
22 additions
and
6 deletions
.gitignore
+
4
−
0
View file @
3b5feab4
...
@@ -10,3 +10,7 @@ java/.classpath
...
@@ -10,3 +10,7 @@ java/.classpath
.project
.project
.classpath
.classpath
**/.*.swp
**/.*.swp
.*.sw[a-z]
*.un~
Session.vim
This diff is collapsed.
Click to expand it.
python/src/ipaaca.py
+
6
−
6
View file @
3b5feab4
...
@@ -210,23 +210,23 @@ class IUInterface(object): #{{{
...
@@ -210,23 +210,23 @@ class IUInterface(object): #{{{
'''
Attempt to add links if the conditions are met
'''
Attempt to add links if the conditions are met
and send an update message. Then call the local setter.
'''
and send an update message. Then call the local setter.
'''
if
not
hasattr
(
targets
,
'
__iter__
'
):
targets
=
[
targets
]
if
not
hasattr
(
targets
,
'
__iter__
'
):
targets
=
[
targets
]
self
.
_modify_links
(
links
=
self
,
is_delta
=
True
,
new_links
=
{
type
:
targets
},
links_to_remove
=
{},
writer_name
=
writer_name
)
self
.
_modify_links
(
is_delta
=
True
,
new_links
=
{
type
:
targets
},
links_to_remove
=
{},
writer_name
=
writer_name
)
self
.
_add_and_remove_links
(
add
=
{
type
:
targets
},
remove
=
{}
)
self
.
_add_and_remove_links
(
add
=
{
type
:
targets
},
remove
=
{}
)
def
remove_links
(
self
,
type
,
targets
,
writer_name
=
None
):
def
remove_links
(
self
,
type
,
targets
,
writer_name
=
None
):
'''
Attempt to remove links if the conditions are met
'''
Attempt to remove links if the conditions are met
and send an update message. Then call the local setter.
'''
and send an update message. Then call the local setter.
'''
if
not
hasattr
(
targets
,
'
__iter__
'
):
targets
=
[
targets
]
if
not
hasattr
(
targets
,
'
__iter__
'
):
targets
=
[
targets
]
self
.
_modify_links
(
links
=
self
,
is_delta
=
True
,
new_links
=
{},
links_to_remove
=
{
type
:
targets
},
writer_name
=
writer_name
)
self
.
_modify_links
(
is_delta
=
True
,
new_links
=
{},
links_to_remove
=
{
type
:
targets
},
writer_name
=
writer_name
)
self
.
_add_and_remove_links
(
add
=
{},
remove
=
{
type
:
targets
}
)
self
.
_add_and_remove_links
(
add
=
{},
remove
=
{
type
:
targets
}
)
def
modify_links
(
self
,
add
,
remove
,
writer_name
=
None
):
def
modify_links
(
self
,
add
,
remove
,
writer_name
=
None
):
'''
Attempt to modify links if the conditions are met
'''
Attempt to modify links if the conditions are met
and send an update message. Then call the local setter.
'''
and send an update message. Then call the local setter.
'''
self
.
_modify_links
(
links
=
self
,
is_delta
=
True
,
new_links
=
add
,
links_to_remove
=
remove
,
writer_name
=
writer_name
)
self
.
_modify_links
(
is_delta
=
True
,
new_links
=
add
,
links_to_remove
=
remove
,
writer_name
=
writer_name
)
self
.
_add_and_remove_links
(
add
=
add
,
remove
=
remove
)
self
.
_add_and_remove_links
(
add
=
add
,
remove
=
remove
)
def
set_links
(
self
,
links
,
writer_name
=
None
):
def
set_links
(
self
,
links
,
writer_name
=
None
):
'''
Attempt to set (replace) links if the conditions are met
'''
Attempt to set (replace) links if the conditions are met
and send an update message. Then call the local setter.
'''
and send an update message. Then call the local setter.
'''
self
.
_modify_links
(
links
=
self
,
is_delta
=
False
,
new_links
=
links
,
links_to_remove
=
{},
writer_name
=
writer_name
)
self
.
_modify_links
(
is_delta
=
False
,
new_links
=
links
,
links_to_remove
=
{},
writer_name
=
writer_name
)
self
.
_replace_links
(
links
=
links
)
self
.
_replace_links
(
links
=
links
)
def
get_links
(
self
,
type
):
def
get_links
(
self
,
type
):
return
set
(
self
.
_links
[
type
])
return
set
(
self
.
_links
[
type
])
...
@@ -300,7 +300,7 @@ class IU(IUInterface):#{{{
...
@@ -300,7 +300,7 @@ class IU(IUInterface):#{{{
self
.
revision_lock
=
threading
.
RLock
()
self
.
revision_lock
=
threading
.
RLock
()
self
.
_payload
=
Payload
(
iu
=
self
)
self
.
_payload
=
Payload
(
iu
=
self
)
def
_modify_links
(
self
,
links
,
is_delta
=
False
,
new_links
=
{},
links_to_remove
=
{},
writer_name
=
None
):
def
_modify_links
(
self
,
is_delta
=
False
,
new_links
=
{},
links_to_remove
=
{},
writer_name
=
None
):
if
self
.
committed
:
if
self
.
committed
:
raise
IUCommittedError
(
self
)
raise
IUCommittedError
(
self
)
with
self
.
revision_lock
:
with
self
.
revision_lock
:
...
@@ -412,7 +412,7 @@ class RemotePushIU(IUInterface):#{{{
...
@@ -412,7 +412,7 @@ class RemotePushIU(IUInterface):#{{{
self
.
_payload
=
Payload
(
iu
=
self
,
new_payload
=
payload
,
omit_init_update_message
=
True
)
self
.
_payload
=
Payload
(
iu
=
self
,
new_payload
=
payload
,
omit_init_update_message
=
True
)
self
.
_links
=
links
self
.
_links
=
links
def
_modify_links
(
self
,
links
,
is_delta
=
False
,
new_links
=
{},
links_to_remove
=
{},
writer_name
=
None
):
def
_modify_links
(
self
,
is_delta
=
False
,
new_links
=
{},
links_to_remove
=
{},
writer_name
=
None
):
"""
Modify the links: add or remove item from this payload remotely and send update.
"""
"""
Modify the links: add or remove item from this payload remotely and send update.
"""
if
self
.
committed
:
if
self
.
committed
:
raise
IUCommittedError
(
self
)
raise
IUCommittedError
(
self
)
...
...
This diff is collapsed.
Click to expand it.
python/test/src/ipaacaspam.py
+
12
−
0
View file @
3b5feab4
...
@@ -66,6 +66,7 @@ class Sender(object):
...
@@ -66,6 +66,7 @@ class Sender(object):
def
__init__
(
self
,
send_frequency
):
def
__init__
(
self
,
send_frequency
):
self
.
ob
=
ipaaca
.
OutputBuffer
(
'
PowerOut
'
)
self
.
ob
=
ipaaca
.
OutputBuffer
(
'
PowerOut
'
)
self
.
iu
=
ipaaca
.
IU
(
'
spam
'
)
self
.
iu
=
ipaaca
.
IU
(
'
spam
'
)
self
.
data_prefix
=
'
A
'
*
1024
;
self
.
iu
.
payload
=
{
'
data
'
:
'
0
'
}
self
.
iu
.
payload
=
{
'
data
'
:
'
0
'
}
self
.
ob
.
add
(
self
.
iu
)
self
.
ob
.
add
(
self
.
iu
)
self
.
counter
=
0
self
.
counter
=
0
...
@@ -79,6 +80,17 @@ class Sender(object):
...
@@ -79,6 +80,17 @@ class Sender(object):
time
.
sleep
(
self
.
delay
)
time
.
sleep
(
self
.
delay
)
self
.
counter
+=
1
self
.
counter
+=
1
self
.
iu
.
payload
[
'
data
'
]
=
str
(
self
.
counter
)
self
.
iu
.
payload
[
'
data
'
]
=
str
(
self
.
counter
)
#self.iu.payload = {
# 'data':self.data_prefix,
# 'data2':self.data_prefix,
# 'data3':self.data_prefix,
# 'data4':self.data_prefix,
# 'data5':self.data_prefix,
# 'data6':self.data_prefix,
# 'data7':self.data_prefix,
# 'data8':self.data_prefix,
# 'data9':self.data_prefix,
# }
if
self
.
counter
==
1000
:
if
self
.
counter
==
1000
:
print
"
Sent 1k updates at
"
,
int
(
1000.0
/
(
time
.
time
()
-
last_time
)),
"
Hz
"
print
"
Sent 1k updates at
"
,
int
(
1000.0
/
(
time
.
time
()
-
last_time
)),
"
Hz
"
last_time
=
time
.
time
()
last_time
=
time
.
time
()
...
...
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