Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
fb25d7e2
There was a problem fetching the pipeline summary.
Commit
fb25d7e2
authored
6 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
if python2...
parent
affde360
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!46
if python2...
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/hawc2/htc_contents.py
+14
-2
14 additions, 2 deletions
wetb/hawc2/htc_contents.py
with
14 additions
and
2 deletions
wetb/hawc2/htc_contents.py
+
14
−
2
View file @
fb25d7e2
...
@@ -48,6 +48,7 @@ class HTCContents(object):
...
@@ -48,6 +48,7 @@ class HTCContents(object):
lines
=
[]
lines
=
[]
contents
=
None
contents
=
None
name_
=
""
name_
=
""
parent
=
None
def
__setitem__
(
self
,
key
,
value
):
def
__setitem__
(
self
,
key
,
value
):
if
isinstance
(
key
,
str
):
if
isinstance
(
key
,
str
):
...
@@ -56,6 +57,7 @@ class HTCContents(object):
...
@@ -56,6 +57,7 @@ class HTCContents(object):
self
.
values
[
key
]
=
value
self
.
values
[
key
]
=
value
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
value
.
parent
=
self
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
...
@@ -72,6 +74,9 @@ class HTCContents(object):
...
@@ -72,6 +74,9 @@ class HTCContents(object):
return
self
.
values
[
key
]
return
self
.
values
[
key
]
def
__getattr__
(
self
,
*
args
,
**
kwargs
):
def
__getattr__
(
self
,
*
args
,
**
kwargs
):
if
args
[
0
]
in
[
'
__members__
'
,
'
__methods__
'
]:
# fix python2 related issue. In py2, dir(self) calls __getattr__(('__members__',)), and this call must fail unhandled to work
return
object
.
__getattribute__
(
self
,
*
args
,
**
kwargs
)
try
:
try
:
return
object
.
__getattribute__
(
self
,
*
args
,
**
kwargs
)
return
object
.
__getattribute__
(
self
,
*
args
,
**
kwargs
)
except
:
except
:
...
@@ -135,7 +140,11 @@ class HTCContents(object):
...
@@ -135,7 +140,11 @@ class HTCContents(object):
self
.
_add_contents
(
line
)
self
.
_add_contents
(
line
)
return
line
return
line
def
location
(
self
):
if
self
.
parent
is
None
:
return
os
.
path
.
basename
(
self
.
filename
)
else
:
return
self
.
parent
.
location
()
+
"
/
"
+
self
.
name_
class
HTCSection
(
HTCContents
):
class
HTCSection
(
HTCContents
):
...
@@ -209,7 +218,10 @@ class HTCLine(HTCContents):
...
@@ -209,7 +218,10 @@ class HTCLine(HTCContents):
return
"
"
.
join
([
str
(
v
).
lower
()
for
v
in
self
.
values
])
return
"
"
.
join
([
str
(
v
).
lower
()
for
v
in
self
.
values
])
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
return
self
.
values
[
key
]
try
:
return
self
.
values
[
key
]
except
:
raise
IndexError
(
"
Parameter %s does not exists for %s
"
%
(
key
+
1
,
self
.
location
()))
@staticmethod
@staticmethod
def
from_lines
(
lines
):
def
from_lines
(
lines
):
...
...
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