1c9f9302d3a556d1dcdc118fb3a58c6b007c717d,data-analytics/cloud-composer-examples/composer_http_post_example/spark_avg_speed.py,AverageSpeedEnhancer,dict_to_csv,#AverageSpeedEnhancer#Any#,57
Before Change
Arguments:
dictionary: A dictionary containing the data of interest.
csv = ",".join([str(dictionary[key]) if dictionary.get(key) is not None else ""
for key in AverageSpeedEnhancer.output_schema])
return csv
def enhance_with_avg_speed(self, record):
After Change
Arguments:
dictionary: A dictionary containing the data of interest.
with closing(cStringIO.StringIO()) as csv_string:
writer = csv.DictWriter(csv_string, AverageSpeedEnhancer.output_schema)
writer.writerow(dictionary)
// Our desired output is a csv string not a line in a file so we strip the
// newline character written by the writerow function by default.
return csv_string.getvalue().strip()
def enhance_with_avg_speed(self, record):
This is the business logic for the average speed column to calculate for each record.
The desired units are miles per hour.
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: GoogleCloudPlatform/professional-services
Commit Name: 1c9f9302d3a556d1dcdc118fb3a58c6b007c717d
Time: 2018-07-13
Author: danielrdeleo@gmail.com
File Name: data-analytics/cloud-composer-examples/composer_http_post_example/spark_avg_speed.py
Class Name: AverageSpeedEnhancer
Method Name: dict_to_csv
Project Name: pantsbuild/pants
Commit Name: 35ba6bfdb63cfedbedfd28c1705996e582178064
Time: 2015-09-23
Author: kwilson@twopensource.com
File Name: src/python/pants/java/nailgun_executor.py
Class Name: NailgunExecutor
Method Name: ensure_connectable
Project Name: home-assistant/home-assistant
Commit Name: dfa81b0117708a41a64d3bb7d11104d115d35d2b
Time: 2015-11-08
Author: ryan.e.t@gmail.com
File Name: homeassistant/components/camera/mjpeg.py
Class Name: MjpegCamera
Method Name: camera_image
Project Name: hpclab/rankeval
Commit Name: 1666dc3ba13743204ae10eaf31b046d0c315e32a
Time: 2019-07-25
Author: trani.salvatore@gmail.com
File Name: rankeval/dataset/svmlight_format.py
Class Name:
Method Name: dump_svmlight_file