delete used file

This commit is contained in:
2023-09-03 23:18:25 +02:00
parent 14d99a9a2f
commit b68012375d
4 changed files with 7 additions and 80 deletions
-65
View File
@@ -1,65 +0,0 @@
import re
from mrz.generator.td3 import TD3CodeGenerator
def encode(s: str) -> str:
s = s.encode(encoding='gb2312').hex()
res = []
for c in s:
res.append(chr(ord('a') + int(c, base=16)))
return "".join(res).upper()
def decode(s: str) -> str:
t = []
for c in s:
t.append(format((ord(c) - ord('A')), 'x'))
t = re.findall('.{1,2}', "".join(t))
res = []
for c in t:
res.append(int("0x" + c, 16))
return bytes(res).decode('gb2312')
chinese_name = "陈欣宁"
first_name = "xinning"
last_name = "chen"
passport_number = "E60999212"
birth_day = "970115"
sex = "F"
# sex = "M"
expire_date = "280116"
encoded_chinese_name = encode(chinese_name)
print(encoded_chinese_name)
optional_data_length = 14 - len(encoded_chinese_name)
for i in range(0, optional_data_length):
encoded_chinese_name = encoded_chinese_name + "<"
# optinal_data = "MFMLMANK<<<<A9" #14位
# nationality = "CHN"
nationality = "CHN"
if nationality == "TWN":
optinal_data = "I100217437" # 14位
document_prefix = "P"
else:
optinal_data = encoded_chinese_name # 14位
document_prefix = "PO"
# first_name = "Lei"
# last_name = "PAN"
# passport_number = "G22611379"
# birth_day = "841215"
# sex = "M"
# optinal_data = "19203301<<<<<<" #14位
# expire_date = "170510"
code = TD3CodeGenerator(document_prefix, nationality, last_name, first_name, passport_number, nationality, birth_day,
sex, expire_date,
optinal_data)
# code = TD3CodeGenerator("PO", "CHN", "PAN", "LEI", "E90600575", "CHN", "841215", "M", "270116", "MFMLMANK<<<<A9")
print(code)
-21
View File
@@ -1,21 +0,0 @@
from mrz.generator.td1 import TD1CodeGenerator
first_name = "Zhen"
last_name = "XU"
document_number = "E10805074"
birth_day = "990620"
sex = "F"
# optinal_data = "MFMLMANK<<<<A9" #14位
nationality = "CHN"
country_code = "HUN"
# optinal_data = "<E10805074" # 14位
optinal_data = None
document_prefix = "IR"
expire_date = "240801"
if optinal_data is not None:
code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality,
last_name, first_name, optional_data1=optinal_data)
else:
code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality,
last_name, first_name)
print(code)
-73
View File
@@ -1,73 +0,0 @@
import random
import string
import xlsxwriter
from src import definitions
from src.pojo.ReserveResultPojo import ReserveResultPojo
from src.pojo.contact_pojo import ContactPojo
def get_random_id_number() -> str:
# write_the_valid_profiles_to_excel()
S = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data.
ran = ''.join(random.choices(string.digits, k=S))
id_number = "57" + str(ran)
print("The randomly generated string is : 94" + str(ran)) # print the random data
return id_number
def write_the_valid_profiles_to_excel():
day_list = ['2022-06-02']
collection = []
for day in day_list:
collection.extend(definitions.firebase_store_manager.get_all_successful_items_for_day(day, source_from=None).stream())
valid_contacts = []
# exist_contacts = ExcelHelper().read_contacts()
for valid_appointment in collection:
reserve_pojo = ReserveResultPojo.from_firestore_dict(valid_appointment.to_dict())
# check whether the contact exists already
# exist = [contact for contact in valid_contacts if contact.mail == reserve_pojo.email]
# if len(exist) == 0:
contact = ContactPojo(reserve_pojo.phone, passport_number=get_random_id_number(),
last_name=reserve_pojo.lastName, first_name=reserve_pojo.firstName, ccid="",
mail=reserve_pojo.email, position=0)
# seed = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data.
# contact.passport = get_random_id_number()
# if contact.passport == None or len(contact.passport) == 0:
# old_contact = [item for item in exist_contacts if item.mail == contact.mail]
# if len(old_contact) > 0:
# contact.passport = old_contact[0].passport
print(contact)
valid_contacts.append(contact)
row = 0
col = 0
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook('valid_profile.xlsx')
header_data = ['name', 'phone', 'passport', 'email', 'ccid', 'position']
worksheet = workbook.add_worksheet()
header_format = workbook.add_format({'bold': True})
for col_num, data in enumerate(header_data):
worksheet.write(row, col_num, data, header_format)
row = row + 1
for info in valid_contacts:
# Iterate over the data and write it out row by row.
worksheet.write(row, col, "{} {}".format(info.last_name, info.first_name))
worksheet.write(row, col + 1, info.phone)
worksheet.write(row, col + 2, info.passport)
worksheet.write(row, col + 3, info.mail)
worksheet.write(row, col + 4, info.ccid)
row += 1
workbook.close()
if __name__ == '__main__':
# get_random_id_number()
write_the_valid_profiles_to_excel()