/usr/lib/python2.7/dist-packages/qrcode/mecard.py is in python-qrcode 5.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import six
# {'code': 'N', 'label': 'Name', 'required': True, 'multipart': [
# 'Last Name', 'First Name']},
PROPERTIES = {
'NICKNAME': {'label': 'Nickname'},
'BDAY': {'label': 'Birthday', 'date': True},
'TEL': {'label': 'Phone'},
'EMAIL': {'label': 'E-mail'},
'ADR': {'label': 'Address', 'multipart': [
'PO Box', 'Room Number', 'House Number', 'City', 'Prefecture',
'Zip Code', 'Country']},
'URL': {'label': 'URL'},
'MEMO': {'label': 'Note'},
}
def build_code(data):
notation = []
name = data['N']
if not isinstance(name, six.text_type):
name = ','.join(name)
notation.append('N', name)
for prop in PROPERTIES:
value = data.get(prop['code'])
if not value:
continue
if prop['date']:
value = value.strftime('%Y%m%d')
elif prop['multipart']:
value = ','.join(value)
|