Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
coolamqp
Commits
0510776b
Commit
0510776b
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
cleaning house
parent
d368329a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
coolamqp/objects.py
+5
-15
5 additions, 15 deletions
coolamqp/objects.py
with
5 additions
and
15 deletions
coolamqp/objects.py
+
5
−
15
View file @
0510776b
...
...
@@ -130,13 +130,8 @@ class Exchange(object):
:type name: unicode is preferred, binary type will get decoded to unicode with utf8
:param type: exchange type. binary/unicode
"""
if
isinstance
(
name
,
six
.
binary_type
):
name
=
name
.
decode
(
'
utf8
'
)
self
.
name
=
name
self
.
type
=
type
.
encode
(
'
utf8
'
)
if
isinstance
(
type
,
six
.
text_type
)
else
type
# must be bytes
self
.
name
=
name
.
decode
(
'
utf8
'
)
if
isinstance
(
name
,
six
.
binary_type
)
else
name
# must be unicode
self
.
type
=
type
.
encode
(
'
utf8
'
)
if
isinstance
(
type
,
six
.
text_type
)
else
type
# must be bytes
self
.
durable
=
durable
self
.
auto_delete
=
auto_delete
...
...
@@ -174,7 +169,7 @@ class Queue(object):
:param exclusive: Is this queue exclusive?
:param auto_delete: Is this queue auto_delete ?
"""
self
.
name
=
name
.
encode
(
'
utf8
'
)
if
isinstance
(
name
,
six
.
text_type
)
else
name
#: public,
this is of type bytes ALWAYS
self
.
name
=
name
.
encode
(
'
utf8
'
)
if
isinstance
(
name
,
six
.
text_type
)
else
name
#: public,
must be bytes
# if name is '', this will be filled in with broker-generated name upon declaration
self
.
durable
=
durable
self
.
exchange
=
exchange
...
...
@@ -183,7 +178,7 @@ class Queue(object):
self
.
anonymous
=
name
==
''
# if this queue is anonymous, it must be regenerated upon reconnect
self
.
consumer_tag
=
name
if
name
!=
''
else
uuid
.
uuid4
().
hex
# consumer tag to use in AMQP comms
self
.
consumer_tag
=
name
if
len
(
name
)
>
0
else
uuid
.
uuid4
().
hex
# consumer tag to use in AMQP comms
def
__eq__
(
self
,
other
):
return
(
self
.
name
==
other
.
name
)
and
(
type
(
self
)
==
type
(
other
))
...
...
@@ -243,12 +238,7 @@ class NodeDefinition(object):
elif
len
(
args
)
==
4
:
self
.
host
,
self
.
user
,
self
.
password
,
self
.
virtual_host
=
args
elif
len
(
args
)
==
1
and
isinstance
(
args
[
0
],
(
six
.
text_type
,
six
.
binary_type
)):
if
isinstance
(
args
[
0
],
six
.
binary_type
):
connstr
=
args
[
0
].
decode
(
'
utf8
'
)
else
:
connstr
=
args
[
0
]
connstr
=
args
[
0
].
decode
(
'
utf8
'
)
if
isinstance
(
args
[
0
],
six
.
binary_type
)
else
args
[
0
]
# AMQP connstring
if
not
connstr
.
startswith
(
u
'
amqp://
'
):
raise
ValueError
(
u
'
should begin with amqp://
'
)
...
...
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