code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def poll(self, throttle, timestamp): """ Parameters ---------- throttle : float positive means forward negative means backward zero means stopped timestamp: int, optional the timestamp to apply to the tick reading or Non...
Parameters ---------- throttle : float positive means forward negative means backward zero means stopped timestamp: int, optional the timestamp to apply to the tick reading or None to use the current time
poll
python
autorope/donkeycar
donkeycar/parts/tachometer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/tachometer.py
MIT
def run_threaded(self, throttle:float=0.0, timestamp:float=None) -> Tuple[float, float]: """ Parameters ---------- throttle : float positive means forward negative means backward zero means stopped timestamp: int, optional the times...
Parameters ---------- throttle : float positive means forward negative means backward zero means stopped timestamp: int, optional the timestamp to apply to the tick reading or None to use the current time Returns ...
run_threaded
python
autorope/donkeycar
donkeycar/parts/tachometer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/tachometer.py
MIT
def run(self, throttle:float=1.0, timestamp:float=None) -> Tuple[float, float]: """ throttle: sign of throttle is use used to determine direction. timestamp: timestamp for update or None to use current time. This is useful for creating deterministic tests. """ ...
throttle: sign of throttle is use used to determine direction. timestamp: timestamp for update or None to use current time. This is useful for creating deterministic tests.
run
python
autorope/donkeycar
donkeycar/parts/tachometer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/tachometer.py
MIT
def map_range(self, x, X_min, X_max, Y_min, Y_max): ''' Linear mapping between two ranges of values ''' X_range = X_max - X_min Y_range = Y_max - Y_min XY_ratio = X_range/Y_range return ((x-X_min) / XY_ratio + Y_min)
Linear mapping between two ranges of values
map_range
python
autorope/donkeycar
donkeycar/parts/teensy.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/teensy.py
MIT
def report(self, metrics): """ Basic reporting - gets arbitrary dictionary with values """ curr_time = int(time.time()) # Store sample with time rounded to second try: self._telem_q.put((curr_time, metrics), block=False) except queue.Full: ...
Basic reporting - gets arbitrary dictionary with values
report
python
autorope/donkeycar
donkeycar/parts/telemetry.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/telemetry.py
MIT
def run(self, *args): """ API function needed to use as a Donkey part. Accepts values, pairs them with their inputs keys and saves them to disk. """ assert len(self._step_inputs) == len(args) # Add to queue record = dict(zip(self._step_inputs, args)) ...
API function needed to use as a Donkey part. Accepts values, pairs them with their inputs keys and saves them to disk.
run
python
autorope/donkeycar
donkeycar/parts/telemetry.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/telemetry.py
MIT
def twiddle(evaluator, tol=0.001, params=3, error_cmp=None, initial_guess=None): """ A coordinate descent parameter tuning algorithm. https://github.com/chrisspen/pid_controller/blob/master/pid_controller/pid.py https://en.wikipedia.org/wiki/Coordinate_descent Params: evaluato...
A coordinate descent parameter tuning algorithm. https://github.com/chrisspen/pid_controller/blob/master/pid_controller/pid.py https://en.wikipedia.org/wiki/Coordinate_descent Params: evaluator := callable that will be passed a series of number parameters, which will return ...
twiddle
python
autorope/donkeycar
donkeycar/parts/transform.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/transform.py
MIT
def write_record(self, record=None): """ Can handle various data types including images. """ contents = dict() for key, value in record.items(): if value is None: continue elif key not in self.input_types: continue ...
Can handle various data types including images.
write_record
python
autorope/donkeycar
donkeycar/parts/tub_v2.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/tub_v2.py
MIT
def __init__(self, tub, num_records=20): """ :param tub: tub to operate on :param num_records: number or records to delete """ self._tub = tub self._num_records = num_records self._active_loop = False
:param tub: tub to operate on :param num_records: number or records to delete
__init__
python
autorope/donkeycar
donkeycar/parts/tub_v2.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/tub_v2.py
MIT
def run(self, is_delete): """ Method in the vehicle loop. Delete records when trigger switches from False to True only. :param is_delete: if deletion has been triggered by the caller """ # only run if input is true and debounced if is_delete: if not se...
Method in the vehicle loop. Delete records when trigger switches from False to True only. :param is_delete: if deletion has been triggered by the caller
run
python
autorope/donkeycar
donkeycar/parts/tub_v2.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/tub_v2.py
MIT
def __init__(self, min_speed:float, max_speed:float, throttle_step:float=1/255, min_throttle:float=0) -> None: """ @param min_speed is speed below which vehicle stalls (so slowest stable working speed) @param max_speed is speed at maximum throttle @param throttle_steps is number of steps...
@param min_speed is speed below which vehicle stalls (so slowest stable working speed) @param max_speed is speed at maximum throttle @param throttle_steps is number of steps in working range of throttle (min_throttle to 1.0) @param min_throttle is throttle that corresponds to min_speed;...
__init__
python
autorope/donkeycar
donkeycar/parts/velocity.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/velocity.py
MIT
def run(self, throttle:float, speed:float, target_speed:float) -> float: """ Given current throttle and speed and a target speed, calculate a new throttle to attain target speed @param throttle is current throttle (-1 to 1) @param speed is current speed where reverse speeds are ...
Given current throttle and speed and a target speed, calculate a new throttle to attain target speed @param throttle is current throttle (-1 to 1) @param speed is current speed where reverse speeds are negative @param throttle_steps number of steps between min_throttle and max_...
run
python
autorope/donkeycar
donkeycar/parts/velocity.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/velocity.py
MIT
def run(self, img_arr: np.ndarray, other_arr: np.ndarray = None): """ Donkeycar parts interface to run the part in the loop. :param img_arr: uint8 [0,255] numpy array with image data :param other_arr: numpy array of additional data to be used in the pil...
Donkeycar parts interface to run the part in the loop. :param img_arr: uint8 [0,255] numpy array with image data :param other_arr: numpy array of additional data to be used in the pilot, like IMU array for the IMU model or a state v...
run
python
autorope/donkeycar
donkeycar/parts/pytorch/ResNet18.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/ResNet18.py
MIT
def get_default_transform(for_video=False, for_inference=False, resize=True): """ Creates a default transform to work with torchvision models Video transform: All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB videos of shape (3 x T x H x W), ...
Creates a default transform to work with torchvision models Video transform: All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB videos of shape (3 x T x H x W), where H and W are expected to be 112, and T is a number of video frames in ...
get_default_transform
python
autorope/donkeycar
donkeycar/parts/pytorch/torch_data.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/torch_data.py
MIT
def __init__(self, config, records: List[TubRecord], transform=None): """Create a PyTorch Tub Dataset Args: config (object): the configuration information records (List[TubRecord]): a list of tub records transform (function, optional): a transform to apply to the dat...
Create a PyTorch Tub Dataset Args: config (object): the configuration information records (List[TubRecord]): a list of tub records transform (function, optional): a transform to apply to the data
__init__
python
autorope/donkeycar
donkeycar/parts/pytorch/torch_data.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/torch_data.py
MIT
def _create_pipeline(self): """ This can be overridden if more complicated pipelines are required """ def y_transform(record: TubRecord): angle: float = record.underlying['user/angle'] throttle: float = record.underlying['user/throttle'] predictions = tor...
This can be overridden if more complicated pipelines are required
_create_pipeline
python
autorope/donkeycar
donkeycar/parts/pytorch/torch_data.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/torch_data.py
MIT
def __init__(self, config: Any, tub_paths: List[str], transform=None): """Create a PyTorch Lightning Data Module to contain all data loading logic Args: config (object): the configuration information tub_paths (List[str]): a list of paths to the tubs to use (minimum size of 1). ...
Create a PyTorch Lightning Data Module to contain all data loading logic Args: config (object): the configuration information tub_paths (List[str]): a list of paths to the tubs to use (minimum size of 1). Each tub path corresponds to another training r...
__init__
python
autorope/donkeycar
donkeycar/parts/pytorch/torch_data.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/torch_data.py
MIT
def setup(self, stage=None): """Load all the tub data and set up the datasets. Args: stage ([string], optional): setup expects a string arg stage. It is used to separate setup logic for trainer.fit and trainer...
Load all the tub data and set up the datasets. Args: stage ([string], optional): setup expects a string arg stage. It is used to separate setup logic for trainer.fit and trainer.test. Defaults to None.
setup
python
autorope/donkeycar
donkeycar/parts/pytorch/torch_data.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/torch_data.py
MIT
def get_model_by_type(model_type, cfg, checkpoint_path=None): ''' given the string model_type and the configuration settings in cfg create a Torch model and return it. ''' if model_type is None: model_type = cfg.DEFAULT_MODEL_TYPE print("\"get_model_by_type\" model Type is: {}".format(mo...
given the string model_type and the configuration settings in cfg create a Torch model and return it.
get_model_by_type
python
autorope/donkeycar
donkeycar/parts/pytorch/torch_utils.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/pytorch/torch_utils.py
MIT
def update(self): ''' Loop to run in separate thread the updates angle, throttle and drive mode. ''' while True: # get latest value from server self.angle, self.throttle, self.mode, self.recording = self.run()
Loop to run in separate thread the updates angle, throttle and drive mode.
update
python
autorope/donkeycar
donkeycar/parts/web_controller/web.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/web_controller/web.py
MIT
def run(self): ''' Posts current car sensor data to webserver and returns angle and throttle recommendations. ''' data = {} response = None while response is None: try: response = self.session.post(self.control_url, ...
Posts current car sensor data to webserver and returns angle and throttle recommendations.
run
python
autorope/donkeycar
donkeycar/parts/web_controller/web.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/web_controller/web.py
MIT
def __init__(self, port=8887, mode='user'): """ Create and publish variables needed on many of the web handlers. """ logger.info('Starting Donkey Server...') this_dir = os.path.dirname(os.path.realpath(__file__)) self.static_file_path = os.path.join(this_dir, 'te...
Create and publish variables needed on many of the web handlers.
__init__
python
autorope/donkeycar
donkeycar/parts/web_controller/web.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/web_controller/web.py
MIT
def run_threaded(self, img_arr=None, num_records=0, mode=None, recording=None): """ :param img_arr: current camera image or None :param num_records: current number of data records :param mode: default user/mode :param recording: default recording mode """ self.img...
:param img_arr: current camera image or None :param num_records: current number of data records :param mode: default user/mode :param recording: default recording mode
run_threaded
python
autorope/donkeycar
donkeycar/parts/web_controller/web.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/web_controller/web.py
MIT
def post(self): ''' Receive post requests as user changes the angle and throttle of the vehicle on a the index webpage ''' data = tornado.escape.json_decode(self.request.body) if data.get('angle') is not None: self.application.angle = data['angle'] if...
Receive post requests as user changes the angle and throttle of the vehicle on a the index webpage
post
python
autorope/donkeycar
donkeycar/parts/web_controller/web.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/web_controller/web.py
MIT
def latch_buttons(buttons, pushes): """ Latch button pushes buttons: the latched values pushes: the update value """ if pushes is not None: # # we got button pushes. # - we latch the pushed buttons so we can process the push # - after it is processed we clear it ...
Latch button pushes buttons: the latched values pushes: the update value
latch_buttons
python
autorope/donkeycar
donkeycar/parts/web_controller/web.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/parts/web_controller/web.py
MIT
def create(cls, aug_type: str, config: Config, prob, always) -> \ albumentations.core.transforms_interface.BasicTransform: """ Augmentation factory. Cropping and trapezoidal mask are transformations which should be applied in training, validation and inference. Multiply, Blur...
Augmentation factory. Cropping and trapezoidal mask are transformations which should be applied in training, validation and inference. Multiply, Blur and similar are augmentations which should be used only in training.
create
python
autorope/donkeycar
donkeycar/pipeline/augmentations.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/augmentations.py
MIT
def image_processor(self, img_arr): """ Transforms the image and augments it if in training. We are not calling the normalisation here, because then the normalised images would get cached in the TubRecord, and they are 8 times larger (as they are 64bit floats and not uint8) """ a...
Transforms the image and augments it if in training. We are not calling the normalisation here, because then the normalised images would get cached in the TubRecord, and they are 8 times larger (as they are 64bit floats and not uint8)
image_processor
python
autorope/donkeycar
donkeycar/pipeline/training.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/training.py
MIT
def _create_pipeline(self) -> TfmIterator: """ This can be overridden if more complicated pipelines are required """ # 1. Initialise TubRecord -> x, y transformations def get_x(record: TubRecord) -> Dict[str, Union[float, np.ndarray]]: """ Extracting x from record for tra...
This can be overridden if more complicated pipelines are required
_create_pipeline
python
autorope/donkeycar
donkeycar/pipeline/training.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/training.py
MIT
def __copy__(self): """ Make shallow copies of config and image and full copies of the rest. :return TubRecord: TubRecord copy """ tubrec = TubRecord(self.config, copy(self.base_path), copy(self.underlying)) tubrec._cache_p...
Make shallow copies of config and image and full copies of the rest. :return TubRecord: TubRecord copy
__copy__
python
autorope/donkeycar
donkeycar/pipeline/types.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/types.py
MIT
def image(self, processor=None, as_nparray=True) -> np.ndarray: """ Loads the image. :param processor: Image processing like augmentations or cropping, if not None. Defaults to None. :param as_nparray: Whether to convert the image to a np array of uint8. ...
Loads the image. :param processor: Image processing like augmentations or cropping, if not None. Defaults to None. :param as_nparray: Whether to convert the image to a np array of uint8. Defaults to True. If false, returns result of ...
image
python
autorope/donkeycar
donkeycar/pipeline/types.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/types.py
MIT
def _image_from_cache(self, as_nparray): """ Cache policy only supports numpy array format :return: Numpy array from cache """ if not as_nparray: return self._image if self._cache_policy == CachePolicy.NOCACHE: raise RuntimeError("Found cached ima...
Cache policy only supports numpy array format :return: Numpy array from cache
_image_from_cache
python
autorope/donkeycar
donkeycar/pipeline/types.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/types.py
MIT
def __init__(self, seq_length: int, records: List[TubRecord]): """ :param seq_length: length of sequence :param records: input record list """ self.records = records self.seq_length = seq_length
:param seq_length: length of sequence :param records: input record list
__init__
python
autorope/donkeycar
donkeycar/pipeline/types.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/types.py
MIT
def is_continuous(rec_1: TubRecord, rec_2: TubRecord) -> bool: """ Checks if second record is next to first record :param rec_1: first record :param rec_2: second record :return: if first record is followed by second record """ it_is = rec_1.underlying...
Checks if second record is next to first record :param rec_1: first record :param rec_2: second record :return: if first record is followed by second record
is_continuous
python
autorope/donkeycar
donkeycar/pipeline/types.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/types.py
MIT
def __iter__(self) -> Iterator[List[TubRecord]]: """ Iterable interface. Returns a generator as Iterator. """ it = iter(self.records) for this_record in it: seq = [this_record] seq_it = copy(it) for next_record in seq_it: if self.is_continuous(...
Iterable interface. Returns a generator as Iterator.
__iter__
python
autorope/donkeycar
donkeycar/pipeline/types.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/pipeline/types.py
MIT
def drive(cfg): ''' Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ a...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part finis...
drive
python
autorope/donkeycar
donkeycar/templates/arduino_drive.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/arduino_drive.py
MIT
def drive(cfg, model_path=None, model_type=None): """ Construct a minimal robotic vehicle from many parts. Here, we use a single camera, web or joystick controller, autopilot and tubwriter. Each part runs as a job in the Vehicle loop, calling either its run or run_threaded method depending on the c...
Construct a minimal robotic vehicle from many parts. Here, we use a single camera, web or joystick controller, autopilot and tubwriter. Each part runs as a job in the Vehicle loop, calling either its run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one...
drive
python
autorope/donkeycar
donkeycar/templates/basic.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/basic.py
MIT
def calibrate(cfg): """ Construct an auxiliary robotic vehicle from only the RC controllers and prints their values. The RC remote usually has a tuning pot for the throttle and steering channel. In this loop we run the controllers and simply print their values in order to allow centering the RC pwm ...
Construct an auxiliary robotic vehicle from only the RC controllers and prints their values. The RC remote usually has a tuning pot for the throttle and steering channel. In this loop we run the controllers and simply print their values in order to allow centering the RC pwm signals. If there is a ...
calibrate
python
autorope/donkeycar
donkeycar/templates/basic.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/basic.py
MIT
def drive(cfg ): ''' Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ ...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part finis...
drive
python
autorope/donkeycar
donkeycar/templates/calibrate.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/calibrate.py
MIT
def drive(cfg, model_path=None, use_joystick=False, model_type=None, camera_type='single', meta=[]): """ Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part finis...
drive
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def __init__(self, auto_record_on_throttle, record_in_autopilot): """ Donkeycar Part that manages the recording state. """ self.auto_record_on_throttle = auto_record_on_throttle self.record_in_autopilot = record_in_autopilot self.recording_latch: bool = None self....
Donkeycar Part that manages the recording state.
__init__
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def run(self, mode: str, recording: bool): """ Set recording based on user/autopilot mode :param mode: 'user'|'local_angle'|'local_pilot' :param recording: current recording flag :return: updated recording flag """ recording_in = recording if recording_in ...
Set recording based on user/autopilot mode :param mode: 'user'|'local_angle'|'local_pilot' :param recording: current recording flag :return: updated recording flag
run
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def run(self, mode, user_steering, user_throttle, pilot_steering, pilot_throttle): """ Main final steering and throttle values based on user mode :param mode: 'user'|'local_angle'|'local_pilot' :param user_steering: steering value in user (manual) mode :pa...
Main final steering and throttle values based on user mode :param mode: 'user'|'local_angle'|'local_pilot' :param user_steering: steering value in user (manual) mode :param user_throttle: throttle value in user (manual) mode :param pilot_steering: steering value in autopilot mod...
run
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def run(self, mode, user_image, pilot_image): """ Maintain run condition and which image to show in web ui :param mode: 'user'|'local_angle'|'local_pilot' :param user_image: image to show in manual (user) pilot :param pilot_image: image to show in auto pilot :return: tupl...
Maintain run condition and which image to show in web ui :param mode: 'user'|'local_angle'|'local_pilot' :param user_image: image to show in manual (user) pilot :param pilot_image: image to show in auto pilot :return: tuple of (user-condition, autopilot-condition, web image) ...
run
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def add_user_controller(V, cfg, use_joystick, input_image='ui/image_array'): """ Add the web controller and any other configured user input controller. :param V: the vehicle pipeline. On output this will be modified. :param cfg: the configuration (from myconfig.py) :return: the con...
Add the web controller and any other configured user input controller. :param V: the vehicle pipeline. On output this will be modified. :param cfg: the configuration (from myconfig.py) :return: the controller
add_user_controller
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def add_camera(V, cfg, camera_type): """ Add the configured camera to the vehicle pipeline. :param V: the vehicle pipeline. On output this will be modified. :param cfg: the configuration (from myconfig.py) """ logger.info("cfg.CAMERA_TYPE %s"%cfg.CAMERA_TYPE) if camera_type ==...
Add the configured camera to the vehicle pipeline. :param V: the vehicle pipeline. On output this will be modified. :param cfg: the configuration (from myconfig.py)
add_camera
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def add_odometry(V, cfg, threaded=True): """ If the configuration support odometry, then add encoders, odometry and kinematics to the vehicle pipeline :param V: the vehicle pipeline. On output this may be modified. :param cfg: the configuration (from myconfig.py) """ from donke...
If the configuration support odometry, then add encoders, odometry and kinematics to the vehicle pipeline :param V: the vehicle pipeline. On output this may be modified. :param cfg: the configuration (from myconfig.py)
add_odometry
python
autorope/donkeycar
donkeycar/templates/complete.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/complete.py
MIT
def drive(cfg, use_joystick=False, camera_type='single', meta=[]): ''' Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after anothe...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part finis...
drive
python
autorope/donkeycar
donkeycar/templates/cv_control.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/cv_control.py
MIT
def drive(cfg): ''' Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ a...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part finis...
drive
python
autorope/donkeycar
donkeycar/templates/just_drive.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/just_drive.py
MIT
def drive(cfg, use_joystick=False, camera_type='single'): ''' Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part fini...
drive
python
autorope/donkeycar
donkeycar/templates/path_follow.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/path_follow.py
MIT
def drive(cfg, model_path=None, use_joystick=False, model_type=None, camera_type='single', meta=[]): ''' Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All ...
Construct a working robotic vehicle from many parts. Each part runs as a job in the Vehicle loop, calling either it's run or run_threaded method depending on the constructor flag `threaded`. All parts are updated one after another at the framerate given in cfg.DRIVE_LOOP_HZ assuming each part finis...
drive
python
autorope/donkeycar
donkeycar/templates/simulator.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/templates/simulator.py
MIT
def test_circular_buffer_queue(self): """ enqueue items to head dequeue items from tail """ queue:CircularBuffer = CircularBuffer(3, defaultValue="out-of-range") self.assertEqual(3, queue.capacity) self.assertEqual(0, queue.count) queue.enqueue(0) ...
enqueue items to head dequeue items from tail
test_circular_buffer_queue
python
autorope/donkeycar
donkeycar/tests/test_circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_circular_buffer.py
MIT
def test_circular_buffer_stack(self): """ push items to head pop items from head """ stack:CircularBuffer = CircularBuffer(2, defaultValue="out-of-range") self.assertEqual(2, stack.capacity) self.assertEqual(0, stack.count) self.assertEqual("out-of-range",...
push items to head pop items from head
test_circular_buffer_stack
python
autorope/donkeycar
donkeycar/tests/test_circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_circular_buffer.py
MIT
def test_circular_buffer_array(self): """ append items to tail set/get items by index """ array:CircularBuffer = CircularBuffer(2, defaultValue="out-of-range") self.assertEqual(2, array.capacity) self.assertEqual(0, array.count) self.assertEqual("out-of-ra...
append items to tail set/get items by index
test_circular_buffer_array
python
autorope/donkeycar
donkeycar/tests/test_circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_circular_buffer.py
MIT
def test_keras_vs_tflite_and_tensorrt(keras_pilot, tmp_dir): """ This test cannot run for the 3D CNN model in tflite and the LSTM model in """ k_keras, k_tflite, k_trt = create_models(keras_pilot, tmp_dir) # prepare data img = get_test_img(k_keras) if keras_pilot is KerasIMU: # simu...
This test cannot run for the 3D CNN model in tflite and the LSTM model in
test_keras_vs_tflite_and_tensorrt
python
autorope/donkeycar
donkeycar/tests/test_keras.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_keras.py
MIT
def calc_center_of_rotation(wheelbase, front_wheel, orientation, steering_angle): """ Calculate the center of rotation for a bicycle turn. Args: wheelbase (float): The length of the bicycle wheelbase. front_wheel (tuple): The x and y coordinates of the front wheel (x, y). orientatio...
Calculate the center of rotation for a bicycle turn. Args: wheelbase (float): The length of the bicycle wheelbase. front_wheel (tuple): The x and y coordinates of the front wheel (x, y). orientation (float): The orientation of the bicycle in radians. steering_angle (float): The...
calc_center_of_rotation
python
autorope/donkeycar
donkeycar/tests/test_kinematics.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_kinematics.py
MIT
def calc_arc_end_point(center, radius, point, radians): """ Calculates the ending point on a circle given the center of the circle, the radius of the circle, a point on the circle and a distance along the circle in radians from the given point. Arguments: center -- the center of the circle represen...
Calculates the ending point on a circle given the center of the circle, the radius of the circle, a point on the circle and a distance along the circle in radians from the given point. Arguments: center -- the center of the circle represented as a tuple (x, y) (tuple) radius -- the radius of the c...
calc_arc_end_point
python
autorope/donkeycar
donkeycar/tests/test_kinematics.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_kinematics.py
MIT
def calc_bicycle_pose(wheelbase, front_wheel, orientation, steering_angle, distance): """ Calculate the ending pose for a bicycle with the given wheel base, starting front wheel position, orientation, and steering angle that has driven the given distance. :param wheelbase: :param front_wheel: ...
Calculate the ending pose for a bicycle with the given wheel base, starting front wheel position, orientation, and steering angle that has driven the given distance. :param wheelbase: :param front_wheel: :param orientation: :param steering_angle: :return: ending pose as tuple of (x, y, ...
calc_bicycle_pose
python
autorope/donkeycar
donkeycar/tests/test_kinematics.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_kinematics.py
MIT
def calc_line_length(p1, p2): """ Calculate the length of a line segment given its endpoints. Args: p1 (tuple): The x and y coordinates of the first endpoint (x1, y1). p2 (tuple): The x and y coordinates of the second endpoint (x2, y2). Returns: float: The length of the line se...
Calculate the length of a line segment given its endpoints. Args: p1 (tuple): The x and y coordinates of the first endpoint (x1, y1). p2 (tuple): The x and y coordinates of the second endpoint (x2, y2). Returns: float: The length of the line segment.
calc_line_length
python
autorope/donkeycar
donkeycar/tests/test_kinematics.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_kinematics.py
MIT
def test_controller_update_with_adjusted_max_throttle(self, serial): ''' The adjusted MAX_FORWARD here should not affect the output throttle value. For example, when RC controller sending a 2000 value it means the user want to go full speed. The throttle value should therefore be...
The adjusted MAX_FORWARD here should not affect the output throttle value. For example, when RC controller sending a 2000 value it means the user want to go full speed. The throttle value should therefore be 1.0. It is the RoboHATDriver responsibility to translate this 1.0 to an...
test_controller_update_with_adjusted_max_throttle
python
autorope/donkeycar
donkeycar/tests/test_robohat.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_robohat.py
MIT
def test_controller_load_cfg(self): ''' Make sure the controller load the value from config ''' cfg.MM1_MAX_FORWARD = 1800 cfg.MM1_MAX_REVERSE = 1200 cfg.MM1_STOPPED_PWM = 1550 cfg.MM1_STEERING_MID = 1450 controller = RoboHATController(cfg) asser...
Make sure the controller load the value from config
test_controller_load_cfg
python
autorope/donkeycar
donkeycar/tests/test_robohat.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_robohat.py
MIT
def config() -> Config: """ Config for the test with relevant parameters""" cfg = Config() cfg.BATCH_SIZE = 2 cfg.TRAIN_TEST_SPLIT = 0.8 cfg.IMAGE_H = 120 cfg.IMAGE_W = 160 cfg.IMAGE_DEPTH = 3 cfg.PRINT_MODEL_SUMMARY = True cfg.EARLY_STOP_PATIENCE = 1000 cfg.MAX_EPOCHS = 3 cf...
Config for the test with relevant parameters
config
python
autorope/donkeycar
donkeycar/tests/test_torch.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_torch.py
MIT
def car_dir(tmpdir_factory): """ Creating car dir with sub dirs and extracting tub """ dir = tmpdir_factory.mktemp('mycar') os.mkdir(os.path.join(dir, 'models')) # extract tub.tar.gz into temp car_dir/tub this_dir = os.path.dirname(os.path.abspath(__file__)) with tarfile.open(os.path.join(this_d...
Creating car dir with sub dirs and extracting tub
car_dir
python
autorope/donkeycar
donkeycar/tests/test_torch.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_torch.py
MIT
def test_train(config: Config, car_dir: str, data: Data) -> None: """ Testing convergence of the linear model :param config: donkey config :param car_dir: car directory (this is a temp dir) :param data: test case data :return: None """ from don...
Testing convergence of the linear model :param config: donkey config :param car_dir: car directory (this is a temp dir) :param data: test case data :return: None
test_train
python
autorope/donkeycar
donkeycar/tests/test_torch.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_torch.py
MIT
def test_training_pipeline(config: Config, model_type: str, car_dir: str) \ -> None: """ Testing consistency of the model interfaces and data used in training pipeline. :param config: donkey config :param model_type: test specification of model type :param ...
Testing consistency of the model interfaces and data used in training pipeline. :param config: donkey config :param model_type: test specification of model type :param tub_dir: tub directory (car_dir/tub) :return: None
test_training_pipeline
python
autorope/donkeycar
donkeycar/tests/test_torch.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_torch.py
MIT
def base_config() -> Config: """ Config for the test with relevant parameters""" cfg = Config() cfg.BATCH_SIZE = 64 cfg.TRAIN_TEST_SPLIT = 0.8 cfg.IMAGE_H = 120 cfg.IMAGE_W = 160 cfg.IMAGE_DEPTH = 3 cfg.PRINT_MODEL_SUMMARY = True cfg.EARLY_STOP_PATIENCE = 1000 cfg.MAX_EPOCHS = 6 ...
Config for the test with relevant parameters
base_config
python
autorope/donkeycar
donkeycar/tests/test_train.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_train.py
MIT
def car_dir(tmpdir_factory, base_config, imu_fields) -> str: """ Creating car dir with sub dirs and extracting tub """ car_dir = tmpdir_factory.mktemp('mycar') os.mkdir(os.path.join(car_dir, 'models')) # extract tub.tar.gz into car_dir/tub this_dir = os.path.dirname(os.path.abspath(__file__)) wi...
Creating car dir with sub dirs and extracting tub
car_dir
python
autorope/donkeycar
donkeycar/tests/test_train.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_train.py
MIT
def test_train(config: Config, data: Data) -> None: """ Testing convergence of the above models :param config: donkey config :param data: test case data :return: None """ def pilot_path(name): pilot_name = f'pilot_{name}.savedmodel' return o...
Testing convergence of the above models :param config: donkey config :param data: test case data :return: None
test_train
python
autorope/donkeycar
donkeycar/tests/test_train.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_train.py
MIT
def test_training_pipeline(config: Config, model_type: str, train_filter: Callable[[TubRecord], bool]) -> None: """ Testing consistency of the model interfaces and data used in training pipeline. :param config: donkey config :param model_type: ...
Testing consistency of the model interfaces and data used in training pipeline. :param config: donkey config :param model_type: test specification of model type :param train_filter: filter for records :return: None
test_training_pipeline
python
autorope/donkeycar
donkeycar/tests/test_train.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_train.py
MIT
def create_lbin(marker_index): """ Create a linear binary array with value set """ l = [0] * 15 l[marker_index] = 1 return l
Create a linear binary array with value set
create_lbin
python
autorope/donkeycar
donkeycar/tests/test_util_data.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/tests/test_util_data.py
MIT
def head(self): """ Non-destructive get of the entry at the head (index count-1) return: if list is not empty, the head (most recently pushed/enqueued) entry. if list is empty, the default value provided in the constructor """ if self.count > 0: ...
Non-destructive get of the entry at the head (index count-1) return: if list is not empty, the head (most recently pushed/enqueued) entry. if list is empty, the default value provided in the constructor
head
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def tail(self): """ Non-destructive get of the entry at the tail (index 0) return: if list is not empty, the tail (least recently pushed/enqueued) entry. if list is empty, the default value provided in the constructor """ if self.count > 0: return self...
Non-destructive get of the entry at the tail (index 0) return: if list is not empty, the tail (least recently pushed/enqueued) entry. if list is empty, the default value provided in the constructor
tail
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def enqueue(self, value): """ Push a value onto the head of the buffer. If the buffer is full, then the value at the tail is dropped to make room. """ if self.count < self.capacity: self.count += 1 else: # drop entry at the tail ...
Push a value onto the head of the buffer. If the buffer is full, then the value at the tail is dropped to make room.
enqueue
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def dequeue(self): """ Remove value at tail of list and return it return: if list not empty, value at tail if list empty, the default value """ theValue = self.tail() if self.count > 0: self.count -= 1 self.tailIndex = (self.tailInd...
Remove value at tail of list and return it return: if list not empty, value at tail if list empty, the default value
dequeue
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def push(self, value): """ Push a value onto the head of the buffer. If the buffer is full, then a IndexError is raised. """ if self.count >= self.capacity: raise IndexError("Attempt to push to a full buffer") self.enqueue(value)
Push a value onto the head of the buffer. If the buffer is full, then a IndexError is raised.
push
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def pop(self): """ Remove value at head of list and return it return: if list not empty, the value at head if list empty, the default value """ theValue = self.head() if self.count > 0: self.count -= 1 return theValue
Remove value at head of list and return it return: if list not empty, the value at head if list empty, the default value
pop
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def append(self, value): """ append a value to the tail (index count-1) of the buffer. If the buffer is at capacity, then this will raise an IndexError. """ if self.count >= self.capacity: raise IndexError("Attempt to append to a full buffer") # make ...
append a value to the tail (index count-1) of the buffer. If the buffer is at capacity, then this will raise an IndexError.
append
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def get(self, i:int): """ Get value at given index where head is index 0 and tail is is index count-1; i: index from 0 to count-1 (head is zero) return: value at index or the default value if index is out of range """ if (i >= 0) and (i < self.coun...
Get value at given index where head is index 0 and tail is is index count-1; i: index from 0 to count-1 (head is zero) return: value at index or the default value if index is out of range
get
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def set(self, i:int, value): """ Set value at given index where head is index 0 and tail is is index count-1; """ if (i >= 0) and (i < self.count): self.buffer[(self.tailIndex + (self.count + i - 1)) % self.capacity] = value return raise IndexError...
Set value at given index where head is index 0 and tail is is index count-1;
set
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def truncateTo(self, count): """ Truncate the list to the given number of values. If the given number is greater than or equal to the current count(), then nothing is changed. If the given number is less than the current count(), then elements are dropped from th...
Truncate the list to the given number of values. If the given number is greater than or equal to the current count(), then nothing is changed. If the given number is less than the current count(), then elements are dropped from the tail to resize to the given number. ...
truncateTo
python
autorope/donkeycar
donkeycar/utilities/circular_buffer.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/circular_buffer.py
MIT
def read_chip_id() -> str: """ Read the tegra chip id. On non-tegra platforms this will be blank. """ try: with open("/sys/module/tegra_fuse/parameters/tegra_chip_id", "r") as f: return next(f) except FileNotFoundError: pass return ""
Read the tegra chip id. On non-tegra platforms this will be blank.
read_chip_id
python
autorope/donkeycar
donkeycar/utilities/dk_platform.py
https://github.com/autorope/donkeycar/blob/master/donkeycar/utilities/dk_platform.py
MIT
def convert_to_tub_v2(paths, output_path): """ Convert from old tubs to new one :param paths: legacy tub paths :param output_path: new tub output path :return: None """ empty_record = {'__empty__': True} if type(paths) is str: paths = [pa...
Convert from old tubs to new one :param paths: legacy tub paths :param output_path: new tub output path :return: None
convert_to_tub_v2
python
autorope/donkeycar
scripts/convert_to_tub_v2.py
https://github.com/autorope/donkeycar/blob/master/scripts/convert_to_tub_v2.py
MIT
def show_pixel_values(image, x, y): """ Create text lines that show the value of the given pixel The text lines are used in the main loop to draw text. """ text = [] if image is not None: text.append(f"Pixel at x={x}, y={y}") colorsRGB = image[y,x] text.append(f"Pixel RG...
Create text lines that show the value of the given pixel The text lines are used in the main loop to draw text.
show_pixel_values
python
autorope/donkeycar
scripts/hsv_picker.py
https://github.com/autorope/donkeycar/blob/master/scripts/hsv_picker.py
MIT
def bgr_to_hsv(pixelRGB): """ Convert a single RGB pixel to HSV """ imgRGB = np.uint8([[pixelRGB]]) imgHSV = cv2.cvtColor(imgRGB, cv2.COLOR_BGR2HSV) pixelHSV = imgHSV[0][0] return pixelHSV
Convert a single RGB pixel to HSV
bgr_to_hsv
python
autorope/donkeycar
scripts/hsv_picker.py
https://github.com/autorope/donkeycar/blob/master/scripts/hsv_picker.py
MIT
def list_templates(config: Config) -> None: """List available templates. :param config: a :class:`.Config` object. """ config.print_stdout("Available templates:\n") for tempname in config._get_template_path().iterdir(): with (tempname / "README").open() as readme: synopsis = n...
List available templates. :param config: a :class:`.Config` object.
list_templates
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def init( config: Config, directory: str, template: str = "generic", package: bool = False, ) -> None: """Initialize a new scripts directory. :param config: a :class:`.Config` object. :param directory: string path of the target directory. :param template: string name of the migration ...
Initialize a new scripts directory. :param config: a :class:`.Config` object. :param directory: string path of the target directory. :param template: string name of the migration environment template to use. :param package: when True, write ``__init__.py`` files into the environment locati...
init
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def revision( config: Config, message: Optional[str] = None, autogenerate: bool = False, sql: bool = False, head: str = "head", splice: bool = False, branch_label: Optional[_RevIdType] = None, version_path: Union[str, os.PathLike[str], None] = None, rev_id: Optional[str] = None, ...
Create a new revision file. :param config: a :class:`.Config` object. :param message: string message to apply to the revision; this is the ``-m`` option to ``alembic revision``. :param autogenerate: whether or not to autogenerate the script from the database; this is the ``--autogenerate`` opti...
revision
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def check(config: "Config") -> None: """Check if revision command with autogenerate has pending upgrade ops. :param config: a :class:`.Config` object. .. versionadded:: 1.9.0 """ script_directory = ScriptDirectory.from_config(config) command_args = dict( message=None, autoge...
Check if revision command with autogenerate has pending upgrade ops. :param config: a :class:`.Config` object. .. versionadded:: 1.9.0
check
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def merge( config: Config, revisions: _RevIdType, message: Optional[str] = None, branch_label: Optional[_RevIdType] = None, rev_id: Optional[str] = None, ) -> Optional[Script]: """Merge two revisions together. Creates a new migration file. :param config: a :class:`.Config` instance :p...
Merge two revisions together. Creates a new migration file. :param config: a :class:`.Config` instance :param revisions: The revisions to merge. :param message: string message to apply to the revision. :param branch_label: string label name to apply to the new revision. :param rev_id: hardcode...
merge
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def upgrade( config: Config, revision: str, sql: bool = False, tag: Optional[str] = None, ) -> None: """Upgrade to a later version. :param config: a :class:`.Config` instance. :param revision: string revision target or range for --sql mode. May be ``"heads"`` to target the most recent...
Upgrade to a later version. :param config: a :class:`.Config` instance. :param revision: string revision target or range for --sql mode. May be ``"heads"`` to target the most recent revision(s). :param sql: if True, use ``--sql`` mode. :param tag: an arbitrary "tag" that can be intercepted by c...
upgrade
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def downgrade( config: Config, revision: str, sql: bool = False, tag: Optional[str] = None, ) -> None: """Revert to a previous version. :param config: a :class:`.Config` instance. :param revision: string revision target or range for --sql mode. May be ``"base"`` to target the first re...
Revert to a previous version. :param config: a :class:`.Config` instance. :param revision: string revision target or range for --sql mode. May be ``"base"`` to target the first revision. :param sql: if True, use ``--sql`` mode. :param tag: an arbitrary "tag" that can be intercepted by custom ...
downgrade
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def show(config: Config, rev: str) -> None: """Show the revision(s) denoted by the given symbol. :param config: a :class:`.Config` instance. :param rev: string revision target. May be ``"current"`` to show the revision(s) currently applied in the database. """ script = ScriptDirectory.from_...
Show the revision(s) denoted by the given symbol. :param config: a :class:`.Config` instance. :param rev: string revision target. May be ``"current"`` to show the revision(s) currently applied in the database.
show
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def history( config: Config, rev_range: Optional[str] = None, verbose: bool = False, indicate_current: bool = False, ) -> None: """List changeset scripts in chronological order. :param config: a :class:`.Config` instance. :param rev_range: string revision range. :param verbose: output...
List changeset scripts in chronological order. :param config: a :class:`.Config` instance. :param rev_range: string revision range. :param verbose: output in verbose mode. :param indicate_current: indicate current revision.
history
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def heads( config: Config, verbose: bool = False, resolve_dependencies: bool = False ) -> None: """Show current available heads in the script directory. :param config: a :class:`.Config` instance. :param verbose: output in verbose mode. :param resolve_dependencies: treat dependency version as dow...
Show current available heads in the script directory. :param config: a :class:`.Config` instance. :param verbose: output in verbose mode. :param resolve_dependencies: treat dependency version as down revisions.
heads
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def branches(config: Config, verbose: bool = False) -> None: """Show current branch points. :param config: a :class:`.Config` instance. :param verbose: output in verbose mode. """ script = ScriptDirectory.from_config(config) for sc in script.walk_revisions(): if sc.is_branch_point: ...
Show current branch points. :param config: a :class:`.Config` instance. :param verbose: output in verbose mode.
branches
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def current(config: Config, verbose: bool = False) -> None: """Display the current revision for a database. :param config: a :class:`.Config` instance. :param verbose: output in verbose mode. """ script = ScriptDirectory.from_config(config) def display_version(rev, context): if verb...
Display the current revision for a database. :param config: a :class:`.Config` instance. :param verbose: output in verbose mode.
current
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def stamp( config: Config, revision: _RevIdType, sql: bool = False, tag: Optional[str] = None, purge: bool = False, ) -> None: """'stamp' the revision table with the given revision; don't run any migrations. :param config: a :class:`.Config` instance. :param revision: target revisi...
'stamp' the revision table with the given revision; don't run any migrations. :param config: a :class:`.Config` instance. :param revision: target revision or list of revisions. May be a list to indicate stamping of multiple branch heads; may be ``"base"`` to remove all revisions from the table...
stamp
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def edit(config: Config, rev: str) -> None: """Edit revision script(s) using $EDITOR. :param config: a :class:`.Config` instance. :param rev: target revision. """ script = ScriptDirectory.from_config(config) if rev == "current": def edit_current(rev, context): if not re...
Edit revision script(s) using $EDITOR. :param config: a :class:`.Config` instance. :param rev: target revision.
edit
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def ensure_version(config: Config, sql: bool = False) -> None: """Create the alembic version table if it doesn't exist already . :param config: a :class:`.Config` instance. :param sql: use ``--sql`` mode. .. versionadded:: 1.7.6 """ script = ScriptDirectory.from_config(config) def do_...
Create the alembic version table if it doesn't exist already . :param config: a :class:`.Config` instance. :param sql: use ``--sql`` mode. .. versionadded:: 1.7.6
ensure_version
python
sqlalchemy/alembic
alembic/command.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/command.py
MIT
def print_stdout(self, text: str, *arg: Any) -> None: """Render a message to standard out. When :meth:`.Config.print_stdout` is called with additional args those arguments will formatted against the provided text, otherwise we simply output the provided text verbatim. This is a...
Render a message to standard out. When :meth:`.Config.print_stdout` is called with additional args those arguments will formatted against the provided text, otherwise we simply output the provided text verbatim. This is a no-op when the``quiet`` messaging option is enabled. e....
print_stdout
python
sqlalchemy/alembic
alembic/config.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/config.py
MIT
def file_config(self) -> ConfigParser: """Return the underlying ``ConfigParser`` object. Dir*-ect access to the .ini file is available here, though the :meth:`.Config.get_section` and :meth:`.Config.get_main_option` methods provide a possibly simpler interface. """ ...
Return the underlying ``ConfigParser`` object. Dir*-ect access to the .ini file is available here, though the :meth:`.Config.get_section` and :meth:`.Config.get_main_option` methods provide a possibly simpler interface.
file_config
python
sqlalchemy/alembic
alembic/config.py
https://github.com/sqlalchemy/alembic/blob/master/alembic/config.py
MIT