summaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/src/compiler/python_generator_helpers.h
diff options
context:
space:
mode:
authorheretic <[email protected]>2022-02-10 16:45:46 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:46 +0300
commit81eddc8c0b55990194e112b02d127b87d54164a9 (patch)
tree9142afc54d335ea52910662635b898e79e192e49 /contrib/libs/grpc/src/compiler/python_generator_helpers.h
parent397cbe258b9e064f49c4ca575279f02f39fef76e (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/grpc/src/compiler/python_generator_helpers.h')
-rw-r--r--contrib/libs/grpc/src/compiler/python_generator_helpers.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/contrib/libs/grpc/src/compiler/python_generator_helpers.h b/contrib/libs/grpc/src/compiler/python_generator_helpers.h
index 441b7dc4c06..78e7efd7e0d 100644
--- a/contrib/libs/grpc/src/compiler/python_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/python_generator_helpers.h
@@ -47,11 +47,11 @@ namespace grpc_python_generator {
namespace {
typedef vector<const Descriptor*> DescriptorVector;
-typedef vector<TString> StringVector;
+typedef vector<TString> StringVector;
-static TString StripModulePrefixes(
- const TString& raw_module_name,
- const std::vector<TString>& prefixes_to_filter) {
+static TString StripModulePrefixes(
+ const TString& raw_module_name,
+ const std::vector<TString>& prefixes_to_filter) {
for (const auto& prefix : prefixes_to_filter) {
if (raw_module_name.rfind(prefix, 0) == 0) {
return raw_module_name.substr(prefix.size(),
@@ -64,10 +64,10 @@ static TString StripModulePrefixes(
// TODO(https://github.com/google/protobuf/issues/888):
// Export `ModuleName` from protobuf's
// `src/google/protobuf/compiler/python/python_generator.cc` file.
-TString ModuleName(const TString& filename,
- const TString& import_prefix,
- const std::vector<TString>& prefixes_to_filter) {
- TString basename = StripProto(filename);
+TString ModuleName(const TString& filename,
+ const TString& import_prefix,
+ const std::vector<TString>& prefixes_to_filter) {
+ TString basename = StripProto(filename);
basename = StringReplace(basename, "-", "_");
basename = StringReplace(basename, "/", ".");
return StripModulePrefixes(import_prefix + basename + "_pb2",
@@ -77,10 +77,10 @@ TString ModuleName(const TString& filename,
// TODO(https://github.com/google/protobuf/issues/888):
// Export `ModuleAlias` from protobuf's
// `src/google/protobuf/compiler/python/python_generator.cc` file.
-TString ModuleAlias(const TString& filename,
- const TString& import_prefix,
- const std::vector<TString>& prefixes_to_filter) {
- TString module_name =
+TString ModuleAlias(const TString& filename,
+ const TString& import_prefix,
+ const std::vector<TString>& prefixes_to_filter) {
+ TString module_name =
ModuleName(filename, import_prefix, prefixes_to_filter);
// We can't have dots in the module name, so we replace each with _dot_.
// But that could lead to a collision between a.b and a_dot_b, so we also
@@ -91,29 +91,29 @@ TString ModuleAlias(const TString& filename,
}
bool GetModuleAndMessagePath(
- const Descriptor* type, TString* out, TString generator_file_name,
- bool generate_in_pb2_grpc, TString& import_prefix,
- const std::vector<TString>& prefixes_to_filter) {
+ const Descriptor* type, TString* out, TString generator_file_name,
+ bool generate_in_pb2_grpc, TString& import_prefix,
+ const std::vector<TString>& prefixes_to_filter) {
const Descriptor* path_elem_type = type;
DescriptorVector message_path;
do {
message_path.push_back(path_elem_type);
path_elem_type = path_elem_type->containing_type();
} while (path_elem_type); // implicit nullptr comparison; don't be explicit
- TString file_name = type->file()->name();
+ TString file_name = type->file()->name();
static const int proto_suffix_length = strlen(".proto");
if (!(file_name.size() > static_cast<size_t>(proto_suffix_length) &&
file_name.find_last_of(".proto") == file_name.size() - 1)) {
return false;
}
- TString module;
+ TString module;
if (generator_file_name != file_name || generate_in_pb2_grpc) {
module = ModuleAlias(file_name, import_prefix, prefixes_to_filter) + ".";
} else {
module = "";
}
- TString message_type;
+ TString message_type;
for (DescriptorVector::reverse_iterator path_iter = message_path.rbegin();
path_iter != message_path.rend(); ++path_iter) {
message_type += (*path_iter)->name() + ".";
@@ -136,8 +136,8 @@ StringVector get_all_comments(const DescriptorType* descriptor) {
return comments;
}
-inline void Split(const TString& s, char delim,
- std::vector<TString>* append_to) {
+inline void Split(const TString& s, char delim,
+ std::vector<TString>* append_to) {
auto current = s.begin();
while (current <= s.end()) {
auto next = std::find(current, s.end(), delim);