Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Buquet
poezio
Commits
b685df50
Commit
b685df50
authored
Jun 30, 2016
by
Link Mauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove every now-useless usage of the Singleton function.
parent
d636d57d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
26 deletions
+2
-26
poezio/core/core.py
poezio/core/core.py
+1
-2
poezio/poezio.py
poezio/poezio.py
+1
-3
poezio/singleton.py
poezio/singleton.py
+0
-20
poezio/tabs/basetabs.py
poezio/tabs/basetabs.py
+0
-1
No files found.
poezio/core/core.py
View file @
b685df50
...
...
@@ -37,7 +37,6 @@ from poezio.fifo import Fifo
from
poezio.logger
import
logger
from
poezio.plugin_manager
import
PluginManager
from
poezio.roster
import
roster
from
poezio.singleton
import
Singleton
from
poezio.size_manager
import
SizeManager
from
poezio.text_buffer
import
TextBuffer
from
poezio.theming
import
get_theme
...
...
@@ -69,7 +68,7 @@ class Core(object):
self
.
status
=
Status
(
show
=
status
,
message
=
config
.
get
(
'status_message'
))
self
.
running
=
True
self
.
xmpp
=
Singleton
(
connection
.
Connection
)
self
.
xmpp
=
connection
.
Connection
(
)
self
.
xmpp
.
core
=
self
self
.
keyboard
=
keyboard
.
Keyboard
()
roster
.
set_node
(
self
.
xmpp
.
client_roster
)
...
...
poezio/poezio.py
View file @
b685df50
...
...
@@ -17,8 +17,6 @@ import logging
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
from
poezio.singleton
import
Singleton
def
test_curses
():
"""
Check if the system ncurses linked with python has unicode capabilities.
...
...
@@ -77,7 +75,7 @@ def main():
log
=
logging
.
getLogger
(
''
)
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_IGN
)
# ignore ctrl-c
cocore
=
Singleton
(
core
.
Core
)
cocore
=
core
.
Core
(
)
signal
.
signal
(
signal
.
SIGUSR1
,
cocore
.
sigusr_handler
)
# reload the config
signal
.
signal
(
signal
.
SIGHUP
,
cocore
.
exit_from_signal
)
signal
.
signal
(
signal
.
SIGTERM
,
cocore
.
exit_from_signal
)
...
...
poezio/singleton.py
deleted
100644 → 0
View file @
d636d57d
# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org>
#
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
"""
Defines a Singleton function that initialize an object
of the given class if it was never instantiated yet. Else, returns
the previously instantiated object.
This method is the only one that I can come up with that do not call
__init__() each time.
"""
_instances
=
{}
def
Singleton
(
cls
,
*
args
,
**
kwargs
):
if
not
cls
in
_instances
:
_instances
[
cls
]
=
cls
(
*
args
,
**
kwargs
)
return
_instances
[
cls
]
poezio/tabs/basetabs.py
View file @
b685df50
...
...
@@ -30,7 +30,6 @@ from poezio.common import safeJID
from
poezio.config
import
config
from
poezio.decorators
import
refresh_wrapper
from
poezio.logger
import
logger
from
poezio.singleton
import
Singleton
from
poezio.text_buffer
import
TextBuffer
from
poezio.theming
import
get_theme
,
dump_tuple
from
poezio.decorators
import
command_args_parser
...
...
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