1234567891011121314151617181920212223242526272829303132333435363738 |
- def find_username_id(username, file_path="username_id"):
- """Find the ID for a given username from the username_id file."""
- try:
- with open(file_path, "r", encoding="utf-8") as file:
- for line in file:
- if line.strip():
- user, user_id = line.strip().split(":")
- if user == username:
- return user_id
- print(f"Username '{username}' not found.")
- return None
- except FileNotFoundError:
- print(f"File not found: {file_path}")
- return None
- except Exception as e:
- print(f"An error occurred: {e}")
- return None
- def generate_evoluz_link(username_id, task_id, base_url):
- """Generate Evoluz link."""
- team_id = f"teamID={username_id}"
- update_team_id = f"updateTeamId={task_id}"
- return f"{base_url}{team_id}&{update_team_id}"
- def find_task_type(branch_name):
- """Extract branch type and task ID from branch name."""
- try:
- parts = branch_name.split("/")
- if len(parts) >= 2:
- branch_type = parts[0]
- task_id = parts[1].split("_")[0]
- return {"task_type": branch_type, "task_id": task_id}
- else:
- print(f"Invalid branch name format: {branch_name}")
- return None
- except Exception as e:
- print(f"Error extracting task type: {e}")
- return None
|