File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,17 +137,38 @@ def build_package(package_data):
137137
138138
139139def party_mapper (party , package , party_type ):
140+ """
141+ Update package parties with party of `party_type` and return package.
142+ https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field-optional
143+ """
140144 for auth in party :
141145 name , email = parse_person (auth )
142146 package .parties .append (models .Party (
143147 type = models .party_person ,
144148 name = name ,
145149 role = party_type ,
146150 email = email ))
151+
147152 return package
148153
149154
150155def parse_person (person ):
156+ """
157+ https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field-optional
158+ A "person" is an object with an optional "name" or "email" field.
159+
160+ A person can be in the form:
161+ "author": "Isaac Z. Schlueter <i@izs.me>"
162+
163+ For example:
164+ >>> parse_person('Barney Rubble <b@rubble.com>')
165+ (u'Barney Rubble', u'b@rubble.com')
166+ >>> parse_person('Barney Rubble')
167+ (u'Barney Rubble', None)
168+ >>> parse_person('<b@rubble.com>')
169+ (None, u'b@rubble.com')
170+ """
171+
151172 parsed = person_parser (person )
152173 if not parsed :
153174 name = None
You can’t perform that action at this time.
0 commit comments