Skip to content

rewrite the parsed info is not efficient #24

Description

@alingse

I want to use this package to do auto-migration git repo

eg: import repo from github.com to gitlab.com

I need some code like this :

u = 'https://github.com/nephila/giturlparse'
repo = parse(u)
repo.domain = 'gitlab.com'
new_url = repo.format('https')
# Expect new_url is  --> https://gitlab.com/nephila/giturlparse.git
# but it real not changed --> https://github.com/nephila/giturlparse.git

I find the way to rewrite the repo info

u = 'https://github.com/nephila/giturlparse'
repo = parse(u)
repo._parsed['domain'] = 'gitlab.com'
new_url = repo.format('https') 
# Expect new_url is  --> https://gitlab.com/nephila/giturlparse.git
# Yes, it work, but not so efficient,
#  and need user to know there is a `_parsed` field, a little not pythonic

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions