def create_letter(letter_id, bureau_id, client, Letter, Bureau, **kwargs): letter = Letter.objects.filter(_id=ObjectId(letter_id)).values( "title", "content")[0] bureau = Bureau.objects.filter(_id=ObjectId(bureau_id)).values( "title", "desc")[0] letter_title = stringcase.spinalcase(letter["title"].replace(" ", "")) bureau_title = stringcase.spinalcase(bureau["title"].replace(" ", "")) content = letter["content"] content = html_prev + content + html_next content = content.replace("{{bureau_desc}}", bureau["desc"]) content = content.replace("{{client_name}}", client.full_name) content = content.replace("{{client_street}}", client.street) content = content.replace("{{client_city}}", client.city) content = content.replace("{{client_state}}", client.state) content = content.replace("{{client_zipcode}}", client.zip_code) content = content.replace("{{account_no}}", kwargs["account_no"]) content = content.replace("{{creditor_name}}", kwargs["creditor_name"]) content = content.replace("{{mention_date}}", str(kwargs["mention_date"])) content = content.replace("<", " <") content = content.replace(">", "> ") name = f'{letter_title}_{bureau_title}_{client.first_name}_{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.pdf' return ContentFile(create_pdf(content), name=name)
def _default_service_configuration(self): cwd = basename(getcwd()) return { u'ecr_repo': { u'name': spinalcase("{}-repo".format(cwd)), }, u'service_role_arn': None, u'services': { pascalcase(self.service_name): { u'http_interface': { u'internal': False, u'alb': { u'create_new': True, }, u'restrict_access_to': [u'0.0.0.0/0'], u'container_port': 80, u'health_check_path': u'/elb-check', u'load_balancing_algorithm': DEFAULT_LOAD_BALANCING_ALGORITHM, u'deregistration_delay': DEFAULT_TARGET_GROUP_DEREGISTRATION_DELAY }, u'secrets_name': spinalcase("{}-{}".format(self.service_name, self.environment)), u'system_controls': [], u'memory_reservation': 1000, u'command': None, u'task_arn': None, u'task_execution_arn': None, } } }
def command_from_signature(object: types.FunctionType, *decorators): for i, (k, v) in enumerate(inspect.signature(object).parameters.items()): if not i and k == "ctx": decorators += (click.pass_context, ) if v.annotation == inspect._empty: continue if v.default == inspect._empty: opts = {} if istype(v.annotation, (typing.List, list)): opts.update(nargs=-1) decorators += (click.argument(stringcase.spinalcase(k), type=click_type(v.annotation), **opts), ) else: type = click_type(v.annotation, v.default) decorators += (click.option( "-" * (1 if len(k) == 1 else 2) + stringcase.spinalcase(k), type=type, show_default=True, is_flag=v.annotation is bool, ), ) return decorators
def convertCase(self, data): txt = self.txtInput.text() result = txt if data == 'Alpha Num Case': result = stringcase.alphanumcase(txt) if data == 'Camel Case': result = stringcase.camelcase(txt) if data == 'Capital Case': result = stringcase.capitalcase(txt) if data == 'Const Case': result = stringcase.constcase(txt) if data == 'Lower Case': result = stringcase.lowercase(txt) if data == 'Pascal Case': result = stringcase.pascalcase(txt) if data == 'Path Case': result = stringcase.pathcase(txt) if data == 'Sentence Case': result = stringcase.sentencecase(txt) if data == 'Snake Case': result = stringcase.snakecase(txt) if data == 'Spinal Case': result = stringcase.spinalcase(txt) if data == 'Title Case': result = stringcase.titlecase(txt) if data == 'Trim Case': result = stringcase.trimcase(txt) if data == 'Upper Case': result = stringcase.uppercase(txt) self.lblResult.setText(result) pyperclip.copy(result)
def convertFile(file, convertType='c'): readFile = '' if len(file) > 1: readFile = file[0].strip() convertType = file[1].strip() else: readFile = file[0].strip() if readFile[-3:] == 'txt': outfile = readFile.strip('.txt') + "_out.txt" print "Output File: ", outfile o = open(outfile, "w+") f = open(readFile, "r") f1 = f.readlines() for line in f1: if convertType == 's': o.write(stringcase.snakecase(line).strip('_') + '\n') elif convertType == 'a': o.write(stringcase.uppercase(line)) elif convertType == 'l': o.write(stringcase.lowercase(line)) elif convertType == 'p': o.write(stringcase.pascalcase(line)) elif convertType == 'd': o.write(stringcase.pathcase(line).strip('/') + '\n') elif convertType == 'm': o.write(stringcase.spinalcase(line).strip('-') + '\n') else: o.write(stringcase.camelcase(stringcase.lowercase(line))) f.close() o.close() else: print 'You will need to you use a .txt'
def __process_native_fields(self, spreadsheet_id, project_id, template_id, display_name, master_template_fields, delete_existing_template): native_fields = self.__filter_fields_by_types( master_template_fields, _DATA_CATALOG_NATIVE_TYPES) StringFormatter.format_elements_to_snakecase(native_fields, 0) enums_names = {} for field in native_fields: if not field[2] == _DATA_CATALOG_ENUM_TYPE: continue names_from_sheet = self.__sheets_reader.read_helper( spreadsheet_id, stringcase.spinalcase(field[0])) enums_names[field[0]] = [name[0] for name in names_from_sheet] template_name = datacatalog.DataCatalogClient.tag_template_path( project_id, _CLOUD_PLATFORM_REGION, template_id) if delete_existing_template: self.__datacatalog_facade.delete_tag_template(template_name) if not self.__datacatalog_facade.tag_template_exists(template_name): self.__datacatalog_facade.create_tag_template( project_id, template_id, display_name, native_fields, enums_names)
def loc_example(item, f_id, type, npi): return (f_templ.location_template.format( type=type, f_id=f_id, npi=npi, location_identifier_system='https://{}.com'.format( spinalcase( item['Provider Organization Name (Legal Business Name)'].lower( ))), name=item['Provider Organization Name (Legal Business Name)'], type_code=item['Healthcare Provider Taxonomy Code_1'], type_code_display=get_qual_code_display( item['Healthcare Provider Taxonomy Code_1']), phone=item[ 'Provider Business Practice Location Address Telephone Number'] if item['Provider Business Practice Location Address Telephone Number'] else '5555555555', address=item[ 'Provider First Line Business Practice Location Address'], #todo add second line city=item['Provider Business Practice Location Address City Name'], state=item['Provider Business Practice Location Address State Name'], zip=item['Provider Business Practice Location Address Postal Code'], LAT=ll.lat_long[get_zip( item['Provider Business Practice Location Address Postal Code'])] [0], # remove the + 4 for looking up lat and long LON=ll.lat_long[get_zip( item['Provider Business Practice Location Address Postal Code'])] [1], ))
def __init__(self, name, environment='', env_sample_file='', timeout_seconds=None, version=None, build_args=None, dockerfile=None, ssh=None, cache_from=None, deployment_identifier=None, working_dir='.'): self.name = name self.environment = environment self.deployment_identifier = deployment_identifier self.env_sample_file = env_sample_file self.timeout_seconds = timeout_seconds self.version = version self.ecr_client = boto3.session.Session(region_name=self.region).client('ecr') self.cluster_name = get_cluster_name(environment) self.service_configuration = ServiceConfiguration(service_name=name, environment=environment).get_config() self.service_info_fetcher = ServiceInformationFetcher(self.name, self.environment, self.service_configuration) if not self.service_info_fetcher.stack_found: raise UnrecoverableException( "error finding stack in ServiceUpdater: {}-{}".format(self.name, self.environment)) ecr_repo_config = self.service_configuration.get('ecr_repo') self.ecr = ECR( self.region, ecr_repo_config.get('name', spinalcase(self.name + '-repo')), ecr_repo_config.get('account_id', get_account_id()), ecr_repo_config.get('assume_role_arn', None), version, build_args, dockerfile, working_dir, ssh, cache_from )
def __process_custom_multivalued_fields(self, files_folder, project_id, template_id, display_name, master_template_fields, delete_existing_template): multivalued_fields = self.__filter_fields_by_types( master_template_fields, [_CUSTOM_MULTIVALUED_TYPE]) StringFormatter.format_elements_to_snakecase(multivalued_fields, 0) for field in multivalued_fields: try: values_from_file = CSVFilesReader.read_helper( files_folder, stringcase.spinalcase(field[0])) fields = [(StringFormatter.format_to_snakecase(value[0]), value[0], _DATA_CATALOG_BOOL_TYPE) for value in values_from_file] except FileNotFoundError: logging.info('NOT FOUND. Ignoring...') continue # Ignore creating a new template representing the multivalued field custom_template_id = f'{template_id}_{field[0]}' custom_display_name = f'{display_name} - {field[1]}' template_name = datacatalog.DataCatalogClient.tag_template_path( project_id, _CLOUD_PLATFORM_REGION, custom_template_id) if delete_existing_template: self.__datacatalog_facade.delete_tag_template(template_name) if not self.__datacatalog_facade.tag_template_exists( template_name): self.__datacatalog_facade.create_tag_template( project_id, custom_template_id, custom_display_name, fields)
def make_header(self, item): """ make the nice header from this """ header = None hero = self.random_hero() model_id = f"-{item['id']}" title = item['title'].replace("\"", "'").replace("@", "") identifier = stringcase.spinalcase(title) tags = item['tags'] date = item['created_at'] weight = item['created_at'].replace("-", "") desc = item['body'][0:60] header = f"""--- title: \"{title}\" date: {date} hero: {hero} menu: sidebar: name: \"{title}\" identifier: {identifier} weight: {model_id} tags: [{tags}] --- """ return header
def create_wallet(self, datadir: Path, wallet_name: str) -> None: try: logger.debug("Creating wallet...") wallet_name = self.normalize_wallet_name(wallet_name) wallet_path = self.get_wallet_path_for_network( datadir, wallet_name) assert wallet_path is not None # typing bug os.makedirs(os.path.dirname(wallet_path), exist_ok=True) password = "******" # New wallet network_string = stringcase.spinalcase( self.plugin.network) # need kebab-case command_string = f"create_wallet --wallet {wallet_path} --walletpassword" \ f" {password} --portable --no-password-check --{network_string}" line = self.feed_commands_to_esv(command_string) process = subprocess.Popen(line, shell=True) process.wait() logger.debug(f"New wallet created at : {wallet_path} ") # New account command_string = ( f"create_account --wallet {wallet_path} --walletpassword {password} --portable " f"--no-password-check") line = self.feed_commands_to_esv(command_string) process = subprocess.Popen(line, shell=True) process.wait() logger.debug( f"New standard (bip32) account created for: '{wallet_path}'") except Exception as e: logger.exception("unexpected problem creating new wallet") raise
def load_(source: JsonObjectType, target: Type[T]) -> Tuple[T, Errors]: kwargs = {} hints = get_type_hints(target) errors = defaultdict(list) if not is_dataclass(target): raise NotDataclass(f'target should be a dataclass {target}') for name, hint in hints.items(): json_name = spinalcase(name) if json_name not in source: value = None if type(None) not in getattr(hint, '__args__', []): errors[json_name].append(f'{json_name} is required') else: value = source[json_name] if is_dataclass(hint): if not isinstance(value, dict): kwargs[name] = None errors[name].append(f'{json_name} should be a dict') continue cls_name = value.get('__name__', None) module_name = value.get('__module__', None) if not isinstance(cls_name, str) or not isinstance( module_name, str): kwargs[name] = None errors[name].append( f'{json_name} missing typed-json type information') continue # 미리 임포트 되어 있는 module 만 사용할 수 있도록 강제한다. if module_name not in sys.modules: kwargs[name] = None errors[name].append( f'{module_name} module is not imported') continue cls = getattr(sys.modules[module_name], cls_name, None) if not is_dataclass(cls): kwargs[name] = None errors[name].append(f'{cls_name} is not dataclass') continue value, value_errors = load_(value, cls) elif hint == str or str in getattr(hint, '__args__', []): if value is not None: value = value.strip() if not value: errors[json_name].append(f'{json_name} is required') kwargs[name] = value typed_json: TypedJson = getattr(hint, '__typed_json__', None) if typed_json: for validator in typed_json.validators: error = validator(value) if error: errors[json_name].append(error) obj = target(**kwargs) return obj, errors
def optionize(fieldKeyName): """Transforms a string into an argparse option """ cased = stringcase.spinalcase(fieldKeyName) # Strip leading dash, which can get introduced if the fieldKeyName starts # with a character that stringcase interprets as a delimiter cased = re.sub('^(-){1,}', '', cased) return '--{0}'.format(cased)
def extract_selectors(declarations_to_use, selectors_file_names): for a_declaration in declarations_to_use: selector = 'app-' + spinalcase(a_declaration.replace("Component", "")) filename_for_selector = str(selectors_file_names[selector]) new_selectors_to_use, new_declarations_to_use, new_selectors_filenames = main(filename_for_selector.replace(".ts", ".html")) final_selectors.extend(new_selectors_to_use) final_declarations.extend(new_declarations_to_use) extract_selectors(new_declarations_to_use, new_selectors_filenames)
def upload_image(self, additional_tags): image_name = spinalcase(self.name) + ':' + self.version ecr_image_name = self.ecr_image_uri + ':' + self.version self.ensure_repository() self._push_image(image_name, ecr_image_name) for new_tag in additional_tags: self._add_image_tag(self.version, new_tag)
def hcs_example(item, f_id, type, npi, hcs): # hcs= healthcareservice return (f_templ.healthcareservice_template.format( type=type, f_id=f_id, npi=npi, name=item['Provider Organization Name (Legal Business Name)'], hcs_code=spinalcase(hcs), HCS_Name=hcs.upper(), identifier_system=urlify( item['Provider Organization Name (Legal Business Name)']), identifier_value='{npi}-{hcs}'.format(npi=npi, hcs=spinalcase(hcs)), phone=item[ 'Provider Business Practice Location Address Telephone Number'] if item['Provider Business Practice Location Address Telephone Number'] else '5555555555', service_list=get_specialty(hcs, 's_list'), specialty=get_specialty(hcs, 's_xml') # hsc_type_code, # hcs_type_display ))
def test_spinalcase(self): from stringcase import spinalcase eq = self.assertEqual eq('foo-bar', spinalcase('fooBar')) eq('foo-bar', spinalcase('foo_bar')) eq('foo-bar', spinalcase('foo-bar')) eq('foo-bar', spinalcase('foo.bar')) eq('-bar-baz', spinalcase('_bar_baz')) eq('-bar-baz', spinalcase('.bar_baz')) eq('', spinalcase('')) eq('none', spinalcase(None))
def generate_command(self) -> typing.Tuple[str, Dict[str, str]]: """ The electrumsv component type can be executed in 1 of 3 ways: 1) custom script (if args are supplied to the right-hand-side of <component_name>) 2) daemon script 3) gui script for running in GUI mode NOTE: This is about as complex as it gets! """ assert self.plugin.src is not None network_string = stringcase.spinalcase( self.plugin.network) # need kebab-case command = "" env_vars = {"PYTHONUNBUFFERED": "1"} esv_launcher = str(self.plugin.src.joinpath("electrum-sv")) port = self.plugin.port logger.debug(f"esv_datadir = {self.plugin.datadir}") # custom script (user-specified arguments are fed to ESV) component_args = self.cli_inputs.component_args \ if len(self.cli_inputs.component_args) != 0 else None if component_args: additional_args = " ".join(component_args) command = f"{sys.executable} {esv_launcher} {additional_args}" if "--dir" not in component_args: command += " " + f"--dir {self.plugin.datadir}" # daemon script elif not self.cli_inputs.gui_flag: path_to_example_dapps = self.plugin.src.joinpath( "examples/applications") append_to_pythonpath([path_to_example_dapps]) command = ( f"{sys.executable} {esv_launcher} --portable --dir {self.plugin.datadir} " f"--{network_string} daemon -dapp restapi --v=debug " f"--file-logging " f"--restapi --restapi-port={port} --restapi-user rpcuser --restapi-password= "******"{sys.executable} {esv_launcher} gui --{network_string} --restapi " f"--restapi-port={port} --v=debug --file-logging --dir {self.plugin.datadir} " ) return command, env_vars
def decorators_from_dicts(annotations, defaults, *decorators): for k, v in annotations.items(): if k in defaults: t = click_type(v, defaults.get(k)) decorators += (click.option( "-" * (1 if len(k) == 1 else 2) + stringcase.spinalcase(k), type=t, default=defaults.get(k), show_default=True, is_flag=v is bool, ), ) elif isinstance(v, typing._GenericAlias) or istype(v, list): decorators += (click.argument( stringcase.spinalcase(k), type=click_type(getattr(v, "__args__", (str, ))[0]), nargs=-1, ), ) else: decorators += (click.argument(stringcase.spinalcase(k), type=click_type(v)), ) return decorators
def card(title, text=None, blend=None): if blend: blend = stringcase.spinalcase(blend) image = Image( f"{NOISEBLEND_IMG}/bg/blend/bg_{blend}_768.jpg", f"{NOISEBLEND_IMG}/bg/blend/bg_{blend}_1280.jpg", ) else: image = Image( f"{NOISEBLEND_IMG}/icons/app/app-android-512x512.png", f"{NOISEBLEND_IMG}/icons/app/app-android-1024x1024.png", ) return StandardCard(title, text, image)
def run(self, spreadsheet_id, project_id, template_id, display_name, delete_existing=False): master_template_fields = self.__sheets_reader.read_master( spreadsheet_id, stringcase.spinalcase(template_id)) self.__process_native_fields(spreadsheet_id, project_id, template_id, display_name, master_template_fields, delete_existing) self.__process_custom_multivalued_fields(spreadsheet_id, project_id, template_id, display_name, master_template_fields, delete_existing)
def run(self, files_folder, project_id, template_id, display_name, delete_existing=False): master_template_fields = CSVFilesReader.read_master( files_folder, stringcase.spinalcase(template_id)) self.__process_native_fields(files_folder, project_id, template_id, display_name, master_template_fields, delete_existing) self.__process_custom_multivalued_fields(files_folder, project_id, template_id, display_name, master_template_fields, delete_existing)
def dump_(source: T) -> JsonObjectType: json = {} hints = get_type_hints(source.__class__) for name, hint in hints.items(): value = getattr(source, name) if is_dataclass(value): class_name = value.__class__.__name__ module_name = value.__class__.__module__ value = dump_(value) value['__name__'] = class_name value['__module__'] = module_name json[spinalcase(name)] = value return json
def ensure_image_in_ecr(self): if self.version: try: commit_sha = self._find_commit_sha(self.version) except: commit_sha = self.version log_intent("Using commit hash " + commit_sha + " to find image") image = self._find_image_in_ecr(commit_sha) if not image: log_warning("Please build, tag and upload the image for the \ commit " + commit_sha) raise UnrecoverableException("Image for given version could not be found.") else: dirty = subprocess.check_output( ["git", "status", "--short"] ).decode("utf-8") if dirty: self.version = 'dirty' log_intent("Version parameter was not provided. Determined \ version to be " + self.version + " based on current status") image = None else: self.version = self._find_commit_sha() log_intent("Version parameter was not provided. Determined \ version to be " + self.version + " based on current status") image = self._find_image_in_ecr(self.version) if image: log_intent("Image found in ECR") else: log_bold("Image not found in ECR. Building image") image_name = spinalcase(self.name) + ':' + self.version ecr_name = self.ecr_image_uri + ':' + self.version self._build_image(image_name) self._push_image(image_name, ecr_name) image = self._find_image_in_ecr(self.version) try: image_manifest = image['imageManifest'] self.ecr_client.put_image( repositoryName=self.repo_name, imageTag=self.version, imageManifest=image_manifest ) except Exception: pass
def temlateToFile(self, t, entity, pck, typename='entity', filterPacks=[]): lname = GenUtils.toFirstLower(entity.name) filename: str = t.parts[len(t.parts) - 1].replace('.jinja2', '') # print('trying to load template ' + str(t)) filename = filename.replace(typename + '$', entity.name) fldr = self.getGeneratedFileName(entity, filename, lname, pck, t, typename) if not filename.startswith(typename) and '$' in filename: print("ret " + filename + " " + typename) return stemPackName = fldr.split('/')[len(fldr.split('/')) - 1] #TODO : wont work on windows #print(stemPackName) if (len(filterPacks) == 0 or stemPackName in filterPacks): #print('trying to load template ' + str(t)) template = self.jinja_env.get_template(str(t)) packageName = f'{utils.getTopLevelPackage()}.{pck.name}.{stemPackName}' def createFqn(extension, fileExtension=None): fileExtension = f'{GenUtils.toFirstUpper(extension)}' if not fileExtension else fileExtension return f'{utils.getTopLevelPackage()}.{pck.name}.{extension}.{entity.name}{fileExtension}' out = template.render(mdl=pck.parent, pck=packageName, entity=entity, fqn=createFqn('model', ' '), fqnRepo=createFqn('repository'), fqnService=createFqn('service'), name=entity.name, lname=lname, genUtils=GenUtils()) opFileName = self.massageOutputFileName(filename) if (opFileName): opfldr = stringcase.spinalcase(fldr) writeToFile(f'srcgen/{opfldr}', opFileName, out)
def __init__(self, args): self.verbose = args.verbose self.ignored_values = args.ignored_values if 'ignored_values' in args else list( ) self.true_values = true_values self.false_values = false_values self.ignored_prefixes = args.ignored_prefixes if 'ignored_prefixes' in args else list( ) # probably should drop this feature: self.strip_any_prefix = args.strip_any_prefix if 'strip_any_prefix' in args else False self.skip_sheets = args.skip_sheets if 'skip_sheets' in args else list( ) self.legacy_key_prefix = stringcase.spinalcase(args.kgiri_prefix) self.legacy_key_column_number = args.key_column_number self.column_names = list() self.counter_rows = 0 self.counter_cells = 0 self.g = rdflib.Graph() self.add_namespaces() self.xlsx_file = Path(args.input) if not self.xlsx_file.exists(): error(f"{self.xlsx_file} does not exist") xlsx_iri = EKG_NS['KGIRI'].term( parse_identity_key_with_prefix("xlsx-file", self.xlsx_file.stem)) self.g.add((xlsx_iri, RDF.type, RAW.XlsxFile)) self.g.add((xlsx_iri, RDF.type, PROV.Entity)) self.g.add((xlsx_iri, RAW.fileName, Literal(self.xlsx_file))) activity_iri = self._prov_activity_start(xlsx_iri) log_item("Reading XSLX file", self.xlsx_file) xlsx = pd.ExcelFile(self.xlsx_file) log_list("Sheet Names", xlsx.sheet_names) log_list("Skipping Sheets", args.skip_sheets) for sheet_name in xlsx.sheet_names: self.parse_sheet(xlsx, xlsx_iri, sheet_name) self._prov_activity_end(activity_iri) log_item('Processed # sheets', len(xlsx.sheet_names)) log_item('Processed # rows', self.counter_rows) log_item('Processed # cells', self.counter_cells) log_item('Generated # triples', len(self.g))
def __call__(self, obj): self.obj_name = getattr(obj, '__name__') if not self.command_name: self.command_name = self.obj_name if not self.description: self.description = getattr(obj, '__doc__', '') if isinstance(obj, type): # pylint: disable=used-before-assignment class NewCommand(obj, CommandClass, metaclass=CommandMeta): command = self self._wrapped = NewCommand() else: if self.auto: arguments = [] signature = inspect.signature(obj) for k, v in signature.parameters.items(): if k in ('self', 'args', 'kwargs'): continue key = stringcase.spinalcase(k) default = None _type = None if v.annotation: _type = v.annotation if v.default is not v.empty: key = f'--{key}' default = v.default if _type is None: # pragma: no cover _type = type(default) arguments.append( Argument(key, type=_type, default=default) ) self.arguments = tuple(arguments) + tuple(self.arguments) self._wrapped = CommandFunction(obj, self) return self._wrapped
def scrape_page(): title = stringcase.spinalcase(strip_text('css-v3d350').split('.')[1].replace(" ", "").strip()) content = strip_text('content__u3I1') code = driver.find_elements_by_css_selector("pre[class=' CodeMirror-line ']") formatted_code = '' for line in code: line_html = line.get_attribute('innerHTML') line_text = h.handle(line_html) formatted_code += line_text.strip() f = open("algorithms/" + title, "w") f.write(content + "Exp Starter Code:\n" + formatted_code) try: next_button = driver.find_element_by_xpath("//button[@data-cy = 'next-question-btn']") next_button.click() scrape_page() except TimeoutError: return
def case_conversion(source, style: StringStyle) -> str: """Case conversion of the input (usually fully qualified vss node inlcuding the path) into a supported string style representation. Args: source: Source string to apply conversion to. style: Target string style to convert source to. Returns: Converted source string according to provided string style. """ if style == StringStyle.ALPHANUM_CASE: return stringcase.alphanumcase(source) elif style == StringStyle.CAMEL_CASE: return camel_case(source) elif style == StringStyle.CAMEL_BACK: return camel_back(source) elif style == StringStyle.CAPITAL_CASE: return stringcase.capitalcase(source) elif style == StringStyle.CONST_CASE: return stringcase.constcase(source) elif style == StringStyle.LOWER_CASE: return stringcase.lowercase(source) elif style == StringStyle.PASCAL_CASE: return stringcase.pascalcase(source) elif style == StringStyle.SENTENCE_CASE: return stringcase.sentencecase(source) elif style == StringStyle.SNAKE_CASE: return stringcase.snakecase(source) elif style == StringStyle.SPINAL_CASE: return stringcase.spinalcase(source) elif style == StringStyle.TITLE_CASE: return stringcase.titlecase(source) elif style == StringStyle.TRIM_CASE: return stringcase.trimcase(source) elif style == StringStyle.UPPER_CASE: return stringcase.uppercase(source) else: return source
def _ensure_image_in_ecr(self): if self.version == 'dirty': image = None else: image = self._find_image_in_ecr(self.version) if image: log_intent("Image found in ECR") else: log_bold( f"Image not found in ECR. Building image {self.name} {self.version}" ) image_name = spinalcase(self.name) + ':' + self.version ecr_name = self.ecr_image_uri + ':' + self.version self._build_image(image_name) self._push_image(image_name, ecr_name) image = self._find_image_in_ecr(self.version) try: image_manifest = image['imageManifest'] self.ecr_client.put_image(repositoryName=self.repo_name, imageTag=self.version, imageManifest=image_manifest) except Exception: pass