Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Andreas Klöckner
pyopencl
Commits
bb96e13e
Commit
bb96e13e
authored
4 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Revert aksetup_helper.py to pre-pyupgrade version
parent
3823b9ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!121
Run pyupgrade and placate flake8-quotes
Pipeline
#70592
passed with warnings
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aksetup_helper.py
+18
-17
18 additions, 17 deletions
aksetup_helper.py
configure.py
+1
-0
1 addition, 0 deletions
configure.py
with
19 additions
and
17 deletions
aksetup_helper.py
+
18
−
17
View file @
bb96e13e
...
@@ -104,7 +104,8 @@ def flatten(lst):
...
@@ -104,7 +104,8 @@ def flatten(lst):
Example: Turn [[a,b,c],[d,e,f]] into [a,b,c,d,e,f].
Example: Turn [[a,b,c],[d,e,f]] into [a,b,c,d,e,f].
"""
"""
for
sublist
in
lst
:
for
sublist
in
lst
:
yield
from
sublist
for
j
in
sublist
:
yield
j
def
humanize
(
sym_str
):
def
humanize
(
sym_str
):
...
@@ -243,13 +244,13 @@ def expand_value(v, options):
...
@@ -243,13 +244,13 @@ def expand_value(v, options):
def
expand_options
(
options
):
def
expand_options
(
options
):
return
{
return
dict
(
k
:
expand_value
(
v
,
options
)
for
k
,
v
in
options
.
items
()
}
(
k
,
expand_value
(
v
,
options
)
)
for
k
,
v
in
options
.
items
()
)
class
ConfigSchema
:
class
ConfigSchema
:
def
__init__
(
self
,
options
,
conf_file
=
"
siteconf.py
"
,
conf_dir
=
"
.
"
):
def
__init__
(
self
,
options
,
conf_file
=
"
siteconf.py
"
,
conf_dir
=
"
.
"
):
self
.
optdict
=
{
opt
.
name
:
opt
for
opt
in
options
}
self
.
optdict
=
dict
((
opt
.
name
,
opt
)
for
opt
in
options
)
self
.
options
=
options
self
.
options
=
options
self
.
conf_dir
=
conf_dir
self
.
conf_dir
=
conf_dir
self
.
conf_file
=
conf_file
self
.
conf_file
=
conf_file
...
@@ -270,12 +271,12 @@ class ConfigSchema:
...
@@ -270,12 +271,12 @@ class ConfigSchema:
self
.
conf_dir
=
conf_dir
self
.
conf_dir
=
conf_dir
def
get_default_config
(
self
):
def
get_default_config
(
self
):
return
{
opt
.
name
:
opt
.
default
for
opt
in
self
.
options
}
return
dict
((
opt
.
name
,
opt
.
default
)
for
opt
in
self
.
options
)
def
read_config_from_pyfile
(
self
,
filename
):
def
read_config_from_pyfile
(
self
,
filename
):
result
=
{}
result
=
{}
filevars
=
{}
filevars
=
{}
infile
=
open
(
filename
)
infile
=
open
(
filename
,
"
r
"
)
try
:
try
:
contents
=
infile
.
read
()
contents
=
infile
.
read
()
finally
:
finally
:
...
@@ -294,8 +295,8 @@ class ConfigSchema:
...
@@ -294,8 +295,8 @@ class ConfigSchema:
filevars
=
{}
filevars
=
{}
try
:
try
:
exec
(
compile
(
open
(
filename
).
read
(),
filename
,
"
exec
"
),
filevars
)
exec
(
compile
(
open
(
filename
,
"
r
"
).
read
(),
filename
,
"
exec
"
),
filevars
)
except
O
S
Error
:
except
I
OError
:
pass
pass
if
"
__builtins__
"
in
filevars
:
if
"
__builtins__
"
in
filevars
:
...
@@ -310,7 +311,7 @@ class ConfigSchema:
...
@@ -310,7 +311,7 @@ class ConfigSchema:
outf
=
open
(
filename
,
"
w
"
)
outf
=
open
(
filename
,
"
w
"
)
for
key
in
keys
:
for
key
in
keys
:
outf
.
write
(
"
{}
=
{}
\n
"
.
format
(
key
,
repr
(
filevars
[
key
])))
outf
.
write
(
"
%s
=
%s
\n
"
%
(
key
,
repr
(
filevars
[
key
])))
outf
.
close
()
outf
.
close
()
return
result
return
result
...
@@ -361,7 +362,7 @@ class ConfigSchema:
...
@@ -361,7 +362,7 @@ class ConfigSchema:
elif
key
==
"
__builtins__
"
:
elif
key
==
"
__builtins__
"
:
pass
pass
else
:
else
:
raise
KeyError
(
"
invalid config key in
{}: {}
"
.
format
(
raise
KeyError
(
"
invalid config key in
%s: %s
"
%
(
filename
,
key
))
filename
,
key
))
def
update_config_from_and_modify_command_line
(
self
,
config
,
argv
):
def
update_config_from_and_modify_command_line
(
self
,
config
,
argv
):
...
@@ -386,7 +387,7 @@ class ConfigSchema:
...
@@ -386,7 +387,7 @@ class ConfigSchema:
result
=
self
.
get_default_config_with_files
()
result
=
self
.
get_default_config_with_files
()
if
os
.
access
(
cfile
,
os
.
R_OK
):
if
os
.
access
(
cfile
,
os
.
R_OK
):
with
open
(
cfile
)
as
inf
:
with
open
(
cfile
,
"
r
"
)
as
inf
:
py_snippet
=
inf
.
read
()
py_snippet
=
inf
.
read
()
self
.
update_from_python_snippet
(
result
,
py_snippet
,
cfile
)
self
.
update_from_python_snippet
(
result
,
py_snippet
,
cfile
)
...
@@ -411,15 +412,15 @@ class ConfigSchema:
...
@@ -411,15 +412,15 @@ class ConfigSchema:
for
opt
in
self
.
options
:
for
opt
in
self
.
options
:
value
=
config
[
opt
.
name
]
value
=
config
[
opt
.
name
]
if
value
is
not
None
:
if
value
is
not
None
:
outf
.
write
(
"
{}
=
{}
\n
"
.
format
(
opt
.
name
,
repr
(
config
[
opt
.
name
])))
outf
.
write
(
"
%s
=
%s
\n
"
%
(
opt
.
name
,
repr
(
config
[
opt
.
name
])))
outf
.
close
()
outf
.
close
()
def
make_substitutions
(
self
,
config
):
def
make_substitutions
(
self
,
config
):
return
{
opt
.
name
:
opt
.
value_to_str
(
config
[
opt
.
name
])
return
dict
((
opt
.
name
,
opt
.
value_to_str
(
config
[
opt
.
name
])
)
for
opt
in
self
.
options
}
for
opt
in
self
.
options
)
class
Option
:
class
Option
(
object
)
:
def
__init__
(
self
,
name
,
default
=
None
,
help
=
None
):
def
__init__
(
self
,
name
,
default
=
None
,
help
=
None
):
self
.
name
=
name
self
.
name
=
name
self
.
default
=
default
self
.
default
=
default
...
@@ -715,7 +716,7 @@ def substitute(substitutions, fname):
...
@@ -715,7 +716,7 @@ def substitute(substitutions, fname):
string_var_re
=
re
.
compile
(
r
"
\$str\{([A-Za-z_0-9]+)\}
"
)
string_var_re
=
re
.
compile
(
r
"
\$str\{([A-Za-z_0-9]+)\}
"
)
fname_in
=
fname
+
"
.in
"
fname_in
=
fname
+
"
.in
"
lines
=
open
(
fname_in
).
readlines
()
lines
=
open
(
fname_in
,
"
r
"
).
readlines
()
new_lines
=
[]
new_lines
=
[]
for
line
in
lines
:
for
line
in
lines
:
made_change
=
True
made_change
=
True
...
@@ -887,7 +888,7 @@ def check_pybind11():
...
@@ -887,7 +888,7 @@ def check_pybind11():
# {{{ (modified) boilerplate from https://github.com/pybind/python_example/blob/2ed5a68759cd6ff5d2e5992a91f08616ef457b5c/setup.py # noqa
# {{{ (modified) boilerplate from https://github.com/pybind/python_example/blob/2ed5a68759cd6ff5d2e5992a91f08616ef457b5c/setup.py # noqa
class
get_pybind_include
:
# noqa: N801
class
get_pybind_include
(
object
)
:
# noqa: N801
"""
Helper class to determine the pybind11 include path
"""
Helper class to determine the pybind11 include path
The purpose of this class is to postpone importing pybind11
The purpose of this class is to postpone importing pybind11
...
...
This diff is collapsed.
Click to expand it.
configure.py
+
1
−
0
View file @
bb96e13e
#! /usr/bin/env python
#! /usr/bin/env python
from
__future__
import
absolute_import
from
aksetup_helper
import
configure_frontend
from
aksetup_helper
import
configure_frontend
configure_frontend
()
configure_frontend
()
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