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
f643f6bf
Commit
f643f6bf
authored
7 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
c71174e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coolamqp/framing/compilation/xml_fields.py
+10
-1
10 additions, 1 deletion
coolamqp/framing/compilation/xml_fields.py
coolamqp/framing/definitions.py
+4199
-0
4199 additions, 0 deletions
coolamqp/framing/definitions.py
with
4209 additions
and
1 deletion
coolamqp/framing/compilation/xml_fields.py
+
10
−
1
View file @
f643f6bf
...
@@ -5,7 +5,7 @@ import logging
...
@@ -5,7 +5,7 @@ import logging
class
_Required
(
object
):
class
_Required
(
object
):
pass
"""
Only a placeholder to tell apart None default values from required fields
"""
def
nop
(
x
):
def
nop
(
x
):
return
x
return
x
...
@@ -16,6 +16,7 @@ __all__ = [
...
@@ -16,6 +16,7 @@ __all__ = [
]
]
class
_Field
(
object
):
class
_Field
(
object
):
"""
Base field object
"""
def
set
(
self
,
obj
,
elem
):
def
set
(
self
,
obj
,
elem
):
obj
.
__dict__
[
self
.
field_name
]
=
self
.
find
(
elem
)
obj
.
__dict__
[
self
.
field_name
]
=
self
.
find
(
elem
)
...
@@ -28,12 +29,20 @@ class _Field(object):
...
@@ -28,12 +29,20 @@ class _Field(object):
class
_ComputedField
(
_Field
):
class
_ComputedField
(
_Field
):
"""
There
'
s no corresponding XML attribute name - value must
be computed from element
"""
def
__init__
(
self
,
field_name
,
find_fun
):
def
__init__
(
self
,
field_name
,
find_fun
):
super
(
_ComputedField
,
self
).
__init__
(
field_name
)
super
(
_ComputedField
,
self
).
__init__
(
field_name
)
self
.
find
=
find_fun
self
.
find
=
find_fun
class
_ValueField
(
_Field
):
class
_ValueField
(
_Field
):
"""
Can hide under a pick of different XML attribute names.
Has a type, can have a default value.
"""
def
__init__
(
self
,
xml_names
,
field_name
,
field_type
=
nop
,
def
__init__
(
self
,
xml_names
,
field_name
,
field_type
=
nop
,
default
=
_Required
):
default
=
_Required
):
if
not
isinstance
(
xml_names
,
tuple
):
if
not
isinstance
(
xml_names
,
tuple
):
...
...
This diff is collapsed.
Click to expand it.
coolamqp/framing/definitions.py
+
4199
−
0
View file @
f643f6bf
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