GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow pattern matching / substitutions · Issue #68 · python-trio/unasync

Allow pattern matching / substitutions #68

New issue
Copy link
New issue
Copy link
Open
Open
Allow pattern matching / substitutions#68
Copy link

Description

@johtso
johtso
opened on Oct 5, 2020
Issue body actions

Think this would be a generally very useful feature. Easy to structure your code so that various things have Async/Sync prefixes, and then you can just target them all with a regex instead of having to list every token.

This is something that httpcore are doing in their custom unasync script https://github.com/encode/httpcore/blob/0.11.1/unasync.py#L10

Reacted by david-alm and Alexandru Dreptu

Activity

  1. pquentin commented on Oct 5, 2020

    @pquentin
    pquentin
    on Oct 5, 2020
    Member
    More actions

    Would additional_replacements be enough for your needs? https://unasync.readthedocs.io/en/latest/#usage

  2. johtso commented on Oct 5, 2020

    @johtso
    johtso
    on Oct 5, 2020
    Author
    More actions

    Well, that's still just string for string replacement, no regexes right?

    I did just realise that with the case of Async/Sync prefixed class names, we just hard-code the replacement. https://github.com/python-trio/unasync/blob/master/src/unasync/__init__.py#L106-L108

    A guess a small benefit of having it implemented as a regex is that it will then be with all the other default replacements at the top of the file rather than hidden in the code.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.