def handleDetail(code,date,parser , conf):
    url=getUrl(num = code,date = date,conf=conf)
    fetchData=Fetcher.fetch(url)
    parseData=parser.parse(fetchData)
    path = Dumper.getPath(code = code , date = date ,dataType = "detail" ,conf = conf)
    Dumper.dump(path = path,data = parseData)
    return True
 def handle(self,code,date):
     url=self.getUrl(code)
     rawData = Fetcher.fetch(url)
     parseData = self.parser.parse(rawData)
     path = Dumper.getPath(code = code , date = date ,dataType = "instant" ,conf = self.conf)
     Dumper.dump(data = parseData , path = path)
     return True
	def summary(self,burn=50):
		p = np.array(self.predicted)
		d = np.array(self.data)
		score = float( np.sum(np.sqrt((d[burn:] - p[burn:-1])**2)) / (len(p)-burn) )
		avg_used = float( np.average(self.meta[:,USED]) )
		#Cummulative per entry error
		CEE = float( np.average(np.sqrt(self.meta[:,ERR])) )
		avg_life = float( np.average(self.tick - self.meta[:,ARRIVED]) )
		self.metrics = {
			'score' : score,
			'data' : { 'mean' : float(d.mean()), 'stddev' : float(d.std()) },
			'predicted' : { 'mean' : float(p.mean()), 'stddev' : float(p.std()) },
			'avg_used' : avg_used,
			'CEE' : CEE,
			'avg_life' : avg_life
		}
		print Dumper.dump(self.metrics)
Exemple #4
0
 def summary(self, burn=50):
     p = np.array(self.predicted)
     d = np.array(self.data)
     score = float(
         np.sum(np.sqrt((d[burn:] - p[burn:-1])**2)) / (len(p) - burn))
     avg_used = float(np.average(self.meta[:, USED]))
     #Cummulative per entry error
     CEE = float(np.average(np.sqrt(self.meta[:, ERR])))
     avg_life = float(np.average(self.tick - self.meta[:, ARRIVED]))
     self.metrics = {
         'score': score,
         'data': {
             'mean': float(d.mean()),
             'stddev': float(d.std())
         },
         'predicted': {
             'mean': float(p.mean()),
             'stddev': float(p.std())
         },
         'avg_used': avg_used,
         'CEE': CEE,
         'avg_life': avg_life
     }
     print Dumper.dump(self.metrics)
Exemple #5
0
 def download(self):
     """
     >>> info=Info(conf)
     >>> info.download()
     """
     source = self.conf.get("SOURCE_NAME",None) or SOURCE_NAME
     parser = Parser.ParserFactory(source)
     res=[]
     for name in self.source:
         url=self.source.get(name)
         rawData = Fetcher.fetch(url)
         parseData = parser.parse(rawData)
         if parseData:
             res=res+parseData
     path = os.path.join(self.conf["INFO_DATA_PATH"],"info.json")
     logging.debug("download info list:" + str(res))
     Dumper.dump(parseData,path) #获得信息列表
     codes=list(set(                       #并对代码去重 \
         map(lambda item:item['code'],res) #获得代码列表 \
         ))
     codes.sort()                         #排序
     path = os.path.join(self.conf["INFO_DATA_PATH"],self.conf.get("CODE_LIST_FILE_NAME",CODE_LIST_FILE_NAME))
     logging.debug("download code list:"+str(codes))
     Dumper.dump(codes,path)
Exemple #6
0
	def dump_filesystem(self, filesystem):
		print("\n------------------------------------------------------")
		print(Dumper.dump(filesystem).encode('utf-8'))
Exemple #7
0
# Utility to convert monobehaviours from asset files to json.
# Requires a type tree file generated with TypeTreeGenerator.exe (UABE)

import sys
import Dumper

if len(sys.argv) <= 3:
	print("Usage: " + sys.argv[0] + " <type_tree_file> <asset_folder> <output_folder>")
	sys.exit()

assetfiles = ["globalgamemanagers.assets", "resources.assets", "sharedassets0.assets"]
# Blacklist applies to both root nodes and pptr nodes
blacklist = ["UMAAssetIndexer", "SlotDataAsset", "CachedPrefab", "OverlayDataAsset", "UMAWardrobeRecipe", "AbilityObjectConstructor", "AnimationFMODSoundPlayer", "AlwaysFaceCamera", "DynamicDNAConverterBehaviour", "UMAExpressionSet", "UmaTPose", "UsingMultipleAbilitiesAI", "VerticalLayoutGroup", "VoidMaterialComponent", "Waiting", "WalkAnimationScaler", "WhenStunVFXPlayer", "WorldAreaEnterListener", "TargetFinder", "StateSoundManager", "ActorDisplayInformation", "ActorSync", "RelayDamageEvents", "RagdollController", "BlendModeEffect", "ActorVisuals", "DetachParticleSystemsOnDeath", "UMABonePose", "Stunned", "AnimationSoundBehaviour", "RandomIdle", "MeshData", "ClothData", "RectangleSpawner", "PrefabReference", "AbilityObjectIndicator", "HitSoundReceiver", "Prefabs", "FT_DestroyParticleByDuration", "MovingToTarget", "RendererManager", "PlayOneShotSound", "StartsTowardsTarget", "AilmentVFXCreator", "CreationReferences", "IMAttacher", "AnimationSpeedRandomiser", "Image", "Button", "ButtonSounds", "HitParticleEffect", "HitFlash", "Mask", "RFX4_ShaderFloatCurve", "TextMeshProUGUI", "DestroyAfterDuration", "ComplexAnimationManager", "AlignmentManager", "ActorPointerEventListener", "ActorOutlineVFX", "CollisionAndNavMeshToggler", "ConstantRotation", "DOTweenAnimation", "Dying", "FX_RandomScale", "FX_Rotation", "LayoutElement", "Outline", "PeriodicallyFadeImage", "PlaySoundDuringLifetime", "SpeedManager", "ConditionHandler", "CharacterStatusTracker", "CharacterStatDisplay", "HitVfxPool", "HorizontalLayoutGroup", "ScaleProjectorOrthographicSizeWithLossyScale", "StartsAtTarget", "AbilityMover", "HitDetector", "SelfDestroyer", "DestroyOnInanimateCollison", "DestroyOnFailingToPierceEnemy", "ShakeScreenOnHit", "HitSoundEmitter", "CreateOnDeath", "LocationDetector", "AttachToAllyOnCreation", "BuffParent", "DestroySelfOnParentDeath", "MoveToParentColliderCentre", "ResizeBasedOnParentCollider", "CreateAbilityObjectOnDeath", "DefineStartDirection", "StartsAboveTarget", "DestroyAfterDurationAfterReachingTargetLocation", "CreateAtTargetLocationOnCreation", "StopAtTargetLocation", "ShakeScreenOnDeath", "SummonEntityOnDeath", "ColliderChanger", "ShakeScreenOnStart", "CreateGlobalOnDeath", "AttachToCreatorOnCreation", "AttachToNearestEnemyOnCreation", "MoveToNearestEnemyOnCreation", "AttachToPlayer", "ActivateCollidersOnStart", "RaycastAbilityMover", "AbilityParabolicMovement", "RandomiseTargetLocation", "BeamColliderScaler", "FadeParticlesWhenDurationIsLow", "DisableActorsOfTypeInteraction", "RicochetMovement", "TimerListener", "MoveToNearestMinion", "StartAwayFromTarget", "HomingMovement", "ChangeColliderSizeOverTime", "AbilityEventListener", "RotateAroundUp", "DestroyOnParentReachingAbilityMovementDestination", "EquipTypeAngles", "FootstepRaycastTrigger", "IMSlotManager", "PlayerAnimationManager", "PlayerFootstepSoundEmitter"]
# Whitelist, if not empty, applies only to root nodes (file dumps)
whitelist = []
#whitelist = ["Ability", "AbilityManager", "AffixList", "GlobalTreeData", "ItemList", "PropertyList", "UniqueList", "WarpathTree", "SkillTreeNode", "CharacterClassList", "KnightTree"]
# Some monobehaviours start at a weird raw position which can't be guessed currently
seek_override = {"SkillTreeNode": 0x2C, "ChangeDamageModifierOverTime": 0x2C}
# For classes that are parsed as pptrs (subnodes), only keep some of the fields
pptr_override = {"Ability":   ["abilityName", "playerAbilityID"],
				 "Quest":     ["id"],
				 "Objective": ["id"]}
d = Dumper.Dumper(sys.argv[1], sys.argv[2], assetfiles, seek_override, blacklist = blacklist, whitelist = whitelist, pptr_override = pptr_override)
# Passing in ignore_pptr = False is slower but will resolve some of the files' interlinks
d.dump_all_json(sys.argv[3], ignore_pptr = False)