<commit_before>"""ua to os - from a user agent return operating system, architecture, and browser"""

import sys,splunk.Intersplunk
import re

os_mapping = (
    ('Windows .. 5.1',      'Windows XP'),
    ('Windows .. 5.2',      'Windows XP'),
    ('Windows NT 6.0',      'Windows Vista'),
    ('Windows 6.0',         'Windows Server 2008'),
    ('Windows NT 6.1',      'Windows 7'),
    ('Windows NT 6.2',      'Windows 8'),
    ('Windows NT 6.3',      'Windows 8.1'),
    ('Windows NT 10.0',     'Windows 10'),
    ('OS X 10.(\d)',        'Mac OS X 10.%s.x'),
    ('SunOS',               'Solaris'),
    ('droid',               'Android'),
    ('Windows',             'Windows - Other'),
    ('iPad',                'iPad'),
    ('iPod',                'iPod'),
    ('iPhone',              'iPhone'),
    ('OS X',                'Mac OS X - Other'),
    ('Darwin',              'Mac OS X - Other'),
    ('Linux ',              'Linux'),
    ('winhttp',             'Windows - Other'),
    ('MSIE 4.0;',           'Windows - Other'),
    ('Microsoft',           'Windows - Other'),
    ('Win32',               'Windows - Other'),
    ('BlackBerry',          'BlackBerry'),
    ('BB10',                'BlackBerry 10'),
    ('RIM (\S+ \S+ \S+)',   'BlackBerry %s'),
    ('OS/2',                'OS/2'),
    ('urlgrabber/.* yum',   'Linux - RedHat/Fedora'),
    ('Skype for Macintosh', 'Mac OS X - Other'),
    ('Xbox Live Client',    'Xbox'),
    ('hpwOS/(\S+)',         'HP webOS %s'),
    ('J2ME',                'JVM Micro Edition'),
    ('CrOS',                'Chromium OS'),
    ('FreeBSD',             'FreeBSD'),
)

browser_mapping = (
    ('MSIE 7.*Trident/4.0', 'Internet Explorer 8.0'),
    ('MSIE ([9876]).0',     'Internet Explorer %s.0'),
    ('MSIE 10.0',           'Internet Explorer 10.0'),
    ('Trident/7.0; rv:11.0','Internet Explorer 11.0'),
    ('droid',               'Android'),
    ('Chrome',              'Chrome'),
    ('Mobile.*Safari',      'Safari - mobile'),
    ('i(pod|pad|phone).*(Safari|AppleWebKit)', 'Safari - mobile'),
    ('Safari/',             'Safari'),
    ('iTunes',              'iTunes'),
    ('Firefox/(\d+)',       'Firefox %s'),
    ('MSIE 5.00',           'Internet Explorer 5.0'),
    ('MSIE',                'Internet Explorer - Other'),
    ('AppleWebKit',         'Safari'),
    ('Google Update',       'Google Update'),
    ('Opera Mini',          'Opera Mini'),
    ('Opera',               'Opera'),
    ('urlgrabber/.* yum',   'yum'),
    ('BlackBerry',          'Blackberry'),<commit_msg>Modifications to ua2os script so that it will work with the w3c format + added additional browsers<commit_after>"""ua to os - from a user agent return operating system, architecture, and browser"""

import sys,splunk.Intersplunk
import re

os_mapping = (
    ('Windows .. 5.1',      'Windows XP'),
    ('Windows .. 5.2',      'Windows XP'),
    ('Windows\+NT\+6.0',    'Windows Vista'),
    ('Windows\+6.0',        'Windows Server 2008'),
    ('Windows\+NT\+6.1',    'Windows 7'),
    ('Windows\+NT\+6.2',    'Windows 8'),
    ('Windows\+NT\+6.3',    'Windows 8.1'),
    ('Windows\+NT\+10.0',   'Windows 10'),
    ('OS\+X\+10\_(\d)',     'Mac OS X 10.%s.x'),
    ('SunOS',               'Solaris'),
    ('droid',               'Android'),
    ('Windows',             'Windows - Other'),
    ('iPad',                'iPad'),
    ('iPod',                'iPod'),
    ('iPhone',              'iPhone'),
    ('OS\+X',                'Mac OS X - Other'),
    ('Darwin',              'Mac OS X - Other'),
    ('Linux ',              'Linux'),
    ('winhttp',             'Windows - Other'),
    ('MSIE+4.0;',           'Windows - Other'),
    ('Microsoft',           'Windows - Other'),
    ('Win32',               'Windows - Other'),
    ('BlackBerry',          'BlackBerry'),
    ('BB10',                'BlackBerry 10'),
    ('RIM (\S+ \S+ \S+)',   'BlackBerry %s'),
    ('OS/2',                'OS/2'),
    ('urlgrabber/.* yum',   'Linux - RedHat/Fedora'),
    ('Skype for Macintosh', 'Mac OS X - Other'),
    ('Xbox\+Live\+Client',    'Xbox'),
    ('hpwOS/(\S+)',         'HP webOS %s'),
    ('J2ME',                'JVM Micro Edition'),
    ('CrOS',                'Chromium OS'),
    ('FreeBSD',             'FreeBSD'),
)

browser_mapping = (
    ('MSIE\+7.*Trident/4.0', 'Internet Explorer 8.0'),
    ('MSIE+([9876]).0',     'Internet Explorer %s.0'),
    ('MSIE\+10.0',           'Internet Explorer 10.0'),
    ('Trident/7.0;\+rv:11.0','Internet Explorer 11.0'),
    ('Edge',                'Microsoft Edge'),
    ('droid',               'Android'),
    ('Vivaldi/(\d+)',       'Vivaldi %s'),
    ('OPR/(\d+)',           'Opera %s'),
    ('Chrome/(\d+)',        'Chrome %s'),
    ('Mobile.*Safari',      'Safari - mobile'),
    ('i(pod|pad|phone).*(Safari|AppleWebKit)', 'Safari - mobile'),
    ('Safari/',             'Safari'),
    ('iTunes',              'iTunes'),
    ('Firefox/(\d+)',       'Firefox %s'),
    ('MSIE 5.00',           'Internet Explorer 5.0'),
    ('MSIE',                'Internet Explorer - Other'),
    ('AppleWebKit',         'Safari'),
    ('Google Update',       'Google Update'),
    ('Opera Mini',          'Opera Mini'),
    ('Opera',               'Opera'),
    ('urlgrabber/.* yum',   'yum'),
    ('BlackBerry',          'Blackberry'),
{'fraction_non_alphanumeric': 0.21609930411886402, 'fraction_numerical': 0.0274590934737634, 'mean_word_length': 1.6804435483870968, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7258350', 'n_tokens_mistral': 1877, 'n_tokens_neox': 1709, 'n_words': 415}