Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
103
Merge Requests
103
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
a482fd1e
Commit
a482fd1e
authored
Jan 08, 2024
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e95aaa46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
software/ors-amarisoft/ru/xbuildout.py
software/ors-amarisoft/ru/xbuildout.py
+17
-2
No files found.
software/ors-amarisoft/ru/xbuildout.py
View file @
a482fd1e
...
...
@@ -19,6 +19,7 @@
- encode/decode convert string to/from form, that is suitable to be used in
names of buildout sections.
- XXX quote
"""
...
...
@@ -59,7 +60,7 @@
#
# # referring to <ru_ref>-stats
# ${ {{-B('%s-stats' % ru_ref)}}:output}
def
encode
(
s
:
str
)
:
# -> str
def
encode
(
s
:
str
)
->
str
:
s
=
s
.
encode
(
'utf-8'
)
outv
=
[]
emit
=
outv
.
append
...
...
@@ -86,7 +87,7 @@ def encode(s: str): # -> str
# decode provides reverse operation for encode.
def
decode
(
s
:
str
)
:
# -> str | ValueError
def
decode
(
s
:
str
)
->
str
|
ValueError
:
try
:
return
_decode
(
s
)
except
Exception
as
e
:
...
...
@@ -127,6 +128,15 @@ def _decode(s):
return
out
# quote converts string s into quoted form with all buildout control characters escaped... XXX
# XXX -> pyquote?
def
quote
(
s
:
str
)
->
str
:
r
=
repr
(
s
)
for
c
in
'$[]{}
\
n
'
:
r
=
r
.
replace
(
c
,
r'\
x%
02x'
%
ord
(
c
))
return
r
# ----------------------------------------
import
re
...
...
@@ -185,3 +195,8 @@ def test_encode():
def
_
(
cause
):
assert
isinstance
(
cause
,
UnicodeDecodeError
)
checkbad
(
x
,
_
)
def
test_quote
():
# XXX
pass
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