Warns and a typo in bush
Moving all code from oblivion.py to oblivion/__init__.py:

TODO: take records out !
See: #65
records.py module:

Changed the import position otherwise only skyrim loads (oblivion module not
seen) - circular imports. It is the `from . import esp` in records.py
that's to blame me thinks. See: http://stackoverflow.com/a/894885/281545

--------------------- Mopy/bash/game/oblivion/__init__.py ---------------------
index b11775d..d8f7cf0 100644
@@ -25,7 +25,6 @@
 """This modules defines static data for use by bush, when
    TES IV: Oblivion is set at the active game."""

-from game.oblivion.records import RecordHeader
 from oblivion_const import bethDataFiles, allBethFiles
 from ... import brec
 from ... import bush
@@ -1678,6 +1677,7 @@ class esp:

     recordTypes = set(topTypes + 'GRUP,TES4,ROAD,REFR,ACHR,ACRE,PGRD,LAND,INFO'.split(','))

+from records import * # MUST BE HERE otherwise all hell breaks loose
 #------------------------------------------------------------------------------
 # Record Elements    ----------------------------------------------------------
 #------------------------------------------------------------------------------
Couple more records ripped:

This is the 2nd commit message:

I think I finally got the imports right (relative imports to the rescue from
bash/bash)

---------------------- Mopy/bash/game/oblivion/records.py ----------------------
 from . import esp

 #--Mod I/O
-from bash.bolt import StateError, Flags
-from bash.brec import MelRecord
+from ...bolt import StateError, Flags
+from ...brec import MelRecord, BaseRecordHeader, ModError

-class RecordHeader(bash.brec.BaseRecordHeader):
+class RecordHeader(BaseRecordHeader):
     size = 20

     def __init__(self,recType='TES4',size=0,arg1=0,arg2=0,arg3=0,*extra):
@@ -54,7 +54,7 @@ def unpack(ins):
         type,size,uint0,uint1,uint2 = ins.unpack('=4s4I',20,'REC_HEADER')
         #--Bad?
         if type not in esp.recordTypes:
-            raise bash.brec.ModError(ins.inName,u'Bad header type: '+repr(type))
+            raise ModError(ins.inName,u'Bad header type: '+repr(type))
         #--Record
         if type != 'GRUP':
             pass
@@ -66,7 +66,7 @@ def unpack(ins):
             elif str0 in esp.topIgTypes:
                 uint0 = esp.topIgTypes[str0]
             else:
-                raise bash.brec.ModError(ins.inName,u'Bad Top GRUP type: '+repr(str0))
+                raise ModError(ins.inName,u'Bad Top GRUP type: '+repr(str0))
         return RecordHeader(type,size,uint0,uint1,uint2)

     def pack(self):
@@ -100,7 +100,7 @@ class MelBipedFlags(bash.bolt.Flags):
     """Biped flags element. Includes biped flag set by default."""
     mask = 0xFFFF
     def __init__(self,default=0L,newNames=None):
-        names = bolt.Flags.getNames('head', 'hair', 'upperBody', 'lowerBody', 'hand', 'foot', 'rightRing', 'leftRing', 'amulet', 'weapon', 'backWeapon', 'sideWeapon', 'quiver', 'shield', 'torch', 'tail')
+        names = Flags.getNames('head', 'hair', 'upperBody', 'lowerBody', 'hand', 'foot', 'rightRing', 'leftRing', 'amulet', 'weapon', 'backWeapon', 'sideWeapon', 'quiver', 'shield', 'torch', 'tail')
         if newNames: names.update(newNames)
         Flags.__init__(self,default,names)
More records - moved stuff to constants to get rid of cyclic imports:

Or circular imports: http://stackoverflow.com/q/744373/281545
Was getting AttributeError: 'module' object has no attribute 'init'
Diffs from vanilla rip (excluding the move)
@@ -27,4 +27,2 @@
 import struct
-import bash
-import bash.brec
 from . import esp
@@ -32,4 +30,3 @@
 #--Mod I/O
-from ...bolt import StateError, Flags
-import bolt
+from ...bolt import StateError, Flags, BoltError, sio
 from ...brec import MelRecord, BaseRecordHeader, ModError, MelStructs, null3, \
@@ -38,4 +35,4 @@
     MelFids
-import bush
-from game.oblivion import allConditions, fid1Conditions, fid2Conditions
+from ...bush import genericAVEffects, mgef_school, mgef_basevalue, actorValues
+from oblivion_const import allConditions, fid1Conditions, fid2Conditions

@@ -105,3 +102,3 @@ def mergeFilter(self,modSet):
 #------------------------------------------------------------------------------
-class MelBipedFlags(bash.bolt.Flags):
+class MelBipedFlags(Flags):
     """Biped flags element. Includes biped flag set by default."""
@@ -150,3 +147,3 @@ def loadData(self,record,ins,type,size,readId):
         if ifunc not in allConditions:
-            raise bolt.BoltError(u'Unknown condition function: %d' % ifunc)
+            raise BoltError(u'Unknown condition function: %d' % ifunc)
         form1 = 'iI'[ifunc in fid1Conditions]
@@ -191,3 +188,3 @@ class MelEffects(MelGroups):
     #--Class Data
-    seFlags = bolt.Flags(0x0L,bolt.Flags.getNames('hostile'))
+    seFlags = Flags(0x0L,Flags.getNames('hostile'))
     class MelEffectsScit(MelStruct):
@@ -239,3 +236,3 @@ def getEffects(self):
         effects = []
-        avEffects = bush.genericAVEffects
+        avEffects = genericAVEffects
         effectsAppend = effects.append
@@ -248,3 +245,3 @@ def getEffects(self):

-    def getSpellSchool(self,mgef_school=bush.mgef_school):
+    def getSpellSchool(self,mgef_school=mgef_school):
         """Returns the school based on the highest cost spell effect."""
@@ -253,3 +250,3 @@ def getSpellSchool(self,mgef_school=bush.mgef_school):
             school = mgef_school[effect.name]
-            effectValue = bush.mgef_basevalue[effect.name]
+            effectValue = mgef_basevalue[effect.name]
             if effect.magnitude:
@@ -266,7 +263,7 @@ def getEffectsSummary(self,mgef_school=None,mgef_name=None):
         """Return a text description of magic effects."""
-        mgef_school = mgef_school or bush.mgef_school
-        mgef_name = mgef_name or bush.mgef_name
-        with bolt.sio() as buff:
-            avEffects = bush.genericAVEffects
-            aValues = bush.actorValues
+        mgef_school = mgef_school or mgef_school
+        mgef_name = mgef_name or mgef_name
+        with sio() as buff:
+            avEffects = genericAVEffects
+            aValues = actorValues
             buffWrite = buff.write
@@ -274,3 +271,3 @@ def getEffectsSummary(self,mgef_school=None,mgef_name=None):
                 school = self.getSpellSchool(mgef_school)
-                buffWrite(bush.actorValues[20+school] + u'\n')
+                buffWrite(actorValues[20+school] + u'\n')
             for index,effect in enumerate(self.effects):
@@ -364,2 +361 @@ def mapFids(self,record,function,save=False):
                 if save: scrxen[index] = (isFid,result)
-
Started ripping "Oblivion records":

Loads skyrim (no crash but oblivion module not seen) - fix:

--------------------- Mopy/bash/game/oblivion/__init__.py ---------------------
index 2da33c2..7725b87 100644
@@ -24,12 +24,11 @@

 """This modules defines static data for use by bush, when
    TES IV: Oblivion is set at the active game."""
-from game.oblivion.records import MreHeader

 from oblivion_const import bethDataFiles, allBethFiles
 from ... import brec
 from ...brec import *
-from ...bolt import DataDict
+from ...bolt import Flags, DataDict, StateError

 # Util Constants ---------------------------------------------------------------
 #--Null strings (for default empty byte arrays)
More records

AttributeError: 'module' object has no attribute 'init' - fix:

---------------------- Mopy/bash/game/oblivion/records.py ----------------------
index 2789d4c..9734cf5 100644
@@ -31,3 +31,2 @@
 from ...bolt import StateError, Flags, BoltError, sio
-import bolt
 from ...brec import MelRecord, BaseRecordHeader, ModError, MelStructs, null3, \
@@ -384,3 +383,3 @@ class MreAchr(MelRecord): # Placed NPC
     classType = 'ACHR'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('oppositeParent'))
+    _flags = Flags(0L,Flags.getNames('oppositeParent'))
     melSet=MelSet(
@@ -401,3 +400,3 @@ class MreAcre(MelRecord): # Placed Creature
     classType = 'ACRE'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('oppositeParent'))
+    _flags = Flags(0L,Flags.getNames('oppositeParent'))
     melSet=MelSet(
@@ -429,3 +428,3 @@ class MreAlch(MelRecord,MreHasEffects):
     classType = 'ALCH'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('autoCalc','isFood'))
+    _flags = Flags(0L,Flags.getNames('autoCalc','isFood'))
     melSet = MelSet(
@@ -445,3 +444,3 @@ class MreAmmo(MelRecord):
     classType = 'AMMO'
-    _flags = bolt.Flags(0L,bolt.Flags.getNames('notNormalWeapon'))
+    _flags = Flags(0L,Flags.getNames('notNormalWeapon'))
     melSet = MelSet(
@@ -483,3 +482,3 @@ class MreArmo(MelRecord):
     classType = 'ARMO'
-    _flags = MelBipedFlags(0L,bolt.Flags.getNames((16,'hideRings'),(17,'hideAmulet'),(22,'notPlayable'),(23,'heavyArmor')))
+    _flags = MelBipedFlags(0L,Flags.getNames((16,'hideRings'),(17,'hideAmulet'),(22,'notPlayable'),(23,'heavyArmor')))
     melSet = MelSet(
@@ -504,3 +503,3 @@ class MreBook(MelRecord):
     classType = 'BOOK'
-    _flags = bolt.Flags(0,bolt.Flags.getNames('isScroll','isFixed'))
+    _flags = Flags(0,Flags.getNames('isScroll','isFixed'))
     melSet = MelSet(
@@ -529,2 +528 @@ class MreBsgn(MelRecord):
     __slots__ = MelRecord.__slots__ + melSet.getSlotsUsed()
-
Wrapping
More records
Wrapping
More records
Wrapping and typos
More records
Wrapping
Finalizing:

- game/oblivion/oblivion_const.py -> game/oblivion/constants.py
- Set literals warnings
- (little) wrapping
- bush message change
- did not change imports in bish as suggested by pycharm - seems to work
Skyrim.py split

Added __init__.py

Added constants.py

Added records.py

Deleted files from game dir

 # This is the 2nd commit message:

Added remaining comments from skyrim.py

---------------------- Mopy/bash/game/skyrim/__init__.py ----------------------
index f4f39f8..344403d 100644
@@ -1411,3 +1411,32 @@ class esp:
 #------------------------------------------------------------------------------
-
+# Unused records, they have empty GRUP in skyrim.esm---------------------------
+# CLDC ------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# Unused records, they have empty GRUP in skyrim.esm---------------------------
+# HAIR ------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# Unused records, they have empty GRUP in skyrim.esm---------------------------
+# PWAT ------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# Unused records, they have empty GRUP in skyrim.esm---------------------------
+# RGDL ------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# Unused records, they have empty GRUP in skyrim.esm---------------------------
+# SCOL ------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# Unused records, they have empty GRUP in skyrim.esm---------------------------
+# SCPT ------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# These Are normally not mergable but added to brec.MreRecord.type_class
+#
+#       MreCell,
+#------------------------------------------------------------------------------
+# These have undefined FormIDs Do not merge them
+#
+#       MreNavi, MreNavm,
+#------------------------------------------------------------------------------
+# These need syntax revision but can be merged once that is corrected
+#
+#       MreAchr, MreDial, MreLctn, MreInfo, MreFact, MrePerk,
+#------------------------------------------------------------------------------
 #--Mergeable record types

----------------------- Mopy/bash/game/skyrim/records.py -----------------------
index 06290f6..946d8ff 100644
@@ -6238 +6238,4 @@ class MreWthr(MelRecord):
     __slots__ = MelRecord.__slots__ + melSet.getSlotsUsed()
+
+# Verified for 305
+# Some things Marked MelBase could be updated if mitigation needed
Updated records.py with current tested versions
Import fixes - skyrim module recognised

More import fixes (module was recognised even without those)

Import fixes 2 : from ...bolt import _encode, _unicode (as in skyrim.py)

Import fixes 3 : from constants import fid5Conditions

Another missed from skyrim.py: from_iterable

----------------------- Mopy/bash/game/skyrim/records.py -----------------------
index cd830fe..f1712c3 100644
@@ -27,4 +27,6 @@
 import struct
+import itertools
 from . import esp
-from ...bolt import StateError, Flags, BoltError, sio, DataDict, winNewLines
+from ...bolt import StateError, Flags, BoltError, sio, DataDict, winNewLines, \
+    _encode, _unicode
 from ...brec import MelRecord, BaseRecordHeader, ModError, MelStructs, null3, \
@@ -37,3 +39,6 @@
 from ...bush import genericAVEffects, mgef_school, mgef_basevalue, actorValues
-from constants import allConditions, fid1Conditions, fid2Conditions
+from constants import allConditions, fid1Conditions, fid2Conditions, \
+    fid5Conditions
+
+from_iterable = itertools.chain.from_iterable

 # This is the 2nd commit message:

Changed to import bush - notice nasty mgef_school or mgef_school

----------------------- Mopy/bash/game/skyrim/records.py -----------------------
index f1712c3..39677bb 100644
@@ -38,3 +38,3 @@
     MelOptStructA, MelCountedFids, MelSortedFidList
-from ...bush import genericAVEffects, mgef_school, mgef_basevalue, actorValues
+from ... import bush
 from constants import allConditions, fid1Conditions, fid2Conditions, \
@@ -446,3 +446,3 @@ def getEffects(self):
         effects = []
-        avEffects = genericAVEffects
+        avEffects = bush.genericAVEffects
         effectsAppend = effects.append
@@ -455,3 +455,3 @@ def getEffects(self):

-    def getSpellSchool(self,mgef_school=mgef_school):
+    def getSpellSchool(self,mgef_school=bush.mgef_school):
         """Returns the school based on the highest cost spell effect."""
@@ -460,3 +460,3 @@ def getSpellSchool(self,mgef_school=mgef_school):
             school = mgef_school[effect.name]
-            effectValue = mgef_basevalue[effect.name]
+            effectValue = bush.mgef_basevalue[effect.name]
             if effect.magnitude:
@@ -473,7 +473,7 @@ def getEffectsSummary(self,mgef_school=None,mgef_name=None):
         """Return a text description of magic effects."""
-        mgef_school = mgef_school or mgef_school
-        mgef_name = mgef_name or mgef_name
+        mgef_school = mgef_school or bush.mgef_school
+        mgef_name = mgef_name or bush.mgef_name
         with sio() as buff:
-            avEffects = genericAVEffects
-            aValues = actorValues
+            avEffects = bush.genericAVEffects
+            aValues = bush.actorValues
             buffWrite = buff.write
@@ -481,3 +481,3 @@ def getEffectsSummary(self,mgef_school=None,mgef_name=None):
                 school = self.getSpellSchool(mgef_school)
-                buffWrite(actorValues[20+school] + u'\n')
+                buffWrite(bush.actorValues[20+school] + u'\n')
         for index,effect in enumerate(self.effects):
Syntax errors (skyrim/records.py):

- Attempt to fix ModSizeError calls: IIUC couple of calls put size and expected
size in reverse. The rest were syntax errors (unresolved var/attr).
- wrong variable names
- comments by Sharlikran in __init__.py

 # This is the 2nd commit message:

Fixes missed - squash with previous

Not sure about record.inName but at least it won't throw

----------------------- Mopy/bash/game/skyrim/records.py -----------------------
index 76e6740..6739b55 100644
@@ -4834,5 +4834,5 @@ def dumpData(self,record,out):
                 format,attrs = ('HB',('entrypoint','function'))
-            # else:
-            #     raise ModError(ins.inName, # no ins.inName
-            #                    _('Unexpected type: %d') % record.type)
+            else:
+                raise ModError(record.inName, # untested
+                               _('Unexpected type: %d') % record.type)
             values = []
@@ -4895,4 +4895,5 @@ def dumpData(self,record,out):
                 element = self.loaders[target.recordType]
-                # if not element:
-                #     raise ModError(ins.inName,_('Unexpected type: %d') % target.recordType)
+                if not element:
+                    raise ModError(record.inName, _(
+                        'Unexpected type: %d') % target.recordType)
                 element.dumpData(target,out)
Removed unused imports from skyrim/records.py + Nitpick