diff --git a/.github/workflows/lint_and_pytest.yml b/.github/workflows/lint_and_pytest.yml index 7f14616..5786edf 100644 --- a/.github/workflows/lint_and_pytest.yml +++ b/.github/workflows/lint_and_pytest.yml @@ -31,9 +31,9 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest python -m pip install -e . -# - name: Lint with flake8 -# run: | -# flake8 . + - name: Lint with flake8 + run: | + flake8 . - name: Test with pytest run: | pytest diff --git a/ptsl/client.py b/ptsl/client.py index 5436843..8531b4a 100644 --- a/ptsl/client.py +++ b/ptsl/client.py @@ -101,8 +101,9 @@ def __init__(self, ..note:: If `certificate_path` is given, the legacy AuthorizeConnection method will be used for setting up the connection session. If it is - `None`, then `company_name` and `application_name` will be used with - the RegisterConnection method (available since Pro Tools 2023.3). + `None`, then `company_name` and `application_name` will be used + with the RegisterConnection method (available since Pro Tools + 2023.3). """ self.channel = grpc.insecure_channel(address) @@ -122,7 +123,8 @@ def __init__(self, else: raise AssertionError( - "company_name and application_name parameters were not given") + "company_name and application_name parameters were " + + "not given") self.is_open = True @@ -276,8 +278,9 @@ def _primitive_register_connection(self, company_name: str, This method is called automatically by the initializer. """ - req = pt.RegisterConnectionRequestBody(company_name=company_name, - application_name=application_name) + req = pt.RegisterConnectionRequestBody( + company_name=company_name, + application_name=application_name) req_json = json_format.MessageToJson(req, preserving_proto_field_name=True) @@ -297,7 +300,8 @@ def _primitive_register_connection(self, company_name: str, def _primitive_authorize_connection(self, api_key_path) -> Optional[str]: """ - (Deprecated) Authorizes the client's connection to the Pro Tools RPC server. + (Deprecated) Authorizes the client's connection to the Pro Tools RPC + server. This method is called automatically by the initializer. """ diff --git a/ptsl/engine.py b/ptsl/engine.py index adc59eb..aa527b4 100644 --- a/ptsl/engine.py +++ b/ptsl/engine.py @@ -87,7 +87,8 @@ def ptsl_version(self) -> int: op = ops.GetPTSLVersion() self.client.run(op) assert isinstance( - op.response, pt.GetPTSLVersionResponseBody), f"Expected response body, encountered {op.response}" + op.response, pt.GetPTSLVersionResponseBody), \ + f"Expected response body, encountered {op.response}" return op.response.version @@ -253,20 +254,22 @@ def save_session_as(self, path: str, name: str): op = ops.SaveSessionAs(session_name=name, session_location=path) self.client.run(op) - def export_session_as_text(self, - include_clip_list: bool = False, - include_file_list: bool = False, - include_markers: bool = False, - include_plugin_list: bool = False, - include_track_edls: bool = False, - show_sub_frames: bool = False, - track_list_type: Optional[pt.TrackListType] = pt.SelectedTracksOnly, - include_user_timestamp=False, - fade_handling_type: pt.FadeHandlingType = pt.DontShowCrossfades, - track_offset_options: pt.TrackOffsetOptions = pt.TimeCode, - text_as_file_format: pt.TextAsFileFormat = pt.UTF8, - output_type: pt.ESI_OutputType = pt.ESI_String, - output_path: Optional[str] = None) -> str: + def export_session_as_text( + self, + include_clip_list: bool = False, + include_file_list: bool = False, + include_markers: bool = False, + include_plugin_list: bool = False, + include_track_edls: bool = False, + show_sub_frames: bool = False, + track_list_type: Optional[pt.TrackListType] = + pt.SelectedTracksOnly, + include_user_timestamp=False, + fade_handling_type: pt.FadeHandlingType = pt.DontShowCrossfades, + track_offset_options: pt.TrackOffsetOptions = pt.TimeCode, + text_as_file_format: pt.TextAsFileFormat = pt.UTF8, + output_type: pt.ESI_OutputType = pt.ESI_String, + output_path: Optional[str] = None) -> str: """ Export the open session as text. """ @@ -324,7 +327,8 @@ def extend_selection_to_target_tracks(self, tracks: List[str]): """ Extend selection to target tracks. - :param List[str] tracks: A list of track names to extend the selection to. + :param List[str] tracks: A list of track names to extend + the selection to. """ op = ops.ExtendSelectionToTargetTracks(tracks_to_extend_to=tracks) self.client.run(op) @@ -427,12 +431,13 @@ def edit_memory_location(self, location_number: int, """ Edit a memory location. - :param int location_number: Location number to edit (if location does not - exist, this will create a new location in 2023.6) + :param int location_number: Location number to edit (if location + does not exist, this will create a new location in 2023.6) :param str name: Location name :param str start_time: Start time :param str end_time: End time - :param TimeProperties time_properties: Time properties, either this is a range or a marker + :param TimeProperties time_properties: Time properties, either this + is a range or a marker :param MemoryLocationReference reference: Reference :param MemoryLocationProperties general_properties: Location properties :param str comments: Comment field diff --git a/ptsl/ops/__init__.py b/ptsl/ops/__init__.py index 147cb0f..41c9147 100644 --- a/ptsl/ops/__init__.py +++ b/ptsl/ops/__init__.py @@ -80,8 +80,7 @@ from .rename_selected_clip import RenameSelectedClip from .rename_target_clip import RenameTargetClip from .toggle_play_state import \ - TogglePlayState, ToggleRecordEnable, \ - PlayHalfSpeed, RecordHalfSpeed + TogglePlayState, ToggleRecordEnable, \ + PlayHalfSpeed, RecordHalfSpeed from .memory_locations import EditMemoryLocation, GetMemoryLocations - diff --git a/ptsl/ops/export_selected_tracks_as_aaf_omf.py b/ptsl/ops/export_selected_tracks_as_aaf_omf.py index e536273..440d149 100644 --- a/ptsl/ops/export_selected_tracks_as_aaf_omf.py +++ b/ptsl/ops/export_selected_tracks_as_aaf_omf.py @@ -1,4 +1,5 @@ from ptsl.ops import Operation + class ExportSelectedTracksAsAAFOMF(Operation): pass diff --git a/ptsl/ops/export_session_info_as_text.py b/ptsl/ops/export_session_info_as_text.py index e9a29e1..088ff21 100644 --- a/ptsl/ops/export_session_info_as_text.py +++ b/ptsl/ops/export_session_info_as_text.py @@ -6,7 +6,7 @@ # # https://duc.avid.com/showthread.php?t=422971 class ExportSessionInfoAsText(Operation): - + @classmethod def response_body(cls): return None diff --git a/ptsl/ops/extend_selection_to_target_tracks.py b/ptsl/ops/extend_selection_to_target_tracks.py index 8f0f8cd..a496b62 100644 --- a/ptsl/ops/extend_selection_to_target_tracks.py +++ b/ptsl/ops/extend_selection_to_target_tracks.py @@ -1,6 +1,5 @@ -from ptsl import PTSL_pb2 as pt - from .operation import Operation + class ExtendSelectionToTargetTracks(Operation): - pass \ No newline at end of file + pass diff --git a/ptsl/ops/get_dyamic_properties.py b/ptsl/ops/get_dyamic_properties.py index 8c8bb95..18aeabf 100644 --- a/ptsl/ops/get_dyamic_properties.py +++ b/ptsl/ops/get_dyamic_properties.py @@ -1,4 +1,5 @@ from ptsl.ops import Operation + class GetDynamicProperties(Operation): pass diff --git a/ptsl/ops/get_file_location.py b/ptsl/ops/get_file_location.py index 34f21ca..3395869 100644 --- a/ptsl/ops/get_file_location.py +++ b/ptsl/ops/get_file_location.py @@ -1,4 +1,5 @@ from ptsl.ops import Operation + class GetFileLocation(Operation): pass diff --git a/ptsl/ops/get_playback_mode.py b/ptsl/ops/get_playback_mode.py index b0f285d..7122068 100644 --- a/ptsl/ops/get_playback_mode.py +++ b/ptsl/ops/get_playback_mode.py @@ -4,6 +4,7 @@ from ptsl.ops import Operation + class GetPlaybackMode(Operation): pass @@ -14,13 +15,12 @@ def xform(x): decoder = json.JSONDecoder() decoded = decoder.decode(in_json) - if isinstance(['possible_settings'][0],str): - decoded['current_settings'] = [xform(x) for x in decoded['current_settings']] - decoded['possible_settings'] = [xform(x) for x in decoded['possible_settings']] + if isinstance(['possible_settings'][0], str): + decoded['current_settings'] = [ + xform(x) for x in decoded['current_settings']] + decoded['possible_settings'] = [ + xform(x) for x in decoded['possible_settings']] encoder = json.JSONEncoder() encoded = encoder.encode(decoded) - return encoded - - - + return encoded diff --git a/ptsl/ops/get_ptsl_version.py b/ptsl/ops/get_ptsl_version.py index f70c6c2..36c554c 100644 --- a/ptsl/ops/get_ptsl_version.py +++ b/ptsl/ops/get_ptsl_version.py @@ -1,4 +1,5 @@ from ptsl.ops import Operation + class GetPTSLVersion(Operation): - pass \ No newline at end of file + pass diff --git a/ptsl/ops/get_record_mode.py b/ptsl/ops/get_record_mode.py index 709b7cd..b5f37db 100644 --- a/ptsl/ops/get_record_mode.py +++ b/ptsl/ops/get_record_mode.py @@ -1,4 +1,5 @@ from ptsl.ops import Operation + class GetRecordMode(Operation): pass diff --git a/ptsl/ops/get_session_audio_format.py b/ptsl/ops/get_session_audio_format.py index 3ee01e1..afcff76 100644 --- a/ptsl/ops/get_session_audio_format.py +++ b/ptsl/ops/get_session_audio_format.py @@ -1,4 +1,5 @@ from ptsl.ops import Operation + class GetSessionAudioFormat(Operation): - pass \ No newline at end of file + pass diff --git a/ptsl/ops/operation.py b/ptsl/ops/operation.py index 013410b..cfcd63f 100644 --- a/ptsl/ops/operation.py +++ b/ptsl/ops/operation.py @@ -76,6 +76,7 @@ def on_empty_response_body(self): def on_response_body(self, response_body: R): """ - The client calls this when the server responds with a JSON `pt.ResponseBody`. + The client calls this when the server responds with a JSON + `pt.ResponseBody`. """ self.response = response_body diff --git a/tests/test_engine.py b/tests/test_engine.py index 66b66d7..3a67eb6 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -7,90 +7,96 @@ from ptsl.engine import open_engine import ptsl.ops as ops -@contextmanager + +@contextmanager def open_engine_with_mock_client(expected_response=Optional[Any]): with patch('ptsl.Client'): - with open_engine(company_name="none", application_name="none") as engine: + with open_engine(company_name="none", + application_name="none") as engine: if expected_response is None: yield engine engine.client.run.assert_called() else: def give_response(op: ops.Operation): op.on_response_body(expected_response) - - with patch.object(engine.client, 'run', new=Mock(side_effect=give_response)): + + with patch.object(engine.client, 'run', + new=Mock(side_effect=give_response)): yield engine engine.client.run.assert_called() + class TestEngine(TestCase): """ - The :class:`TestEngine` test case exercises the :class:`Engine` interface. The client - is fully mocked. These tests are here mostly to make sure the engine is translating - the *Request classes from call arguments, and *Response classes into return values, - correctly. + The :class:`TestEngine` test case exercises the :class:`Engine` interface. + The client is fully mocked. These tests are here mostly to make sure the + engine is translating the *Request classes from call arguments, and + *Response classes into return values, correctly. - If these fail, it probably means a breaking change has ocurred in `PTSL.proto` or the - engine's interface. + If these fail, it probably means a breaking change has ocurred in + `PTSL.proto` or the engine's interface. """ MARKER_LOCATION_FIXTURE = [ - { 'number':1, - 'name':"Marker 1", - 'start_time':"01:00:00:00", - 'end_time':"01:00:01:00", - 'time_properties':pt.TP_Selection, - 'reference':pt.MLR_Absolute, - 'general_properties':pt.MemoryLocationProperties(zoom_settings=True, - pre_post_roll_times=True, - track_visibility=False, - track_heights=True, - group_enables=True, - window_configuration=True, - window_configuration_index=0, - window_configuration_name="Work"), - 'comments':"These are my marker comments."}, - { - 'number': 2, - 'name': 'Location 2', - 'start_time': "00:59:59:23", - 'end_time':"", - 'time_properties': pt.TP_Marker, - 'reference': pt.MLR_Absolute, - 'general_properties':pt.MemoryLocationProperties(zoom_settings=True, - pre_post_roll_times=True, - track_visibility=False, - track_heights=True, - group_enables=True, - window_configuration=True, - window_configuration_index=0, - window_configuration_name="Work"), - 'comments': "These are more comments." - } - ] + {'number': 1, + 'name': "Marker 1", + 'start_time': "01:00:00:00", + 'end_time': "01:00:01:00", + 'time_properties': pt.TP_Selection, + 'reference': pt.MLR_Absolute, + 'general_properties': pt.MemoryLocationProperties( + zoom_settings=True, + pre_post_roll_times=True, + track_visibility=False, + track_heights=True, + group_enables=True, + window_configuration=True, + window_configuration_index=0, + window_configuration_name="Work"), + 'comments': "These are my marker comments."}, + + {'number': 2, + 'name': 'Location 2', + 'start_time': "00:59:59:23", + 'end_time': "", + 'time_properties': pt.TP_Marker, + 'reference': pt.MLR_Absolute, + 'general_properties': pt.MemoryLocationProperties( + zoom_settings=True, + pre_post_roll_times=True, + track_visibility=False, + track_heights=True, + group_enables=True, + window_configuration=True, + window_configuration_index=0, + window_configuration_name="Work"), + 'comments': "These are more comments."}] def test_ptsl_version(self): with open_engine_with_mock_client( - expected_response=pt.GetPTSLVersionResponseBody(version=1)) as engine: - self.assertEqual(engine.ptsl_version(),1) + expected_response=pt.GetPTSLVersionResponseBody(version=1) + ) as engine: + self.assertEqual(engine.ptsl_version(), 1) def test_create_session(self): with open_engine_with_mock_client() as engine: - self.assertIsNone(engine.create_session(name="test name", - path="test/to/path", - file_type=pt.SAF_AIFF, - sample_rate=pt.SR_96000, - bit_depth=pt.Bit32Float, - io_setting=pt.IO_51FilmMix, - is_interleaved=False)) + self.assertIsNone( + engine.create_session(name="test name", + path="test/to/path", + file_type=pt.SAF_AIFF, + sample_rate=pt.SR_96000, + bit_depth=pt.Bit32Float, + io_setting=pt.IO_51FilmMix, + is_interleaved=False)) def test_create_session_from_template(self): with open_engine_with_mock_client() as engine: self.assertIsNone( engine.create_session_from_template( - template_group="xyz", + template_group="xyz", template_name="template", - name="test", - path="template/test/path", + name="test", + path="template/test/path", file_type=pt.SAF_AIFF, sample_rate=pt.SR_176400, bit_depth=pt.Bit16, @@ -123,7 +129,7 @@ def test_close_session(self): self.assertIsNone( engine.close_session(save_on_close=True) ) - + def test_save_session(self): with open_engine_with_mock_client() as engine: self.assertIsNone( @@ -138,22 +144,24 @@ def test_save_session_as(self): ) def text_export_session_as_text(self): - resp = pt.ExportSessionInfoAsTextResponseBody(session_info="test string") + resp = pt.ExportSessionInfoAsTextResponseBody( + session_info="test string") with open_engine_with_mock_client(expected_response=resp) as engine: - info = engine.export_session_as_text(include_clip_list=True, - include_file_list=True, - include_markers=False, - include_plugin_list=True, - include_track_edls=True, - show_sub_frames=True, - track_list_type=pt.AllTracks, - include_user_timestamp=False, - fade_handling_type=pt.ShowCrossfades, - track_offset_options=pt.BarsBeats, - text_as_file_format=pt.TextEdit, - output_type=pt.ESI_String, - output_path=None) - self.assertEqual(info,"test_string") + info = engine.export_session_as_text( + include_clip_list=True, + include_file_list=True, + include_markers=False, + include_plugin_list=True, + include_track_edls=True, + show_sub_frames=True, + track_list_type=pt.AllTracks, + include_user_timestamp=False, + fade_handling_type=pt.ShowCrossfades, + track_offset_options=pt.BarsBeats, + text_as_file_format=pt.TextEdit, + output_type=pt.ESI_String, + output_path=None) + self.assertEqual(info, "test_string") def test_import_data(self): with open_engine_with_mock_client() as engine: @@ -164,15 +172,16 @@ def test_import_data(self): video_options=pt.LinkToSourceVideo, match_options=pt.MT_ImportAsNewTrack, playlist_options=pt.ImportReplaceExistingPlaylists, - track_data_to_import=pt.TrackDataToImport(track_data_preset_path="path/to/preset", - clip_gain=False,clips_and_media=True, - volume_automation=True), + track_data_to_import=pt.TrackDataToImport( + track_data_preset_path="path/to/preset", + clip_gain=False, + clips_and_media=True, + volume_automation=True), timecode_mapping_units=pt.MapStartTimeCodeTo, timecode_mapping_start_time="01:00:00:00", - adjust_session_start_time_to_match_source=False - ) + adjust_session_start_time_to_match_source=False) - audio_data = pt.AudioData(file_list = ["file_1","/path/to/file_2"], + audio_data = pt.AudioData(file_list=["file_1", "/path/to/file_2"], audio_operations=pt.CopyAudio, destination_path="path/to/destination", destination=pt.MD_NewTrack, @@ -194,7 +203,7 @@ def test_select_all_clips_on_track(self): def test_extend_track_selection(self): with open_engine_with_mock_client() as engine: self.assertIsNone( - engine.extend_selection_to_target_tracks(tracks=["a","b"]) + engine.extend_selection_to_target_tracks(tracks=["a", "b"]) ) def test_trim_to_selection(self): @@ -206,8 +215,9 @@ def test_trim_to_selection(self): def test_create_batch_fades(self): with open_engine_with_mock_client() as engine: self.assertIsNone( - engine.create_batch_fades(preset_name="fades1",adjust_bounds=False) - ) + engine.create_batch_fades( + preset_name="fades1", + adjust_bounds=False)) def test_rename_track(self): with open_engine_with_mock_client() as engine: @@ -220,8 +230,8 @@ def test_rename_track(self): def test_rename_selected_clip(self): with open_engine_with_mock_client() as engine: self.assertIsNone( - engine.rename_target_clip(clip_name="x", - new_name="y", + engine.rename_target_clip(clip_name="x", + new_name="y", rename_file=True) ) @@ -253,7 +263,8 @@ def test_edit_memory_location(self): with open_engine_with_mock_client() as engine: for fixture in self.MARKER_LOCATION_FIXTURE: test_fixture = fixture.copy() - # "number" is called "location_number" in the EditmemoryLocationRequest + # "number" is called "location_number" in the + # EditmemoryLocationRequest test_fixture['location_number'] = test_fixture.pop('number') self.assertIsNone( engine.edit_memory_location(**test_fixture) @@ -261,8 +272,9 @@ def test_edit_memory_location(self): def test_get_memory_locations(self): fixture = pt.GetMemoryLocationsResponseBody( - memory_locations=[pt.MemoryLocation(**x) for x in self.MARKER_LOCATION_FIXTURE] - ) + memory_locations=[ + pt.MemoryLocation( + **x) for x in self.MARKER_LOCATION_FIXTURE]) with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.get_memory_locations() @@ -280,66 +292,86 @@ def test_consolidate_clip(self): def test_export_clips_as_files(self): with open_engine_with_mock_client() as engine: self.assertIsNone( - engine.export_clips_as_files(path="path/to/export", - ftype=pt.WAV, - bit_depth=pt.Bit24,ex_format=pt.EF_Mono, - enforce_avid_compatibility=False, - resolve_duplicates=pt.AutoRenaming) - ) + engine.export_clips_as_files( + path="path/to/export", + ftype=pt.WAV, + bit_depth=pt.Bit24, + ex_format=pt.EF_Mono, + enforce_avid_compatibility=False, + resolve_duplicates=pt.AutoRenaming)) def test_get_file_location(self): - fixture = pt.GetFileLocationResponseBody(stats=None, - file_locations= - [pt.FileLocation(path="path/to/a/file.wav",info=pt.FileLocationInfo(is_online=True)), - pt.FileLocation(path="path/to/b/file.wav",info=pt.FileLocationInfo(is_online=False))]) + fixture = pt.GetFileLocationResponseBody( + stats=None, + file_locations=[ + pt.FileLocation( + path="path/to/a/file.wav", + info=pt.FileLocationInfo( + is_online=True)), + pt.FileLocation( + path="path/to/b/file.wav", + info=pt.FileLocationInfo( + is_online=False))]) with open_engine_with_mock_client(expected_response=fixture) as engine: - got = engine.get_file_location(filters=[pt.Audio_Files,pt.Online_Files]) + got = engine.get_file_location( + filters=[pt.Audio_Files, pt.Online_Files]) self.assertEqual(len(got), 2) self.assertEqual(got[0].path, "path/to/a/file.wav") self.assertEqual(got[1].info.is_online, False) def test_export_mix(self): - - sources = [pt.EM_SourceInfo(source_type=pt.PhysicalOut, name="Output 1")] + + sources = [ + pt.EM_SourceInfo( + source_type=pt.PhysicalOut, + name="Output 1")] audio_info = pt.EM_AudioInfo(compression_type=pt.CT_PCM, - export_format=pt.EF_MultipleMono, - bit_depth=pt.Bit24, - sample_rate=pt.SR_96000, - pad_to_frame_boundary=pt.TB_False, - delivery_format=pt.EM_DF_FilePerMixSource) - - video_info = pt.EM_VideoInfo(include_video=pt.TB_False, - export_option=pt.VE_Transcode, - replace_timecode_track=pt.TB_True, - codec_info=pt.EM_CodecInfo(codec_name="my codec", - property_list=[])) - location_info = pt.EM_LocationInfo(import_after_bounce=pt.TB_None, - import_options=pt.EM_ImportOptions()) - - dolby_info = pt.EM_DolbyAtmosInfo(add_first_frame_of_action=pt.TB_False, - timecode_value="01:00:00:00", - property_list=[]) + export_format=pt.EF_MultipleMono, + bit_depth=pt.Bit24, + sample_rate=pt.SR_96000, + pad_to_frame_boundary=pt.TB_False, + delivery_format=pt.EM_DF_FilePerMixSource) + + video_info = pt.EM_VideoInfo( + include_video=pt.TB_False, + export_option=pt.VE_Transcode, + replace_timecode_track=pt.TB_True, + codec_info=pt.EM_CodecInfo( + codec_name="my codec", + property_list=[])) + location_info = pt.EM_LocationInfo( + import_after_bounce=pt.TB_None, + import_options=pt.EM_ImportOptions()) + + dolby_info = pt.EM_DolbyAtmosInfo( + add_first_frame_of_action=pt.TB_False, + timecode_value="01:00:00:00", + property_list=[]) with open_engine_with_mock_client() as engine: - self.assertIsNone( engine.export_mix(base_name="outfile", - file_type=pt.EM_WAV, - sources=sources, - audio_info=audio_info, - video_info=video_info, - location_info=location_info, - dolby_atmos_info=dolby_info, - offline_bounce=pt.TB_True)) + self.assertIsNone(engine.export_mix(base_name="outfile", + file_type=pt.EM_WAV, + sources=sources, + audio_info=audio_info, + video_info=video_info, + location_info=location_info, + dolby_atmos_info=dolby_info, + offline_bounce=pt.TB_True)) def test_session_name(self): - fixture = pt.GetSessionNameResponseBody(session_name="My Great Session") + fixture = pt.GetSessionNameResponseBody( + session_name="My Great Session") with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.session_name() self.assertEqual(got, "My Great Session") def test_session_path(self): - fixture = pt.GetSessionPathResponseBody(session_path=pt.FileLocation(path="path/to/my/great/session", - info=pt.FileLocationInfo(is_online=True))) + fixture = pt.GetSessionPathResponseBody( + session_path=pt.FileLocation( + path="path/to/my/great/session", + info=pt.FileLocationInfo( + is_online=True))) with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.session_path() @@ -353,41 +385,43 @@ def test_session_sample_rate(self): self.assertEqual(got, 44100) def test_session_audio_format(self): - fixture = pt.GetSessionAudioFormatResponseBody(current_setting=pt.SAF_AIFF, - possible_settings=[pt.SAF_AIFF, pt.SAF_WAVE]) + fixture = pt.GetSessionAudioFormatResponseBody( + current_setting=pt.SAF_AIFF, possible_settings=[ + pt.SAF_AIFF, pt.SAF_WAVE]) with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.session_audio_format() self.assertEqual(got, pt.SAF_AIFF) def test_session_bit_depth(self): - fixture = pt.GetSessionBitDepthResponseBody(current_setting=pt.Bit32Float, - possible_settings=[pt.Bit16, pt.Bit24, pt.Bit32Float]) + fixture = pt.GetSessionBitDepthResponseBody( + current_setting=pt.Bit32Float, possible_settings=[ + pt.Bit16, pt.Bit24, pt.Bit32Float]) with open_engine_with_mock_client(expected_response=fixture) as engine: - got = engine.session_bit_depth() + got = engine.session_bit_depth() self.assertEqual(got, pt.Bit32Float) def test_session_interleaved_state(self): - fixture = pt.GetSessionInterleavedStateResponseBody(current_setting=True, - possible_settings=[True,False]) + fixture = pt.GetSessionInterleavedStateResponseBody( + current_setting=True, possible_settings=[True, False]) with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.session_interleaved_state() self.assertTrue(got) def test_session_timecode_rate(self): - fixture = pt.GetSessionTimeCodeRateResponseBody(current_setting=pt.STCR_Fps23976, - possible_settings=[pt.STCR_Fps23976, - pt.STCR_Fps24, - pt.STCR_Fps25]) + fixture = pt.GetSessionTimeCodeRateResponseBody( + current_setting=pt.STCR_Fps23976, possible_settings=[ + pt.STCR_Fps23976, pt.STCR_Fps24, pt.STCR_Fps25]) with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.session_timecode_rate() self.assertEqual(got, pt.STCR_Fps23976) def test_session_start_time(self): - fixture = pt.GetSessionStartTimeResponseBody(session_start_time="00:59:00:00") + fixture = pt.GetSessionStartTimeResponseBody( + session_start_time="00:59:00:00") with open_engine_with_mock_client(expected_response=fixture) as engine: got = engine.session_start_time() @@ -401,53 +435,56 @@ def test_session_length(self): self.assertEqual(got, "24:00:00:00") def test_session_feet_frames_rate(self): - fixture = pt.GetSessionFeetFramesRateResponseBody(current_setting=pt.SFFR_Fps24, - possible_settings=[pt.SFFR_Fps24, - pt.SFFR_Fps25, - pt.SFFR_Fps23976]) + fixture = pt.GetSessionFeetFramesRateResponseBody( + current_setting=pt.SFFR_Fps24, possible_settings=[ + pt.SFFR_Fps24, pt.SFFR_Fps25, pt.SFFR_Fps23976]) with open_engine_with_mock_client(fixture) as engine: got = engine.session_feet_frames_rate() self.assertEqual(got, pt.SFFR_Fps24) - def test_session_audio_rate_pull(self): - fixture = pt.GetSessionAudioRatePullSettingsResponseBody(current_setting=pt.SRP_Up01, - possible_settings=[pt.SRP_None, - pt.SRP_Up01, - pt.SRP_Up4Up01, - pt.SRP_Up4, - pt.SRP_Down01, - pt.SRP_Down4, - pt.SRP_Down4Up01, - pt.SRP_Down4Down01]) + fixture = pt.GetSessionAudioRatePullSettingsResponseBody( + current_setting=pt.SRP_Up01, + possible_settings=[ + pt.SRP_None, + pt.SRP_Up01, + pt.SRP_Up4Up01, + pt.SRP_Up4, + pt.SRP_Down01, + pt.SRP_Down4, + pt.SRP_Down4Up01, + pt.SRP_Down4Down01]) with open_engine_with_mock_client(fixture) as engine: got = engine.session_audio_rate_pull() self.assertEqual(got, pt.SRP_Up01) def test_session_video_rate_pull(self): - fixture = pt.GetSessionVideoRatePullSettingsResponseBody(current_setting=pt.SRP_Down4Down01, - possible_settings=[pt.SRP_None, - pt.SRP_Up01, - pt.SRP_Up4Up01, - pt.SRP_Up4, - pt.SRP_Down01, - pt.SRP_Down4, - pt.SRP_Down4Up01, - pt.SRP_Down4Down01]) + fixture = pt.GetSessionVideoRatePullSettingsResponseBody( + current_setting=pt.SRP_Down4Down01, + possible_settings=[ + pt.SRP_None, + pt.SRP_Up01, + pt.SRP_Up4Up01, + pt.SRP_Up4, + pt.SRP_Down01, + pt.SRP_Down4, + pt.SRP_Down4Up01, + pt.SRP_Down4Down01]) with open_engine_with_mock_client(fixture) as engine: got = engine.session_video_rate_pull() self.assertEqual(got, pt.SRP_Down4Down01) def test_transport_state(self): - fixture = pt.GetTransportStateResponseBody(current_setting=pt.TS_TransportFastForward, - possible_settings=[pt.TS_TransportIsPreviewing, - pt.TS_TransportFastForward, - pt.TS_TransportIsCued, - pt.TS_TransportRewind - ]) + fixture = pt.GetTransportStateResponseBody( + current_setting=pt.TS_TransportFastForward, + possible_settings=[ + pt.TS_TransportIsPreviewing, + pt.TS_TransportFastForward, + pt.TS_TransportIsCued, + pt.TS_TransportRewind]) with open_engine_with_mock_client(fixture) as engine: got = engine.transport_state() @@ -461,57 +498,62 @@ def test_transport_armed(self): self.assertFalse(got) def test_playback_modes(self): - fixture = pt.GetPlaybackModeResponseBody(current_settings=[pt.PM_Normal, pt.PM_DynamicTransport], - possible_settings=[pt.PM_Normal, pt.PM_Loop, pt.PM_DynamicTransport]) + fixture = pt.GetPlaybackModeResponseBody( + current_settings=[ + pt.PM_Normal, pt.PM_DynamicTransport], possible_settings=[ + pt.PM_Normal, pt.PM_Loop, pt.PM_DynamicTransport]) with open_engine_with_mock_client(fixture) as engine: got = engine.playback_modes() - self.assertEqual(got,(True, False, True)) + self.assertEqual(got, (True, False, True)) - def test_record_mode(self): - fixture = pt.GetRecordModeResponseBody(current_setting=pt.RM_QuickPunch, - possible_settings=[pt.RM_QuickPunch, - pt.RM_Loop]) + def test_record_mode(self): + fixture = pt.GetRecordModeResponseBody( + current_setting=pt.RM_QuickPunch, possible_settings=[ + pt.RM_QuickPunch, pt.RM_Loop]) with open_engine_with_mock_client(fixture) as engine: got = engine.record_mode() self.assertEqual(got, pt.RM_QuickPunch) def test_track_list(self): - + track_attriute_none = getattr(pt, "None") - fixture = pt.GetTrackListResponseBody(stats=None, - track_list=[ - pt.Track(name="Track 1", - type=pt.AudioTrack, - id="xyz1", - index=0, - color="#FF0000", - track_attributes=pt.TrackAttributes(is_inactive=pt.SetExplicitly, - is_hidden=pt.SetExplicitly, - is_selected=track_attriute_none, - contains_clips=False, - is_soloed=False, - is_record_enabled=False, - is_input_monitoring_on=track_attriute_none, - is_smart_dsp_on=False, - is_locked=False, - is_muted=False, - is_frozen=False, - is_open=True, - is_online=True), - id_compressed="zzzz" - ) - ]) + fixture = pt.GetTrackListResponseBody( + stats=None, + track_list=[ + pt.Track( + name="Track 1", + type=pt.AudioTrack, + id="xyz1", + index=0, + color="#FF0000", + track_attributes=pt.TrackAttributes( + is_inactive=pt.SetExplicitly, + is_hidden=pt.SetExplicitly, + is_selected=track_attriute_none, + contains_clips=False, + is_soloed=False, + is_record_enabled=False, + is_input_monitoring_on=track_attriute_none, + is_smart_dsp_on=False, + is_locked=False, + is_muted=False, + is_frozen=False, + is_open=True, + is_online=True), + id_compressed="zzzz")]) with open_engine_with_mock_client(fixture) as engine: - got = engine.track_list(filters=[pt.TrackListInvertibleFilter(filter=pt.All, - is_inverted=False)]) - self.assertEqual(len(got),1) + got = engine.track_list( + filters=[ + pt.TrackListInvertibleFilter( + filter=pt.All, + is_inverted=False)]) + self.assertEqual(len(got), 1) self.assertEqual(got[0].name, "Track 1") self.assertEqual(got[0].track_attributes.contains_clips, False) def test_set_playback_mode(self): pass -