diff options
| author | morefigs <morefigs@gmail.com> | 2019-04-13 16:32:07 +1000 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-04-13 16:32:07 +1000 |
| commit | a768500ccd472cbb18262bf4de6a7e533e57b4b6 (patch) | |
| tree | db08eeec9647788dfd3078f7586763089472308f | |
| parent | 3d00598641e5b1ee570390148e15d8a8c7e19183 (diff) | |
| download | pymba-a768500ccd472cbb18262bf4de6a7e533e57b4b6.tar.gz pymba-a768500ccd472cbb18262bf4de6a7e533e57b4b6.zip | |
Replace f-strings with format for backwards compatibility
| -rw-r--r-- | examples/camera/display_frame.py | 2 | ||||
| -rw-r--r-- | examples/camera/list_feature_values_and_ranges.py | 4 | ||||
| -rw-r--r-- | examples/interface/list_feature_values_and_ranges.py | 4 | ||||
| -rw-r--r-- | examples/show_version.py | 4 | ||||
| -rw-r--r-- | examples/system/list_feature_values_and_ranges.py | 4 | ||||
| -rw-r--r-- | pymba/vimba_c.py | 7 | ||||
| -rw-r--r-- | pymba/vimba_object.py | 2 |
7 files changed, 15 insertions, 12 deletions
diff --git a/examples/camera/display_frame.py b/examples/camera/display_frame.py index 6dc3f84..c5b7dbe 100644 --- a/examples/camera/display_frame.py +++ b/examples/camera/display_frame.py @@ -15,7 +15,7 @@ def display_frame(frame: Frame, delay: Optional[int] = 1) -> None: :param frame: The frame object to display. :param delay: Display delay in milliseconds, use 0 for indefinite. """ - print(f'frame {frame.data.frameID}') + print('frame {}'.format(frame.data.frameID)) # get a copy of the frame data image = frame.buffer_data_numpy() diff --git a/examples/camera/list_feature_values_and_ranges.py b/examples/camera/list_feature_values_and_ranges.py index 353d48e..c6c7a05 100644 --- a/examples/camera/list_feature_values_and_ranges.py +++ b/examples/camera/list_feature_values_and_ranges.py @@ -27,8 +27,8 @@ if __name__ == '__main__': print('\n\t'.join( str(x) for x in ( feature_name, - f'value: {value}', - f'range: {range_}') + 'value: {}'.format(value), + 'range: {}'.format(range_)) if x is not None)) camera.close() diff --git a/examples/interface/list_feature_values_and_ranges.py b/examples/interface/list_feature_values_and_ranges.py index b33c76a..c07bec3 100644 --- a/examples/interface/list_feature_values_and_ranges.py +++ b/examples/interface/list_feature_values_and_ranges.py @@ -26,8 +26,8 @@ if __name__ == '__main__': print('\n\t'.join( str(x) for x in ( feature_name, - f'value: {value}', - f'range: {range_}') + 'value: {}'.format(value), + 'range: {}'.format(range_)) if x is not None)) interface.close() diff --git a/examples/show_version.py b/examples/show_version.py index 386d622..660ae60 100644 --- a/examples/show_version.py +++ b/examples/show_version.py @@ -2,5 +2,5 @@ from pymba import Vimba, PYMBA_VERSION if __name__ == '__main__': - print(f'Pymba version: {PYMBA_VERSION}') - print(f'Vimba C API version: {Vimba.version()}') + print('Pymba version: {}'.format(PYMBA_VERSION)) + print('Vimba C API version: {}'.format(Vimba.version())) diff --git a/examples/system/list_feature_values_and_ranges.py b/examples/system/list_feature_values_and_ranges.py index ef4da34..91a2a36 100644 --- a/examples/system/list_feature_values_and_ranges.py +++ b/examples/system/list_feature_values_and_ranges.py @@ -25,6 +25,6 @@ if __name__ == '__main__': print('\n\t'.join( str(x) for x in ( feature_name, - f'value: {value}', - f'range: {range_}') + 'value: {}'.format(value), + 'range: {}'.format(range_)) if x is not None)) diff --git a/pymba/vimba_c.py b/pymba/vimba_c.py index 802d5e8..d1d80c4 100644 --- a/pymba/vimba_c.py +++ b/pymba/vimba_c.py @@ -92,8 +92,11 @@ else: class NiceStructure(Structure): def __repr__(self): field_names = (field[0] for field in self._fields_) - return f'{type(self).__name__}(' \ - f'{", ".join("=".join((field, str(getattr(self, field)))) for field in field_names)})' + return '{}({})'.format( + type(self).__name__, + ", ".join("=".join((field, str(getattr(self, field)))) + for field in field_names) + ) class VmbVersionInfo(NiceStructure): diff --git a/pymba/vimba_object.py b/pymba/vimba_object.py index ca91bd3..9c68c5f 100644 --- a/pymba/vimba_object.py +++ b/pymba/vimba_object.py @@ -36,7 +36,7 @@ class VimbaObject: # otherwise attempt to get their value return feature.value - raise AttributeError(f'{self.__class__.__name__} object has no attribute {item}') + raise AttributeError('{} object has no attribute {}'.format(self.__class__.__name__, item)) # allow direct access to feature values as an attribute def __setattr__(self, item: str, value): |
