How to use cleanup_version method in localstack

Best Python code snippet using localstack_python

minify

Source:minify Github

copy

Full Screen

...11from git.exc import GitCommandError12from packaging import version13MINIMUM_VERSION = "v1.24.0"14_new_publish = []15def cleanup_version(a):16 return version.parse(a.split('_')[-1].lstrip("v"))17_ignore_branches = ['krogoth', 'pyro', 'rocko', 'sumo', 'thud']18_minimum_version = cleanup_version(MINIMUM_VERSION)19def create_parser():20 parser = argparse.ArgumentParser()21 parser.add_argument("--excludes", default=os.path.join(os.path.dirname(22 __file__), "..", ".minifyexcludes"), help="Source checkout of meta-sca")23 parser.add_argument("source", help="Source checkout of meta-sca")24 parser.add_argument("target", help="Target checkout of meta-sca-minified")25 return parser.parse_args()26def get_excludes(excludefile):27 _cnt = []28 with open(excludefile) as i:29 _cnt = [x.strip("\n") for x in i.readlines() if x]30 return _cnt31def create_release_map(source, target, excludefile):32 _list = {}33 for branch in source.references:34 if isinstance(branch, git.refs.remote.RemoteReference):35 if branch.name in _ignore_branches:36 continue37 _tags_on_branch = source.git.tag(38 '--sort=v:refname', '--merged', branch.name).split('\n')39 for i, v in enumerate(_tags_on_branch):40 if i >= len(_tags_on_branch) - 1:41 continue42 if cleanup_version(v) < _minimum_version:43 continue44 if cleanup_version(v) == _minimum_version:45 v = MINIMUM_VERSION46 _this_tag = v47 _next_tag = _tags_on_branch[i+1]48 _excludes = [':(exclude){}'.format(x)49 for x in get_excludes(excludefile) if x]50 _args = [_this_tag, _next_tag, '--binary']51 if _excludes:52 _args += ["--", *_excludes]53 patch = source.git.diff(*_args)54 if not patch.endswith("\n"):55 patch += "\n"56 _branch = [x.strip() for x in source.git.branch(57 '--contains', _next_tag).split(' ') if x]58 if len(_branch) > 1:59 _branch = 'master'60 elif any(_branch):61 _branch = _branch[0]62 else:63 _branch = branch.name64 65 _branch = _branch.replace("origin/", "", 1)66 if _next_tag not in _list:67 print("Adding new diff {}..{} on {}".format(_this_tag, _next_tag, _branch))68 _list[_next_tag] = {69 'patch': patch,70 'branch': _branch,71 'before': _this_tag72 }73 return _list74def apply_branch(branch, list, source, target):75 global _new_publish76 _releases = sorted(list.keys(), key=lambda k: cleanup_version(k))77 if not any(_releases):78 return79 _initial_fork = [v['before']80 for k, v in list.items() if k == _releases[0]][0]81 if not any(x.name == branch for x in target.branches):82 target.git.branch(branch, 'tags/' + _initial_fork)83 _new_publish.append(branch)84 target.git.checkout(branch)85 for release in _releases:86 _obj = [v for k, v in list.items() if k == release]87 if any(_obj):88 _obj = _obj[0]89 else:90 continue...

Full Screen

Full Screen

runtime.py

Source:runtime.py Github

copy

Full Screen

1import boto32import re3CODEBUILD_PLATFORMS = ['UBUNTU']4def cleanup_version(version_str):5 """6 Function that replaces the parts of the string as decribed in pairs in the dict7 Allows to run a sub(x, y, str) of another sub for each key of hte dict8 """9 dict = {10 'aws/codebuild/': '',11 '.': '',12 ':': '',13 '-': '',14 '_': ''15 }16 regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))17 return regex.sub(lambda word: dict[word.string[word.start():word.end()]], version_str)18def generate_runtime_mapping_and_parameters(languages):19 client = boto3.client('codebuild')20 try:21 mappings = {}22 params_languages = []23 params_versions = []24 platform_mappings = {}25 platforms = client.list_curated_environment_images()['platforms']26 for platform in platforms:27 if platform['platform'] in CODEBUILD_PLATFORMS:28 platform_key = platform['platform'].lower()29 platform_mappings[platform_key] = {}30 for language in platform['languages']:31 if language['language'].lower() in languages:32 language_name = language['language']33 language_key = cleanup_version(language['language'].lower())34 params_languages.append(language_key)35 platform_mappings[platform_key][language_key] = {}36 for image in language['images']:37 language_version = cleanup_version(image['name'])38 params_versions.append(language_version)39 platform_mappings[platform_key][language_key][language_version] = language_version40 platform_mappings[platform_key][language_key][language_version] = image['versions'][-1]41 mappings = {}42 for platform in CODEBUILD_PLATFORMS:43 key = platform.lower()44 for j in platform_mappings[key]:45 mappings[j] = platform_mappings[key][j]46 return (True, mappings, params_languages, params_versions)47 except Exception as error:48 return None49if __name__ == '__main__':50 import json51 print(json.dumps(...

Full Screen

Full Screen

RawData2Rangefft.py

Source:RawData2Rangefft.py Github

copy

Full Screen

1from Cleanup_version.process.config import *2from Cleanup_version.process.fft_process_byframe import *3from Cleanup_version.tools.Reshape_KKT_RawData import reshape_rawdata4# path = "D:\\kkt_dataset\\0119\\"5# name = "p2_50cm"6# raw_data = np.load(path + name + ".npy", allow_pickle=True)7def build_fft_buffer_data(path, name):8 raw_data = np.load(path+ "raw\\" + name + ".npy", allow_pickle=True)9 fftcfg, dpccfg, cfarcfg, bpfcfg, hpfcfg, larry_cfg = vitalcfg()10 for i in range(len(raw_data)):11 dataInCh1, dataInCh2 = reshape_rawdata(raw_data[i])12 sigfft1 = fft_process_byframe(dataInCh1, fftcfg, larry_cfg)13 sigfft = np.expand_dims(sigfft1, axis=1)14 # out_arr[i, :] = sigfft[:, 0]15 if i == 0:16 out_arr = np.copy(sigfft[:, 0])17 else:18 out_arr = np.vstack((out_arr, sigfft[:, 0]))19 np.save(path +"range_fft_buf\\"+ name + "_rangefft.npy", out_arr)20if __name__ == "__main__":21 # path = "D:\\kkt_dataset\\0119\\"22 # rawdata = np.load(path + "p2_stop_100cm" + ".npy", allow_pickle=True)23 # build_fft_buffer_data(path, "p2_stop_100cm", rawdata)24 # person = ["1", "2", "3"]25 # cm = ["50", "100", "150", "200"]26 # for cm_numb in cm:27 # for p_numb in person:28 # filename = "p" + p_numb + "_" + cm_numb + "cm"29 # print("---------- {} ------------".format(filename))30 # rawdata = np.load(path + filename + ".npy", allow_pickle=True)31 # build_fft_buffer_data(path, filename, rawdata)32 # path = "D:\\kkt_dataset\\lie_dataset\\raw\\"33 path = "C:\\data_set\\lie_dataset\\"34 # B_speed = ["slow", "fast"]35 # B_amp = ["light", "heavy"]36 B_speed = ["fast"]37 B_amp = ["heavy"]38 B_person=["1"]39 for b_s in B_speed:40 for b_a in B_amp:41 for b_p in B_person:42 for time in range(4):43 # name = "lie_"+str(b_s)+"_"+str(b_a)+"_p"+str(b_p)\44 # +"_t"+str(time+1)45 name = "lie_stop_p"+str(b_p)+"_t"+str(time+1)46 print("-----process {}-------".format(name))...

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