<commit_before>#!/usr/bin/env python

import types
from string import *;

try:
	import cPickle
	pickle=cPickle
except:
	print "WARNING: Failed to import module cPickle, using slower pickle library"
	import pickle

try:
	import cspacec
	from cspace import *
except:
    	print "WARNING: Failed to import module cspace, can only pickle the map"

class Object:
	"""Lowest level Unreal Object"""
	def __init__(self, attrib):
	        self.attrib=attrib.copy()
	        self.stack=[]
	def Add(self, attrib):
		self.attrib.update(attrib)
	def Push(self, child):
		self.stack.append(child)

class Actor(Object):
	"""An actor object from Unreal"""
	pass
	
class Info(Actor):
	pass
class ZoneInfo(Info):
	pass
class LevelInfo(ZoneInfo):
    	pass
class Light(Actor):
    	pass
class PlayerStart(Actor):
	pass
class Brush(Actor):
    	"""A geometry object from Unreal"""
    	def MakeGeom(self, vecs, room, tm):
		if not self.attrib.has_key('CsgOper'):
			poly=room.NewPolygon(tm)
		elif self.attrib['CsgOper']=='CSG_Add':
#			thing=csThing()
#			poly=thing.NewPolygon(tm)
#			vecs.Load(poly)
#			room.AddThing(thing)
			return
		else:
			print "WARNING: Unknown "+self.attrib['CsgOper']
			return
		vecs.Load(poly)
	def Load(self, room, tm):
		for x in self.stack:
			for y in x.stack:
				for z in y.stack:
					self.MakeGeom(z, room, tm)
class FakeBrush(Object):
	pass
class PolyList(Object):
    	"""A list of polygons"""
	pass
	
scale=0.10
	
class Polygon(Object):
    	"""A polygons"""
	def __init__(self, attrib):
	        self.attrib=attrib
	        self.veclist=[]
	def AddPoint(self, vec):
		self.veclist.insert(0, vec)
	def Load(self, poly):
		for x in self.veclist:
			poly.AddVertex(csVector3(x[0], x[1], x[2]))
		poly.SetTextureSpace(poly.Vobj(0), poly.Vobj(1), 3);
	def __repr__(self):
		return str(self.veclist)
	
class Map(Actor):
	"""A pickleable map"""
	def Count(self):
		print "----- Map Count -----"
		print "---------------------"
	def Load(self):
		system=GetSystem()
		room=csSector(roomptr)
		view=csView(viewptr)
		tm=csTextureHandle(tmptr)
		for x in self.stack:
			if isinstance(x, Brush):
				x.Load(room, tm)
#			elif isinstance(x, PlayerStart):
#				x.Load(view)	
		g3d=system.Query_iGraphics3D()

# The Map Reader

def VectorConvert(vec):
	return (float(vec[0])*scale, float(vec[1])*scale, float(vec[2])*scale)
class UnrealMap:
	"""Import an Unreal Map and pickle it"""
	def Load(self, file):
		if(type(file)==types.StringType):
			file=open(file, 'r')
		self.stack=[]<commit_msg>Removed CSG_Add<commit_after>#!/usr/bin/env python

import types
from string import *;

try:
	import cPickle
	pickle=cPickle
except:
	print "WARNING: Failed to import module cPickle, using slower pickle library"
	import pickle

try:
	import cspacec
	from cspace import *
except:
    	print "WARNING: Failed to import module cspace, can only pickle the map"

class Object:
	"""Lowest level Unreal Object"""
	def __init__(self, attrib):
	        self.attrib=attrib.copy()
	        self.stack=[]
	def Add(self, attrib):
		self.attrib.update(attrib)
	def Push(self, child):
		self.stack.append(child)

class Actor(Object):
	"""An actor object from Unreal"""
	pass
	
class Info(Actor):
	pass
class ZoneInfo(Info):
	pass
class LevelInfo(ZoneInfo):
    	pass
class Light(Actor):
    	pass
class PlayerStart(Actor):
	pass
class Brush(Actor):
    	"""A geometry object from Unreal"""
    	def MakeGeom(self, vecs, room, tm):
		if not self.attrib.has_key('CsgOper'):
			poly=room.NewPolygon(tm)
#		elif self.attrib['CsgOper']=='CSG_Add':
#			thing=csThing()
#			poly=thing.NewPolygon(tm)
#			vecs.Load(poly)
#			room.AddThing(thing)
#			return
		else:
			print "WARNING: Unknown "+self.attrib['CsgOper']
			return
		vecs.Load(poly)
	def Load(self, room, tm):
		for x in self.stack:
			for y in x.stack:
				for z in y.stack:
					self.MakeGeom(z, room, tm)
class FakeBrush(Object):
	pass
class PolyList(Object):
    	"""A list of polygons"""
	pass
	
scale=0.10
	
class Polygon(Object):
    	"""A polygons"""
	def __init__(self, attrib):
	        self.attrib=attrib
	        self.veclist=[]
	def AddPoint(self, vec):
		self.veclist.insert(0, vec)
	def Load(self, poly):
		for x in self.veclist:
			poly.AddVertex(csVector3(x[0], x[1], x[2]))
		poly.SetTextureSpace(poly.Vobj(0), poly.Vobj(1), 3);
	def __repr__(self):
		return str(self.veclist)
	
class Map(Actor):
	"""A pickleable map"""
	def Count(self):
		print "----- Map Count -----"
		print "---------------------"
	def Load(self):
		system=GetSystem()
		room=csSector(roomptr)
#		view=csView(viewptr)
		tm=csTextureHandle(tmptr)
		for x in self.stack:
			if isinstance(x, Brush):
				x.Load(room, tm)
#			elif isinstance(x, PlayerStart):
#				x.Load(view)	
		g3d=system.Query_iGraphics3D()

# The Map Reader

def VectorConvert(vec):
	return (float(vec[0])*scale, float(vec[1])*scale, float(vec[2])*scale)
class UnrealMap:
	"""Import an Unreal Map and pickle it"""
	def Load(self, file):
		if(type(file)==types.StringType):
			file=open(file, 'r')
		self.stack=[]
{'fraction_non_alphanumeric': 0.1530632608261824, 'fraction_numerical': 0.006385950908002395, 'mean_word_length': 3.791586998087954, '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': '4356291', 'n_tokens_mistral': 2039, 'n_tokens_neox': 1895, 'n_words': 466}