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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
Social Cognitive Systems
ipaaca
Commits
52810bb2
Commit
52810bb2
authored
2 years ago
by
Ramin Yaghoubzadeh Torky
Browse files
Options
Downloads
Patches
Plain Diff
Better compliance with Python >=3.10 (comparison warnings)
parent
4e41fb25
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ipaacalib/python/src/ipaaca/buffer.py
+15
-9
15 additions, 9 deletions
ipaacalib/python/src/ipaaca/buffer.py
ipaacalib/python/src/ipaaca/converter.py
+2
-2
2 additions, 2 deletions
ipaacalib/python/src/ipaaca/converter.py
with
17 additions
and
11 deletions
ipaacalib/python/src/ipaaca/buffer.py
+
15
−
9
View file @
52810bb2
...
...
@@ -4,7 +4,7 @@
# "Incremental Processing Architecture
# for Artificial Conversational Agents".
#
# Copyright (c) 2009-20
15
Social Cognitive Systems Group
# Copyright (c) 2009-20
22
Social Cognitive Systems Group
# CITEC, Bielefeld University
#
# http://opensource.cit-ec.de/projects/ipaaca/
...
...
@@ -171,6 +171,12 @@ class Buffer(object):
return
FrozenIUStore
(
original_iu_store
=
self
.
_iu_store
)
iu_store
=
property
(
fget
=
_get_frozen_iu_store
,
doc
=
'
Copy-on-read version of the internal IU store
'
)
def
_get_channel
(
self
):
return
self
.
_channel
channel
=
property
(
fget
=
_get_channel
,
doc
=
'
The IPAACA channel the buffer is connected to.
'
)
def
register_handler
(
self
,
handler_function
,
for_event_types
=
None
,
for_categories
=
None
):
"""
Register a new IU event handler function.
...
...
@@ -307,7 +313,7 @@ class InputBuffer(Buffer):
event -- a converted RSB event
'''
type_
=
type
(
event
.
data
)
if
type_
is
ipaaca
.
iu
.
RemotePushIU
:
if
type_
==
ipaaca
.
iu
.
RemotePushIU
:
# a new IU
if
event
.
data
.
uid
not
in
self
.
_iu_store
:
self
.
_iu_store
[
event
.
data
.
uid
]
=
event
.
data
...
...
@@ -320,7 +326,7 @@ class InputBuffer(Buffer):
# done via the resend request mechanism).
self
.
_iu_store
[
event
.
data
.
uid
]
=
event
.
data
event
.
data
.
buffer
=
self
elif
type_
is
ipaaca
.
iu
.
RemoteMessage
:
elif
type_
==
ipaaca
.
iu
.
RemoteMessage
:
# a new Message, an ephemeral IU that is removed after calling handlers
self
.
_iu_store
[
event
.
data
.
uid
]
=
event
.
data
event
.
data
.
buffer
=
self
...
...
@@ -329,7 +335,7 @@ class InputBuffer(Buffer):
else
:
if
event
.
data
.
uid
not
in
self
.
_iu_store
:
if
(
self
.
_resend_active
and
not
type_
is
ipaaca
.
ipaaca_pb2
.
IURetraction
):
not
type_
==
ipaaca
.
ipaaca_pb2
.
IURetraction
):
# send resend request to remote server, IURetraction is ignored
try
:
self
.
_request_remote_resend
(
event
)
...
...
@@ -340,7 +346,7 @@ class InputBuffer(Buffer):
LOGGER
.
warning
(
"
Received an update for an IU which we did not receive before.
"
)
return
# an update to an existing IU
if
type_
is
ipaaca
.
ipaaca_pb2
.
IURetraction
:
if
type_
==
ipaaca
.
ipaaca_pb2
.
IURetraction
:
# IU retraction (cannot be triggered remotely)
iu
=
self
.
_iu_store
[
event
.
data
.
uid
]
iu
.
_revision
=
event
.
data
.
revision
...
...
@@ -351,18 +357,18 @@ class InputBuffer(Buffer):
# Notify only for remotely triggered events;
# Discard updates that originate from this buffer
return
if
type_
is
ipaaca
.
ipaaca_pb2
.
IUCommission
:
if
type_
==
ipaaca
.
ipaaca_pb2
.
IUCommission
:
# IU commit
iu
=
self
.
_iu_store
[
event
.
data
.
uid
]
iu
.
_apply_commission
()
iu
.
_revision
=
event
.
data
.
revision
self
.
call_iu_event_handlers
(
event
.
data
.
uid
,
local
=
False
,
event_type
=
ipaaca
.
iu
.
IUEventType
.
COMMITTED
,
category
=
iu
.
category
)
elif
type_
is
ipaaca
.
converter
.
IUPayloadUpdate
:
elif
type_
==
ipaaca
.
converter
.
IUPayloadUpdate
:
# IU payload update
iu
=
self
.
_iu_store
[
event
.
data
.
uid
]
iu
.
_apply_update
(
event
.
data
)
self
.
call_iu_event_handlers
(
event
.
data
.
uid
,
local
=
False
,
event_type
=
ipaaca
.
iu
.
IUEventType
.
UPDATED
,
category
=
iu
.
category
)
elif
type_
is
ipaaca
.
converter
.
IULinkUpdate
:
elif
type_
==
ipaaca
.
converter
.
IULinkUpdate
:
# IU link update
iu
=
self
.
_iu_store
[
event
.
data
.
uid
]
iu
.
_apply_link_update
(
event
.
data
)
...
...
@@ -509,7 +515,7 @@ class OutputBuffer(Buffer):
return
0
iu
=
self
.
_iu_store
[
iu_resend_request_pack
.
uid
]
with
iu
.
revision_lock
:
if
iu_resend_request_pack
.
hidden_scope_name
is
not
None
and
iu_resend_request_pack
.
hidden_scope_name
is
not
''
:
if
iu_resend_request_pack
.
hidden_scope_name
is
not
None
and
iu_resend_request_pack
.
hidden_scope_name
!=
''
:
informer
=
self
.
_get_informer
(
iu_resend_request_pack
.
hidden_scope_name
)
informer
.
publishData
(
iu
)
return
iu
.
revision
...
...
This diff is collapsed.
Click to expand it.
ipaacalib/python/src/ipaaca/converter.py
+
2
−
2
View file @
52810bb2
...
...
@@ -4,7 +4,7 @@
# "Incremental Processing Architecture
# for Artificial Conversational Agents".
#
# Copyright (c) 2009-20
14
Social Cognitive Systems Group
# Copyright (c) 2009-20
22
Social Cognitive Systems Group
# CITEC, Bielefeld University
#
# http://opensource.cit-ec.de/projects/ipaaca/
...
...
@@ -274,7 +274,7 @@ class IUConverter(ConverterBase):
read_only
=
pbo
.
read_only
,
owner_name
=
pbo
.
owner_name
,
category
=
pbo
.
category
,
payload_type
=
'
str
'
if
pbo
.
payload_type
is
'
MAP
'
else
pbo
.
payload_type
,
payload_type
=
'
str
'
if
pbo
.
payload_type
==
'
MAP
'
else
pbo
.
payload_type
,
committed
=
pbo
.
committed
,
payload
=
_payload
,
links
=
_links
)
...
...
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