Skip to content

Proposal for fix_urllib #47566

Closed
Closed

Description

@nedds
mannequin
BPO 3316
Nosy @warsaw, @brettcannon, @orsenthil, @benjaminp
Files
  • fix_urllib.diff: Diff for fix_urllib
  • fix_urllib.diff: Diff for updated fix_urllib
  • fix_urllib.diff: Diff for fix_urllib and test suite
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2008-07-16.05:13:47.214>
    created_at = <Date 2008-07-07.20:36:53.430>
    labels = ['deferred-blocker', 'expert-2to3']
    title = 'Proposal for fix_urllib'
    updated_at = <Date 2008-07-16.05:13:47.213>
    user = 'https://bugs.python.org/nedds'

    bugs.python.org fields:

    activity = <Date 2008-07-16.05:13:47.213>
    actor = 'brett.cannon'
    assignee = 'collinwinter'
    closed = True
    closed_date = <Date 2008-07-16.05:13:47.214>
    closer = 'brett.cannon'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2008-07-07.20:36:53.430>
    creator = 'nedds'
    dependencies = []
    files = ['10845', '10846', '10903']
    hgrepos = []
    issue_num = 3316
    keywords = ['patch']
    message_count = 13.0
    messages = ['69395', '69399', '69513', '69525', '69704', '69706', '69708', '69731', '69733', '69735', '69757', '69763', '69765']
    nosy_count = 6.0
    nosy_names = ['barry', 'brett.cannon', 'collinwinter', 'orsenthil', 'benjamin.peterson', 'nedds']
    pr_nums = []
    priority = 'deferred blocker'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue3316'
    versions = []

    Activity

    1. nedds commented on Jul 7, 2008

      neddsmannequin
      MannequinAuthor

      Here is my proposed fix_urllib. The transform function is massive
      because there are a lot of cases, so maybe I should break it into
      separate functions for each case, and it could maybe do with some more
      documentation as well. I also use FromImport from fixer_util.py even
      though it warns against doing so for dotted imports because it appears
      to work. The temp.py file is a dummy python file that you can test it on
      to get an idea of what it does. I think it's got all the desired
      functionality, but I'm not an expert on the urllib changes so let me
      know if I missed anything. I haven't written tests for it yet, but
      assuming it looks reasonable, I can do that later today or tomorrow.

    2. nedds commented on Jul 7, 2008

      neddsmannequin
      MannequinAuthor

      I broke up transform into the logical pieces of it, so I think now the
      code is a little bit more clear.

    3. collinwinter commented on Jul 10, 2008

      collinwintermannequin
      Mannequin
      • You should add tests to test_fixers to ensure that this does what you
        expect. This will make it much easier for others to modify this fixer
        later. You can probably just reuse the tests Brett initially added.

      • There's a better data structure for MAPPING: rather than using

      MAPPING = {module: [(new_module, [member, member, ..., member])]}

      you should probably use

      MAPPING = {module: {new_module: [member, member, ..., member]}}

      The list-of-2-tuples was a bad idea on my part that didn't scale.

      • The "cannot handle star imports" warning isn't strictly correct: star
        imports for robotparser and urlparse can both be handled correctly,
        since they're just being renamed.

      • urlparse and robotparser don't seem to belong to this more specialized
        fixer: they can go in fix_imports, since they aren't being broken across
        multiple modules.

    4. brettcannon commented on Jul 11, 2008

      @brettcannon
      Member

      What Collin said. =)

      I will put robotparser and urlparse into fix_imports myself and continue
      to update the docs in 2.x for urllib(2).

      Thanks to the both of you for helping with this! It's going to be great
      once this fixer is ready to go as it will put PEP-3108 REALLY close to
      being finished!

    5. brettcannon commented on Jul 15, 2008

      @brettcannon
      Member

      Nick, are you going to be able to get this cleaned up today for the beta
      release tomorrow?

    6. nedds commented on Jul 15, 2008

      neddsmannequin
      MannequinAuthor

      I should be able to. What time would you need it by?

    7. benjaminp commented on Jul 15, 2008

      @benjaminp
      Contributor

      Today or tomorrow.

    8. warsaw commented on Jul 15, 2008

      @warsaw
      Member

      I would really like to get this in by beta2, but it's not quite enough
      to hold up the release. Please try to get this cleaned up and committed
      by July 16 for beta 2.

    9. nedds commented on Jul 16, 2008

      neddsmannequin
      MannequinAuthor

      I've got it finished, I just need to write some tests for it. It will
      all be done later tonight.

    10. warsaw commented on Jul 16, 2008

      @warsaw
      Member

      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      On Jul 15, 2008, at 8:10 PM, Nick Edds wrote:

      Nick Edds <nedds@uchicago.edu> added the comment:

      I've got it finished, I just need to write some tests for it. It will
      all be done later tonight.

      Great!

      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.9 (Darwin)

      iQCVAwUBSH0/RHEjvBPtnXfVAQIdvAP/Sxz4XayNMlBWIicFVmmQ/C85Fujsb7wN
      tqznDWfM7rqCiChkSe2dMPoMTQsOntCIEze+d1Usc5SqqVQk45dSX/ARs2qVtI6g
      siVDSAxt2e1DWVCpko7hDySfP70e+1Id+Uv9obrHDJ6p6l7tx2hcZeS24NtQ+7aX
      vrCfAtAJZxk=
      =vtPk
      -----END PGP SIGNATURE-----

    11. nedds commented on Jul 16, 2008

      neddsmannequin
      MannequinAuthor

      Here is a working version with tests. I believe it has all the desired
      functionality, but correct me if I'm wrong Brett. Also, I did not model
      MAPPING as suggested by Collin because order was important in generating
      tests, so I didn't think using a dictionary would be appropriate. As for
      star imports, right now they aren't supported, although I don't quite
      understand why they couldn't be. Also, if this looks good, could
      somebody commit it for me. I don't think I have write privileges. Sorry
      this took me until so late tonight to submit, I hadn't realized the high
      priority it had until this morning.

    12. brettcannon commented on Jul 16, 2008

      @brettcannon
      Member

      I got your patch and it looks good overall. I made some style changes
      and upped the code reuse in some places. I am running the test suite now
      before I commit.

    13. brettcannon commented on Jul 16, 2008

      @brettcannon
      Member

      r65002 has the patch. Thanks, Nick!

    14. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions