Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
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
Model registry
Operate
Environments
Monitor
Incidents
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
Weblate
gajim
Commits
39c3afb5
Commit
39c3afb5
authored
15 years ago
by
steve-e
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused import and apply naming convention.
parent
fc01d32a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/caps.py
+19
-20
19 additions, 20 deletions
src/common/caps.py
with
19 additions
and
20 deletions
src/common/caps.py
+
19
−
20
View file @
39c3afb5
...
...
@@ -23,7 +23,6 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
from
itertools
import
*
import
gajim
import
helpers
...
...
@@ -89,31 +88,31 @@ class CapsCache(object):
__names
=
{}
def
__init__
(
ciself
,
hash_method
,
hash_
):
# cached into db
ci
self
.
hash_method
=
hash_method
ci
self
.
hash
=
hash_
ci
self
.
_features
=
[]
ci
self
.
_identities
=
[]
self
.
hash_method
=
hash_method
self
.
hash
=
hash_
self
.
_features
=
[]
self
.
_identities
=
[]
# not cached into db:
# have we sent the query?
# 0 == not queried
# 1 == queried
# 2 == got the answer
ci
self
.
queried
=
0
self
.
queried
=
0
def
_get_features
(
ci
self
):
return
ci
self
.
_features
def
_get_features
(
self
):
return
self
.
_features
def
_set_features
(
ci
self
,
value
):
ci
self
.
_features
=
[]
def
_set_features
(
self
,
value
):
self
.
_features
=
[]
for
feature
in
value
:
ci
self
.
_features
.
append
(
ci
self
.
__names
.
setdefault
(
feature
,
self
.
_features
.
append
(
self
.
__names
.
setdefault
(
feature
,
feature
))
features
=
property
(
_get_features
,
_set_features
)
def
_get_identities
(
ci
self
):
def
_get_identities
(
self
):
list_
=
[]
for
i
in
ci
self
.
_identities
:
for
i
in
self
.
_identities
:
# transforms it back in a dict
d
=
dict
()
d
[
'
category
'
]
=
i
[
0
]
...
...
@@ -125,20 +124,20 @@ class CapsCache(object):
d
[
'
name
'
]
=
i
[
3
]
list_
.
append
(
d
)
return
list_
def
_set_identities
(
ci
self
,
value
):
ci
self
.
_identities
=
[]
def
_set_identities
(
self
,
value
):
self
.
_identities
=
[]
for
identity
in
value
:
# dict are not hashable, so transform it into a tuple
t
=
(
identity
[
'
category
'
],
identity
.
get
(
'
type
'
),
identity
.
get
(
'
xml:lang
'
),
identity
.
get
(
'
name
'
))
ci
self
.
_identities
.
append
(
ci
self
.
__names
.
setdefault
(
t
,
t
))
self
.
_identities
.
append
(
self
.
__names
.
setdefault
(
t
,
t
))
identities
=
property
(
_get_identities
,
_set_identities
)
def
update
(
ci
self
,
identities
,
features
):
def
update
(
self
,
identities
,
features
):
# NOTE: self refers to CapsCache object, not to CacheItem
ci
self
.
identities
=
identities
ci
self
.
features
=
features
self
.
logger
.
add_caps_entry
(
ci
self
.
hash_method
,
ci
self
.
hash
,
self
.
identities
=
identities
self
.
features
=
features
self
.
logger
.
add_caps_entry
(
self
.
hash_method
,
self
.
hash
,
identities
,
features
)
self
.
__CacheItem
=
CacheItem
...
...
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