On 19.02.2019 18:06, Anders Hovmöller wrote: > > >> On 19 Feb 2019, at 17:36, Rhodri James <rho...@kynesim.co.uk> wrote: >> >> On 19/02/2019 16:26, Anders Hovmöller wrote: >>>> If it were me, I'd probably write (or would have re-written when I added >>>> the type hints) that as follows: >>>> >>>> def resolve_annotations( >>>> *, >>>> raw_annotations: Dict[str, Type[Any]], >>>> module_name: Optional[str] >>>> ) -> Dict[str, Type[Any]]: >>> I would like to point out here that breaking up a line breaks grepping >>> quite badly. I've had to write AST-based searches to find simple usages of >>> arguments in the code base at work precisely because of code that is split >>> on likes like this. (This tool is available here: >>> https://github.com/boxed/parso_utils) >> >> How odd. I always break up long lines like this, and I've never once had an >> issue grepping. > > Maybe you know some grep magic I don't? Is there a way to do multi line grep > that knows that open paren means to ignore new lines until the matching close > paren? I'd love to hear about it!
This should help: https://stackoverflow.com/questions/3717772/regex-grep-for-multi-line-search-needed but you can also use Python's re module with the re.DOTALL flag. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Feb 19 2019) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/ _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/