Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Voice
asterisk
Commits
6131d70a
Commit
6131d70a
authored
8 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "astconfigparser.py: Update with realtime fixes."
parents
aa698770
1e7168ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/scripts/sip_to_pjsip/astconfigparser.py
+21
-3
21 additions, 3 deletions
contrib/scripts/sip_to_pjsip/astconfigparser.py
with
21 additions
and
3 deletions
contrib/scripts/sip_to_pjsip/astconfigparser.py
+
21
−
3
View file @
6131d70a
"""
Copyright (C) 2016, Digium, Inc.
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
"""
import
re
import
itertools
...
...
@@ -44,6 +51,12 @@ class Section(MultiOrderedDict):
"""
return
cmp
(
self
.
id
,
other
.
id
)
def
__eq__
(
self
,
other
):
"""
Use self.id as means of determining equality
"""
return
self
.
id
==
other
.
id
def
get
(
self
,
key
,
from_self
=
True
,
from_templates
=
True
,
from_defaults
=
True
):
"""
...
...
@@ -184,9 +197,14 @@ def remove_comment(line, is_comment):
# otherwise it was an embedded comment so combine
return
''
.
join
([
part
[
0
].
strip
(),
'
'
,
line
]).
rstrip
(),
False
# check for eol comment
return
line
.
partition
(
COMMENT
)[
0
].
strip
(),
False
# find the first occurence of a comment that is not escaped
match
=
re
.
match
(
r
'
.*?([^\\];)
'
,
line
)
if
match
:
# the end of where the real string is is where the comment starts
line
=
line
[
0
:(
match
.
end
()
-
1
)]
return
line
.
replace
(
"
\\
"
,
""
).
strip
(),
False
def
try_include
(
line
):
"""
...
...
@@ -224,7 +242,7 @@ def try_section(line):
def
try_option
(
line
):
"""
Parses the line as an option, returning the key/value pair.
"""
data
=
re
.
split
(
'
=>?
'
,
line
)
data
=
re
.
split
(
'
=>?
'
,
line
,
1
)
# should split in two (key/val), but either way use first two elements
return
data
[
0
].
rstrip
(),
data
[
1
].
lstrip
()
...
...
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