59f4c8d706884309f2681e39955cc1ce80a5962b,src/python/pants/tasks/protobuf_gen.py,,calculate_genfiles,#Any#Any#,174
Before Change
outer_class_name = camelcase(filename)
multiple_files = False
types = set()
for line in lines:
match = DEFAULT_PACKAGE_PARSER.match(line)
if match:
package = match.group(1)
else:
match = OPTION_PARSER.match(line)
if match:
name = match.group(1)
value = match.group(2)
def string_value():
return value.lstrip(""").rstrip(""")
def bool_value():
return value == "true"
if "java_package" == name:
package = string_value()
elif "java_outer_classname" == name:
outer_class_name = string_value()
elif "java_multiple_files" == name:
multiple_files = bool_value()
else:
match = TYPE_PARSER.match(line)
if match:
type_ = match.group(2)
types.add(type_)
if match.group(1) == "message":
types.add("%sOrBuilder" % type_)
genfiles = defaultdict(set)
genfiles["py"].update(calculate_python_genfiles(source))
genfiles["java"].update(calculate_java_genfiles(package,
outer_class_name,
After Change
outer_types = set()
inner_types = set()
type_depth = 0
for line in lines:
match = DEFAULT_PACKAGE_PARSER.match(line)
if match:
package = match.group(1)
else:
match = OPTION_PARSER.match(line)
if match:
name = match.group(1)
value = match.group(2)
def string_value():
return value.lstrip(""").rstrip(""")
def bool_value():
return value == "true"
if "java_package" == name:
package = string_value()
elif "java_outer_classname" == name:
outer_class_name = string_value()
elif "java_multiple_files" == name:
multiple_files = bool_value()
else:
match = TYPE_PARSER.match(line)
if match:
type_depth += 1
type_ = match.group(2)
if type_depth == 1:
_record_type(outer_types, type_, match.group(1))
else:
_record_type(inner_types, type_, match.group(1))
else:
match = END_TYPE_PARSER.match(line)
if match:
type_depth -= 1
// TODO(Eric Ayers) replace with a real lex/parse understanding of protos
// This is a big hack. The parsing for finding type definitions is not reliable.
// See https://github.com/pantsbuild/pants/issues/96
types = set()
if multiple_files:
if type_depth == 0:
types = outer_types
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: pantsbuild/pants
Commit Name: 59f4c8d706884309f2681e39955cc1ce80a5962b
Time: 2014-05-01
Author: zundel@squareup.com
File Name: src/python/pants/tasks/protobuf_gen.py
Class Name:
Method Name: calculate_genfiles
Project Name: wkentaro/labelme
Commit Name: 448bd4a78699766aea66231ba442b8b5826d2a05
Time: 2019-05-15
Author: www.kentaro.wada@gmail.com
File Name: labelme/app.py
Class Name: MainWindow
Method Name: loadLabels
Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 3eae7586a1c85f0ac46919f542bf2eb1fdcbf22c
Time: 2015-11-17
Author: skschneider@google.com
File Name: perfkitbenchmarker/providers/azure/azure_virtual_machine.py
Class Name:
Method Name: _GetDefaultImagesFromAzure