How to use _value_format method in pytest-benchmark

Best Python code snippet using pytest-benchmark

cell_data_item.py

Source: cell_data_item.py Github

copy

Full Screen

1# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E11012# Smartsheet Python SDK.3#4# Copyright 2017 Smartsheet.com, Inc.5#6# Licensed under the Apache License, Version 2.0 (the "License"): you may7# not use this file except in compliance with the License. You may obtain8# a copy of the License at9#10# http:/​/​www.apache.org/​licenses/​LICENSE-2.011#12# Unless required by applicable law or agreed to in writing, software13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the15# License for the specific language governing permissions and limitations16# under the License.17from __future__ import absolute_import18from ..util import prep19from .cell import Cell20import logging21import six22import json23class CellDataItem(object):24 """Smartsheet CellDataItem data model."""25 def __init__(self, props=None, base_obj=None):26 """Initialize the CellDataItem model."""27 self._base = None28 if base_obj is not None:29 self._base = base_obj30 self._label = None31 self._label_format = None32 self._object_value = None33 self._cell = None34 self._value_format = None35 self._order = None36 self._column_id = None37 if props:38 # account for alternate variable names from raw API response39 if 'label' in props:40 self.label = props['label']41 if 'labelFormat' in props:42 self.label_format = props['labelFormat']43 if 'label_format' in props:44 self.label_format = props['label_format']45 if 'objectValue' in props:46 self.object_value = props['objectValue']47 if 'object_value' in props:48 self.object_value = props['object_value']49 if 'cell' in props:50 self.cell = props['cell']51 if 'valueFormat' in props:52 self.value_format = props['valueFormat']53 if 'value_format' in props:54 self.value_format = props['value_format']55 if 'order' in props:56 self.order = props['order']57 if 'columnId' in props:58 self.column_id = props['columnId']59 if 'column_id' in props:60 self.column_id = props['column_id']61 self.__initialized = True62 @property63 def label(self):64 return self._label65 @label.setter66 def label(self, value):67 if isinstance(value, six.string_types):68 self._label = value69 @property70 def label_format(self):71 return self._label_format72 @label_format.setter73 def label_format(self, value):74 if isinstance(value, six.string_types):75 self._label_format = value76 @property77 def object_value(self):78 return self._object_value79 @object_value.setter80 def object_value(self, value):81 self._object_value = value82 @property83 def cell(self):84 return self._cell85 @cell.setter86 def cell(self, value):87 if isinstance(value, Cell):88 self._cell = value89 @property90 def value_format(self):91 return self._value_format92 @value_format.setter93 def value_format(self, value):94 if isinstance(value, six.string_types):95 self._value_format = value96 @property97 def column_id(self):98 return self._column_id99 @column_id.setter100 def column_id(self, value):101 if isinstance(value, six.integer_types):102 self._column_id = value103 def to_dict(self, op_id=None, method=None):104 obj = {105 'label': prep(self._label),106 'labelFormat': prep(self._label_format),107 'objectValue': prep(self._object_value),108 'cell': prep(self._cell),109 'valueFormat': prep(self._value_format),110 'order': prep(self._order),111 'columnId': prep(self._column_id)}112 return obj113 def to_json(self):114 return json.dumps(self.to_dict(), indent=2)115 def __str__(self):...

Full Screen

Full Screen

PptxTableValueCell.py

Source: PptxTableValueCell.py Github

copy

Full Screen

1from pptx.table import _Cell2from module_pptx.pptx_styles.PptxCellStyle import PptxCellStyle3from module_pptx.PptxTextContent import PptxTextContent4from module_pptx.pptx_table.PptxTableCellBase import PptxTableCellBase5class PptxTableValueCell(PptxTableCellBase):6 def __init__(self, parameters, default_cell_style=None):7 super().__init__(parameters, default_cell_style)8 self._cell_style_input = None9 self._value_content = None10 self._value_format = None11 self._extractor.add_object("style", PptxCellStyle, description="")12 self._extractor.add_list("content", entry_type=dict, entry_object_type=PptxTextContent, description="")13 # Todo: Create a value format class with user friendly instructions14 self._extractor.add_str("value_format", description="This format is applied to the value before printing it to "15 "the cell. For example '{:.2f}' rounds the value to 2 "16 "decimals.")17 self._extractor.set_group_name("Presentation")18 def set_cell_value(self, value):19 self._value_content = [{20 "text": self.apply_format(value)21 }]22 def apply_format(self, value):23 if self._value_format is not None:24 return self._value_format.format(float(value))25 else:26 return str(value)27 def apply_styles(self, cell: _Cell):28 cell_style = PptxCellStyle(self._default_cell_style)29 cell_style.update_styles_by_input(self._cell_style_input)30 cell_style.generate()31 cell_style.apply_styles(cell)32 text_content = PptxTextContent(self._value_content, self._default_cell_style, cell.text_frame)33 text_content.update_styles_input(self._cell_style_input)34 text_content.apply_styles()35 def get_arguments(self):36 self._value_format = self._extractor.get_value("value_format")37 self._value_content = self._extractor.get_value("content")38 self._cell_style_input = self._extractor.get_value("style")39 def generate(self):40 self.extract()...

Full Screen

Full Screen

PptxTableTextCell.py

Source: PptxTableTextCell.py Github

copy

Full Screen

1from pptx.table import _Cell2from module_pptx.pptx_styles.PptxCellStyle import PptxCellStyle3from module_pptx.PptxTextContent import PptxTextContent4from module_pptx.pptx_table.PptxTableCellBase import PptxTableCellBase5class PptxTableTextCell(PptxTableCellBase):6 def __init__(self, parameters, default_cell_style=None):7 super().__init__(parameters, default_cell_style)8 self._text_content = None9 self._cell_style_input = None10 self._value_format = None11 self._extractor.add_list("content", entry_type=dict, entry_object_type=PptxTextContent, description="")12 self._extractor.add_object("style", PptxCellStyle, description="")13 # Todo: Create a value format class with user friendly instructions14 self._extractor.add_str("value_format", description="This format is applied to the value before printing it to "15 "the cell. For example '{:.2f}' rounds the value to 2 "16 "decimals.")17 self._extractor.set_group_name("Presentation")18 def set_cell_value(self, value):19 self._text_content = [{20 "text": self.apply_format(value)21 }]22 def apply_format(self, value):23 if self._value_format is not None:24 return self._value_format.format(float(value))25 else:26 return str(value)27 def apply_styles(self, cell: _Cell):28 cell_style = PptxCellStyle(self._default_cell_style)29 cell_style.update_styles_by_input(self._cell_style_input)30 cell_style.generate()31 cell_style.apply_styles(cell)32 text_content = PptxTextContent(self._text_content, self._default_cell_style, cell.text_frame)33 text_content.update_styles_input(self._cell_style_input)34 text_content.apply_styles()35 def get_arguments(self):36 self._text_content = self._extractor.get_value("content")37 self._cell_style_input = self._extractor.get_value("style")38 self._value_format = self._extractor.get_value("value_format")39 def generate(self):40 self.extract()...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

What is coaching leadership

Coaching is a term that is now being mentioned a lot more in the leadership space. Having grown successful teams I thought that I was well acquainted with this subject.

Webinar: Move Forward With An Effective Test Automation Strategy [Voices of Community]

The key to successful test automation is to focus on tasks that maximize the return on investment (ROI), ensuring that you are automating the right tests and automating them in the right way. This is where test automation strategies come into play.

Are Agile Self-Managing Teams Realistic with Layered Management?

Agile software development stems from a philosophy that being agile means creating and responding to change swiftly. Agile means having the ability to adapt and respond to change without dissolving into chaos. Being Agile involves teamwork built on diverse capabilities, skills, and talents. Team members include both the business and software development sides working together to produce working software that meets or exceeds customer expectations continuously.

A Complete Guide To CSS Grid

Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.

Get A Seamless Digital Experience With #LambdaTestYourBusiness????

The holidays are just around the corner, and with Christmas and New Year celebrations coming up, everyone is busy preparing for the festivities! And during this busy time of year, LambdaTest also prepped something special for our beloved developers and testers – #LambdaTestYourBusiness

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-benchmark automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful