Skip to content

Commit f1c9fa2

Browse files
authored
Merge branch 'master' into master
2 parents 2b6b564 + 5223786 commit f1c9fa2

File tree

4 files changed

+214
-22
lines changed

4 files changed

+214
-22
lines changed

libvin/decoding.py

+28-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(c) Copyright 2016 Dan Kegel <[email protected]>
55
"""
66

7-
from libvin.static import *
7+
from static import *
88

99

1010
class Vin(object):
@@ -155,6 +155,7 @@ def make(self):
155155
'''
156156
man = self.manufacturer
157157
for suffix in [
158+
'Argentina',
158159
'Canada',
159160
'Cars',
160161
'France',
@@ -165,34 +166,42 @@ def make(self):
165166
'Turkey',
166167
'USA',
167168
'USA - trucks',
169+
'USA (AutoAlliance International)',
168170
]:
169171
if man.endswith(suffix):
170172
man = man.replace(" %s" % suffix, "")
171173
if man == "General Motors":
172174
return "GMC"
173-
make = man
174-
# 2012 and later: first 3 positions became overloaded, some 'make' aka brand info moved further in; see
175-
# https://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_(VIN_codes)/Chrysler/VIN_Codes
176-
# http://www.allpar.com/mopar/vin-decoder.html
177-
if self.year > 2011:
178-
if man == 'Chrysler':
175+
if man == 'Chrysler':
176+
# 2012 and later: first 3 positions became overloaded, some 'make' aka brand info moved further in; see
177+
# https://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_(VIN_codes)/Chrysler/VIN_Codes
178+
# http://www.allpar.com/mopar/vin-decoder.html
179+
if self.year > 2011:
179180
brandcode = self.vin[4]
180181
if brandcode == 'D':
181-
make = 'Dodge'
182+
return 'Dodge'
182183
if brandcode == 'F':
183-
make = 'Fiat'
184+
return 'Fiat'
184185
if brandcode == 'J':
185-
make = 'Jeep'
186+
return 'Jeep'
187+
if man == "Fuji Heavy Industries (Subaru)":
188+
return 'Subaru'
186189
if man == 'Nissan':
187-
# FIXME: this was gathered from just four test cases, probably needs updating
188-
brandcode = self.vin[3:5]
189-
if brandcode == 'CV':
190-
make = 'Infiniti'
191-
if brandcode == 'BS':
192-
make = 'Infiniti'
193-
if brandcode == 'CS':
194-
make = 'Infiniti'
195-
return make
190+
# ftp://safercar.gov/MfrMail/ORG7377.pdf "MY12 Nissan VIN Coding System"
191+
# https://vpic.nhtsa.dot.gov/mid/home/displayfile/29173 "MY16 Nissan VIN Coding System"
192+
# say Ininiti if offset 4 is [JVY], Nissan otherwise.
193+
# ftp://safercar.gov/MfrMail/ORG6337.pdf "MY11 Nissan VIN Coding System"
194+
# says that plus Infiniti if offset 4 + 5 are S1. (Nissan Rogue is S5.)
195+
# ftp://ftp.nhtsa.dot.gov/mfrmail/ORG7846.pdf "MY13 Nissan VIN Coding System"
196+
# says that plus Infiniti if offset 4 + 5 are L0.
197+
if self.vin[4] in "JVY" or self.vin[4:6] == 'S1' or self.vin[4:6] == 'L0':
198+
return 'Infiniti'
199+
if man == 'Renault Samsung':
200+
# FIXME: they build other makes, too
201+
return 'Nissan'
202+
if man == 'Subaru-Isuzu Automotive':
203+
return 'Subaru'
204+
return man
196205

197206
@property
198207
def year(self):

libvin/static.py

+21
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@
325325
'XL9': 'Spyker',
326326
'XMC': 'Mitsubishi (NedCar)',
327327
'XTA': 'Lada/AutoVaz (Russia)',
328+
'YH4': 'Fisker',
328329
'YK1': 'Saab',
329330
'YS2': 'Scania AB',
330331
'YS3': 'Saab',
@@ -361,6 +362,7 @@
361362
'1FV': 'Freightliner',
362363
'1F9': 'FWD Corp.',
363364
'1G': 'General Motors USA',
365+
'1GB': 'Chevrolet USA',
364366
'1GC': 'Chevrolet Truck USA',
365367
'1GT': 'GMC Truck USA',
366368
'1G1': 'Chevrolet USA',
@@ -369,6 +371,7 @@
369371
'1G4': 'Buick USA',
370372
'1G6': 'Cadillac USA',
371373
'1GM': 'Pontiac USA',
374+
'1GN': 'Chevrolet USA',
372375
'1G8': 'Saturn USA',
373376
'1GY': 'Cadillac',
374377
'1H': 'Honda USA',
@@ -388,6 +391,7 @@
388391
'1XK': 'Kenworth USA',
389392
'1XP': 'Peterbilt USA',
390393
'1YV': 'Mazda USA (AutoAlliance International)',
394+
'1ZV': 'Ford Motor Company',
391395
'137': 'Hummer',
392396
'19U': 'Acura',
393397
'19V': 'Acura',
@@ -408,6 +412,8 @@
408412
'2FV': 'Freightliner',
409413
'2FZ': 'Sterling',
410414
'2G': 'General Motors Canada',
415+
'2GC': 'Chevrolet Canada',
416+
'2GN': 'Chevrolet Canada',
411417
'2G1': 'Chevrolet Canada',
412418
'2G2': 'Pontiac Canada',
413419
'2G3': 'Oldsmobile Canada',
@@ -421,26 +427,35 @@
421427
'2M': 'Mercury',
422428
'2P3': 'Plymouth Canada',
423429
'2T': 'Toyota Canada',
430+
'2T2': 'Lexus Canada',
424431
'2V4': 'Volkswagen Canada',
425432
'2WK': 'Western Star',
426433
'2WL': 'Western Star',
427434
'2WM': 'Western Star',
428435
'3C3': 'Chrysler',
436+
'3C4': 'Dodge Mexico',
429437
'3C6': 'Chrysler',
438+
'3CZ': 'Honda Mexico',
430439
'3D3': 'Dodge Mexico',
431440
'3D4': 'Dodge Mexico',
432441
'3D7': 'Dodge Mexico',
442+
'3MZ': 'Mazda Mexico',
433443
'3FA': 'Ford Motor Company Mexico',
434444
'3FE': 'Ford Motor Company Mexico',
435445
'3G': 'General Motors Mexico',
446+
'3GC': 'Chevrolet Mexico',
447+
'3GN': 'Chevrolet Mexico',
436448
'3GY': 'Cadillac',
437449
'3H': 'Honda Mexico',
438450
'3LN': 'Lincoln',
439451
'3N': 'Nissan Mexico',
440452
'3P3': 'Plymouth Mexico',
453+
'3TM': 'Toyota Mexico',
441454
'3VW': 'Volkswagen Mexico',
442455
'4A3': 'Mitsubishi',
456+
'4A4': 'Mitsubishi',
443457
'4F': 'Mazda USA',
458+
'4JG': 'Mercedes-Benz',
444459
'4M': 'Mercury',
445460
'4S': 'Subaru-Isuzu Automotive',
446461
'4T': 'Toyota',
@@ -459,6 +474,7 @@
459474
'5FR': 'Acura',
460475
'5GA': 'Buick',
461476
'5GN': 'Hummer',
477+
'5GR': 'Hummer', # general motors
462478
'5J6': 'Honda',
463479
'5J8': 'Acura',
464480
'5L': 'Lincoln',
@@ -467,6 +483,10 @@
467483
'5T': 'Toyota USA - trucks',
468484
'5UM': 'BMW',
469485
'5UX': 'BMW',
486+
'5XX': 'Kia',
487+
'5YF': 'Toyota',
488+
'55S': 'Mercedes-Benz',
489+
'58A': 'Lexus',
470490
'6AB': 'MAN Australia',
471491
'6F4': 'Nissan Motor Company Australia',
472492
'6F5': 'Kenworth Australia',
@@ -487,6 +507,7 @@
487507
'8AK': 'Suzuki Argentina',
488508
'8AJ': 'Toyota Argentina',
489509
'8AW': 'Volkswagen Argentina',
510+
'8BR': 'Mercedes-Benz Argentina',
490511
'93U': 'Audi Brazil',
491512
'9BG': 'Chevrolet Brazil',
492513
'935': 'Citroen Brazil',

0 commit comments

Comments
 (0)