How to use default_fmt method in yandex-tank

Best Python code snippet using yandex-tank

_translation_map.py

Source:_translation_map.py Github

copy

Full Screen

...78 """Update bindings. Mappings name->source are always added, but may be overridden by the user."""79 source_to_source = {source: source for source in self.sources}80 self._name_to_source: NameToSourceDict = {**source_to_source, **value}81 @property82 def default_fmt(self) -> Optional[Format]:83 """Return the format specification to use instead of `fmt` for fallback translation."""84 return self._default_fmt # pragma: no cover85 @default_fmt.setter86 def default_fmt(self, value: Optional[FormatType]) -> None:87 self._default_fmt = None if value is None else Format.parse(value)88 @property89 def fmt(self) -> Optional[Format]:90 """Return the translation format."""91 return self._fmt # pragma: no cover92 @fmt.setter93 def fmt(self, value: Optional[FormatType]) -> None:94 self._fmt = None if value is None else Format.parse(value)95 @property96 def reverse_mode(self) -> bool:97 """Return reversed mode status flag.98 If set, the mappings returned by :meth:`apply` (and therefore also ``__getitem__`` are reversed.99 Returns:100 Reversal status flag....

Full Screen

Full Screen

myutil.py

Source:myutil.py Github

copy

Full Screen

1from datetime import datetime2from datetime import *3DEFAULT_FMT = '%Y-%m-%d %H:%M:%S'4def from_unix_time(timestamp, FMT=DEFAULT_FMT):5 int_time = timestamp6 if type(int_time) == str:7 int_time = int(int_time)8 return datetime.fromtimestamp(int_time).strftime(DEFAULT_FMT)9def format_datetime(dt, FMT=DEFAULT_FMT):10 return dt.strftime(FMT)11def now(FMT=DEFAULT_FMT):12 return format_datetime(datetime.now())13def get_interval(tdelta, mode='m'):14 if mode == 'm':15 return tdelta.seconds / 6016 elif mode == 's':17 return tdelta.seconds18 elif mode == 'h':19 return tdelta.seconds / 360020 elif mode == 'd':21 return tdelta.days22 else:23 return tdelta.microseconds24def time_diff(t1, t2, FMT=DEFAULT_FMT, mode='s'):25 tdelta = datetime.strptime(t2, FMT) - datetime.strptime(t1, FMT)26 return get_interval(tdelta, mode)27# unix timestamp28def after_time(t, interval, FMT=DEFAULT_FMT, mode='s'):29 t1 = datetime.strptime(t, FMT)30 if mode == 's':31 delta = timedelta(seconds=interval)32 elif mode == 'h':33 delta = timedelta(hours=interval)34 elif mode == 'm':35 delta = timedelta(minutes=interval)36 elif mode == 'd':37 delta = timedelta(days=interval)38 t2 = t1 + delta39 40 return format_datetime(t2, FMT)41def time_interval(dt1, dt2, mode='s'):42 if dt1 < dt2:43 return get_interval(dt2 - dt1, mode)44 else:45 return 0 - get_interval(dt1 - dt2, mode)46def time_interval_unix(t1, t2, mode='s'):47 dt1 = datetime.fromtimestamp(t1)48 dt2 = datetime.fromtimestamp(t2)49 return time_interval(dt1, dt2)50def from_now_unix(unix_time, mode='s'):51 if type(unix_time) == str:52 unix_time = int(unix_time)53 return time_interval(datetime.now(), datetime.fromtimestamp(unix_time), mode)54if __name__ == '__main__':55 # print from_unix_time('1433398870')56 # print time_diff('2015-06-04T13:19:58Z', '2015-06-04T14:18:58Z', mode='m')57 # print from_now_unix('1433398870', 'm')...

Full Screen

Full Screen

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 yandex-tank 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