How to use _original_path method in tox

Best Python code snippet using tox_python

er_midi_settings.py

Source:er_midi_settings.py Github

copy

Full Screen

1import collections2import dataclasses3import numbers4import os5import typing6from . import er_misc_funcs7from . import er_tuning8# User probably won't need to access these settings9@dataclasses.dataclass10class MidiSettings:11 num_tracks: int = None # Not to be set by user, will be overwritten later12 _output_path: str = None # Not to be set by user, will be overwritten later13 _original_path: str = (14 None # Not to be set by user, will be overwritten later15 )16 output_dir: str = None #17 tet: int = 1218 time_sig: typing.Tuple[int, int] = None19 max_denominator: int = 819220 num_channels_pitch_bend_loop: int = 921 pitch_bend_time_prop: numbers.Number = 0.7522 def __post_init__(self):23 self.note_counter = collections.Counter()24 # If the file is in 12 tet and features no finetuning then these steps are25 # not necessary but for the moment it seems like more effort than it's26 # worth to check:27 self.pitch_bend_time_dict = {28 track_i: [0 for _ in range(self.num_channels_pitch_bend_loop)]29 for track_i in range(self.num_tracks)30 }31 self.pitch_bend_tuple_dict = er_tuning.return_pitch_bend_tuple_dict(32 self.tet33 )34 def num_tracks_from(self, score):35 self.num_tracks = score.num_voices36 @property37 def original_path(self):38 return self._original_path39 @original_path.setter40 def original_path(self, original_path):41 self._original_path = original_path42 if self.output_dir is None:43 self.output_dir = os.path.dirname(original_path)44 @property45 def output_path(self):46 if self._output_path is None or os.path.exists(self._output_path):47 self._output_path = er_misc_funcs.get_changed_midi_path(48 os.path.join(49 self.output_dir,50 (os.path.basename(self._original_path)),51 )52 )...

Full Screen

Full Screen

misc.py

Source:misc.py Github

copy

Full Screen

1"""2Copyright 2021 Keisuke Izumiya3Licensed under the Apache License, Version 2.0 (the "License");4you may not use this file except in compliance with the License.5You may obtain a copy of the License at6 http://www.apache.org/licenses/LICENSE-2.07Unless required by applicable law or agreed to in writing, software8distributed under the License is distributed on an "AS IS" BASIS,9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.10See the License for the specific language governing permissions and11limitations under the License.12"""13import os14from pathlib import Path15from tempfile import TemporaryDirectory16class Chdir:17 def __init__(self, path: Path) -> None:18 self._original_path: Path = Path.cwd()19 self._new_path: Path = path20 def __enter__(self) -> None:21 os.chdir(self._new_path)22 def __exit__(self, _0: any, _1: any, _2: any) -> None:23 os.chdir(self._original_path)24class TmpDir:25 def __init__(self) -> None:26 self._tmp_dir: TemporaryDirectory = TemporaryDirectory()27 self.path: Path = Path(self._tmp_dir.name)28 def __del__(self) -> None:29 self._cleanup()30 def __enter__(self) -> Path:31 return self.path32 def __exit__(self, _0: any, _1: any, _2: any) -> None:33 self._cleanup()34 def _cleanup(self) -> None:35 self._tmp_dir.cleanup()36def id_fn(x: any) -> any:37 return x38def range1(end: int, step: int = 1) -> range:...

Full Screen

Full Screen

dbcopy.py

Source:dbcopy.py Github

copy

Full Screen

1import os2import shutil3import tempfile4class DbCopy(object):5 def __init__(self, original_path):6 self._original_path = original_path7 def __enter__(self):8 temp_dir = tempfile.gettempdir()9 base_path = os.path.basename(self._original_path)10 self.path = os.path.join(temp_dir,base_path)11 shutil.copy2(self._original_path, self.path)12 return self.path13 def __exit__(self,exc_type, exc_val, exc_tb):...

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 tox 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