Skip to content

Commit bc7be83

Browse files
committed
Update pre-commit
1 parent 35e61b3 commit bc7be83

File tree

5 files changed

+84
-46
lines changed

5 files changed

+84
-46
lines changed

paddle/fluid/pybind/pybind.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
// Generated by the paddle/operator/CMakeLists.txt. DO NOT EDIT!
216

317
USE_CUDA_ONLY_OP(ncclAllReduce);

paddle/string/piece.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace string {
2828
// its syntax is simple as it doesn't own/manage the string, it is
2929
// cheap to construct Pieces and pass them around.
3030
class Piece {
31-
public:
31+
public:
3232
static const size_t npos = static_cast<size_t>(-1);
3333

3434
// We provide non-explicit singleton constructors so users can
@@ -55,7 +55,7 @@ class Piece {
5555
// Return a string that contains the copy of the referenced data.
5656
std::string ToString() const { return std::string(data_, size_); }
5757

58-
private:
58+
private:
5959
const char* data_;
6060
size_t size_;
6161

paddle/string/printf_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ TEST(StringPrintf, StringPrintf) {
2424
long hour = 14;
2525
int min = 44;
2626
EXPECT_EQ(std::string("Wednesday, July 27, 14:44"),
27-
paddle::string::Sprintf("%s, %s %d, %.2d:%.2d", weekday, month, day,
28-
hour, min));
27+
paddle::string::Sprintf(
28+
"%s, %s %d, %.2d:%.2d", weekday, month, day, hour, min));
2929
}

paddle/string/tinyformat/tinyformat.h

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ namespace detail {
147147
// Test whether type T1 is convertible to type T2
148148
template <typename T1, typename T2>
149149
struct is_convertible {
150-
private:
150+
private:
151151
// two types of different size
152152
struct fail {
153153
char dummy[2];
@@ -160,7 +160,7 @@ struct is_convertible {
160160
static succeed tryConvert(const T2 &);
161161
static const T1 &makeT1();
162162

163-
public:
163+
public:
164164
// Standard trick: the (...) version of tryConvert will be chosen from
165165
// the overload set only if the version taking a T2 doesn't match.
166166
// Then we compare the sizes of the return types to check which
@@ -170,7 +170,8 @@ struct is_convertible {
170170

171171
// Format the value by casting to type fmtT. This default implementation
172172
// should never be called.
173-
template <typename T, typename fmtT,
173+
template <typename T,
174+
typename fmtT,
174175
bool convertible = is_convertible<T, fmtT>::value>
175176
struct formatValueAsType {
176177
static void invoke(std::ostream & /*out*/, const T & /*value*/) { assert(0); }
@@ -240,8 +241,11 @@ TINYFORMAT_DEFINE_FORMAT_TRUNCATED_CSTR(char)
240241
/// operator<< to format the type T, with special cases for the %c and %p
241242
/// conversions.
242243
template <typename T>
243-
inline void formatValue(std::ostream &out, const char * /*fmtBegin*/,
244-
const char *fmtEnd, int ntrunc, const T &value) {
244+
inline void formatValue(std::ostream &out,
245+
const char * /*fmtBegin*/,
246+
const char *fmtEnd,
247+
int ntrunc,
248+
const T &value) {
245249
// The mess here is to support the %c and %p conversions: if these
246250
// conversions are active we try to convert the type to a char or const
247251
// void* respectively and format that instead of the value itself. For the
@@ -263,22 +267,25 @@ inline void formatValue(std::ostream &out, const char * /*fmtBegin*/,
263267
}
264268

265269
// Overloaded version for char types to support printing as an integer
266-
#define TINYFORMAT_DEFINE_FORMATVALUE_CHAR(charType) \
267-
inline void formatValue(std::ostream &out, const char * /*fmtBegin*/, \
268-
const char *fmtEnd, int /**/, charType value) { \
269-
switch (*(fmtEnd - 1)) { \
270-
case 'u': \
271-
case 'd': \
272-
case 'i': \
273-
case 'o': \
274-
case 'X': \
275-
case 'x': \
276-
out << static_cast<int>(value); \
277-
break; \
278-
default: \
279-
out << value; \
280-
break; \
281-
} \
270+
#define TINYFORMAT_DEFINE_FORMATVALUE_CHAR(charType) \
271+
inline void formatValue(std::ostream &out, \
272+
const char * /*fmtBegin*/, \
273+
const char *fmtEnd, \
274+
int /**/, \
275+
charType value) { \
276+
switch (*(fmtEnd - 1)) { \
277+
case 'u': \
278+
case 'd': \
279+
case 'i': \
280+
case 'o': \
281+
case 'X': \
282+
case 'x': \
283+
out << static_cast<int>(value); \
284+
break; \
285+
default: \
286+
out << value; \
287+
break; \
288+
} \
282289
}
283290
// per 3.9.1: char, signed char and unsigned char are all distinct types
284291
TINYFORMAT_DEFINE_FORMATVALUE_CHAR(char)
@@ -475,7 +482,7 @@ namespace detail {
475482
// each argument to be allocated as a homogenous array inside FormatList
476483
// whereas a naive implementation based on inheritance does not.
477484
class FormatArg {
478-
public:
485+
public:
479486
FormatArg() {}
480487

481488
template <typename T>
@@ -484,17 +491,22 @@ class FormatArg {
484491
m_formatImpl(&formatImpl<T>),
485492
m_toIntImpl(&toIntImpl<T>) {}
486493

487-
void format(std::ostream &out, const char *fmtBegin, const char *fmtEnd,
494+
void format(std::ostream &out,
495+
const char *fmtBegin,
496+
const char *fmtEnd,
488497
int ntrunc) const {
489498
m_formatImpl(out, fmtBegin, fmtEnd, ntrunc, m_value);
490499
}
491500

492501
int toInt() const { return m_toIntImpl(m_value); }
493502

494-
private:
503+
private:
495504
template <typename T>
496-
static void formatImpl(std::ostream &out, const char *fmtBegin,
497-
const char *fmtEnd, int ntrunc, const void *value) {
505+
static void formatImpl(std::ostream &out,
506+
const char *fmtBegin,
507+
const char *fmtEnd,
508+
int ntrunc,
509+
const void *value) {
498510
formatValue(out, fmtBegin, fmtEnd, ntrunc, *static_cast<const T *>(value));
499511
}
500512

@@ -504,8 +516,11 @@ class FormatArg {
504516
}
505517

506518
const void *m_value;
507-
void (*m_formatImpl)(std::ostream &out, const char *fmtBegin,
508-
const char *fmtEnd, int ntrunc, const void *value);
519+
void (*m_formatImpl)(std::ostream &out,
520+
const char *fmtBegin,
521+
const char *fmtEnd,
522+
int ntrunc,
523+
const void *value);
509524
int (*m_toIntImpl)(const void *value);
510525
};
511526

@@ -554,10 +569,12 @@ inline const char *printFormatStringLiteral(std::ostream &out,
554569
// necessary to pull out variable width and precision . The function returns a
555570
// pointer to the character after the end of the current format spec.
556571
inline const char *streamStateFromFormat(std::ostream &out,
557-
bool &spacePadPositive, int &ntrunc,
572+
bool &spacePadPositive,
573+
int &ntrunc,
558574
const char *fmtStart,
559575
const detail::FormatArg *formatters,
560-
int &argIndex, int numFormatters) {
576+
int &argIndex,
577+
int numFormatters) {
561578
if (*fmtStart != '%') {
562579
TINYFORMAT_ERROR(
563580
"tinyformat: Not enough conversion specifiers in format string");
@@ -733,8 +750,10 @@ inline const char *streamStateFromFormat(std::ostream &out,
733750
}
734751

735752
//------------------------------------------------------------------------------
736-
inline void formatImpl(std::ostream &out, const char *fmt,
737-
const detail::FormatArg *formatters, int numFormatters) {
753+
inline void formatImpl(std::ostream &out,
754+
const char *fmt,
755+
const detail::FormatArg *formatters,
756+
int numFormatters) {
738757
// Saved stream state
739758
std::streamsize origWidth = out.width();
740759
std::streamsize origPrecision = out.precision();
@@ -746,9 +765,13 @@ inline void formatImpl(std::ostream &out, const char *fmt,
746765
fmt = printFormatStringLiteral(out, fmt);
747766
bool spacePadPositive = false;
748767
int ntrunc = -1;
749-
const char *fmtEnd =
750-
streamStateFromFormat(out, spacePadPositive, ntrunc, fmt, formatters,
751-
argIndex, numFormatters);
768+
const char *fmtEnd = streamStateFromFormat(out,
769+
spacePadPositive,
770+
ntrunc,
771+
fmt,
772+
formatters,
773+
argIndex,
774+
numFormatters);
752775
if (argIndex >= numFormatters) {
753776
// Check args remain after reading any variable width/precision
754777
TINYFORMAT_ERROR("tinyformat: Not enough format arguments");
@@ -797,14 +820,15 @@ inline void formatImpl(std::ostream &out, const char *fmt,
797820
/// information has been stripped from the arguments, leaving just enough of a
798821
/// common interface to perform formatting as required.
799822
class FormatList {
800-
public:
823+
public:
801824
FormatList(detail::FormatArg *formatters, int N)
802825
: m_formatters(formatters), m_N(N) {}
803826

804-
friend void vformat(std::ostream &out, const char *fmt,
827+
friend void vformat(std::ostream &out,
828+
const char *fmt,
805829
const FormatList &list);
806830

807-
private:
831+
private:
808832
const detail::FormatArg *m_formatters;
809833
int m_N;
810834
};
@@ -817,22 +841,22 @@ namespace detail {
817841
// Format list subclass with fixed storage to avoid dynamic allocation
818842
template <int N>
819843
class FormatListN : public FormatList {
820-
public:
844+
public:
821845
template <typename... Args>
822846
FormatListN(const Args &... args)
823847
: FormatList(&m_formatterStore[0], N),
824848
m_formatterStore{FormatArg(args)...} {
825849
static_assert(sizeof...(args) == N, "Number of args must be N");
826850
}
827851

828-
private:
852+
private:
829853
FormatArg m_formatterStore[N];
830854
};
831855

832856
// Special 0-arg version - MSVC says zero-sized C array in struct is nonstandard
833857
template <>
834858
class FormatListN<0> : public FormatList {
835-
public:
859+
public:
836860
FormatListN() : FormatList(0, 0) {}
837861
};
838862

paddle/string/to_string_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License. */
1717

1818
constexpr char kOutputString[] = "User Defined Output";
1919
class UserDefinedClass {
20-
public:
20+
public:
2121
};
2222

2323
std::ostream& operator<<(std::ostream& s, const UserDefinedClass& ins) {

0 commit comments

Comments
 (0)