def test_alphanumcase(self): from stringcase import alphanumcase eq = self.assertEqual eq('FooBar', alphanumcase('_Foo., Bar')) eq('Foo123Bar', alphanumcase('Foo_123 Bar!')) eq('', alphanumcase('')) eq('None', alphanumcase(None))
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 main(): df = pd.read_excel(MASTER_FILE, sheet_name=SHEET_NAME) df = sqldf("select * from df") print(df) for index, row in df.iterrows(): filename = stringcase.alphanumcase(row['title']) + ".mp3" print("%s: downloading %s" % (index, filename)) try: url = getDialogUrl(row['lessonId'], row['levelShowCode'], row['hashKey']) fpath = OUTPUT_FILE_DIR + "/" + filename urllib.request.urlretrieve(url, fpath) except: print('error download ' + filename)
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 _parse_value_to_rdf_type(value): value = stringcase.alphanumcase(value) return LDAP.term(stringcase.capitalcase(value))
def logfile(self, path=""): name = snakecase(alphanumcase(self.name)) uid = self.id return os.path.join(path, f'{name}_{uid}.txt')
def get_album_id(album_name): """Album ID = Album name in lowercase, without any space nor accent""" return unidecode.unidecode(stringcase.alphanumcase(album_name).lower())
from ddlparse.ddlparse import DdlParse import stringcase import json f = open("./vmdm_public.dmp", "r") ddl_text=f.read() ddls = ddl_text.split(";") for index, ddl in enumerate(ddls): if ddl.find("CREATE TABLE") != -1: try: table = DdlParse().parse(ddl=ddl) logical_id = stringcase.alphanumcase( stringcase.capitalcase(stringcase.camelcase(table.name)) ) table_name = table.name columns = list(map(lambda col: {"Name":col.name.lower(),"Type":"string"}, table.columns.values())) columns_json = json.dumps(columns, separators=(',', ':')) print("{logical_id} {table_name} {columns_json}".format(logical_id = logical_id, table_name = table_name, columns_json = columns_json)) except Exception as e: print(index) print(value) print(e)