MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / parse_person

Function parse_person

src/packagedcode/cocoapods.py:681–708  ·  view source on GitHub ↗

Return name and email from person string. https://guides.cocoapods.org/syntax/podspec.html#authors Author can be in the form: s.author = 'Rohit Potter' or s.author = 'Rohit Potter=>rohit@gmail.com' >>> p = parse_person('Rohit Potter=>rohit@gmail.com') >

(person)

Source from the content-addressed store, hash-verified

679
680
681def parse_person(person):
682 """
683 Return name and email from person string.
684
685 https://guides.cocoapods.org/syntax/podspec.html#authors
686 Author can be in the form:
687 s.author = 'Rohit Potter'
688 or
689 s.author = 'Rohit Potter=>rohit@gmail.com'
690
691 >>> p = parse_person('Rohit Potter=>rohit@gmail.com')
692 >>> assert p == ('Rohit Potter', 'rohit@gmail.com'), p
693 >>> p = parse_person('Rohit Potter')
694 >>> assert p == ('Rohit Potter', None), p
695 """
696 if '=>' in person:
697 name, _, email = person.partition('=>')
698 email = email.strip('\'" =')
699 elif '=' in person:
700 name, _, email = person.partition('=')
701 email = email.strip('\'" ')
702 else:
703 name = person
704 email = None
705
706 name = name.strip('\'"')
707
708 return name, email
709
710
711def parse_dep_requirements(dep):

Callers 1

parseMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected