python类excel_tab()的实例源码

__init__.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-rabbitmq-server 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-percona-cluster 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-percona-cluster 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-cinder 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-cinder-ceph 作者: openstack 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-nova-compute-proxy 作者: openstack 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-ceilometer-agent 作者: openstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
__init__.py 文件源码 项目:charm-ceph-proxy 作者: openstack 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
test_cmdline.py 文件源码 项目:charm-helpers 作者: juju 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_outputs_tab(self):
        sample = StringIO()
        writer = csv.writer(sample, dialect=csv.excel_tab)
        writer.writerows(self.output_data)
        sample.seek(0)
        self.of.tab(self.output_data)
        self.outfile.seek(0)
        self.assertEqual(self.outfile.read(), sample.read())
__init__.py 文件源码 项目:charm-helpers 作者: juju 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tab(self, output):
        """Output data in excel-compatible tab-delimited format"""
        import csv
        csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab)
        csvwriter.writerows(output)
export_metrics.py 文件源码 项目:rca-evaluation 作者: sieve-microservices 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def dump_app(app_args, path, begin, now, container_image_pattern = ""):

    # the app_args argument is supplied in the format 
    #   <app name>:<additional influxdb table 1>:<additional influxdb table 2>:...
    app_args = app_args.split(":")
    # get the tag (keys and values) and fields from the docker measurements and 
    # any additional tables
    app = dump_column_names(app_args)

    # build queries
    queries = []
    # always extract docker metrics (here referred to as 'system metrics')
    for system in SYSTEM_METRICS:
        pattern = CONTAINER_IMAGE_PATTERNS[app.name].format(container_image_pattern)
        q = """select * from "docker_container_{}" where
                container_name =~ /{}/
                and container_image =~ /{}/
                and time > '%s' and time < '%s'
            """.format(system, app.name, pattern)
        queries.append(scroll(q, begin, now))

    if len(app_args) > 1:
        for app_arg in app_args[1:]:
            q = "select * from \"{}\" where time > '%s' and time < '%s'".format(app_arg)
            print(q)
            queries.append(scroll(q, begin, now, prefix = app.name))

    path = os.path.join(path, app.filename)

    with gzip.open(path, "wb") as f:
        columns = app.fields + app.tags + ["time"]
        writer = csv.DictWriter(f, fieldnames=columns, dialect=csv.excel_tab, extrasaction='ignore')
        writer.writeheader()
        for _, row in heapq.merge(*queries):
            writer.writerow(row)
    return app

# in general, all apps have docker metrics for them, se we retrieve the 
# metrics stored in 'docker_container_*' tables by default. we save these 
# metrics under an app name equal to the first string in a sequence of strings 
# separated by a ':'. app-specific metrics for such app names are gathered from 
# the tables specified in subsequent strings.


问题


面经


文章

微信
公众号

扫码关注公众号