content
stringlengths
7
928k
avg_line_length
float64
3.5
33.8k
max_line_length
int64
6
139k
alphanum_fraction
float64
0.08
0.96
licenses
sequence
repository_name
stringlengths
7
104
path
stringlengths
4
230
size
int64
7
928k
lang
stringclasses
1 value
import xml.etree.ElementTree as ET from .. import NAMESPACE class ServerResponseError(Exception): def __init__(self, code, summary, detail): self.code = code self.summary = summary self.detail = detail super(ServerResponseError, self).__init__(str(self)) def __str__(self): return "\n\n\t{0}: {1}\n\t\t{2}".format(self.code, self.summary, self.detail) @classmethod def from_response(cls, resp): # Check elements exist before .text parsed_response = ET.fromstring(resp) error_response = cls(parsed_response.find('t:error', namespaces=NAMESPACE).get('code', ''), parsed_response.find('.//t:summary', namespaces=NAMESPACE).text, parsed_response.find('.//t:detail', namespaces=NAMESPACE).text) return error_response class MissingRequiredFieldError(Exception): pass
33.962963
99
0.642312
[ "MIT" ]
reevery/server-client-python
tableauserverclient/server/endpoint/exceptions.py
917
Python
import csv from convertextract.parsers.csv_parser import Parser as BaseParser class Parser(BaseParser): """Extract text from tab separated values files (.tsv). """ delimiter = '\t'
21.666667
66
0.717949
[ "MIT" ]
roedoejet/convertextract
convertextract/parsers/tsv_parser.py
195
Python
#!/usr/bin/env python3 from Crypto.PublicKey import RSA, ECC import json from hashlib import sha256 from Crypto.Cipher import AES, PKCS1_OAEP from base64 import b64decode from Crypto.Signature import DSS from Crypto.Hash import SHA256 import socket from base64 import * from server import * # key = RSA.importKey(open("rsapubkey.pem", "r").read() ) # key = ECC.generate(curve='P-256') # f = open("fakekey.pem", 'w') # f.write(key.export_key(format='PEM')) message = json.loads('{"aeskey": "nwmHkXTN/EjnoO5IzhpNwE3nXEUMHsNWFI7dcHnpxIIiXCO+dLCjR6TfqYfbL9Z6a7SNCKbeTFBLnipXcRoN6o56urZMWwCioVTsV7PHrlCU42cKX+c/ShcVFrA5aOTTjaO9rxTMxB1PxJqYyxlpNaUpRFslzj9LKH+g8hVEuP9lVMm7q4aniyOUgPrAxyn044mbuxPu6Kh+JHSt5dkmnPZGNfUDKCwvMKeilb5ZkLaW/EaoXXsJLh/wUinMROIqmD2dkiWnk10633sJIu1lEOUsiykYXtJcd3o/B2dfTx2/85C2J6IsIp3+jJne76AYryAONPSxuh+M0h1xCzNeQg==", "message": "6VCnnSOU1DBImyhlqt7SoEjRtmBxjmABFVmXYhlKDyc+NBlnZ3Hpj4EkLwydPGpHiAvr4R0zTXSyUnMk5N6fi0/BFZE=", "nonce": "Cems9uHF6mk=", "signature": "uhLCnBvGfdC1fVkGUKQ8zNp/fOXNnFxNuDEc7CDGEYSxnuZMoGqbEqMLguJqDdvHFSHoUrq2R9/+mfk8LHndhw==", "eccpubkey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEGww+NA3xHj4kCyztekLhmJVB62Hhq/oGDWwo4fxgZCgbODqD3vrMFFTGCWfO8ZyHtstuW+Yztpq94CnSNpJoug=="}') def fake_signature(msg) : eccpubkey = ECC.import_key(msg["eccpubkey"]) h = SHA256.new(msg["aeskey"] + msg["nonce"] + msg["message"]) sign = DSS.new(eccpubkey, 'fips-186-3') msg['signature'] = sign.sign(h) return msg HOST = 'crypto1.ctf.nullcon.net' # The server's hostname or IP address PORT = 5001 # The port used by the server def sendMsg(msg) : msg = fake_signature(msg) msg["nonce"] = b64encode(msg["nonce"]).decode() msg["message"] = b64encode(msg["message"]).decode() msg["aeskey"] = b64encode(msg["aeskey"]).decode() msg["signature"] = b64encode(msg["signature"]).decode() msg["eccpubkey"] = b64encode(msg["eccpubkey"]).decode() with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) s.recv(1024) s.sendall(json.dumps(msg).encode() + b"\n") recpt = s.recv(1024).split(b'\n') assert recpt[0] == b'Here is your read receipt:' return recpt[1] """ Recovery xor key """ def xor(a, b) : return bytes([ai ^ bi for (ai, bi) in zip(a,b)]) ciphertext = b64decode(message['message']) print(ciphertext) flag = b"hackim20{digital_singatures_does_not_always_imp" fake_message = xor(flag, ciphertext[:len(flag)]) import progressbar from string import ascii_lowercase , digits printable = ascii_lowercase + "{}_" + digits for _ in range(len(flag), len(ciphertext)) : print(_) H = SHA256.new(bytes(len(fake_message) + 1)).hexdigest().encode() brute = list(map(lambda x : ord(x) ^ ciphertext[_], printable)) for i in progressbar.ProgressBar(widgets=[progressbar.Counter(), ' ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA()])(brute) : message["nonce"] = b64decode(message["nonce"]) message["aeskey"] = b64decode(message["aeskey"]) message["signature"] = b64decode(message["signature"]) message['eccpubkey'] = open("fakekey.pem","r").read().encode() new_fake_message = fake_message + bytes([i]) message['message'] = new_fake_message recpt = sendMsg(message) if recpt == H : fake_message += bytes([i]) flag = xor(fake_message, ciphertext[:_+1]) print(flag) break
44.7
761
0.683166
[ "MIT" ]
hacmao/hacmao.github.io
ctf/2020/nullcon/msg/solve.py
3,576
Python
#!/usr/bin/env python from distutils.core import setup setup( name='tweepy_crawler', version='0.1', license='MIT', long_description=open('README.md').read(), )
16.181818
46
0.657303
[ "MIT" ]
MCardus/GuruFinder
twitter_crawlers/tweepy_crawler/setup.py
178
Python
from django.contrib import admin from .. import models @admin.register(models.Code) class CodeAdmin(admin.ModelAdmin): """ 코드 정보 """ list_display = ['id', 'author', 'problem', 'language', 'name', 'available_game', 'date' ] class Meta: model = models.Code
18
93
0.628472
[ "MIT" ]
Capstone-onepanman/api-server
onepanman_api/admin/code.py
296
Python
from .euro import api as euro_ns
16.5
32
0.787879
[ "MIT" ]
erkandem/rates_app
app/api/rates/__init__.py
33
Python
""" strings and logic related to composing notifications """ HELLO_STATUS = "Hello! I'm Vaccination Notifier" HELLO_MESSAGE = ( "Hello there!\n" "\n" "I'm Vaccination Notifier. This is just a message to let you know I'm running and " "to test our notification configuration. I'll check for changes to your " "vaccination status once every {delay} minutes---unless I crash! Every now and then, " "you should probably check on me to make sure nothing has gone wrong.\n" "\n" "Love,\n" "Vaccination Notifier" ) def hello_message(delay): return (HELLO_STATUS, HELLO_MESSAGE.format(delay=delay)) UPDATE_STATUS = "Vaccination update detected" UPDATE_MESSAGE = ( "Hello there!\n" "\n" "I noticed that your vaccination results page was updated recently. Here's " "a summary of the update:\n" "Health Facility:{facility}\n" "Vaccination Location:{location}\n" "Date:{date}\n" "Time:{time}\n" "\n" "Love,\n" "Vaccination Notifier" ) def update_message(dict): facility = dict['Health Facility:'] location = dict['Vaccination Location:'] date = dict['Date:'] time = dict['Time:'] return (UPDATE_STATUS, UPDATE_MESSAGE.format(facility=facility, location=location, date=date, time=time))
30.714286
90
0.675969
[ "MIT" ]
Cedric0303/Vaccination-Notifier
messages.py
1,290
Python
from __future__ import print_function """ A script to batch render and update interactive viewer. """ import os import sys import argparse import pyexr import numpy as np import json import subprocess as sp from analyze import update_stats, compute_stats, write_data if __name__ == '__main__': # Parse arguments parser = argparse.ArgumentParser( description='Batch analysis of rendered images.') parser.add_argument('-mts', '--mitsuba', help='mitsuba executable', type=str, default='./mitsuba') parser.add_argument('-r', '--ref', help='reference image', type=str, required=True) parser.add_argument('-s', '--scene', help='scene xml file', type=str, required=True) parser.add_argument('-o', '--options', help='mitsuba options', type=str) parser.add_argument('-d', '--dir', help='corresponding viewer scene directory', type=str, required=True) parser.add_argument('-n', '--name', help='algorithm name', type=str, required=True) parser.add_argument('-a', '--alg', help='mitsuba algorithm keyword', type=str, required=True) parser.add_argument('-t', '--timeout', help='render time (s)', type=int) parser.add_argument('-f', '--frequency', help='intermediate image output frequency (s)', type=int) parser.add_argument('-m', '--metrics', help='difference metrics', nargs='+', choices=['l1', 'l2', 'mrse', 'mape', 'smape', 'dssim'], type=str) parser.add_argument('-eps', '--epsilon', help='epsilon value', type=float, default=1e-2) parser.add_argument('-c', '--clip', help='clipping values for min/max', nargs=2, type=float, default=[0, 1]) args = parser.parse_args() # Create Mistuba command fname = '{}.exr'.format(args.name.replace(' ', '-')) out_path = os.path.join(os.path.dirname(args.scene), fname) render = '{} {} -D integrator={}'.format( args.mitsuba, args.scene, args.alg) if args.frequency: render = '{} -r {}'.format(render, args.frequency) if args.options: render = '{} {}'.format(render, args.options) render = '{} -o {}'.format(render, out_path) cmd = render.split() # Run and time out after fixed amount of time sys.stdout.write('Rendering... ') sys.stdout.flush() try: out = sp.check_output(cmd, shell=False, timeout=args.timeout) except sp.TimeoutExpired as e: print('done.') # Update interactive viewer sys.stdout.write('Recomputing metrics... ') sys.stdout.flush() ref_fp = pyexr.open(args.ref) ref = np.array(ref_fp.get()) img_fp = pyexr.open(out_path) img = np.array(img_fp.get()) test = [{'name': args.name, 'data': img}] with open(os.path.join(args.dir, 'data.json'), 'r') as fp: data = json.load(fp) with open(os.path.join(args.dir, 'stats.json'), 'r') as fp: stats = json.load(fp) data = update_stats(args.dir, data, ref, test, args.metrics, args.clip, args.epsilon) write_data(args.dir, data) print('done.') web_url = os.path.abspath(os.path.join(args.dir, 'index.html')) print('Interactive viewer updated: {}'.format(web_url))
38.931818
127
0.590193
[ "MIT" ]
beltegeuse/interactive-viewer
tools/render.py
3,426
Python
import json import time from dataclasses import dataclass from logging import Logger import requests from insightconnect_plugin_runtime.exceptions import PluginException from insightconnect_plugin_runtime.helper import clean from requests.auth import HTTPBasicAuth @dataclass class AlertParams: alert_type: [str] severity: [str] source_type: [str] network_type: [str] matched_asset_value: str remediation_status: [str] source_date_from: str source_date_to: str found_date_from: str found_date_to: str assigned: str is_flagged: str is_closed: str has_ioc: bool def to_dict(self) -> dict: return clean( { "alertType": ",".join(self.alert_type) if self.alert_type else None, "severity": ",".join(self.severity) if self.severity else None, "sourceType": ",".join(self.source_type) if self.source_type else None, "networkType": ",".join(self.network_type) if self.network_type else None, "matchedAssetValue": ",".join(self.matched_asset_value) if self.matched_asset_value else None, "remediationStatus": ",".join(self.remediation_status) if self.remediation_status else None, "sourceDateFrom": int(self.source_date_from) if self.source_date_from else None, "sourceDateTo": int(self.source_date_to) if self.source_date_to else None, "foundDateFrom": int(self.found_date_from) if self.found_date_from else None, "foundDateTo": int(self.found_date_to) if self.found_date_to else None, "assigned": self.assigned == "Assigned" if self.assigned else None, "isFlagged": self.is_flagged == "Flagged" if self.is_flagged else None, "isClosed": self.is_closed == "Closed" if self.is_closed else None, "hasIoc": self.has_ioc, } ) @dataclass class Image: type: str data: str @dataclass class ManualAlertParams: title: str found_date: str description: str type: str sub_type: str severity: str source_type: int source_network_type: int source_url: int source_date: int images: [Image] def to_dict(self) -> dict: images = [] if self.images: for image in self.images: if not image: continue try: images.append({"Type": image["type"], "Data": image["data"]}) except KeyError as e: raise PluginException(cause="Wrong input parameter.", assistance=f"Wrong image: {e}.") return clean( { "FoundDate": self.found_date, "Details": { "Title": self.title, "Description": self.description, "Type": self.type, "SubType": self.sub_type, "Severity": self.severity, "Source": { "Type": self.source_type, "NetworkType": self.source_network_type, "URL": self.source_url, "Date": self.source_date, }, "Images": images, }, } ) class IntSightsAPI: def __init__(self, account_id: str, api_key: str, logger: Logger): self.account_id = account_id self.api_key = api_key self.url = "https://api.intsights.com" self.logger = logger def get_indicator_by_value(self, ioc_value: str) -> dict: return self.make_json_request("GET", f"public/v2/iocs/ioc-by-value?iocValue={ioc_value}") def enrich_indicator(self, ioc_value: str) -> dict: response = {} for _ in range(0, 9999): response = self.make_json_request("GET", f"public/v1/iocs/enrich/{ioc_value}") if response.get("Status", "InProgress") in ["Done", "Failed"]: break time.sleep(5) return response def rescan_indicator(self, indicator_file_hash: str) -> dict: return self.make_json_request("POST", "public/v1/iocs/rescan", json_data={"IocValue": indicator_file_hash}) def get_scan_status(self, task_id: str) -> dict: return self.make_json_request("GET", f"public/v1/iocs/rescan/status/{task_id}") def get_complete_alert_by_id(self, alert_id: str) -> dict: return self.make_json_request("GET", f"public/v1/data/alerts/get-complete-alert/{alert_id}") def takedown_request(self, alert_id: str, target: str) -> dict: return self.make_json_request( "PATCH", f"public/v1/data/alerts/takedown-request/{alert_id}", json_data={"Target": target} ) def get_alerts(self, alert_params: AlertParams) -> list: return self.make_request("GET", "public/v1/data/alerts/alerts-list", params=alert_params.to_dict()).json() def add_manual_alert(self, manual_alert_params: ManualAlertParams) -> str: return self.make_request("PUT", "public/v1/data/alerts/add-alert", json_data=manual_alert_params.to_dict()).text def test_credentials(self) -> bool: return self.make_request("HEAD", "public/v1/test-credentials").status_code == 200 def make_json_request(self, method: str, path: str, json_data: dict = None, params: dict = None) -> dict: try: response = self.make_request(method=method, path=path, json_data=json_data, params=params) if response.status_code == 204: return {} json_response = response.json() if json_response.get("Status") == "Invalid": raise PluginException( cause="IntSights returned an error response: ", assistance=f"{json_response.get('FailedReason')}." ) return json_response except json.decoder.JSONDecodeError as e: raise PluginException(preset=PluginException.Preset.INVALID_JSON, data=e) def make_request(self, method: str, path: str, json_data: dict = None, params: dict = None) -> requests.Response: try: response = requests.request( method=method, url=f"{self.url}/{path}", headers={"Content-Type": "application/json"}, verify=True, params=params, json=json_data, auth=HTTPBasicAuth(self.account_id, self.api_key), ) if response.status_code == 401: raise PluginException(preset=PluginException.Preset.USERNAME_PASSWORD, data=response.text) if response.status_code == 403: raise PluginException(preset=PluginException.Preset.API_KEY, data=response.text) if response.status_code == 404: raise PluginException(preset=PluginException.Preset.NOT_FOUND, data=response.text) if 400 <= response.status_code < 500: raise PluginException( preset=PluginException.Preset.UNKNOWN, data=response.text, ) if response.status_code >= 500: raise PluginException(preset=PluginException.Preset.SERVER_ERROR, data=response.text) if 200 <= response.status_code < 300: return response raise PluginException(preset=PluginException.Preset.UNKNOWN, data=response.text) except requests.exceptions.HTTPError as e: raise PluginException(preset=PluginException.Preset.UNKNOWN, data=e)
39.642487
120
0.606065
[ "MIT" ]
ax-zyoutz/insightconnect-plugins
plugins/rapid7_intsights/icon_rapid7_intsights/util/api.py
7,651
Python
# PuLP : Python LP Modeler # Version 1.4.2 # Copyright (c) 2002-2005, Jean-Sebastien Roy ([email protected]) # Modifications Copyright (c) 2007- Stuart Anthony Mitchell ([email protected]) # $Id:solvers.py 1791 2008-04-23 22:54:34Z smit023 $ # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.""" from .core import LpSolver_CMD, LpSolver, subprocess, PulpSolverError, clock, log from .core import gurobi_path import os from uuid import uuid4 import sys from .. import constants import warnings # to import the gurobipy name into the module scope gurobipy = None class GUROBI(LpSolver): """ The Gurobi LP/MIP solver (via its python interface) The Gurobi variables are available (after a solve) in var.solverVar Constriaints in constraint.solverConstraint and the Model is in prob.solverModel """ try: sys.path.append(gurobi_path) # to import the name into the module scope global gurobipy import gurobipy except: # FIXME: Bug because gurobi returns #a gurobi exception on failed imports def available(self): """True if the solver is available""" return False def actualSolve(self, lp, callback = None): """Solve a well formulated lp problem""" raise PulpSolverError("GUROBI: Not Available") else: def __init__(self, mip = True, msg = True, timeLimit = None, epgap = None, **solverParams): """ Initializes the Gurobi solver. @param mip: if False the solver will solve a MIP as an LP @param msg: displays information from the solver to stdout @param timeLimit: sets the maximum time for solution @param epgap: sets the integer bound gap """ LpSolver.__init__(self, mip, msg) self.timeLimit = timeLimit self.epgap = epgap #set the output of gurobi if not self.msg: gurobipy.setParam("OutputFlag", 0) #set the gurobi parameter values for key,value in solverParams.items(): gurobipy.setParam(key, value) def findSolutionValues(self, lp): model = lp.solverModel solutionStatus = model.Status GRB = gurobipy.GRB # TODO: check status for Integer Feasible gurobiLpStatus = {GRB.OPTIMAL: constants.LpStatusOptimal, GRB.INFEASIBLE: constants.LpStatusInfeasible, GRB.INF_OR_UNBD: constants.LpStatusInfeasible, GRB.UNBOUNDED: constants.LpStatusUnbounded, GRB.ITERATION_LIMIT: constants.LpStatusNotSolved, GRB.NODE_LIMIT: constants.LpStatusNotSolved, GRB.TIME_LIMIT: constants.LpStatusNotSolved, GRB.SOLUTION_LIMIT: constants.LpStatusNotSolved, GRB.INTERRUPTED: constants.LpStatusNotSolved, GRB.NUMERIC: constants.LpStatusNotSolved, } #populate pulp solution values try: for var, value in zip(lp.variables(), model.getAttr(GRB.Attr.X, model.getVars())): var.varValue = value except (gurobipy.GurobiError, AttributeError): pass try: for var, value in zip(lp.variables(), model.getAttr(GRB.Attr.RC, model.getVars())): var.dj = value except (gurobipy.GurobiError, AttributeError): pass #put pi and slack variables against the constraints try: for constr, value in zip(lp.constraints.values(), model.getAttr(GRB.Pi, model.getConstrs())): constr.pi = value except (gurobipy.GurobiError, AttributeError): pass try: for constr, value in zip(lp.constraints.values(), model.getAttr(GRB.Slack, model.getConstrs())): constr.slack = value except (gurobipy.GurobiError, AttributeError): pass if self.msg: print("Gurobi status=", solutionStatus) lp.resolveOK = True for var in lp.variables(): var.isModified = False status = gurobiLpStatus.get(solutionStatus, constants.LpStatusUndefined) lp.assignStatus(status) return status def available(self): """True if the solver is available""" return True def callSolver(self, lp, callback = None): """Solves the problem with gurobi """ #solve the problem self.solveTime = -clock() lp.solverModel.optimize(callback = callback) self.solveTime += clock() def buildSolverModel(self, lp): """ Takes the pulp lp model and translates it into a gurobi model """ log.debug("create the gurobi model") lp.solverModel = gurobipy.Model(lp.name) log.debug("set the sense of the problem") if lp.sense == constants.LpMaximize: lp.solverModel.setAttr("ModelSense", -1) if self.timeLimit: lp.solverModel.setParam("TimeLimit", self.timeLimit) if self.epgap: lp.solverModel.setParam("MIPGap", self.epgap) log.debug("add the variables to the problem") for var in lp.variables(): lowBound = var.lowBound if lowBound is None: lowBound = -gurobipy.GRB.INFINITY upBound = var.upBound if upBound is None: upBound = gurobipy.GRB.INFINITY obj = lp.objective.get(var, 0.0) varType = gurobipy.GRB.CONTINUOUS if var.cat == constants.LpInteger and self.mip: varType = gurobipy.GRB.INTEGER var.solverVar = lp.solverModel.addVar(lowBound, upBound, vtype = varType, obj = obj, name = var.name) lp.solverModel.update() log.debug("add the Constraints to the problem") for name,constraint in lp.constraints.items(): #build the expression expr = gurobipy.LinExpr(list(constraint.values()), [v.solverVar for v in constraint.keys()]) if constraint.sense == constants.LpConstraintLE: relation = gurobipy.GRB.LESS_EQUAL elif constraint.sense == constants.LpConstraintGE: relation = gurobipy.GRB.GREATER_EQUAL elif constraint.sense == constants.LpConstraintEQ: relation = gurobipy.GRB.EQUAL else: raise PulpSolverError('Detected an invalid constraint type') constraint.solverConstraint = lp.solverModel.addConstr(expr, relation, -constraint.constant, name) lp.solverModel.update() def actualSolve(self, lp, callback = None): """ Solve a well formulated lp problem creates a gurobi model, variables and constraints and attaches them to the lp model which it then solves """ self.buildSolverModel(lp) #set the initial solution log.debug("Solve the Model using gurobi") self.callSolver(lp, callback = callback) #get the solution information solutionStatus = self.findSolutionValues(lp) for var in lp.variables(): var.modified = False for constraint in lp.constraints.values(): constraint.modified = False return solutionStatus def actualResolve(self, lp, callback = None): """ Solve a well formulated lp problem uses the old solver and modifies the rhs of the modified constraints """ log.debug("Resolve the Model using gurobi") for constraint in lp.constraints.values(): if constraint.modified: constraint.solverConstraint.setAttr(gurobipy.GRB.Attr.RHS, -constraint.constant) lp.solverModel.update() self.callSolver(lp, callback = callback) #get the solution information solutionStatus = self.findSolutionValues(lp) for var in lp.variables(): var.modified = False for constraint in lp.constraints.values(): constraint.modified = False return solutionStatus class GUROBI_CMD(LpSolver_CMD): """The GUROBI_CMD solver""" def defaultPath(self): return self.executableExtension("gurobi_cl") def available(self): """True if the solver is available""" return self.executable(self.path) def actualSolve(self, lp): """Solve a well formulated lp problem""" # TODO: workaround for python not reading LD_LIBRARY_PATH # in my version of ubuntu if 'GUROBI_HOME' in os.environ: if 'LD_LIBRARY_PATH' not in os.environ: os.environ['LD_LIBRARY_PATH'] = "" os.environ['LD_LIBRARY_PATH'] += ':' + os.environ['GUROBI_HOME'] + "/lib" if not self.executable(self.path): raise PulpSolverError("PuLP: cannot execute "+self.path) if not self.keepFiles: uuid = uuid4().hex tmpLp = os.path.join(self.tmpDir, "%s-pulp.lp" % uuid) tmpSol = os.path.join(self.tmpDir, "%s-pulp.sol" % uuid) tmpMst = os.path.join(self.tmpDir, "%s-pulp.mst" % uuid) else: tmpLp = lp.name+"-pulp.lp" tmpSol = lp.name+"-pulp.sol" tmpMst = lp.name + "-pulp.mst" vs = lp.writeLP(tmpLp, writeSOS = 1) try: os.remove(tmpSol) except: pass cmd = self.path cmd += ' ' + ' '.join(['%s=%s' % (key, value) for key, value in self.options]) cmd += ' ResultFile=%s' % tmpSol if self.mip_start: self.writesol(filename=tmpMst, vs=vs) cmd += ' InputFile=%s' % tmpMst if lp.isMIP(): if not self.mip: warnings.warn('GUROBI_CMD does not allow a problem to be relaxed') cmd += ' %s' % tmpLp if self.msg: pipe = None else: pipe = open(os.devnull, 'w') return_code = subprocess.call(cmd.split(), stdout = pipe, stderr = pipe) # Close the pipe now if we used it. if pipe is not None: pipe.close() if return_code != 0: raise PulpSolverError("PuLP: Error while trying to execute "+self.path) if not os.path.exists(tmpSol): warnings.warn('GUROBI_CMD does provide good solution status of non optimal solutions') status = constants.LpStatusNotSolved values = reducedCosts = shadowPrices = slacks = None else: status, values, reducedCosts, shadowPrices, slacks = self.readsol(tmpSol) if not self.keepFiles: for f in [tmpSol, tmpMst, tmpLp, "gurobi.log"]: try: os.remove(f) except: pass if status != constants.LpStatusInfeasible: lp.assignVarsVals(values) lp.assignVarsDj(reducedCosts) lp.assignConsPi(shadowPrices) lp.assignConsSlack(slacks) lp.assignStatus(status) return status def readsol(self, filename): """Read a Gurobi solution file""" with open(filename) as my_file: try: next(my_file) # skip the objective value except StopIteration: # Empty file not solved warnings.warn('GUROBI_CMD does provide good solution status of non optimal solutions') status = constants.LpStatusNotSolved return status, {}, {}, {}, {} #We have no idea what the status is assume optimal # TODO: check status for Integer Feasible status = constants.LpStatusOptimal shadowPrices = {} slacks = {} shadowPrices = {} slacks = {} values = {} reducedCosts = {} for line in my_file: if line[0] != '#': #skip comments name, value = line.split() values[name] = float(value) return status, values, reducedCosts, shadowPrices, slacks def writesol(self, filename, vs): """Writes a GUROBI solution file""" values = [(v.name, v.value()) for v in vs if v.value() is not None] rows = [] for name, value in values: rows.append('{} {}'.format(name, value)) with open(filename, 'w') as f: f.write('\n'.join(rows)) return True
41.512968
112
0.567581
[ "MIT" ]
KCachel/pulp
pulp/apis/gurobi_api.py
14,405
Python
import os, sys from base64 import decodebytes from wptserve.utils import isomorphic_decode import importlib subresource = importlib.import_module("common.security-features.subresource.subresource") def generate_payload(request, server_data): data = (u'{"headers": %(headers)s}') % server_data if b"id" in request.GET: request.server.stash.put(request.GET[b"id"], data) # Simple base64 encoded .tff font return decodebytes(b"AAEAAAANAIAAAwBQRkZUTU6u6MkAAAXcAAAAHE9TLzJWYW" b"QKAAABWAAAAFZjbWFwAA8D7wAAAcAAAAFCY3Z0IAAhAnkA" b"AAMEAAAABGdhc3D//wADAAAF1AAAAAhnbHlmCC6aTwAAAx" b"QAAACMaGVhZO8ooBcAAADcAAAANmhoZWEIkAV9AAABFAAA" b"ACRobXR4EZQAhQAAAbAAAAAQbG9jYQBwAFQAAAMIAAAACm" b"1heHAASQA9AAABOAAAACBuYW1lehAVOgAAA6AAAAIHcG9z" b"dP+uADUAAAWoAAAAKgABAAAAAQAAMhPyuV8PPPUACwPoAA" b"AAAMU4Lm0AAAAAxTgubQAh/5wFeAK8AAAACAACAAAAAAAA" b"AAEAAAK8/5wAWgXcAAAAAAV4AAEAAAAAAAAAAAAA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ADAA" b"EECQAEAAoBAgADAAEECQAFACABFAADAAEECQAGAAoBRwBD" b"AG8AcAB5AHIAaQBnAGgAdAAgACgAYwApACAAMgAwADAAOA" b"AgAE0AbwB6AGkAbABsAGEAIABDAG8AcgBwAG8AcgBhAHQA" b"aQBvAG4AAENvcHlyaWdodCAoYykgMjAwOCBNb3ppbGxhIE" b"NvcnBvcmF0aW9uAABNAGEAcgBrAEEAAE1hcmtBAABNAGUA" b"ZABpAHUAbQAATWVkaXVtAABGAG8AbgB0AEYAbwByAGcAZQ" b"AgADIALgAwACAAOgAgAE0AYQByAGsAQQAgADoAIAA1AC0A" b"MQAxAC0AMgAwADAAOAAARm9udEZvcmdlIDIuMCA6IE1hcm" b"tBIDogNS0xMS0yMDA4AABNAGEAcgBrAEEAAE1hcmtBAABW" b"AGUAcgBzAGkAbwBuACAAMAAwADEALgAwADAAMAAgAABWZX" b"JzaW9uIDAwMS4wMDAgAABNAGEAcgBrAEEAAE1hcmtBAAAA" b"AgAAAAAAAP+DADIAAAABAAAAAAAAAAAAAAAAAAAAAAAEAA" b"AAAQACACQAAAAAAAH//wACAAAAAQAAAADEPovuAAAAAMU4" b"Lm0AAAAAxTgubQ==") def generate_report_headers_payload(request, server_data): stashed_data = request.server.stash.take(request.GET[b"id"]) return stashed_data def main(request, response): handler = lambda data: generate_payload(request, data) content_type = b'application/x-font-truetype' if b"report-headers" in request.GET: handler = lambda data: generate_report_headers_payload(request, data) content_type = b'application/json' subresource.respond(request, response, payload_generator = handler, content_type = content_type, access_control_allow_origin = b"*")
56.714286
89
0.651477
[ "BSD-3-Clause" ]
2901Naim/wpt
common/security-features/subresource/font.py
4,367
Python
from pathlib import Path data_path = Path(Path(__file__).parent) __all__ = ['data_path']
16
40
0.708333
[ "MIT" ]
tranandrew0421/Rin-Bot
data/__init__.py
96
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import json import logging import os import warnings from builtins import str from typing import Any from rasa_core import utils from rasa_core.domain import Domain from rasa_core.policies import Policy from rasa_core.training.data import DialogueTrainingData logger = logging.getLogger(__name__) class KerasPolicy(Policy): SUPPORTS_ONLINE_TRAINING = True def __init__(self, model=None, graph=None, current_epoch=0, featurizer=None, max_history=None): import keras super(KerasPolicy, self).__init__(featurizer, max_history) if KerasPolicy.is_using_tensorflow() and not graph: self.graph = keras.backend.tf.get_default_graph() else: self.graph = graph self.model = model self.current_epoch = current_epoch @property def max_len(self): if self.model: return self.model.layers[0].batch_input_shape[1] else: return None @staticmethod def is_using_tensorflow(): import keras return keras.backend._BACKEND == "tensorflow" def predict_action_probabilities(self, tracker, domain): x = self.featurize(tracker, domain) # we need to add a batch dimension with length 1 x = x.reshape((1, self.max_len, x.shape[1])) if KerasPolicy.is_using_tensorflow() and self.graph is not None: with self.graph.as_default(): y_pred = self.model.predict(x, batch_size=1) else: y_pred = self.model.predict(x, batch_size=1) return y_pred[-1].tolist() def _build_model(self, num_features, num_actions, max_history_len): warnings.warn("Deprecated, use `model_architecture` instead.", DeprecationWarning, stacklevel=2) return def model_architecture(self, num_features, num_actions, max_history_len): """Build a keras model and return a compiled model. :param max_history_len: The maximum number of historical turns used to decide on next action """ from keras.layers import LSTM, Activation, Masking, Dense from keras.models import Sequential n_hidden = 32 # Neural Net and training params batch_shape = (None, max_history_len, num_features) # Build Model model = Sequential() model.add(Masking(-1, batch_input_shape=batch_shape)) model.add(LSTM(n_hidden, batch_input_shape=batch_shape, dropout=0.2)) model.add(Dense(input_dim=n_hidden, units=num_actions)) model.add(Activation('softmax')) model.compile(loss='categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy']) logger.debug(model.summary()) return model def train(self, training_data, domain, **kwargs): # type: (DialogueTrainingData, Domain, **Any) -> None self.model = self.model_architecture(domain.num_features, domain.num_actions, training_data.max_history()) shuffled_X, shuffled_y = training_data.shuffled(domain) validation_split = kwargs.get("validation_split", 0.0) logger.info("Fitting model with {} total samples and a validation " "split of {}".format(training_data.num_examples(), validation_split)) self.model.fit(shuffled_X, shuffled_y, **kwargs) self.current_epoch = kwargs.get("epochs", 10) logger.info("Done fitting keras policy model") def continue_training(self, training_data, domain, **kwargs): # fit to one extra example self.current_epoch += 1 self.model.fit(training_data.X, training_data.y_as_one_hot(domain), epochs=self.current_epoch + 1, batch_size=1, verbose=0, initial_epoch=self.current_epoch) def _persist_configuration(self, config_file): model_config = { "arch": "keras_arch.json", "weights": "keras_weights.h5", "epochs": self.current_epoch} utils.dump_obj_as_json_to_file(config_file, model_config) def persist(self, path): if self.model: arch_file = os.path.join(path, 'keras_arch.json') weights_file = os.path.join(path, 'keras_weights.h5') config_file = os.path.join(path, 'keras_policy.json') # makes sure the model directory exists utils.create_dir_for_file(weights_file) utils.dump_obj_as_str_to_file(arch_file, self.model.to_json()) self._persist_configuration(config_file) self.model.save_weights(weights_file, overwrite=True) else: warnings.warn("Persist called without a trained model present. " "Nothing to persist then!") @classmethod def _load_model_arch(cls, path, meta): from keras.models import model_from_json arch_file = os.path.join(path, meta["arch"]) if os.path.isfile(arch_file): with io.open(arch_file) as f: model = model_from_json(f.read()) return model else: return None @classmethod def _load_weights_for_model(cls, path, model, meta): weights_file = os.path.join(path, meta["weights"]) if model is not None and os.path.exists(weights_file): model.load_weights(weights_file) return model @classmethod def load(cls, path, featurizer, max_history): if os.path.exists(path): meta_path = os.path.join(path, "keras_policy.json") if os.path.isfile(meta_path): with io.open(meta_path) as f: meta = json.loads(f.read()) model_arch = cls._load_model_arch(path, meta) return cls( cls._load_weights_for_model(path, model_arch, meta), current_epoch=meta["epochs"], max_history=max_history, featurizer=featurizer ) else: return cls(max_history=max_history, featurizer=featurizer) else: raise Exception("Failed to load dialogue model. Path {} " "doesn't exist".format(os.path.abspath(path)))
37.363128
77
0.612141
[ "Apache-2.0" ]
AdrianAdamiec/rasa_core
rasa_core/policies/keras_policy.py
6,688
Python
config = { "interfaces": { "google.ads.googleads.v1.services.CustomerFeedService": { "retry_codes": { "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], "non_idempotent": [] }, "retry_params": { "default": { "initial_retry_delay_millis": 5000, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 3600000, "rpc_timeout_multiplier": 1.0, "max_rpc_timeout_millis": 3600000, "total_timeout_millis": 3600000 } }, "methods": { "GetCustomerFeed": { "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "MutateCustomerFeeds": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } } } } }
35.029412
67
0.438287
[ "Apache-2.0" ]
BenRKarl/google-ads-python
google/ads/google_ads/v1/services/customer_feed_service_client_config.py
1,191
Python
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os from textwrap import dedent import pytest from pants.backend.jvm.artifact import Artifact from pants.backend.jvm.repository import Repository from pants.backend.jvm.scala_artifact import ScalaArtifact from pants.backend.jvm.targets.java_library import JavaLibrary from pants.backend.python.targets.python_library import PythonLibrary from pants.build_graph.build_file_aliases import BuildFileAliases from pants.build_graph.target import Target from pants.rules.core import list_targets_old from pants.testutil.goal_rule_test_base import GoalRuleTestBase class ListTargetsTest(GoalRuleTestBase): goal_cls = list_targets_old.List @classmethod def alias_groups(cls): return BuildFileAliases( targets={ "target": Target, "java_library": JavaLibrary, "python_library": PythonLibrary, }, objects={ "pants": lambda x: x, "artifact": Artifact, "scala_artifact": ScalaArtifact, "public": Repository( name="public", url="http://maven.example.com", push_db_basedir="/tmp" ), }, ) @classmethod def rules(cls): return super().rules() + list_targets_old.rules() def setUp(self) -> None: super().setUp() # Setup a BUILD tree for various list tests class Lib: def __init__(self, name: str, provides: bool = False) -> None: self.name = name self.provides = ( dedent( f""" artifact( org='com.example', name='{name}', repo=public ) """ ).strip() if provides else "None" ) def create_library(path: str, *libs: Lib) -> None: libs = libs or (Lib(os.path.basename(os.path.dirname(self.build_path(path)))),) for lib in libs: target = f"java_library(name='{lib.name}', provides={lib.provides}, sources=[])\n" self.add_to_build_file(path, target) create_library("a") create_library("a/b", Lib("b", provides=True)) create_library("a/b/c", Lib("c"), Lib("c2", provides=True), Lib("c3")) create_library("a/b/d") create_library("a/b/e", Lib("e1")) self.add_to_build_file( "f", dedent( ''' target( name='alias', dependencies=[ 'a/b/c:c3', 'a/b/d:d', ], description = """ Exercises alias resolution. Further description. """, ) ''' ), ) def test_list_all_empty(self): # NB: Also renders a warning to stderr, which is challenging to detect here but confirmed in: # tests/python/pants_test/engine/legacy/test_list_integration.py self.assert_console_output(args=[]) def test_list_path(self): self.assert_console_output("a/b:b", args=["a/b"]) def test_list_siblings(self): self.assert_console_output("a/b:b", args=["a/b:"]) self.assert_console_output("a/b/c:c", "a/b/c:c2", "a/b/c:c3", args=["a/b/c/:"]) def test_list_descendants(self): self.assert_console_output("a/b/c:c", "a/b/c:c2", "a/b/c:c3", args=["a/b/c/::"]) self.assert_console_output( "a/b:b", "a/b/c:c", "a/b/c:c2", "a/b/c:c3", "a/b/d:d", "a/b/e:e1", args=["a/b::"] ) @pytest.mark.skip(reason="flaky: https://github.com/pantsbuild/pants/issues/8678") def test_list_all(self): self.assert_entries( "\n", "a:a", "a/b:b", "a/b/c:c", "a/b/c:c2", "a/b/c:c3", "a/b/d:d", "a/b/e:e1", "f:alias", args=["::"], ) self.assert_entries( ", ", "a:a", "a/b:b", "a/b/c:c", "a/b/c:c2", "a/b/c:c3", "a/b/d:d", "a/b/e:e1", "f:alias", args=["--sep=, ", "::"], ) self.assert_console_output( "a:a", "a/b:b", "a/b/c:c", "a/b/c:c2", "a/b/c:c3", "a/b/d:d", "a/b/e:e1", "f:alias", args=["::"], ) def test_list_provides(self): self.assert_console_output( "a/b:b com.example#b", "a/b/c:c2 com.example#c2", args=["--provides", "::"] ) def test_list_provides_customcols(self): self.assert_console_output( "/tmp a/b:b http://maven.example.com public com.example#b", "/tmp a/b/c:c2 http://maven.example.com public com.example#c2", args=[ "--provides", "--provides-columns=push_db_basedir,address,repo_url,repo_name,artifact_id", "::", ], ) def test_list_dedups(self): self.assert_console_output("a/b/c:c3", "a/b/d:d", args=["a/b/d/::", "a/b/c:c3", "a/b/d:d"]) def test_list_documented(self): self.assert_console_output( # Confirm empty listing args=["--documented", "a/b"], ) self.assert_console_output_ordered( "f:alias", " Exercises alias resolution.", " Further description.", args=["--documented", "::"], )
31.774194
101
0.494585
[ "Apache-2.0" ]
rahuliyer95/pants
tests/python/pants_test/backend/graph_info/tasks/test_list_targets.py
5,910
Python
from typing import Any, Dict from .base import Presenter from .presenter import register_presenter @register_presenter("initial-data") class InitialData(Presenter): """ Initial data for setup """ @property def data(self) -> Dict[Any, Any]: return { "privacy_policy": "The PP", "legal_notice": "The LN", "theme": "openslides-default", "logo_web_header_path": None, "login_info_text": None, "saml_settings": None, }
22.869565
42
0.587452
[ "MIT" ]
ThomasJunk/openslides-backend
openslides_backend/presenter/initial_data.py
526
Python
from data_common.config.configurer import get_conf from data_common.provision.gs_buckets import confirm_bucket def init_namespace_poc(): conf = get_conf() project_id = conf.cloud.gcp.project namespaces = conf.namespaces for namespace, v in namespaces.items(): print(f'namespace: {namespace}') bucket = confirm_bucket( bucket_name=namespace, project_id=project_id ) print(bucket.name)
22.047619
59
0.678186
[ "Apache-2.0" ]
hamshif/dags
provision/onboarding/onboard_namespaces.py
463
Python
# -*- coding:utf-8 -*- import functools import six from flask import current_app, g, request from flask import session, abort from api.extensions import cache def get_access_token(): return class AccessTokenCache(object): @classmethod def get(cls): if cache.get("AccessToken") is not None: return cache.get("AccessToken") res = get_access_token() or "" cache.set("AccessToken", res, timeout=60 * 60) return res @classmethod def clean(cls): cache.clear("AccessToken") class ACLManager(object): def __init__(self): self.access_token = AccessTokenCache.get() self.acl_session = dict(uid=session.get("uid"), token=self.access_token) self.user_info = session["acl"] if "acl" in session else {} def add_resource(self, name, resource_type_name=None): pass def grant_resource_to_role(self, name, role, resource_type_name=None): pass def del_resource(self, name, resource_type_name=None): pass def get_user_info(self, username): return dict() def get_resources(self, resource_type_name=None): if "acl" not in session: abort(405) return [] def has_permission(self, resource_name, resource_type, perm): if "acl" not in session: abort(405) return True def validate_permission(resources, resource_type, perm): if not resources: return if current_app.config.get("USE_ACL"): if g.user.username == "worker": return resources = [resources] if isinstance(resources, six.string_types) else resources for resource in resources: if not ACLManager().has_permission(resource, resource_type, perm): return abort(403, "has no permission") def can_access_resources(resource_type): def decorator_can_access_resources(func): @functools.wraps(func) def wrapper_can_access_resources(*args, **kwargs): if current_app.config.get("USE_ACL"): res = ACLManager().get_resources(resource_type) result = {i.get("name"): i.get("permissions") for i in res} if hasattr(g, "resources"): g.resources.update({resource_type: result}) else: g.resources = {resource_type: result} return func(*args, **kwargs) return wrapper_can_access_resources return decorator_can_access_resources def has_perm(resources, resource_type, perm): def decorator_has_perm(func): @functools.wraps(func) def wrapper_has_perm(*args, **kwargs): if not resources: return if current_app.config.get("USE_ACL"): validate_permission(resources, resource_type, perm) return func(*args, **kwargs) return wrapper_has_perm return decorator_has_perm def has_perm_from_args(arg_name, resource_type, perm, callback=None): def decorator_has_perm(func): @functools.wraps(func) def wrapper_has_perm(*args, **kwargs): if not arg_name: return resource = request.view_args.get(arg_name) or request.values.get(arg_name) if callback is not None and resource: resource = callback(resource) if current_app.config.get("USE_ACL") and resource: validate_permission(resource, resource_type, perm) return func(*args, **kwargs) return wrapper_has_perm return decorator_has_perm def role_required(role_name): def decorator_role_required(func): @functools.wraps(func) def wrapper_role_required(*args, **kwargs): if not role_name: return if current_app.config.get("USE_ACL"): if role_name not in session.get("acl", {}).get("parentRoles", []): return abort(403, "Role {0} is required".format(role_name)) return func(*args, **kwargs) return wrapper_role_required return decorator_role_required
29.785714
89
0.622302
[ "MIT" ]
Lancger/cmdb-1
api/lib/perm/acl.py
4,170
Python
import sqlite3 import logging DOOR_OPENED = 'door opened' DOOR_CLOSED = 'door closed' class DataStore: def __init__(self, setup=False): self.connection = sqlite3.connect('db/app.sqlite3.db') self.connection.row_factory = sqlite3.Row if setup: self.setup() def record_door_opened(self): self.add_event(DOOR_OPENED) def record_door_closed(self): self.add_event(DOOR_CLOSED) def add_event(self, event): params = [event] cursor = self.connection.cursor() cursor.execute("""insert into events (EVENT) values(?);""", params) self.connection.commit() cursor.close() def get_events(self): cursor = self.connection.cursor() cursor.execute("""select datetime(dt,'localtime') as dt, event from events order by dt desc limit 15""") rows = cursor.fetchall() events = [] if rows is not None: for row in rows: event = {} for key in row.keys(): event[key.lower()] = row[key] events.append(event) cursor.close() return events def get_last_event(self): cursor = self.connection.cursor() cursor.execute("""select datetime(dt,'localtime') as dt, event from events order by dt desc limit 1""") rows = cursor.fetchone() event = {} if rows is not None: for row in rows: for key in row.keys(): event[key.lower()] = row[key] cursor.close() return event def get_status(self): cursor = self.connection.cursor() cursor.execute("""select datetime(dt,'localtime') as dt, event, (strftime('%s','now') - strftime('%s',dt))/60 as elapsed_minutes from events order by dt desc limit 1""") row = cursor.fetchone() status = {} if row is not None: for key in row.keys(): status[key.lower()] = row[key] cursor.close() return status def get_settings(self): cursor = self.connection.cursor() cursor.execute("""select * from settings limit 1""") row = cursor.fetchone() settings = {} if row is not None: for key in row.keys(): settings[key.lower()] = row[key] cursor.close() return settings def shutdown(self): self.connection.commit() self.connection.close() def setup(self): cursor = self.connection.cursor() try: cursor.execute('select count(*) from events') # print cursor.fetchone() except Exception as e: logging.getLogger('garage').info('Required table not found... creating events table...') cursor.execute("""create table events( ID INTEGER PRIMARY KEY AUTOINCREMENT, DT DATETIME DEFAULT CURRENT_TIMESTAMP, EVENT TEXT);""") logging.info('done!') finally: cursor.close() self.connection.commit() cursor = self.connection.cursor() try: cursor.execute('select count(*) from settings') # print cursor.fetchone() except Exception as e: logging.getLogger('garage').info('Required table not found... creating settings table...') cursor.execute("""CREATE TABLE "settings" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT, "check_interval_mins" INTEGER DEFAULT (2), "notify_interval_mins" INTEGER DEFAULT (30), "warning_threshold_mins" INTEGER DEFAULT (15), "sentry_mode" INTEGER DEFAULT (0))""") self.connection.commit() cursor.execute('insert into settings (id) values (1)') logging.info('done!') finally: cursor.close() self.connection.commit()
33.866667
112
0.546752
[ "Apache-2.0" ]
gurumitts/garage-butler
garage/datastore.py
4,064
Python
import torch import torch.nn as nn #from .utils import load_state_dict_from_url from .utils import zerocenter __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'wide_resnet50_2', 'wide_resnet101_2'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth', 'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth', 'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth', 'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth', 'resnext50_32x4d': 'https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth', 'resnext101_32x8d': 'https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth', 'wide_resnet50_2': 'https://download.pytorch.org/models/wide_resnet50_2-95faca4d.pth', 'wide_resnet101_2': 'https://download.pytorch.org/models/wide_resnet101_2-32ee1156.pth', } def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation) def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, base_width=64, dilation=1, norm_layer=None): super(BasicBlock, self).__init__() if norm_layer is None: norm_layer = nn.BatchNorm2d if groups != 1 or base_width != 64: raise ValueError('BasicBlock only supports groups=1 and base_width=64') if dilation > 1: raise NotImplementedError("Dilation > 1 not supported in BasicBlock") # Both self.conv1 and self.downsample layers downsample the input when stride != 1 self.conv1 = conv3x3(inplanes, planes, stride) self.bn1 = norm_layer(planes) self.relu = nn.ReLU(inplace=True) self.conv2 = conv3x3(planes, planes) self.bn2 = norm_layer(planes) self.downsample = downsample self.stride = stride def forward(self, x): identity = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = zerocenter(out) out = self.conv2(out) out = self.bn2(out) if self.downsample is not None: identity = self.downsample(x) out += identity out = self.relu(out) out = zerocenter(out) return out class Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, base_width=64, dilation=1, norm_layer=None): super(Bottleneck, self).__init__() if norm_layer is None: norm_layer = nn.BatchNorm2d width = int(planes * (base_width / 64.)) * groups # Both self.conv2 and self.downsample layers downsample the input when stride != 1 self.conv1 = conv1x1(inplanes, width) self.bn1 = norm_layer(width) self.conv2 = conv3x3(width, width, stride, groups, dilation) self.bn2 = norm_layer(width) self.conv3 = conv1x1(width, planes * self.expansion) self.bn3 = norm_layer(planes * self.expansion) self.relu = nn.ReLU(inplace=True) self.downsample = downsample self.stride = stride def forward(self, x): identity = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = zerocenter(out) out = self.conv2(out) out = self.bn2(out) out = self.relu(out) out = zerocenter(out) out = self.conv3(out) out = self.bn3(out) if self.downsample is not None: identity = self.downsample(x) out += identity out = self.relu(out) out = zerocenter(out) return out class ResNet(nn.Module): def __init__(self, block, layers, num_classes=1000, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, norm_layer=None): super(ResNet, self).__init__() if norm_layer is None: norm_layer = nn.BatchNorm2d self._norm_layer = norm_layer self.inplanes = 64 self.dilation = 1 if replace_stride_with_dilation is None: # each element in the tuple indicates if we should replace # the 2x2 stride with a dilated convolution instead replace_stride_with_dilation = [False, False, False] if len(replace_stride_with_dilation) != 3: raise ValueError("replace_stride_with_dilation should be None " "or a 3-element tuple, got {}".format(replace_stride_with_dilation)) self.groups = groups self.base_width = width_per_group self.conv1 = nn.Conv2d(3, self.inplanes, kernel_size=7, stride=2, padding=3, bias=False) self.bn1 = norm_layer(self.inplanes) self.relu = nn.ReLU(inplace=True) self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1) self.layer1 = self._make_layer(block, 64, layers[0]) self.layer2 = self._make_layer(block, 128, layers[1], stride=2, dilate=replace_stride_with_dilation[0]) self.layer3 = self._make_layer(block, 256, layers[2], stride=2, dilate=replace_stride_with_dilation[1]) self.layer4 = self._make_layer(block, 512, layers[3], stride=2, dilate=replace_stride_with_dilation[2]) self.avgpool = nn.AdaptiveAvgPool2d((1, 1)) self.fc = nn.Linear(512 * block.expansion, num_classes) for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') elif isinstance(m, (nn.BatchNorm2d, nn.GroupNorm)): nn.init.constant_(m.weight, 1) nn.init.constant_(m.bias, 0) # Zero-initialize the last BN in each residual branch, # so that the residual branch starts with zeros, and each residual block behaves like an identity. # This improves the model by 0.2~0.3% according to https://arxiv.org/abs/1706.02677 if zero_init_residual: for m in self.modules(): if isinstance(m, Bottleneck): nn.init.constant_(m.bn3.weight, 0) elif isinstance(m, BasicBlock): nn.init.constant_(m.bn2.weight, 0) def _make_layer(self, block, planes, blocks, stride=1, dilate=False): norm_layer = self._norm_layer downsample = None previous_dilation = self.dilation if dilate: self.dilation *= stride stride = 1 if stride != 1 or self.inplanes != planes * block.expansion: downsample = nn.Sequential( conv1x1(self.inplanes, planes * block.expansion, stride), norm_layer(planes * block.expansion), ) layers = [] layers.append(block(self.inplanes, planes, stride, downsample, self.groups, self.base_width, previous_dilation, norm_layer)) self.inplanes = planes * block.expansion for _ in range(1, blocks): layers.append(block(self.inplanes, planes, groups=self.groups, base_width=self.base_width, dilation=self.dilation, norm_layer=norm_layer)) return nn.Sequential(*layers) def forward(self, x): x = self.conv1(x) x = self.bn1(x) x = self.relu(x) x = self.maxpool(x) x = zerocenter(x) x = self.layer1(x) x = self.layer2(x) x = self.layer3(x) x = self.layer4(x) x = self.avgpool(x) x = torch.flatten(x, 1) x = self.fc(x) return x def _resnet(arch, block, layers, pretrained, progress, **kwargs): model = ResNet(block, layers, **kwargs) # if pretrained: # state_dict = load_state_dict_from_url(model_urls[arch], # progress=progress) # model.load_state_dict(state_dict) return model def resnet18(pretrained=False, progress=True, **kwargs): r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _resnet('resnet18', BasicBlock, [2, 2, 2, 2], pretrained, progress, **kwargs) def resnet34(pretrained=False, progress=True, **kwargs): r"""ResNet-34 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _resnet('resnet34', BasicBlock, [3, 4, 6, 3], pretrained, progress, **kwargs) def resnet50(pretrained=False, progress=True, **kwargs): r"""ResNet-50 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _resnet('resnet50', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs) def resnet101(pretrained=False, progress=True, **kwargs): r"""ResNet-101 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _resnet('resnet101', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs) def resnet152(pretrained=False, progress=True, **kwargs): r"""ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ return _resnet('resnet152', Bottleneck, [3, 8, 36, 3], pretrained, progress, **kwargs) def resnext50_32x4d(pretrained=False, progress=True, **kwargs): r"""ResNeXt-50 32x4d model from `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ kwargs['groups'] = 32 kwargs['width_per_group'] = 4 return _resnet('resnext50_32x4d', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs) def resnext101_32x8d(pretrained=False, progress=True, **kwargs): r"""ResNeXt-101 32x8d model from `"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ kwargs['groups'] = 32 kwargs['width_per_group'] = 8 return _resnet('resnext101_32x8d', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs) def wide_resnet50_2(pretrained=False, progress=True, **kwargs): r"""Wide ResNet-50-2 model from `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ kwargs['width_per_group'] = 64 * 2 return _resnet('wide_resnet50_2', Bottleneck, [3, 4, 6, 3], pretrained, progress, **kwargs) def wide_resnet101_2(pretrained=False, progress=True, **kwargs): r"""Wide ResNet-101-2 model from `"Wide Residual Networks" <https://arxiv.org/pdf/1605.07146.pdf>`_ The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr """ kwargs['width_per_group'] = 64 * 2 return _resnet('wide_resnet101_2', Bottleneck, [3, 4, 23, 3], pretrained, progress, **kwargs) class ZeroCenterEncoder(ResNet): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.pretrained = False del self.fc def forward(self, x): x0 = self.conv1(x) x0 = self.bn1(x0) x0 = self.relu(x0) x1 = self.maxpool(x0) x1 = zerocenter(x1) x1 = self.layer1(x1) x2 = self.layer2(x1) x3 = self.layer3(x2) x4 = self.layer4(x3) return [x4, x3, x2, x1, x0] def load_state_dict(self, state_dict, **kwargs): state_dict.pop('fc.bias') state_dict.pop('fc.weight') super().load_state_dict(state_dict, **kwargs)
38.396277
107
0.626377
[ "MIT" ]
vinnamkim/segmentation_models.pytorch
segmentation_models_pytorch/encoders/zerocenter.py
14,437
Python
from collections import defaultdict import requests from logger import logger from perfrunner.helpers.misc import pretty_dict from perfrunner.helpers.remote import RemoteHelper from perfrunner.tests import PerfTest class FIOTest(PerfTest): TRACKER = 'fio.sc.couchbase.com' TEMPLATE = { 'group': '{}, random mixed reads and writes, IOPS', 'metric': None, 'value': None, } def __init__(self, cluster_spec, test_config, verbose): self.cluster_spec = cluster_spec self.test_config = test_config self.remote = RemoteHelper(cluster_spec, verbose) def __exit__(self, *args, **kwargs): pass @staticmethod def _parse(results): """Parse the test output. See also https://github.com/axboe/fio/blob/master/HOWTO """ stats = defaultdict(int) for host, output in results.items(): for job in output.split(): stats[host] += int(job.split(';')[7]) # reads stats[host] += int(job.split(';')[48]) # writes return stats def _post(self, data): data = pretty_dict(data) logger.info('Posting: {}'.format(data)) requests.post('http://{}/api/v1/benchmarks'.format(self.TRACKER), data=data) def _report_kpi(self, stats): for host, iops in stats.items(): data = self.TEMPLATE.copy() data['group'] = data['group'].format(self.cluster_spec.name.title()) data['metric'] = host data['value'] = iops self._post(data) def run(self): stats = self.remote.fio(self.test_config.fio['config']) self._report_kpi(self._parse(stats))
28.783333
80
0.600463
[ "Apache-2.0" ]
agyryk/perfrunner
perfrunner/tests/fio.py
1,727
Python
#!/usr/bin/env python3 """ Possible string formats: <author(s)> <title> <source> <year> """ import re import pdf CRED = '\033[91m' CGREEN = '\33[32m' CYELLOW = '\33[33m' CBLUE = '\33[34m' CVIOLET = '\33[35m' CBEIGE = '\33[36m' CWHITE = '\33[37m' CEND = '\033[0m' def extract_references_list_by_keyword(text, keyword): print(text) match_res = re.search(keyword, text) ref_text = text[match_res.span()[0]:] # print(ref_text) # WARNING: not more than 999 references! index_re = re.compile('\[[0-9]([0-9]|)([0-9]|)\]') ref_pos = [] for ref in index_re.finditer(ref_text): ref_pos.append(ref.span()[0]) ref_pos.append(len(ref_text)) for i in range(len(ref_pos)-1): print(CYELLOW + ref_text[ref_pos[i]:ref_pos[i+1]] + CEND) def extract_references_list(text): res = [] buffer = "" state = 0 for i in reversed(range(0, len(text)-1)): c = text[i] buffer = c + buffer if state == 0: if c == ']': state = 1 elif state == 1: if c in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: state = 2 else: state = 0 elif state == 2: if c == '[': res.append(buffer) if buffer[1] == '1' and buffer[2] == ']': break state = 0 buffer = "" else: print("Unknown state") raise return reversed(res) def extract_article_from_reference(string): pass # return (autors, title, date) if __name__ == '__main__': import sys text = pdf.extract_text(sys.argv[1]) print(text) # zextract_references_list_by_keyword('REFERENCES') ref_list = extract_references_list(text) for ref in ref_list: print(CYELLOW + ref + CEND)
22.768293
71
0.528656
[ "MIT" ]
Dewdis/scholar_tree
parse_reference.py
1,867
Python
import unittest import datetime from unittest.mock import Mock, patch from types import MethodType from serverobjects.ban import BanInstance class TestCheckIfMessageInfringes(unittest.TestCase): def test_check_if_message_infringes__exact_match(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': 'test', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertTrue(test_ban.check_if_message_infringes('test')) def test_check_if_message_infringes__embedded_match(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': 'test', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertTrue(test_ban.check_if_message_infringes('this is a test message.')) def test_check_if_message_infringes__no_match(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': 'test', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertFalse(test_ban.check_if_message_infringes('this message does not infringe.')) def test_check_if_message_infringes__word_embedded_in_other(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': 'vore', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertFalse(test_ban.check_if_message_infringes('omnivore')) def test_check_if_message_infringes__at_mention_test(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': '<@12345>', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertTrue(test_ban.check_if_message_infringes(' <@12345> ')) self.assertTrue(test_ban.check_if_message_infringes('<@12345>')) def test_check_if_message_infringes__similar_word_unicode(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': 'vore', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertTrue(test_ban.check_if_message_infringes('vÒrË')) self.assertTrue(test_ban.check_if_message_infringes('vᴑRè')) def test_check_if_message_infringes__similar_word_formatting(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word': 'vore', 'calledout_at': '2019-11-11 11:11:11', 'infracted_at': '2019-11-11 11:11:11', 'server_id': 1234, 'record': { 'record_seconds': 2400, 'infraction_count': 0 } }, datetime.datetime.now(), 0, None) self.assertTrue(test_ban.check_if_message_infringes('-v-o-r-e-')) self.assertTrue(test_ban.check_if_message_infringes('**v**o**r**e**')) self.assertTrue(test_ban.check_if_message_infringes('|||v||||o||||r||e|||'))
28.450382
90
0.635632
[ "MIT" ]
matthew-robertson/banned-word-tracker
tests/serverobjects/test_ban.py
3,732
Python
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. from __future__ import absolute_import import os import pytest import tests.integ from sagemaker import AutoML, CandidateEstimator, AutoMLInput from botocore.exceptions import ClientError from sagemaker.utils import unique_name_from_base from tests.integ import DATA_DIR, AUTO_ML_DEFAULT_TIMEMOUT_MINUTES, auto_ml_utils from tests.integ.timeout import timeout ROLE = "SageMakerRole" PREFIX = "sagemaker/beta-automl-xgboost" AUTO_ML_INSTANCE_TYPE = "ml.m5.2xlarge" INSTANCE_COUNT = 1 RESOURCE_POOLS = [{"InstanceType": AUTO_ML_INSTANCE_TYPE, "PoolSize": INSTANCE_COUNT}] TARGET_ATTRIBUTE_NAME = "virginica" DATA_DIR = os.path.join(DATA_DIR, "automl", "data") TRAINING_DATA = os.path.join(DATA_DIR, "iris_training.csv") TEST_DATA = os.path.join(DATA_DIR, "iris_test.csv") TRANSFORM_DATA = os.path.join(DATA_DIR, "iris_transform.csv") PROBLEM_TYPE = "MultiClassClassification" BASE_JOB_NAME = "auto-ml" # use a succeeded AutoML job to test describe and list candidates method, otherwise tests will run too long AUTO_ML_JOB_NAME = "python-sdk-integ-test-base-job" DEFAULT_MODEL_NAME = "python-sdk-automl" EXPECTED_DEFAULT_JOB_CONFIG = { "CompletionCriteria": {"MaxCandidates": 3}, "SecurityConfig": {"EnableInterContainerTrafficEncryption": False}, } @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) @pytest.mark.canary_quick def test_auto_ml_fit(sagemaker_session): auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session, max_candidates=3, ) job_name = unique_name_from_base("auto-ml", max_length=32) inputs = sagemaker_session.upload_data(path=TRAINING_DATA, key_prefix=PREFIX + "/input") with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): auto_ml.fit(inputs, job_name=job_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_auto_ml_fit_local_input(sagemaker_session): auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session, max_candidates=1, ) inputs = TRAINING_DATA job_name = unique_name_from_base("auto-ml", max_length=32) with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): auto_ml.fit(inputs, job_name=job_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_auto_ml_input_object_fit(sagemaker_session): auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session, max_candidates=1, ) job_name = unique_name_from_base("auto-ml", max_length=32) s3_input = sagemaker_session.upload_data(path=TRAINING_DATA, key_prefix=PREFIX + "/input") inputs = AutoMLInput(inputs=s3_input, target_attribute_name=TARGET_ATTRIBUTE_NAME) with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): auto_ml.fit(inputs, job_name=job_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_auto_ml_fit_optional_args(sagemaker_session): output_path = "s3://{}/{}".format(sagemaker_session.default_bucket(), "specified_ouput_path") problem_type = "MulticlassClassification" job_objective = {"MetricName": "Accuracy"} auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session, max_candidates=1, output_path=output_path, problem_type=problem_type, job_objective=job_objective, ) inputs = TRAINING_DATA with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): auto_ml.fit(inputs, job_name=unique_name_from_base(BASE_JOB_NAME)) auto_ml_desc = auto_ml.describe_auto_ml_job(job_name=auto_ml.latest_auto_ml_job.job_name) assert auto_ml_desc["AutoMLJobStatus"] == "Completed" assert auto_ml_desc["AutoMLJobName"] == auto_ml.latest_auto_ml_job.job_name assert auto_ml_desc["AutoMLJobObjective"] == job_objective assert auto_ml_desc["ProblemType"] == problem_type assert auto_ml_desc["OutputDataConfig"]["S3OutputPath"] == output_path @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_auto_ml_invalid_target_attribute(sagemaker_session): auto_ml = AutoML( role=ROLE, target_attribute_name="y", sagemaker_session=sagemaker_session, max_candidates=1 ) job_name = unique_name_from_base("auto-ml", max_length=32) inputs = sagemaker_session.upload_data(path=TRAINING_DATA, key_prefix=PREFIX + "/input") with pytest.raises( ClientError, match=r"An error occurred \(ValidationException\) when calling the CreateAutoMLJob " "operation: Target attribute name y does not exist in header.", ): auto_ml.fit(inputs, job_name=job_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_auto_ml_describe_auto_ml_job(sagemaker_session): expected_default_input_config = [ { "DataSource": { "S3DataSource": { "S3DataType": "S3Prefix", "S3Uri": "s3://{}/{}/input/iris_training.csv".format( sagemaker_session.default_bucket(), PREFIX ), } }, "TargetAttributeName": TARGET_ATTRIBUTE_NAME, } ] expected_default_output_config = { "S3OutputPath": "s3://{}/".format(sagemaker_session.default_bucket()) } auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) desc = auto_ml.describe_auto_ml_job(job_name=AUTO_ML_JOB_NAME) assert desc["AutoMLJobName"] == AUTO_ML_JOB_NAME assert desc["AutoMLJobStatus"] == "Completed" assert isinstance(desc["BestCandidate"], dict) assert desc["InputDataConfig"] == expected_default_input_config assert desc["AutoMLJobConfig"] == EXPECTED_DEFAULT_JOB_CONFIG assert desc["OutputDataConfig"] == expected_default_output_config @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_auto_ml_attach(sagemaker_session): expected_default_input_config = [ { "DataSource": { "S3DataSource": { "S3DataType": "S3Prefix", "S3Uri": "s3://{}/{}/input/iris_training.csv".format( sagemaker_session.default_bucket(), PREFIX ), } }, "TargetAttributeName": TARGET_ATTRIBUTE_NAME, } ] expected_default_output_config = { "S3OutputPath": "s3://{}/".format(sagemaker_session.default_bucket()) } auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) attached_automl_job = AutoML.attach( auto_ml_job_name=AUTO_ML_JOB_NAME, sagemaker_session=sagemaker_session ) attached_desc = attached_automl_job.describe_auto_ml_job() assert attached_desc["AutoMLJobName"] == AUTO_ML_JOB_NAME assert attached_desc["AutoMLJobStatus"] == "Completed" assert isinstance(attached_desc["BestCandidate"], dict) assert attached_desc["InputDataConfig"] == expected_default_input_config assert attached_desc["AutoMLJobConfig"] == EXPECTED_DEFAULT_JOB_CONFIG assert attached_desc["OutputDataConfig"] == expected_default_output_config @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_list_candidates(sagemaker_session): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) candidates = auto_ml.list_candidates(job_name=AUTO_ML_JOB_NAME) assert len(candidates) == 3 @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_best_candidate(sagemaker_session): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) best_candidate = auto_ml.best_candidate(job_name=AUTO_ML_JOB_NAME) assert len(best_candidate["InferenceContainers"]) == 3 assert len(best_candidate["CandidateSteps"]) == 4 assert best_candidate["CandidateStatus"] == "Completed" @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) @pytest.mark.canary_quick def test_deploy_best_candidate(sagemaker_session, cpu_instance_type): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) best_candidate = auto_ml.best_candidate(job_name=AUTO_ML_JOB_NAME) endpoint_name = unique_name_from_base("sagemaker-auto-ml-best-candidate-test") with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): auto_ml.deploy( candidate=best_candidate, initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, endpoint_name=endpoint_name, ) endpoint_status = sagemaker_session.sagemaker_client.describe_endpoint( EndpointName=endpoint_name )["EndpointStatus"] assert endpoint_status == "InService" sagemaker_session.sagemaker_client.delete_endpoint(EndpointName=endpoint_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_create_model_best_candidate(sagemaker_session, cpu_instance_type): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML.attach(auto_ml_job_name=AUTO_ML_JOB_NAME, sagemaker_session=sagemaker_session) best_candidate = auto_ml.best_candidate() with timeout(minutes=5): pipeline_model = auto_ml.create_model( name=DEFAULT_MODEL_NAME, candidate=best_candidate, sagemaker_session=sagemaker_session, vpc_config=None, enable_network_isolation=False, model_kms_key=None, predictor_cls=None, ) inputs = sagemaker_session.upload_data( path=TRANSFORM_DATA, key_prefix=PREFIX + "/transform_input" ) pipeline_model.transformer( instance_count=1, instance_type=cpu_instance_type, assemble_with="Line", output_path="s3://{}/{}".format(sagemaker_session.default_bucket(), "transform_test"), accept="text/csv", ).transform(data=inputs, content_type="text/csv", split_type="Line", join_source="Input") @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_candidate_estimator_default_rerun_and_deploy(sagemaker_session, cpu_instance_type): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) candidates = auto_ml.list_candidates(job_name=AUTO_ML_JOB_NAME) candidate = candidates[1] candidate_estimator = CandidateEstimator(candidate, sagemaker_session) inputs = sagemaker_session.upload_data(path=TEST_DATA, key_prefix=PREFIX + "/input") endpoint_name = unique_name_from_base("sagemaker-auto-ml-rerun-candidate-test") with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): candidate_estimator.fit(inputs) auto_ml.deploy( initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, candidate=candidate, endpoint_name=endpoint_name, ) endpoint_status = sagemaker_session.sagemaker_client.describe_endpoint( EndpointName=endpoint_name )["EndpointStatus"] assert endpoint_status == "InService" sagemaker_session.sagemaker_client.delete_endpoint(EndpointName=endpoint_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_candidate_estimator_rerun_with_optional_args(sagemaker_session, cpu_instance_type): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) candidates = auto_ml.list_candidates(job_name=AUTO_ML_JOB_NAME) candidate = candidates[1] candidate_estimator = CandidateEstimator(candidate, sagemaker_session) inputs = sagemaker_session.upload_data(path=TEST_DATA, key_prefix=PREFIX + "/input") endpoint_name = unique_name_from_base("sagemaker-auto-ml-rerun-candidate-test") with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES): candidate_estimator.fit(inputs, encrypt_inter_container_traffic=True) auto_ml.deploy( initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, candidate=candidate, endpoint_name=endpoint_name, ) endpoint_status = sagemaker_session.sagemaker_client.describe_endpoint( EndpointName=endpoint_name )["EndpointStatus"] assert endpoint_status == "InService" sagemaker_session.sagemaker_client.delete_endpoint(EndpointName=endpoint_name) @pytest.mark.skipif( tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS, reason="AutoML is not supported in the region yet.", ) def test_candidate_estimator_get_steps(sagemaker_session): auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session) auto_ml = AutoML( role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session ) candidates = auto_ml.list_candidates(job_name=AUTO_ML_JOB_NAME) candidate = candidates[1] candidate_estimator = CandidateEstimator(candidate, sagemaker_session) steps = candidate_estimator.get_steps() assert len(steps) == 3
38.866834
107
0.739156
[ "Apache-2.0" ]
AWS-Bassem/sagemaker-python-sdk
tests/integ/test_auto_ml.py
15,469
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import torch import torch.nn as nn import torch.nn.functional as F from lib.models.decode import mot_decode from lib.models.losses import FocalLoss from lib.models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss from lib.models.utils import _sigmoid, _tranpose_and_gather_feat from lib.utils.post_process import ctdet_post_process from .base_trainer import BaseTrainer # 损失函数的定义 class MotLoss(torch.nn.Module): def __init__(self, opt): super(MotLoss, self).__init__() self.crit = torch.nn.MSELoss() if opt.mse_loss else FocalLoss() self.crit_reg = RegL1Loss() if opt.reg_loss == 'l1' else \ RegLoss() if opt.reg_loss == 'sl1' else None # L1 loss or smooth l1 loss self.crit_wh = torch.nn.L1Loss(reduction='sum') if opt.dense_wh else \ NormRegL1Loss() if opt.norm_wh else \ RegWeightedL1Loss() if opt.cat_spec_wh else self.crit_reg # box size loss self.opt = opt self.emb_dim = opt.reid_dim self.nID = opt.nID # 唯一包含可学习参数的层: 用于Re-ID的全连接层 self.classifier = nn.Linear(self.emb_dim, self.nID) # 不同的track id分类最后一层FC:将特征转换到概率得分 self.IDLoss = nn.CrossEntropyLoss(ignore_index=-1) # 不同的track id分类用交叉熵损失 # self.TriLoss = TripletLoss() self.emb_scale = math.sqrt(2) * math.log(self.nID - 1) self.s_det = nn.Parameter(-1.85 * torch.ones(1)) # 检测的损失缩放系数 self.s_id = nn.Parameter(-1.05 * torch.ones(1)) # track id分类的损失缩放系数 def forward(self, outputs, batch): """ :param outputs: :param batch: :return: """ opt = self.opt hm_loss, wh_loss, off_loss, id_loss = 0.0, 0.0, 0.0, 0.0 # 初始化4个loss为0 for s in range(opt.num_stacks): output = outputs[s] if not opt.mse_loss: output['hm'] = _sigmoid(output['hm']) # 计算heatmap loss hm_loss += self.crit(output['hm'], batch['hm']) / opt.num_stacks if opt.wh_weight > 0: if opt.dense_wh: mask_weight = batch['dense_wh_mask'].sum() + 1e-4 wh_loss += (self.crit_wh(output['wh'] * batch['dense_wh_mask'], batch['dense_wh'] * batch['dense_wh_mask']) / mask_weight) / opt.num_stacks else: # 计算box尺寸的L1/Smooth L1 loss wh_loss += self.crit_reg( output['wh'], batch['reg_mask'], batch['ind'], batch['wh']) / opt.num_stacks if opt.reg_offset and opt.off_weight > 0: # 计算box中心坐标偏移的L1 loss off_loss += self.crit_reg(output['reg'], batch['reg_mask'], batch['ind'], batch['reg']) / opt.num_stacks # 检测目标id分类的交叉熵损失 if opt.id_weight > 0: id_head = _tranpose_and_gather_feat(output['id'], batch['ind']) id_head = id_head[batch['reg_mask'] > 0].contiguous() # 只有有目标的像素才计算id loss id_head = self.emb_scale * F.normalize(id_head) id_target = batch['ids'][batch['reg_mask'] > 0] # 有目标的track id id_output = self.classifier.forward(id_head).contiguous() # 用于检测目标分类的最后一层是FC? id_loss += self.IDLoss(id_output, id_target) # id_loss += self.IDLoss(id_output, id_target) + self.TriLoss(id_head, id_target) # loss = opt.hm_weight * hm_loss + opt.wh_weight * wh_loss + opt.off_weight * off_loss + opt.id_weight * id_loss det_loss = opt.hm_weight * hm_loss \ + opt.wh_weight * wh_loss \ + opt.off_weight * off_loss loss = torch.exp(-self.s_det) * det_loss \ + torch.exp(-self.s_id) * id_loss \ + (self.s_det + self.s_id) loss *= 0.5 # print(loss, hm_loss, wh_loss, off_loss, id_loss) loss_stats = {'loss': loss, 'hm_loss': hm_loss, 'wh_loss': wh_loss, 'off_loss': off_loss, 'id_loss': id_loss} return loss, loss_stats # 核心训练类 class MotTrainer(BaseTrainer): def __init__(self, opt, model, optimizer=None): super(MotTrainer, self).__init__(opt, model, optimizer=optimizer) def _get_losses(self, opt): loss_states = ['loss', 'hm_loss', 'wh_loss', 'off_loss', 'id_loss'] loss = MotLoss(opt) return loss_states, loss def save_result(self, output, batch, results): reg = output['reg'] if self.opt.reg_offset else None dets = mot_decode( output['hm'], output['wh'], reg=reg, cat_spec_wh=self.opt.cat_spec_wh, K=self.opt.K) dets = dets.detach().cpu().numpy().reshape(1, -1, dets.shape[2]) dets_out = ctdet_post_process( dets.copy(), batch['meta']['c'].cpu().numpy(), batch['meta']['s'].cpu().numpy(), output['hm'].shape[2], output['hm'].shape[3], output['hm'].shape[1]) results[batch['meta']['img_id'].cpu().numpy()[0]] = dets_out[0]
42.483871
120
0.579157
[ "MIT" ]
CaptainEven/FairMOTVehicle
src/lib/trains/mot.py
5,548
Python
from typing import Any, Dict, List import pandas from dagster import AssetKey, AssetMaterialization, EventMetadataEntry from dagster_dbt import DbtOutput from .snowflake_io_manager import connect_snowflake class DbtAssetResource: """ This class defines a resource that is capable of producing a list of AssetMaterializations from a DbtOutput. It has one public function, get_asset_materializations(), which finds all the generated models in the dbt output and produces corresponding asset materializations. Putting this logic in a resource makes it easier to swap out between modes. You probably want your local testing / development pipelines to produce different assets than your production pipelines, as they will ideally be writing to different tables (with different dbt profiles). """ def __init__(self, asset_key_prefix: List[str]): self._asset_key_prefix = asset_key_prefix def _get_metadata(self, result: Dict[str, Any]) -> List[EventMetadataEntry]: return [ EventMetadataEntry.float( value=result["execution_time"], label="Execution Time (seconds)" ) ] def get_asset_materializations(self, dbt_output: DbtOutput) -> List[AssetMaterialization]: ret = [] # dbt_output.result contains the parsed contents of the results.json file # Note that the json schema can change from version to version. This is written for # https://schemas.getdbt.com/dbt/run-results/v2.json (also will work with v1.json) for result in dbt_output.result["results"]: if result["status"] != "success": continue unique_id = result["unique_id"] # Here, we choose a naming scheme for our asset keys that will look something like # <asset prefix> / model / <dbt project> / <model name>, but this is pretty arbitrary asset_key = AssetKey(self._asset_key_prefix + unique_id.split(".")) # create an AssetMaterialization with our key and metadata ret.append( AssetMaterialization( description=f"dbt node: {unique_id}", metadata_entries=self._get_metadata(result), asset_key=asset_key, ) ) return ret class SnowflakeQueryDbtAssetResource(DbtAssetResource): """ This resource allows us to add in some extra information to these AssetMaterialization events. Because the relevant dbt project is configured for a Snowflake cluster, we can query the output models to get some additional information that we might want Dagster to track over time. Of course, this is completely optional. """ def __init__(self, snowflake_config: Dict[str, str], dbt_schema: str): self._snowflake_config = snowflake_config self._dbt_schema = dbt_schema super().__init__(asset_key_prefix=["snowflake", dbt_schema]) def _get_metadata(self, result: Dict[str, Any]) -> List[EventMetadataEntry]: """ Here, we run queries against our output Snowflake database tables to add additional context to our asset materializations. """ table_name = result["unique_id"].split(".")[-1] with connect_snowflake(config=self._snowflake_config, schema=self._dbt_schema) as con: n_rows = pandas.read_sql_query(f"SELECT COUNT(*) FROM {table_name}", con) sample_rows = pandas.read_sql_query( f"SELECT * FROM {table_name} SAMPLE ROW (10 rows)", con ) return super()._get_metadata(result) + [ EventMetadataEntry.int(int(n_rows.iloc[0][0]), "dbt Model Number of Rows"), EventMetadataEntry.md(sample_rows.astype("str").to_markdown(), "dbt Model Sample Rows"), ]
43.795455
100
0.674364
[ "Apache-2.0" ]
AndreaGiardini/dagster
examples/hacker_news/hacker_news/resources/dbt_asset_resource.py
3,854
Python
# *************************************************************************************** # *************************************************************************************** # # Name : importcode.py # Author : Paul Robson ([email protected]) # Date : 12th March 2019. # Purpose : Import code into buffer area # # *************************************************************************************** # *************************************************************************************** import sys from imagelib import * # # Initialise and get info # image = BinaryImage() bufferInfo = image.sourcePages() firstSourcePage = bufferInfo[0] sourcePageCount = bufferInfo[1] pageSize = image.getBufferSize() # # Clear all buffers # for p in range(firstSourcePage,firstSourcePage+sourcePageCount*2,2): for a in range(0xC000,0x10000,pageSize): image.write(p,a,0x80) image.write(p,a+pageSize-1,0x00) print("Found and erased {0} buffers for import ${1:02x}-${2:02x}.". \ format(int(sourcePageCount*16384/pageSize),firstSourcePage,firstSourcePage+sourcePageCount*2-2)) # # Info on first buffer # currentPageNumber = firstSourcePage currentPageAddress = 0xC000 currentBasePageAddress = 0xC000 bytesRemaining = pageSize count = 1 # # Work through all the source # for f in sys.argv[1:]: src = [x if x.find("//") < 0 else x[:x.find("//")] for x in open(f).readlines()] src = " ".join([x.replace("\t"," ").replace("\n"," ") for x in src]) src = [x for x in src.split(" ") if x != ""] for word in src: # # For each word, look at it to see if it has a tag. Default is compilation. # tag = 0x40 # Green (compile) $40 if word[0] == ":": # Red (define) $00 tag = 0x00 word = word[1:] elif word[0] == "[" and word[-1] == "]": # Yellow (execute) $80 tag = 0x80 word = word[1:-1] # # Make the final word and check it fits. # assert len(word) < 32,"Word too long "+word if len(word) + 4 >= bytesRemaining: # it doesn't fit. image.write(currentPageNumber,currentPageAddress,0x80) currentPageAddress = (currentBasePageAddress + pageSize) & 0xFFFF if currentPageAddress == 0: currentPageNumber += 1 currentPageAddress = 0xC000 currentBasePageAddress = currentPageAddress count += 1 bytesRemaining = pageSize # #print("\t\t{0:02x} {1:16} ${2:02x}:${3:04x} {4}".format(tag,word,currentPageNumber,currentPageAddress,bytesRemaining)) # # Store the word # image.write(currentPageNumber,currentPageAddress,tag+len(word)) currentPageAddress += 1 for c in word: image.write(currentPageNumber,currentPageAddress,ord(c)) currentPageAddress += 1 bytesRemaining = bytesRemaining - 1 - len(word) # # Add a trailing $80 in case it is the last. # image.write(currentPageNumber,currentPageAddress,0x80) print("\tImported file '{0}'.".format(f)) # # and write out # image.save() print("Filled {0} buffers.".format(count))
31.956522
121
0.591837
[ "MIT" ]
paulscottrobson/flat
scripts/importcode.py
2,940
Python
# -*- coding: utf-8 -*- import os from O365 import Account, Connection, FileSystemTokenBackend from datetime import datetime as dt from datetime import timedelta from conf.conf import CONFIG as conf from fritzhome import FritzBox import logging class Core: @staticmethod def get_credentials(): return conf['OFFICE_CLIENT_ID'], conf['OFFICE_CLIENT_SECRET'] @staticmethod def get_account(): return Account(credentials=Core.get_credentials()) @staticmethod def get_scopes(): return ['offline_access', 'https://graph.microsoft.com/Mail.ReadWrite', 'https://graph.microsoft.com/Mail.Send', 'https://graph.microsoft.com/Calendars.Read', 'https://graph.microsoft.com/Files.ReadWrite', 'https://graph.microsoft.com/User.Read'] @staticmethod def get_con_obj(): credentials = (conf['OFFICE_CLIENT_ID'], conf['OFFICE_CLIENT_SECRET']) scopes = Core.get_scopes() return Connection(credentials, scopes=scopes, token_backend=FileSystemTokenBackend(token_filename='o365_token.txt')) def run(self): con = Core.get_con_obj() if not con.token_backend.check_token(): logging.error("You have to generate your token file with python -m radiator_fritz_o365_sync.gen_token first!") exit(1) con.refresh_token() heating = self.query_for_heating_periods() # Cool down if no heating entries found in calendar if len(heating) == 0: logging.debug('No heating entry in calendar found. Cooling down all thermostats if they are heating. ') self.cool_down_all() # For each heating entry in calendar heat up subjects = [] for heat in heating: logging.info('Found entry "%s"', heat.subject) self.heat_up(heat.subject) subjects.append(heat.subject) # Cool down thermostats if they are not heated self.cool_down_unless(subjects) # auto reset if len(heating) == 0: self.auto_reset() # Every night refresh the token and cool down to reset manual changes on thermostats if dt.now().time().strftime('%H:%M') == '00:00': con.refresh_token() """ Gets all thermostats from fritzbox """ def get_thermostats(self): if conf['FRITZ_TLS']: fritzbox = FritzBox(conf['FRITZ_IP'], conf['FRITZ_USER'], conf['FRITZ_PW'], use_tls=conf['FRITZ_TLS'], tls_cert_path='conf/fritz.crt') else: fritzbox = FritzBox(conf['FRITZ_IP'], conf['FRITZ_USER'], conf['FRITZ_PW']) fritzbox.login() actors = fritzbox.get_actors() thermostats = [] for actor in actors: if actor.has_heating_controller: thermostats.append(actor) return thermostats def thermostat_heatup(self, actor): if actor.target_temperature == conf['HEATING_LOW_TEMP']: logging.info('Heating up %s ...', actor.name) actor.set_temperature(conf['HEATING_COMFORT_TEMP']) """ Sets the temperature of thermostats with matching subject or all thermostats to comfort temperature """ def heat_up(self, sub): thermostats = self.get_thermostats() for thermostat in thermostats: if sub == conf['CALENDAR_HEAT_ALL_SUBJECT']: self.thermostat_heatup(thermostat) else: if thermostat.name == sub: self.thermostat_heatup(thermostat) """ Cool down every thermostat which is not in unless list """ def cool_down_unless(self, unless): # return if wildcard is found in subjects if conf['CALENDAR_HEAT_ALL_SUBJECT'] in unless: return thermostats = self.get_thermostats() for thermostat in thermostats: if thermostat.name not in unless: self.cool_down(thermostat) """ Sets the temperature of all thermostats to LOW_TEMP if they are currently set to COMFORT_TEMP """ def cool_down_all(self): thermostats = self.get_thermostats() for thermostat in thermostats: self.cool_down(thermostat) """ Sets the temperature of thermostat to low temp if it is on comfort temp """ def cool_down(self, thermostat): if thermostat.target_temperature == conf['HEATING_COMFORT_TEMP']: logging.info('Cooling down %s ...', thermostat.name) thermostat.set_temperature(conf['HEATING_LOW_TEMP']) """ If the temperature has changed manually via app or on the thermostat itself, this method resets the temperature to the HEATING_LOW_TEMP on a given time """ def auto_reset(self): if conf['HEATING_AUTO_RESET']: current_time = dt.now().time() target_time = conf['HEATING_AUTO_RESET_TIME'] if current_time.strftime('%H:%M') == target_time: logging.info('Resetting temperature on all thermostats now!') thermostats = self.get_thermostats() for thermostat in thermostats: thermostat.set_temperature(conf['HEATING_LOW_TEMP']) def query_for_heating_periods(self): account = Core.get_account() schedule = account.schedule() calendar = schedule.get_calendar(calendar_name=conf['CALENDAR_NAME']) if calendar is None: logging.error("Calendar with name '%s' does not exist!", conf['CALENDAR_NAME']) exit(1) q = calendar.new_query('start').greater_equal(dt.now()) q.chain('and').on_attribute('end').less_equal(dt.now() + timedelta(minutes=5)) return list(calendar.get_events(query=q)) if __name__ == "__main__": Core().run()
35.658537
146
0.632695
[ "Apache-2.0" ]
ykorzikowski/python-fritz-office-365-sync
radiator_fritz_o365_sync/core.py
5,848
Python
from wagtailstreamforms.models import Form def get_form_instance_from_request(request): """ Get the form class from the request. """ form_id = request.POST.get("form_id") if form_id and form_id.isdigit(): try: return Form.objects.get(pk=int(form_id)) except Form.DoesNotExist: pass return None
25.214286
52
0.657224
[ "MIT" ]
AsankaL/wagtailstreamforms
wagtailstreamforms/utils/requests.py
353
Python
# define BipIdb and some helper functions for easier scripting (at the end). import ida_kernwin import idaapi import idc class BipIdb(object): """ Class for representing the idb loaded by IDA, this has the goal to provide access to things specific to the IDB. Currently this contain only static methods. """ @staticmethod def ptr_size(): """ Return the number of bits in a pointer. :rtype: int """ info = idaapi.get_inf_structure() if info.is_64bit(): bits = 64 elif info.is_32bit(): bits = 32 else: bits = 16 return bits @staticmethod def min_ea(): """ Return the lowest mapped address of the IDB. """ return idc.get_inf_attr(idc.INF_MIN_EA) @staticmethod def max_ea(): """ Return the highest mapped address of the IDB. """ return idc.get_inf_attr(idc.INF_MAX_EA) @staticmethod def image_base(): """ Return the base address of the image loaded in the IDB. This is different from :meth:`~BipIdb.min_ea` which is the lowest *mapped* address. """ return idaapi.get_imagebase() @staticmethod def current_addr(): """ Return current screen address. :return: The current address selected. """ return ida_kernwin.get_screen_ea() @staticmethod def relea(addr): """ Calculate the relative address compare to the IDA image base. The calcul done is ``ADDR - IMGBASE``. The opposite of this function is :func:`absea`. :param int addr: The absolute address to translate. :return: The offset from image base corresponding to ``addr``. :rtype: int """ return addr-idaapi.get_imagebase() @staticmethod def absea(offset): """ Calculate the absolute address from an offset of the image base. The calcul done is ``OFFSET + IMGBASE`` . The opposite of this function is :func:`relea`. :param int offset: The offset from the beginning of the image base to translate. :return: The absolute address corresponding to the offset. :rtype: int """ return offset+idaapi.get_imagebase() def min_ea(): """ Return the lowest mapped address of the IDB. Wrapper on :meth:`BipIdb.min_ea`. """ return BipIdb.min_ea() def max_ea(): """ Return the highest mapped address of the IDB. Wrapper on :meth:`BipIdb.max_ea`. """ return BipIdb.max_ea() def Here(): """ Return current screen address. :return: The current address. """ return BipIdb.current_addr()
24.791667
78
0.558319
[ "BSD-3-Clause" ]
BrunoPujos/bip
bip/base/bipidb.py
2,975
Python
from hog_cpp.fhog import fhog import numpy as np ''' https://github.com/lawpdas/fhog-python ''' def get_hog(img): M = np.zeros(img.shape[:2], dtype='float32') O = np.zeros(img.shape[:2], dtype='float32') H = np.zeros([img.shape[0] // 4, img.shape[1] // 4, 32], dtype='float32') # python3 fhog.gradientMag(img.astype(np.float32), M, O) fhog.gradientHist(M, O, H) H = H[:, :, :31] return H ''' if __name__ == "__main__": img_path = 'D:/DATASET/OTB100/Basketball/img/0001.jpg' img = cv2.imread(img_path) sub = img[0:40, 0:40] H = get_hog(sub) print(H) '''
21
88
0.599343
[ "MIT" ]
ElnuraMusaoglu/KernelizedCorrelationFilter
hog_cpp/fhog/get_hog.py
609
Python
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. # # Modifications copyright (c) 2021 DocYard Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from collections import OrderedDict import torch from torch import nn from torch.nn import functional as F from .self_attention import WrapEncoder, WrapEncoderForFeature gradient_clip = 10 from functools import partial class PVAM(nn.Module): def __init__( self, in_channels, char_num, max_text_length, num_heads, num_encoder_tus, hidden_dims, ): super(PVAM, self).__init__() self.char_num = char_num self.max_length = max_text_length self.num_heads = num_heads self.num_encoder_TUs = num_encoder_tus self.hidden_dims = hidden_dims # Transformer encoder t = 256 self.wrap_encoder_for_feature = WrapEncoderForFeature( src_vocab_size=1, max_length=t, n_layer=self.num_encoder_TUs, n_head=self.num_heads, d_key=int(self.hidden_dims / self.num_heads), d_value=int(self.hidden_dims / self.num_heads), d_model=self.hidden_dims, d_inner_hid=self.hidden_dims, prepostprocess_dropout=0.1, attention_dropout=0.1, relu_dropout=0.1, preprocess_cmd="n", postprocess_cmd="da", weight_sharing=True, ) # PVAM self.flatten0 = nn.Flatten(start_dim=0, end_dim=1) self.fc0 = nn.Linear( in_features=in_channels, out_features=in_channels, ) self.emb = nn.Embedding( num_embeddings=self.max_length, embedding_dim=in_channels ) self.flatten1 = nn.Flatten(start_dim=0, end_dim=2) self.fc1 = nn.Linear( in_features=in_channels, out_features=1, bias=False ) def forward(self, inputs, encoder_word_pos, gsrm_word_pos): b, c, h, w = inputs.shape conv_features = torch.reshape(inputs, shape=(-1, c, h * w)) conv_features = conv_features.permute(0, 2, 1) # transformer encoder b, t, c = conv_features.shape enc_inputs = [conv_features, encoder_word_pos, None] word_features = self.wrap_encoder_for_feature(enc_inputs) # pvam b, t, c = word_features.shape word_features = self.fc0(word_features) word_features_ = torch.reshape(word_features, (-1, 1, t, c)) word_features_ = torch.tile(word_features_, (1, self.max_length, 1, 1)) word_pos_feature = self.emb(gsrm_word_pos) word_pos_feature_ = torch.reshape( word_pos_feature, (-1, self.max_length, 1, c) ) word_pos_feature_ = torch.tile(word_pos_feature_, (1, 1, t, 1)) y = word_pos_feature_ + word_features_ y = F.tanh(y) attention_weight = self.fc1(y) attention_weight = torch.reshape( attention_weight, shape=(-1, self.max_length, t) ) attention_weight = F.softmax(attention_weight, dim=-1) pvam_features = torch.bmm( attention_weight, word_features ) # [b, max_length, c] return pvam_features class GSRM(nn.Module): def __init__( self, in_channels, char_num, max_text_length, num_heads, num_encoder_tus, num_decoder_tus, hidden_dims, ): super(GSRM, self).__init__() self.char_num = char_num self.max_length = max_text_length self.num_heads = num_heads self.num_encoder_TUs = num_encoder_tus self.num_decoder_TUs = num_decoder_tus self.hidden_dims = hidden_dims self.fc0 = nn.Linear( in_features=in_channels, out_features=self.char_num ) self.wrap_encoder0 = WrapEncoder( src_vocab_size=self.char_num + 1, max_length=self.max_length, n_layer=self.num_decoder_TUs, n_head=self.num_heads, d_key=int(self.hidden_dims / self.num_heads), d_value=int(self.hidden_dims / self.num_heads), d_model=self.hidden_dims, d_inner_hid=self.hidden_dims, prepostprocess_dropout=0.1, attention_dropout=0.1, relu_dropout=0.1, preprocess_cmd="n", postprocess_cmd="da", weight_sharing=True, ) self.wrap_encoder1 = WrapEncoder( src_vocab_size=self.char_num + 1, max_length=self.max_length, n_layer=self.num_decoder_TUs, n_head=self.num_heads, d_key=int(self.hidden_dims / self.num_heads), d_value=int(self.hidden_dims / self.num_heads), d_model=self.hidden_dims, d_inner_hid=self.hidden_dims, prepostprocess_dropout=0.1, attention_dropout=0.1, relu_dropout=0.1, preprocess_cmd="n", postprocess_cmd="da", weight_sharing=True, ) # self.mul = lambda x: torch.matmul(x, # (self.wrap_encoder0.prepare_decoder.emb0.weightk).transpose(-2, -1)) # ! This is an error here, weightk is wrong correct it by visualizing torch model_dict self.mul = partial( self.f, self.wrap_encoder0.prepare_decoder.emb0.weight ) @staticmethod def f(w, x): return torch.matmul(x, w.transpose(-2, -1)) def forward( self, inputs, gsrm_word_pos, gsrm_slf_attn_bias1, gsrm_slf_attn_bias2 ): # ===== GSRM Visual-to-semantic embedding block ===== b, t, c = inputs.shape pvam_features = torch.reshape(inputs, (-1, c)) word_out = self.fc0(pvam_features) word_ids = torch.argmax(F.softmax(word_out), dim=1) word_ids = torch.reshape(word_ids, shape=(-1, t, 1)) # ===== GSRM Semantic reasoning block ===== """ This module is achieved through bi-transformers, ngram_feature1 is the froward one, ngram_fetaure2 is the backward one """ pad_idx = self.char_num word1 = word_ids.float() pad1 = nn.ConstantPad1d((1, 0), value=1.0 * pad_idx) word1 = pad1(word1.permute(0, 2, 1)).permute(0, 2, 1) word1 = word1.long() word1 = word1[:, :-1, :] word2 = word_ids enc_inputs_1 = [word1, gsrm_word_pos, gsrm_slf_attn_bias1] enc_inputs_2 = [word2, gsrm_word_pos, gsrm_slf_attn_bias2] gsrm_feature1 = self.wrap_encoder0(enc_inputs_1) gsrm_feature2 = self.wrap_encoder1(enc_inputs_2) pad = nn.ConstantPad1d((0, 1), value=0.0) gsrm_feature2 = pad(gsrm_feature2.permute(0, 2, 1)).permute(0, 2, 1) gsrm_feature2 = gsrm_feature2[ :, 1:, ] gsrm_features = gsrm_feature1 + gsrm_feature2 gsrm_out = self.mul(gsrm_features) b, t, c = gsrm_out.shape gsrm_out = torch.reshape(gsrm_out, (-1, c)) return gsrm_features, word_out, gsrm_out class VSFD(nn.Module): def __init__(self, in_channels=512, pvam_ch=512, char_num=38): super(VSFD, self).__init__() self.char_num = char_num self.fc0 = nn.Linear(in_features=in_channels * 2, out_features=pvam_ch) self.fc1 = nn.Linear(in_features=pvam_ch, out_features=self.char_num) def forward(self, pvam_feature, gsrm_feature): b, t, c1 = pvam_feature.shape b, t, c2 = gsrm_feature.shape combine_feature_ = torch.cat([pvam_feature, gsrm_feature], dim=2) img_comb_feature_ = torch.reshape( combine_feature_, shape=(-1, c1 + c2) ) img_comb_feature_map = self.fc0(img_comb_feature_) img_comb_feature_map = torch.sigmoid(img_comb_feature_map) img_comb_feature_map = torch.reshape( img_comb_feature_map, shape=(-1, t, c1) ) combine_feature = ( img_comb_feature_map * pvam_feature + (1.0 - img_comb_feature_map) * gsrm_feature ) img_comb_feature = torch.reshape(combine_feature, shape=(-1, c1)) out = self.fc1(img_comb_feature) return out class SRNHead(nn.Module): def __init__( self, in_channels, out_channels, max_text_length, num_heads, num_encoder_TUs, num_decoder_TUs, hidden_dims, **kwargs ): super(SRNHead, self).__init__() self.char_num = out_channels self.max_length = max_text_length self.num_heads = num_heads self.num_encoder_TUs = num_encoder_TUs self.num_decoder_TUs = num_decoder_TUs self.hidden_dims = hidden_dims self.pvam = PVAM( in_channels=in_channels, char_num=self.char_num, max_text_length=self.max_length, num_heads=self.num_heads, num_encoder_tus=self.num_encoder_TUs, hidden_dims=self.hidden_dims, ) self.gsrm = GSRM( in_channels=in_channels, char_num=self.char_num, max_text_length=self.max_length, num_heads=self.num_heads, num_encoder_tus=self.num_encoder_TUs, num_decoder_tus=self.num_decoder_TUs, hidden_dims=self.hidden_dims, ) self.vsfd = VSFD(in_channels=in_channels, char_num=self.char_num) self.gsrm.wrap_encoder1.prepare_decoder.emb0 = ( self.gsrm.wrap_encoder0.prepare_decoder.emb0 ) def forward(self, inputs, others): encoder_word_pos = others[0] gsrm_word_pos = others[1] gsrm_slf_attn_bias1 = others[2] gsrm_slf_attn_bias2 = others[3] pvam_feature = self.pvam(inputs, encoder_word_pos, gsrm_word_pos) gsrm_feature, word_out, gsrm_out = self.gsrm( pvam_feature, gsrm_word_pos, gsrm_slf_attn_bias1, gsrm_slf_attn_bias2, ) final_out = self.vsfd(pvam_feature, gsrm_feature) if not self.training: final_out = F.softmax(final_out, dim=1) _, decoded_out = torch.topk(final_out, k=1) predicts = OrderedDict( [ ("predict", final_out), ("pvam_feature", pvam_feature), ("decoded_out", decoded_out), ("word_out", word_out), ("gsrm_out", gsrm_out), ] ) return predicts
33.620482
201
0.613241
[ "Apache-2.0" ]
DocYard-ai/UCR
ucr/core/architecture/head/rec_srn_head.py
11,162
Python
classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: Apache Software License', 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: C', 'Programming Language :: C++', 'Programming Language :: Fortran', 'Topic :: Scientific/Engineering :: Astronomy', ] def main(): for i in classifiers: print(i) if __name__ == "__main__": main()
30.04
57
0.624501
[ "Apache-2.0" ]
GFTwrt/amuse
support/classifiers.py
751
Python
import torch import torch.nn as nn from model.modules.stage_backbone import StageBackbone from model.modules.feature_pyramid_net import FeaturePyramidNet from model.modules.polar_head import PolarHead class PolarInst(nn.Module): def __init__(self, num_polars, num_channels, num_classes): super(PolarInst, self).__init__() self.num_classes = num_classes self.backbone = StageBackbone() self.fpn = FeaturePyramidNet(num_channels) self.polar_head = PolarHead(num_polars, num_channels, num_classes) self.distance_scales = [nn.Parameter(torch.tensor(1., dtype=torch.float)) for _ in range(5)] def forward(self, x): batch_size = x.size(0) backbone_outs = self.backbone(x) fpn_outs = self.fpn(backbone_outs['c3'], backbone_outs['c4'], backbone_outs['c5']) class_pred, distance_pred, centerness_pred = [], [], [] for idx, (distance_scale, fpn_out) in enumerate(zip(self.distance_scales, fpn_outs.values())): head_out = self.polar_head(fpn_out) head_out['distance'] *= distance_scale head_out['distance'] = head_out['distance'].exp() class_pred.append(head_out['cls'].permute(0, 2, 3, 1).reshape(batch_size, -1, self.num_classes)) distance_pred.append(head_out['distance'].permute(0, 2, 3, 1).reshape(batch_size, -1, 4)) centerness_pred.append(head_out['centerness'].permute(0, 2, 3, 1).reshape(batch_size, -1)) class_pred = torch.cat(class_pred, dim=1) distance_pred = torch.cat(distance_pred, dim=1) centerness_pred = torch.cat(centerness_pred, dim=1) return class_pred, distance_pred, centerness_pred
39.72093
108
0.683255
[ "Apache-2.0" ]
Tenvence/polar-inst
model/polar_inst.py
1,708
Python
# coding: utf-8 """ FINBOURNE Insights API FINBOURNE Technology # noqa: E501 The version of the OpenAPI document: 0.0.238 Contact: [email protected] Generated by: https://openapi-generator.tech """ try: from inspect import getfullargspec except ImportError: from inspect import getargspec as getfullargspec import pprint import re # noqa: F401 import six from finbourne_insights.configuration import Configuration class AuditProcess(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. required_map (dict): The key is attribute name and the value is whether it is 'required' or 'optional'. """ openapi_types = { 'name': 'str', 'run_id': 'str', 'start_time': 'datetime', 'end_time': 'datetime', 'succeeded': 'bool' } attribute_map = { 'name': 'name', 'run_id': 'runId', 'start_time': 'startTime', 'end_time': 'endTime', 'succeeded': 'succeeded' } required_map = { 'name': 'required', 'run_id': 'required', 'start_time': 'required', 'end_time': 'optional', 'succeeded': 'optional' } def __init__(self, name=None, run_id=None, start_time=None, end_time=None, succeeded=None, local_vars_configuration=None): # noqa: E501 """AuditProcess - a model defined in OpenAPI" :param name: (required) :type name: str :param run_id: (required) :type run_id: str :param start_time: (required) :type start_time: datetime :param end_time: :type end_time: datetime :param succeeded: :type succeeded: bool """ # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration self._name = None self._run_id = None self._start_time = None self._end_time = None self._succeeded = None self.discriminator = None self.name = name self.run_id = run_id self.start_time = start_time self.end_time = end_time self.succeeded = succeeded @property def name(self): """Gets the name of this AuditProcess. # noqa: E501 :return: The name of this AuditProcess. # noqa: E501 :rtype: str """ return self._name @name.setter def name(self, name): """Sets the name of this AuditProcess. :param name: The name of this AuditProcess. # noqa: E501 :type name: str """ if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and name is not None and len(name) > 128): raise ValueError("Invalid value for `name`, length must be less than or equal to `128`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and name is not None and len(name) < 0): raise ValueError("Invalid value for `name`, length must be greater than or equal to `0`") # noqa: E501 self._name = name @property def run_id(self): """Gets the run_id of this AuditProcess. # noqa: E501 :return: The run_id of this AuditProcess. # noqa: E501 :rtype: str """ return self._run_id @run_id.setter def run_id(self, run_id): """Sets the run_id of this AuditProcess. :param run_id: The run_id of this AuditProcess. # noqa: E501 :type run_id: str """ if self.local_vars_configuration.client_side_validation and run_id is None: # noqa: E501 raise ValueError("Invalid value for `run_id`, must not be `None`") # noqa: E501 self._run_id = run_id @property def start_time(self): """Gets the start_time of this AuditProcess. # noqa: E501 :return: The start_time of this AuditProcess. # noqa: E501 :rtype: datetime """ return self._start_time @start_time.setter def start_time(self, start_time): """Sets the start_time of this AuditProcess. :param start_time: The start_time of this AuditProcess. # noqa: E501 :type start_time: datetime """ if self.local_vars_configuration.client_side_validation and start_time is None: # noqa: E501 raise ValueError("Invalid value for `start_time`, must not be `None`") # noqa: E501 self._start_time = start_time @property def end_time(self): """Gets the end_time of this AuditProcess. # noqa: E501 :return: The end_time of this AuditProcess. # noqa: E501 :rtype: datetime """ return self._end_time @end_time.setter def end_time(self, end_time): """Sets the end_time of this AuditProcess. :param end_time: The end_time of this AuditProcess. # noqa: E501 :type end_time: datetime """ self._end_time = end_time @property def succeeded(self): """Gets the succeeded of this AuditProcess. # noqa: E501 :return: The succeeded of this AuditProcess. # noqa: E501 :rtype: bool """ return self._succeeded @succeeded.setter def succeeded(self, succeeded): """Sets the succeeded of this AuditProcess. :param succeeded: The succeeded of this AuditProcess. # noqa: E501 :type succeeded: bool """ self._succeeded = succeeded def to_dict(self, serialize=False): """Returns the model properties as a dict""" result = {} def convert(x): if hasattr(x, "to_dict"): args = getfullargspec(x.to_dict).args if len(args) == 1: return x.to_dict() else: return x.to_dict(serialize) else: return x for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) attr = self.attribute_map.get(attr, attr) if serialize else attr if isinstance(value, list): result[attr] = list(map( lambda x: convert(x), value )) elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], convert(item[1])), value.items() )) else: result[attr] = convert(value) return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, AuditProcess): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, AuditProcess): return True return self.to_dict() != other.to_dict()
29.277154
140
0.584751
[ "MIT" ]
finbourne/finbourne-insights-sdk-python
sdk/finbourne_insights/models/audit_process.py
7,817
Python
#! /usr/bin/env python # PuLP : Python LP Modeler # Version 1.5.1 # Copyright (c) 2002-2005, Jean-Sebastien Roy ([email protected]) # Modifications Copyright (c) 2007- Stuart Anthony Mitchell ([email protected]) # $Id: pulp.py 1791 2008-04-23 22:54:34Z smit023 $ # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ PuLP is an LP modeler written in python. PuLP can generate MPS or LP files and call GLPK[1], COIN CLP/CBC[2], CPLEX[3], and GUROBI[4] to solve linear problems. See the examples directory for examples. PuLP requires Python >= 2.5. The examples require at least a solver in your PATH or a shared library file. Documentation is found on https://www.coin-or.org/PuLP/. A comprehensive wiki can be found at https://www.coin-or.org/PuLP/ Use LpVariable() to create new variables. To create a variable 0 <= x <= 3 >>> x = LpVariable("x", 0, 3) To create a variable 0 <= y <= 1 >>> y = LpVariable("y", 0, 1) Use LpProblem() to create new problems. Create "myProblem" >>> prob = LpProblem("myProblem", LpMinimize) Combine variables to create expressions and constraints and add them to the problem. >>> prob += x + y <= 2 If you add an expression (not a constraint), it will become the objective. >>> prob += -4*x + y Choose a solver and solve the problem. ex: >>> status = prob.solve(GLPK(msg = 0)) Display the status of the solution >>> LpStatus[status] 'Optimal' You can get the value of the variables using value(). ex: >>> value(x) 2.0 Exported Classes: - LpProblem -- Container class for a Linear programming problem - LpVariable -- Variables that are added to constraints in the LP - LpConstraint -- A constraint of the general form a1x1+a2x2 ...anxn (<=, =, >=) b - LpConstraintVar -- Used to construct a column of the model in column-wise modelling Exported Functions: - value() -- Finds the value of a variable or expression - lpSum() -- given a list of the form [a1*x1, a2x2, ..., anxn] will construct a linear expression to be used as a constraint or variable - lpDot() --given two lists of the form [a1, a2, ..., an] and [ x1, x2, ..., xn] will construct a linear epression to be used as a constraint or variable Comments, bug reports, patches and suggestions are welcome. [email protected] References: [1] http://www.gnu.org/software/glpk/glpk.html [2] http://www.coin-or.org/ [3] http://www.cplex.com/ [4] http://www.gurobi.com/ """ import types import string import itertools from constants import * from solvers import * from types import GeneratorType _DICT_TYPE = dict if sys.platform not in ['cli']: # iron python does not like an OrderedDict try: from odict import OrderedDict _DICT_TYPE = OrderedDict except ImportError: pass try: #python 2.7 or 3.1 from collections import OrderedDict _DICT_TYPE = OrderedDict except ImportError: pass def setConfigInformation(**keywords): """ set the data in the configuration file at the moment will only edit things in [locations] the keyword value pairs come from the keywords dictionary """ #TODO: extend if we ever add another section in the config file #read the old configuration config = ConfigParser.SafeConfigParser() config.read(config_filename) #set the new keys for (key,val) in keywords.items(): config.set("locations",key,val) #write the new configuration fp = open(config_filename,"w") config.write(fp) fp.close() # Default solver selection if PULP_CBC_CMD().available(): LpSolverDefault = PULP_CBC_CMD() elif GLPK_CMD().available(): LpSolverDefault = GLPK_CMD() elif COIN_CMD().available(): LpSolverDefault = COIN_CMD() else: LpSolverDefault = None class LpElement(object): """Base class for LpVariable and LpConstraintVar """ #to remove illegal characters from the names trans = string.maketrans("-+[] ->/","________") def setName(self,name): if name: self.__name = str(name).translate(self.trans) else: self.__name = None def getName(self): return self.__name name = property(fget = getName,fset = setName) def __init__(self, name): self.name = name # self.hash MUST be different for each variable # else dict() will call the comparison operators that are overloaded self.hash = id(self) self.modified = True def __hash__(self): return self.hash def __str__(self): return self.name def __repr__(self): return self.name def __neg__(self): return - LpAffineExpression(self) def __pos__(self): return self def __nonzero__(self): return 1 def __add__(self, other): return LpAffineExpression(self) + other def __radd__(self, other): return LpAffineExpression(self) + other def __sub__(self, other): return LpAffineExpression(self) - other def __rsub__(self, other): return other - LpAffineExpression(self) def __mul__(self, other): return LpAffineExpression(self) * other def __rmul__(self, other): return LpAffineExpression(self) * other def __div__(self, other): return LpAffineExpression(self)/other def __rdiv__(self, other): raise TypeError, "Expressions cannot be divided by a variable" def __le__(self, other): return LpAffineExpression(self) <= other def __ge__(self, other): return LpAffineExpression(self) >= other def __eq__(self, other): return LpAffineExpression(self) == other def __ne__(self, other): if isinstance(other, LpVariable): return self.name is not other.name elif isinstance(other, LpAffineExpression): if other.isAtomic(): return self is not other.atom() else: return 1 else: return 1 class LpVariable(LpElement): """ This class models an LP Variable with the specified associated parameters :param name: The name of the variable used in the output .lp file :param lowbound: The lower bound on this variable's range. Default is negative infinity :param upBound: The upper bound on this variable's range. Default is positive infinity :param cat: The category this variable is in, Integer, Binary or Continuous(default) :param e: Used for column based modelling: relates to the variable's existence in the objective function and constraints """ def __init__(self, name, lowBound = None, upBound = None, cat = LpContinuous, e = None): LpElement.__init__(self,name) self.lowBound = lowBound self.upBound = upBound self.cat = cat self.varValue = None self.init = 0 #code to add a variable to constraints for column based # modelling if cat == LpBinary: self.lowBound = 0 self.upBound = 1 self.cat = LpInteger if e: self.add_expression(e) def add_expression(self,e): self.expression = e self.addVariableToConstraints(e) @classmethod def matrix(cls, name, indexs, lowBound = None, upBound = None, cat = LpContinuous, indexStart = []): if not isinstance(indexs, tuple): indexs = (indexs,) if "%" not in name: name += "_%s" * len(indexs) index = indexs[0] indexs = indexs[1:] if len(indexs) == 0: return [ LpVariable(name % tuple(indexStart + [i]), lowBound, upBound, cat) for i in index ] else: return [ LpVariable.matrix(name, indexs, lowBound, upBound, cat, indexStart + [i]) for i in index ] @classmethod def dicts(cls, name, indexs, lowBound = None, upBound = None, cat = LpContinuous, indexStart = []): """ Creates a dictionary of LP variables This function creates a dictionary of LP Variables with the specified associated parameters. :param name: The prefix to the name of each LP variable created :param indexs: A list of strings of the keys to the dictionary of LP variables, and the main part of the variable name itself :param lowbound: The lower bound on these variables' range. Default is negative infinity :param upBound: The upper bound on these variables' range. Default is positive infinity :param cat: The category these variables are in, Integer or Continuous(default) :return: A dictionary of LP Variables """ if not isinstance(indexs, tuple): indexs = (indexs,) if "%" not in name: name += "_%s" * len(indexs) index = indexs[0] indexs = indexs[1:] d = {} if len(indexs) == 0: for i in index: d[i] = LpVariable(name % tuple(indexStart + [str(i)]), lowBound, upBound, cat) else: for i in index: d[i] = LpVariable.dicts(name, indexs, lowBound, upBound, cat, indexStart + [i]) return d @classmethod def dict(cls, name, indexs, lowBound = None, upBound = None, cat = LpContinuous): if not isinstance(indexs, tuple): indexs = (indexs,) if "%" not in name: name += "_%s" * len(indexs) lists = indexs if len(indexs)>1: # Cartesian product res = [] while len(lists): first = lists[-1] nres = [] if res: if first: for f in first: nres.extend([[f]+r for r in res]) else: nres = res res = nres else: res = [[f] for f in first] lists = lists[:-1] index = [tuple(r) for r in res] elif len(indexs) == 1: index = indexs[0] else: return {} d = dict((i, cls(name % i, lowBound, upBound, cat)) for i in index) return d def getLb(self): return self.lowBound def getUb(self): return self.upBound def bounds(self, low, up): self.lowBound = low self.upBound = up def positive(self): self.lowBound = 0 self.upBound = None def value(self): return self.varValue def round(self, epsInt = 1e-5, eps = 1e-7): if self.varValue is not None: if self.upBound != None and self.varValue > self.upBound and self.varValue <= self.upBound + eps: self.varValue = self.upBound elif self.lowBound != None and self.varValue < self.lowBound and self.varValue >= self.lowBound - eps: self.varValue = self.lowBound if self.cat == LpInteger and abs(round(self.varValue) - self.varValue) <= epsInt: self.varValue = round(self.varValue) def roundedValue(self, eps = 1e-5): if self.cat == LpInteger and self.varValue != None \ and abs(self.varValue - round(self.varValue)) <= eps: return round(self.varValue) else: return self.varValue def valueOrDefault(self): if self.varValue != None: return self.varValue elif self.lowBound != None: if self.upBound != None: if 0 >= self.lowBound and 0 <= self.upBound: return 0 else: if self.lowBound >= 0: return self.lowBound else: return self.upBound else: if 0 >= self.lowBound: return 0 else: return self.lowBound elif self.upBound != None: if 0 <= self.upBound: return 0 else: return self.upBound else: return 0 def valid(self, eps): if self.varValue == None: return False if self.upBound != None and self.varValue > self.upBound + eps: return False if self.lowBound != None and self.varValue < self.lowBound - eps: return False if self.cat == LpInteger and abs(round(self.varValue) - self.varValue) > eps: return False return True def infeasibilityGap(self, mip = 1): if self.varValue == None: raise ValueError, "variable value is None" if self.upBound != None and self.varValue > self.upBound: return self.varValue - self.upBound if self.lowBound != None and self.varValue < self.lowBound: return self.varValue - self.lowBound if mip and self.cat == LpInteger and round(self.varValue) - self.varValue != 0: return round(self.varValue) - self.varValue return 0 def isBinary(self): return self.cat == LpInteger and self.lowBound == 0 and self.upBound == 1 def isInteger(self): return self.cat == LpInteger def isFree(self): return self.lowBound == None and self.upBound == None def isConstant(self): return self.lowBound != None and self.upBound == self.lowBound def isPositive(self): return self.lowBound == 0 and self.upBound == None def asCplexLpVariable(self): if self.isFree(): return self.name + " free" if self.isConstant(): return self.name + " = %.12g" % self.lowBound if self.lowBound == None: s= "-inf <= " # Note: XPRESS and CPLEX do not interpret integer variables without # explicit bounds elif (self.lowBound == 0 and self.cat == LpContinuous): s = "" else: s= "%.12g <= " % self.lowBound s += self.name if self.upBound != None: s+= " <= %.12g" % self.upBound return s def asCplexLpAffineExpression(self, name, constant = 1): return LpAffineExpression(self).asCplexLpAffineExpression(name, constant) def __ne__(self, other): if isinstance(other, LpElement): return self.name is not other.name elif isinstance(other, LpAffineExpression): if other.isAtomic(): return self is not other.atom() else: return 1 else: return 1 def addVariableToConstraints(self,e): """adds a variable to the constraints indicated by the LpConstraintVars in e """ for constraint, coeff in e.items(): constraint.addVariable(self,coeff) def setInitialValue(self,val): """sets the initial value of the Variable to val may of may not be supported by the solver """ raise NotImplementedError class LpAffineExpression(_DICT_TYPE): """ A linear combination of :class:`LpVariables<LpVariable>`. Can be initialised with the following: #. e = None: an empty Expression #. e = dict: gives an expression with the values being the coefficients of the keys (order of terms is undetermined) #. e = list or generator of 2-tuples: equivalent to dict.items() #. e = LpElement: an expression of length 1 with the coefficient 1 #. e = other: the constant is initialised as e Examples: >>> f=LpAffineExpression(LpElement('x')) >>> f 1*x + 0 >>> x_name = ['x_0', 'x_1', 'x_2'] >>> x = [LpVariable(x_name[i], lowBound = 0, upBound = 10) for i in range(3) ] >>> c = LpAffineExpression([ (x[0],1), (x[1],-3), (x[2],4)]) >>> c 1*x_0 + -3*x_1 + 4*x_2 + 0 """ #to remove illegal characters from the names trans = string.maketrans("-+[] ","_____") def setName(self,name): if name: self.__name = str(name).translate(self.trans) else: self.__name = None def getName(self): return self.__name name = property(fget=getName, fset=setName) def __init__(self, e = None, constant = 0, name = None): self.name = name #TODO remove isinstance usage if e is None: e = {} if isinstance(e, LpAffineExpression): # Will not copy the name self.constant = e.constant super(LpAffineExpression, self).__init__(e.items()) elif isinstance(e, dict): self.constant = constant super(LpAffineExpression, self).__init__(e.items()) elif isinstance(e, list) or isinstance(e, GeneratorType): self.constant = constant super(LpAffineExpression, self).__init__(e) elif isinstance(e,LpElement): self.constant = 0 super(LpAffineExpression, self).__init__( [(e, 1)]) else: self.constant = e super(LpAffineExpression, self).__init__() # Proxy functions for variables def isAtomic(self): return len(self) == 1 and self.constant == 0 and self.values()[0] == 1 def isNumericalConstant(self): return len(self) == 0 def atom(self): return self.keys()[0] # Functions on expressions def __nonzero__(self): return float(self.constant) != 0 or len(self) def value(self): s = self.constant for v,x in self.iteritems(): if v.varValue is None: return None s += v.varValue * x return s def valueOrDefault(self): s = self.constant for v,x in self.iteritems(): s += v.valueOrDefault() * x return s def addterm(self, key, value): y = self.get(key, 0) if y: y += value self[key] = y else: self[key] = value def emptyCopy(self): return LpAffineExpression() def copy(self): """Make a copy of self except the name which is reset""" # Will not copy the name return LpAffineExpression(self) def __str__(self, constant = 1): s = "" for v in self.sorted_keys(): val = self[v] if val<0: if s != "": s += " - " else: s += "-" val = -val elif s != "": s += " + " if val == 1: s += str(v) else: s += str(val) + "*" + str(v) if constant: if s == "": s = str(self.constant) else: if self.constant < 0: s += " - " + str(-self.constant) elif self.constant > 0: s += " + " + str(self.constant) elif s == "": s = "0" return s def sorted_keys(self): """ returns the list of keys sorted by name """ result = [(v.name, v) for v in self.keys()] result.sort() result = [v for _, v in result] return result def __repr__(self): l = [str(self[v]) + "*" + str(v) for v in self.sorted_keys()] l.append(str(self.constant)) s = " + ".join(l) return s @staticmethod def _count_characters(line): #counts the characters in a list of strings return sum(len(t) for t in line) def asCplexVariablesOnly(self, name): """ helper for asCplexLpAffineExpression """ result = [] line = ["%s:" % name] notFirst = 0 variables = self.sorted_keys() for v in variables: val = self[v] if val < 0: sign = " -" val = -val elif notFirst: sign = " +" else: sign = "" notFirst = 1 if val == 1: term = "%s %s" %(sign, v.name) else: term = "%s %.12g %s" % (sign, val, v.name) if self._count_characters(line) + len(term) > LpCplexLPLineSize: result += ["".join(line)] line = [term] else: line += [term] return result, line def asCplexLpAffineExpression(self, name, constant = 1): """ returns a string that represents the Affine Expression in lp format """ #refactored to use a list for speed in iron python result, line = self.asCplexVariablesOnly(name) if not self: term = " %s" % self.constant else: term = "" if constant: if self.constant < 0: term = " - %s" % (-self.constant) elif self.constant > 0: term = " + %s" % self.constant if self._count_characters(line) + len(term) > LpCplexLPLineSize: result += ["".join(line)] line += [term] else: line += [term] result += ["".join(line)] result = "%s\n" % "\n".join(result) return result def addInPlace(self, other): if other is 0: return self if other is None: return self if isinstance(other,LpElement): self.addterm(other, 1) elif (isinstance(other,list) or isinstance(other,types.GeneratorType)): for e in other: self.addInPlace(e) elif isinstance(other,LpAffineExpression): self.constant += other.constant for v,x in other.iteritems(): self.addterm(v, x) elif isinstance(other,dict): for e in other.itervalues(): self.addInPlace(e) else: self.constant += other return self def subInPlace(self, other): if other is 0: return self if other is None: return self if isinstance(other,LpElement): self.addterm(other, -1) elif (isinstance(other,list) or isinstance(other,types.GeneratorType)): for e in other: self.subInPlace(e) elif isinstance(other,LpAffineExpression): self.constant -= other.constant for v,x in other.iteritems(): self.addterm(v, -x) elif isinstance(other,dict): for e in other.itervalues(): self.subInPlace(e) else: self.constant -= other return self def __neg__(self): e = self.emptyCopy() e.constant = - self.constant for v,x in self.iteritems(): e[v] = - x return e def __pos__(self): return self def __add__(self, other): return self.copy().addInPlace(other) def __radd__(self, other): return self.copy().addInPlace(other) def __sub__(self, other): return self.copy().subInPlace(other) def __rsub__(self, other): return (-self).addInPlace(other) def __mul__(self, other): e = self.emptyCopy() if isinstance(other,LpAffineExpression): e.constant = self.constant * other.constant if len(other): if len(self): raise TypeError, "Non-constant expressions cannot be multiplied" else: c = self.constant if c != 0: for v,x in other.iteritems(): e[v] = c * x else: c = other.constant if c != 0: for v,x in self.iteritems(): e[v] = c * x elif isinstance(other,LpVariable): return self * LpAffineExpression(other) else: if other != 0: e.constant = self.constant * other for v,x in self.iteritems(): e[v] = other * x return e def __rmul__(self, other): return self * other def __div__(self, other): if isinstance(other,LpAffineExpression) or isinstance(other,LpVariable): if len(other): raise TypeError, "Expressions cannot be divided by a non-constant expression" other = other.constant e = self.emptyCopy() e.constant = self.constant / other for v,x in self.iteritems(): e[v] = x / other return e def __rdiv__(self, other): e = self.emptyCopy() if len(self): raise TypeError, "Expressions cannot be divided by a non-constant expression" c = self.constant if isinstance(other,LpAffineExpression): e.constant = other.constant / c for v,x in other.iteritems(): e[v] = x / c else: e.constant = other / c return e def __le__(self, other): return LpConstraint(self - other, LpConstraintLE) def __ge__(self, other): return LpConstraint(self - other, LpConstraintGE) def __eq__(self, other): return LpConstraint(self - other, LpConstraintEQ) class LpConstraint(LpAffineExpression): """An LP constraint""" def __init__(self, e = None, sense = LpConstraintEQ, name = None, rhs = None): """ :param e: an instance of :class:`LpAffineExpression` :param sense: one of :data:`~pulp.constants.LpConstraintEQ`, :data:`~pulp.constants.LpConstraintGE`, :data:`~pulp.constants.LpConstraintLE` (0, 1, -1 respectively) :param name: identifying string :param rhs: numerical value of constraint target """ LpAffineExpression.__init__(self, e, name = name) if rhs is not None: self.constant = - rhs self.sense = sense self.modified = True def getLb(self): if ( (self.sense == LpConstraintGE) or (self.sense == LpConstraintEQ) ): return -self.constant else: return None def getUb(self): if ( (self.sense == LpConstraintLE) or (self.sense == LpConstraintEQ) ): return -self.constant else: return None def __str__(self): s = LpAffineExpression.__str__(self, 0) if self.sense: s += " " + LpConstraintSenses[self.sense] + " " + str(-self.constant) return s def asCplexLpConstraint(self, name): """ Returns a constraint as a string """ result, line = self.asCplexVariablesOnly(name) if not self.keys(): line += ["0"] c = -self.constant if c == 0: c = 0 # Supress sign term = " %s %.12g" % (LpConstraintSenses[self.sense], c) if self._count_characters(line)+len(term) > LpCplexLPLineSize: result += ["".join(line)] line = [term] else: line += [term] result += ["".join(line)] result = "%s\n" % "\n".join(result) return result def changeRHS(self, RHS): """ alters the RHS of a constraint so that it can be modified in a resolve """ self.constant = -RHS self.modified = True def __repr__(self): s = LpAffineExpression.__repr__(self) if self.sense is not None: s += " " + LpConstraintSenses[self.sense] + " 0" return s def copy(self): """Make a copy of self""" return LpConstraint(self, self.sense) def emptyCopy(self): return LpConstraint(sense = self.sense) def addInPlace(self, other): if isinstance(other,LpConstraint): if self.sense * other.sense >= 0: LpAffineExpression.addInPlace(self, other) self.sense |= other.sense else: LpAffineExpression.subInPlace(self, other) self.sense |= - other.sense elif isinstance(other,list): for e in other: self.addInPlace(e) else: LpAffineExpression.addInPlace(self, other) #raise TypeError, "Constraints and Expressions cannot be added" return self def subInPlace(self, other): if isinstance(other,LpConstraint): if self.sense * other.sense <= 0: LpAffineExpression.subInPlace(self, other) self.sense |= - other.sense else: LpAffineExpression.addInPlace(self, other) self.sense |= other.sense elif isinstance(other,list): for e in other: self.subInPlace(e) else: LpAffineExpression.subInPlace(self, other) #raise TypeError, "Constraints and Expressions cannot be added" return self def __neg__(self): c = LpAffineExpression.__neg__(self) c.sense = - c.sense return c def __add__(self, other): return self.copy().addInPlace(other) def __radd__(self, other): return self.copy().addInPlace(other) def __sub__(self, other): return self.copy().subInPlace(other) def __rsub__(self, other): return (-self).addInPlace(other) def __mul__(self, other): if isinstance(other,LpConstraint): c = LpAffineExpression.__mul__(self, other) if c.sense == 0: c.sense = other.sense elif other.sense != 0: c.sense *= other.sense return c else: return LpAffineExpression.__mul__(self, other) def __rmul__(self, other): return self * other def __div__(self, other): if isinstance(other,LpConstraint): c = LpAffineExpression.__div__(self, other) if c.sense == 0: c.sense = other.sense elif other.sense != 0: c.sense *= other.sense return c else: return LpAffineExpression.__mul__(self, other) def __rdiv__(self, other): if isinstance(other,LpConstraint): c = LpAffineExpression.__rdiv__(self, other) if c.sense == 0: c.sense = other.sense elif other.sense != 0: c.sense *= other.sense return c else: return LpAffineExpression.__mul__(self, other) def valid(self, eps = 0): val = self.value() if self.sense == LpConstraintEQ: return abs(val) <= eps else: return val * self.sense >= - eps def makeElasticSubProblem(self, *args, **kwargs): """ Builds an elastic subproblem by adding variables to a hard constraint uses FixedElasticSubProblem """ return FixedElasticSubProblem(self, *args, **kwargs) class LpFractionConstraint(LpConstraint): """ Creates a constraint that enforces a fraction requirement a/b = c """ def __init__(self, numerator, denominator = None, sense = LpConstraintEQ, RHS = 1.0, name = None, complement = None): """ creates a fraction Constraint to model constraints of the nature numerator/denominator {==, >=, <=} RHS numerator/(numerator + complement) {==, >=, <=} RHS :param numerator: the top of the fraction :param denominator: as described above :param sense: the sense of the relation of the constraint :param RHS: the target fraction value :param complement: as described above """ self.numerator = numerator if denominator is None and complement is not None: self.complement = complement self.denominator = numerator + complement elif denominator is not None and complement is None: self.denominator = denominator self.complement = denominator - numerator else: self.denominator = denominator self.complement = complement lhs = self.numerator - RHS * self.denominator LpConstraint.__init__(self, lhs, sense = sense, rhs = 0, name = name) self.RHS = RHS def findLHSValue(self): """ Determines the value of the fraction in the constraint after solution """ if abs(value(self.denominator))>= EPS: return value(self.numerator)/value(self.denominator) else: if abs(value(self.numerator))<= EPS: #zero divided by zero will return 1 return 1.0 else: raise ZeroDivisionError def makeElasticSubProblem(self, *args, **kwargs): """ Builds an elastic subproblem by adding variables and splitting the hard constraint uses FractionElasticSubProblem """ return FractionElasticSubProblem(self, *args, **kwargs) class LpConstraintVar(LpElement): """A Constraint that can be treated as a variable when constructing a LpProblem by columns """ def __init__(self, name = None ,sense = None, rhs = None, e = None): LpElement.__init__(self,name) self.constraint = LpConstraint(name = self.name, sense = sense, rhs = rhs , e = e) def addVariable(self, var, coeff): """ Adds a variable to the constraint with the activity coeff """ self.constraint.addterm(var, coeff) def value(self): return self.constraint.value() class LpProblem(object): """An LP Problem""" def __init__(self, name = "NoName", sense = LpMinimize): """ Creates an LP Problem This function creates a new LP Problem with the specified associated parameters :param name: name of the problem used in the output .lp file :param sense: of the LP problem objective. \ Either :data:`~pulp.constants.LpMinimize` (default) \ or :data:`~pulp.constants.LpMaximize`. :return: An LP Problem """ self.objective = None self.constraints = _DICT_TYPE() self.name = name self.sense = sense self.sos1 = {} self.sos2 = {} self.status = LpStatusNotSolved self.noOverlap = 1 self.solver = None self.initialValues = {} self.resolveOK = False self._variables = [] self._variable_ids = {} #old school using dict.keys() for a set self.dummyVar = None # locals self.lastUnused = 0 def __repr__(self): string = self.name+":\n" if self.sense == 1: string += "MINIMIZE\n" else: string += "MAXIMIZE\n" string += repr(self.objective) +"\n" if self.constraints: string += "SUBJECT TO\n" for n, c in self.constraints.iteritems(): string += c.asCplexLpConstraint(n) +"\n" string += "VARIABLES\n" for v in self.variables(): string += v.asCplexLpVariable() + " " + LpCategories[v.cat] + "\n" return string def copy(self): """Make a copy of self. Expressions are copied by reference""" lpcopy = LpProblem(name = self.name, sense = self.sense) lpcopy.objective = self.objective lpcopy.constraints = self.constraints.copy() lpcopy.sos1 = self.sos1.copy() lpcopy.sos2 = self.sos2.copy() return lpcopy def deepcopy(self): """Make a copy of self. Expressions are copied by value""" lpcopy = LpProblem(name = self.name, sense = self.sense) if self.objective is not None: lpcopy.objective = self.objective.copy() lpcopy.constraints = {} for k,v in self.constraints.iteritems(): lpcopy.constraints[k] = v.copy() lpcopy.sos1 = self.sos1.copy() lpcopy.sos2 = self.sos2.copy() return lpcopy def normalisedNames(self): constraintsNames = {} i = 0 for k in self.constraints: constraintsNames[k] = "C%07d" % i i += 1 variablesNames = {} i = 0 for k in self.variables(): variablesNames[k.name] = "X%07d" % i i += 1 return constraintsNames, variablesNames, "OBJ" def isMIP(self): for v in self.variables(): if v.cat == LpInteger: return 1 return 0 def roundSolution(self, epsInt = 1e-5, eps = 1e-7): """ Rounds the lp variables Inputs: - none Side Effects: - The lp variables are rounded """ for v in self.variables(): v.round(epsInt, eps) def unusedConstraintName(self): self.lastUnused += 1 while 1: s = "_C%d" % self.lastUnused if s not in self.constraints: break self.lastUnused += 1 return s def valid(self, eps = 0): for v in self.variables(): if not v.valid(eps): return False for c in self.constraints.itervalues(): if not c.valid(eps): return False else: return True def infeasibilityGap(self, mip = 1): gap = 0 for v in self.variables(): gap = max(abs(v.infeasibilityGap(mip)), gap) for c in self.constraints.itervalues(): if not c.valid(0): gap = max(abs(c.value()), gap) return gap def addVariable(self, variable): """ Adds a variable to the problem before a constraint is added @param variable: the variable to be added """ if id(variable) not in self._variable_ids: self._variables.append(variable) self._variable_ids[id(variable)] = variable def addVariables(self, variables): """ Adds variables to the problem before a constraint is added @param variables: the variables to be added """ for v in variables: self.addVariable(v) def variables(self): """ Returns a list of the problem variables Inputs: - none Returns: - A list of the problem variables """ if self.objective: self.addVariables(self.objective.keys()) for c in self.constraints.itervalues(): self.addVariables(c.keys()) variables = self._variables #sort the varibles DSU variables = [[v.name, v] for v in variables] variables.sort() variables = [v for _, v in variables] return variables def variablesDict(self): variables = {} if self.objective: for v in self.objective: variables[v.name] = v for c in self.constraints.values(): for v in c: variables[v.name] = v return variables def add(self, constraint, name = None): self.addConstraint(constraint, name) def addConstraint(self, constraint, name = None): if not isinstance(constraint, LpConstraint): raise TypeError, "Can only add LpConstraint objects" if name: constraint.name = name try: if constraint.name: name = constraint.name else: name = self.unusedConstraintName() except AttributeError: raise TypeError, "Can only add LpConstraint objects" #removed as this test fails for empty constraints # if len(constraint) == 0: # if not constraint.valid(): # raise ValueError, "Cannot add false constraints" if name in self.constraints: if self.noOverlap: raise PulpError, "overlapping constraint names: " + name else: print "Warning: overlapping constraint names:", name self.constraints[name] = constraint self.addVariables(constraint.keys()) def setObjective(self,obj): """ Sets the input variable as the objective function. Used in Columnwise Modelling :param obj: the objective function of type :class:`LpConstraintVar` Side Effects: - The objective function is set """ if isinstance(obj, LpVariable): # allows the user to add a LpVariable as an objective obj = obj + 0.0 try: obj = obj.constraint name = obj.name except AttributeError: name = None self.objective = obj self.objective.name = name self.resolveOK = False def __iadd__(self, other): if isinstance(other, tuple): other, name = other else: name = None if other is True: return self if isinstance(other, LpConstraintVar): self.addConstraint(other.constraint) elif isinstance(other, LpConstraint): self.addConstraint(other, name) elif isinstance(other, LpAffineExpression): self.objective = other self.objective.name = name elif isinstance(other, LpVariable) or type(other) in [int, float]: self.objective = LpAffineExpression(other) self.objective.name = name else: raise TypeError, "Can only add LpConstraintVar, LpConstraint, LpAffineExpression or True objects" return self def extend(self, other, use_objective = True): """ extends an LpProblem by adding constraints either from a dictionary a tuple or another LpProblem object. @param use_objective: determines whether the objective is imported from the other problem For dictionaries the constraints will be named with the keys For tuples an unique name will be generated For LpProblems the name of the problem will be added to the constraints name """ if isinstance(other, dict): for name in other: self.constraints[name] = other[name] elif isinstance(other, LpProblem): for v in set(other.variables()).difference(self.variables()): v.name = other.name + v.name for name,c in other.constraints.iteritems(): c.name = other.name + name self.addConstraint(c) if use_objective: self.objective += other.objective else: for c in other: if isinstance(c,tuple): name = c[0] c = c[1] else: name = None if not name: name = c.name if not name: name = self.unusedConstraintName() self.constraints[name] = c def coefficients(self, translation = None): coefs = [] if translation == None: for c in self.constraints: cst = self.constraints[c] coefs.extend([(v.name, c, cst[v]) for v in cst]) else: for c in self.constraints: ctr = translation[c] cst = self.constraints[c] coefs.extend([(translation[v.name], ctr, cst[v]) for v in cst]) return coefs def writeMPS(self, filename, mpsSense = 0, rename = 0, mip = 1): wasNone, dummyVar = self.fixObjective() f = file(filename, "w") if mpsSense == 0: mpsSense = self.sense cobj = self.objective if mpsSense != self.sense: n = cobj.name cobj = - cobj cobj.name = n if rename: constraintsNames, variablesNames, cobj.name = self.normalisedNames() f.write("*SENSE:"+LpSenses[mpsSense]+"\n") n = self.name if rename: n = "MODEL" f.write("NAME "+n+"\n") vs = self.variables() # constraints f.write("ROWS\n") objName = cobj.name if not objName: objName = "OBJ" f.write(" N %s\n" % objName) mpsConstraintType = {LpConstraintLE:"L", LpConstraintEQ:"E", LpConstraintGE:"G"} for k,c in self.constraints.iteritems(): if rename: k = constraintsNames[k] f.write(" "+mpsConstraintType[c.sense]+" "+k+"\n") # matrix f.write("COLUMNS\n") # Creation of a dict of dict: # coefs[nomVariable][nomContrainte] = coefficient coefs = {} for k,c in self.constraints.iteritems(): if rename: k = constraintsNames[k] for v in c: n = v.name if rename: n = variablesNames[n] if n in coefs: coefs[n][k] = c[v] else: coefs[n] = {k:c[v]} for v in vs: if mip and v.cat == LpInteger: f.write(" MARK 'MARKER' 'INTORG'\n") n = v.name if rename: n = variablesNames[n] if n in coefs: cv = coefs[n] # Most of the work is done here for k in cv: f.write(" %-8s %-8s % .5e\n" % (n,k,cv[k])) # objective function if v in cobj: f.write(" %-8s %-8s % .5e\n" % (n,objName,cobj[v])) if mip and v.cat == LpInteger: f.write(" MARK 'MARKER' 'INTEND'\n") # right hand side f.write("RHS\n") for k,c in self.constraints.iteritems(): c = -c.constant if rename: k = constraintsNames[k] if c == 0: c = 0 f.write(" RHS %-8s % .5e\n" % (k,c)) # bounds f.write("BOUNDS\n") for v in vs: n = v.name if rename: n = variablesNames[n] if v.lowBound != None and v.lowBound == v.upBound: f.write(" FX BND %-8s % .5e\n" % (n, v.lowBound)) elif v.lowBound == 0 and v.upBound == 1 and mip and v.cat == LpInteger: f.write(" BV BND %-8s\n" % n) else: if v.lowBound != None: # In MPS files, variables with no bounds (i.e. >= 0) # are assumed BV by COIN and CPLEX. # So we explicitly write a 0 lower bound in this case. if v.lowBound != 0 or (mip and v.cat == LpInteger and v.upBound == None): f.write(" LO BND %-8s % .5e\n" % (n, v.lowBound)) else: if v.upBound != None: f.write(" MI BND %-8s\n" % n) else: f.write(" FR BND %-8s\n" % n) if v.upBound != None: f.write(" UP BND %-8s % .5e\n" % (n, v.upBound)) f.write("ENDATA\n") f.close() self.restoreObjective(wasNone, dummyVar) # returns the variables, in writing order if rename == 0: return vs else: return vs, variablesNames, constraintsNames, cobj.name def writeLP(self, filename, writeSOS = 1, mip = 1): """ Write the given Lp problem to a .lp file. This function writes the specifications (objective function, constraints, variables) of the defined Lp problem to a file. :param filename: the name of the file to be created. Side Effects: - The file is created. """ f = file(filename, "w") f.write("\\* "+self.name+" *\\\n") if self.sense == 1: f.write("Minimize\n") else: f.write("Maximize\n") wasNone, dummyVar = self.fixObjective() objName = self.objective.name if not objName: objName = "OBJ" f.write(self.objective.asCplexLpAffineExpression(objName, constant = 0)) f.write("Subject To\n") ks = self.constraints.keys() ks.sort() for k in ks: constraint = self.constraints[k] if not constraint.keys(): #empty constraint add the dummyVar constraint += self.get_dummyVar() f.write(constraint.asCplexLpConstraint(k)) vs = self.variables() # check if any names are longer than 100 characters long_names = [v.name for v in vs if len(v.name) > 100] if long_names: raise PulpError('Variable names too long for Lp format\n' + str(long_names)) # check for repeated names repeated_names = {} for v in vs: repeated_names[v.name] = repeated_names.get(v.name, 0) + 1 repeated_names = [(key, value) for key, value in repeated_names.items() if value >= 2] if repeated_names: raise PulpError('Repeated variable names in Lp format\n' + str(repeated_names)) # Bounds on non-"positive" variables # Note: XPRESS and CPLEX do not interpret integer variables without # explicit bounds if mip: vg = [v for v in vs if not (v.isPositive() and v.cat == LpContinuous) \ and not v.isBinary()] else: vg = [v for v in vs if not v.isPositive()] if vg: f.write("Bounds\n") for v in vg: f.write("%s\n" % v.asCplexLpVariable()) # Integer non-binary variables if mip: vg = [v for v in vs if v.cat == LpInteger and not v.isBinary()] if vg: f.write("Generals\n") for v in vg: f.write("%s\n" % v.name) # Binary variables vg = [v for v in vs if v.isBinary()] if vg: f.write("Binaries\n") for v in vg: f.write("%s\n" % v.name) # Special Ordered Sets if writeSOS and (self.sos1 or self.sos2): f.write("SOS\n") if self.sos1: for sos in self.sos1.itervalues(): f.write("S1:: \n") for v,val in sos.iteritems(): f.write(" %s: %.12g\n" % (v.name, val)) if self.sos2: for sos in self.sos2.itervalues(): f.write("S2:: \n") for v,val in sos.iteritems(): f.write(" %s: %.12g\n" % (v.name, val)) f.write("End\n") f.close() self.restoreObjective(wasNone, dummyVar) def assignVarsVals(self, values): variables = self.variablesDict() for name in values: if name != '__dummy': variables[name].varValue = values[name] def assignVarsDj(self,values): variables = self.variablesDict() for name in values: if name != '__dummy': variables[name].dj = values[name] def assignConsPi(self, values): for name in values: self.constraints[name].pi = values[name] def assignConsSlack(self, values, activity=False): for name in values: if activity: #reports the activitynot the slack self.constraints[name].slack = -(self.constraints[name].constant + float(values[name])) else: self.constraints[name].slack = float(values[name]) def get_dummyVar(self): if self.dummyVar is None: self.dummyVar = LpVariable("__dummy", 0, 0) return self.dummyVar def fixObjective(self): if self.objective is None: self.objective = 0 wasNone = 1 else: wasNone = 0 if not isinstance(self.objective, LpAffineExpression): self.objective = LpAffineExpression(self.objective) if self.objective.isNumericalConstant(): dummyVar = self.get_dummyVar() self.objective += dummyVar else: dummyVar = None return wasNone, dummyVar def restoreObjective(self, wasNone, dummyVar): if wasNone: self.objective = None elif not dummyVar is None: self.objective -= dummyVar def solve(self, solver = None, **kwargs): """ Solve the given Lp problem. This function changes the problem to make it suitable for solving then calls the solver.actualSolve() method to find the solution :param solver: Optional: the specific solver to be used, defaults to the default solver. Side Effects: - The attributes of the problem object are changed in :meth:`~pulp.solver.LpSolver.actualSolve()` to reflect the Lp solution """ if not(solver): solver = self.solver if not(solver): solver = LpSolverDefault wasNone, dummyVar = self.fixObjective() #time it self.solutionTime = -clock() status = solver.actualSolve(self, **kwargs) self.solutionTime += clock() self.restoreObjective(wasNone, dummyVar) self.solver = solver return status def sequentialSolve(self, objectives, absoluteTols = None, relativeTols = None, solver = None, debug = False): """ Solve the given Lp problem with several objective functions. This function sequentially changes the objective of the problem and then adds the objective function as a constraint :param objectives: the list of objectives to be used to solve the problem :param absoluteTols: the list of absolute tolerances to be applied to the constraints should be +ve for a minimise objective :param relativeTols: the list of relative tolerances applied to the constraints :param solver: the specific solver to be used, defaults to the default solver. """ #TODO Add a penalty variable to make problems elastic #TODO add the ability to accept different status values i.e. infeasible etc if not(solver): solver = self.solver if not(solver): solver = LpSolverDefault if not(absoluteTols): absoluteTols = [0] * len(objectives) if not(relativeTols): relativeTols = [1] * len(objectives) #time it self.solutionTime = -clock() statuses = [] for i,(obj,absol,rel) in enumerate(zip(objectives, absoluteTols, relativeTols)): self.setObjective(obj) status = solver.actualSolve(self) statuses.append(status) if debug: self.writeLP("%sSequence.lp"%i) if self.sense == LpMinimize: self += obj <= value(obj)*rel + absol,"%s_Sequence_Objective"%i elif self.sense == LpMaximize: self += obj >= value(obj)*rel + absol,"%s_Sequence_Objective"%i self.solutionTime += clock() self.solver = solver return statuses def resolve(self, solver = None, **kwargs): """ resolves an Problem using the same solver as previously """ if not(solver): solver = self.solver if self.resolveOK: return self.solver.actualResolve(self, **kwargs) else: logging.warn('resolve not ok. solving instead') return self.solve(solver=solver, **kwargs) def setSolver(self,solver = LpSolverDefault): """Sets the Solver for this problem useful if you are using resolve """ self.solver = solver def setInitial(self,values): self.initialValues = values class FixedElasticSubProblem(LpProblem): """ Contains the subproblem generated by converting a fixed constraint :math:`\sum_{i}a_i x_i = b` into an elastic constraint. :param constraint: The LpConstraint that the elastic constraint is based on :param penalty: penalty applied for violation (+ve or -ve) of the constraints :param proportionFreeBound: the proportional bound (+ve and -ve) on constraint violation that is free from penalty :param proportionFreeBoundList: the proportional bound on \ constraint violation that is free from penalty, expressed as a list\ where [-ve, +ve] """ def __init__(self, constraint, penalty = None, proportionFreeBound = None, proportionFreeBoundList = None): subProblemName = "%s_elastic_SubProblem" % constraint.name LpProblem.__init__(self, subProblemName, LpMinimize) self.objective = LpAffineExpression() self.constraint = constraint self.constant = constraint.constant self.RHS = - constraint.constant self.objective = LpAffineExpression() self += constraint, "_Constraint" #create and add these variables but disabled self.freeVar = LpVariable("_free_bound", upBound = 0, lowBound = 0) self.upVar = LpVariable("_pos_penalty_var", upBound = 0, lowBound = 0) self.lowVar = LpVariable("_neg_penalty_var", upBound = 0, lowBound = 0) constraint.addInPlace(self.freeVar + self.lowVar + self.upVar) if proportionFreeBound: proportionFreeBoundList = [proportionFreeBound, proportionFreeBound] if proportionFreeBoundList: #add a costless variable self.freeVar.upBound = abs(constraint.constant * proportionFreeBoundList[0]) self.freeVar.lowBound = -abs(constraint.constant * proportionFreeBoundList[1]) # Note the reversal of the upbound and lowbound due to the nature of the # variable if penalty is not None: #activate these variables self.upVar.upBound = None self.lowVar.lowBound = None self.objective = penalty*self.upVar - penalty*self.lowVar def _findValue(self, attrib): """ safe way to get the value of a variable that may not exist """ var = getattr(self, attrib, 0) if var: if value(var) is not None: return value(var) else: return 0.0 else: return 0.0 def isViolated(self): """ returns true if the penalty variables are non-zero """ upVar = self._findValue("upVar") lowVar = self._findValue("lowVar") freeVar = self._findValue("freeVar") result = abs(upVar + lowVar) >= EPS if result: logging.debug("isViolated %s, upVar %s, lowVar %s, freeVar %s result %s"%( self.name, upVar, lowVar, freeVar, result)) logging.debug("isViolated value lhs %s constant %s"%( self.findLHSValue(), self.RHS)) return result def findDifferenceFromRHS(self): """ The amount the actual value varies from the RHS (sense: LHS - RHS) """ return self.findLHSValue() - self.RHS def findLHSValue(self): """ for elastic constraints finds the LHS value of the constraint without the free variable and or penalty variable assumes the constant is on the rhs """ upVar = self._findValue("upVar") lowVar = self._findValue("lowVar") freeVar = self._findValue("freeVar") return self.constraint.value() - self.constant - \ upVar - lowVar - freeVar def deElasticize(self): """ de-elasticize constraint """ self.upVar.upBound = 0 self.lowVar.lowBound = 0 def reElasticize(self): """ Make the Subproblem elastic again after deElasticize """ self.upVar.lowBound = 0 self.upVar.upBound = None self.lowVar.upBound = 0 self.lowVar.lowBound = None def alterName(self, name): """ Alters the name of anonymous parts of the problem """ self.name = "%s_elastic_SubProblem" % name if hasattr(self, 'freeVar'): self.freeVar.name = self.name + "_free_bound" if hasattr(self, 'upVar'): self.upVar.name = self.name + "_pos_penalty_var" if hasattr(self, 'lowVar'): self.lowVar.name = self.name + "_neg_penalty_var" class FractionElasticSubProblem(FixedElasticSubProblem): """ Contains the subproblem generated by converting a Fraction constraint numerator/(numerator+complement) = b into an elastic constraint :param name: The name of the elastic subproblem :param penalty: penalty applied for violation (+ve or -ve) of the constraints :param proportionFreeBound: the proportional bound (+ve and -ve) on constraint violation that is free from penalty :param proportionFreeBoundList: the proportional bound on constraint violation that is free from penalty, expressed as a list where [-ve, +ve] """ def __init__(self, name, numerator, RHS, sense, complement = None, denominator = None, penalty = None, proportionFreeBound = None, proportionFreeBoundList = None): subProblemName = "%s_elastic_SubProblem" % name self.numerator = numerator if denominator is None and complement is not None: self.complement = complement self.denominator = numerator + complement elif denominator is not None and complement is None: self.denominator = denominator self.complement = denominator - numerator else: raise PulpError, 'only one of denominator and complement must be specified' self.RHS = RHS self.lowTarget = self.upTarget = None LpProblem.__init__(self, subProblemName, LpMinimize) self.freeVar = LpVariable("_free_bound", upBound = 0, lowBound = 0) self.upVar = LpVariable("_pos_penalty_var", upBound = 0, lowBound = 0) self.lowVar = LpVariable("_neg_penalty_var", upBound = 0, lowBound = 0) if proportionFreeBound: proportionFreeBoundList = [proportionFreeBound, proportionFreeBound] if proportionFreeBoundList: upProportionFreeBound, lowProportionFreeBound = \ proportionFreeBoundList else: upProportionFreeBound, lowProportionFreeBound = (0, 0) #create an objective self += LpAffineExpression() #There are three cases if the constraint.sense is ==, <=, >= if sense in [LpConstraintEQ, LpConstraintLE]: #create a constraint the sets the upper bound of target self.upTarget = RHS + upProportionFreeBound self.upConstraint = LpFractionConstraint(self.numerator, self.complement, LpConstraintLE, self.upTarget, denominator = self.denominator) if penalty is not None: self.lowVar.lowBound = None self.objective += -1* penalty * self.lowVar self.upConstraint += self.lowVar self += self.upConstraint, '_upper_constraint' if sense in [LpConstraintEQ, LpConstraintGE]: #create a constraint the sets the lower bound of target self.lowTarget = RHS - lowProportionFreeBound self.lowConstraint = LpFractionConstraint(self.numerator, self.complement, LpConstraintGE, self.lowTarget, denominator = self.denominator) if penalty is not None: self.upVar.upBound = None self.objective += penalty * self.upVar self.lowConstraint += self.upVar self += self.lowConstraint, '_lower_constraint' def findLHSValue(self): """ for elastic constraints finds the LHS value of the constraint without the free variable and or penalty variable assumes the constant is on the rhs """ # uses code from LpFractionConstraint if abs(value(self.denominator))>= EPS: return value(self.numerator)/value(self.denominator) else: if abs(value(self.numerator))<= EPS: #zero divided by zero will return 1 return 1.0 else: raise ZeroDivisionError def isViolated(self): """ returns true if the penalty variables are non-zero """ if abs(value(self.denominator))>= EPS: if self.lowTarget is not None: if self.lowTarget > self.findLHSValue(): return True if self.upTarget is not None: if self.findLHSValue() > self.upTarget: return True else: #if the denominator is zero the constraint is satisfied return False class LpVariableDict(dict): """An LP variable generator""" def __init__(self, name, data = {}, lowBound = None, upBound = None, cat = LpContinuous): self.name = name dict.__init__(self, data) def __getitem__(self, key): if key in self: return dict.__getitem__(self, key) else: self[key] = LpVariable(name % key, lowBound, upBound, cat) return self[key] # Utility functions def lpSum(vector): """ Calculate the sum of a list of linear expressions :param vector: A list of linear expressions """ return LpAffineExpression().addInPlace(vector) def lpDot(v1, v2): """Calculate the dot product of two lists of linear expressions""" if not isiterable(v1) and not isiterable(v2): return v1 * v2 elif not isiterable(v1): return lpDot([v1]*len(v2),v2) elif not isiterable(v2): return lpDot(v1,[v2]*len(v1)) else: return lpSum([lpDot(e1,e2) for e1,e2 in zip(v1,v2)]) def isNumber(x): """Returns true if x is an int of a float""" return type(x) in [int, float] def value(x): """Returns the value of the variable/expression x, or x if it is a number""" if isNumber(x): return x else: return x.value() def valueOrDefault(x): """Returns the value of the variable/expression x, or x if it is a number Variable without value (None) are affected a possible value (within their bounds).""" if isNumber(x): return x else: return x.valueOrDefault() def combination(orgset, k = None): """ returns an iterator that lists the combinations of orgset of length k :param orgset: the list to be iterated :param k: the cardinality of the subsets :return: an iterator of the subsets example: >>> c = combination([1,2,3,4],2) >>> for s in c: ... print s (1, 2) (1, 3) (1, 4) (2, 3) (2, 4) (3, 4) """ try: import probstat return probstat.Combination(orgset,k) except(ImportError): return __combination(orgset,k) def __combination(orgset,k): """ fall back if probstat is not installed note it is GPL so cannot be included """ if k == 1: for i in orgset: yield (i,) elif k>1: for i,x in enumerate(orgset): #iterates though to near the end for s in __combination(orgset[i+1:],k-1): yield (x,) + s def permutation(orgset, k = None): """ returns an iterator that lists the permutations of orgset of length k :param orgset: the list to be iterated :param k: the cardinality of the subsets :return: an iterator of the subsets example: >>> c = permutation([1,2,3,4],2) >>> for s in c: ... print s (1, 2) (1, 3) (1, 4) (2, 1) (2, 3) (2, 4) (3, 1) (3, 2) (3, 4) (4, 1) (4, 2) (4, 3) """ try: import probstat return probstat.Permutation(orgset, k) except(ImportError): return __permutation(orgset, k) def __permutation(orgset, k): """ fall back if probstat is not installed note it is GPL so cannot be included """ if k == 1: for i in orgset: yield (i,) elif k>1: for i,x in enumerate(orgset): #iterates though to near the end for s in __permutation(orgset[:i] + orgset[i+1:],k-1): yield (x,)+ s def allpermutations(orgset,k): """ returns all permutations of orgset with up to k items :param orgset: the list to be iterated :param k: the maxcardinality of the subsets :return: an iterator of the subsets example: >>> c = allpermutations([1,2,3,4],2) >>> for s in c: ... print s (1,) (2,) (3,) (4,) (1, 2) (1, 3) (1, 4) (2, 1) (2, 3) (2, 4) (3, 1) (3, 2) (3, 4) (4, 1) (4, 2) (4, 3) """ return itertools.chain(*[permutation(orgset,i) for i in range(1,k+1)]) def allcombinations(orgset,k): """ returns all permutations of orgset with up to k items :param orgset: the list to be iterated :param k: the maxcardinality of the subsets :return: an iterator of the subsets example: >>> c = allcombinations([1,2,3,4],2) >>> for s in c: ... print s (1,) (2,) (3,) (4,) (1, 2) (1, 3) (1, 4) (2, 3) (2, 4) (3, 4) """ return itertools.chain(*[combination(orgset,i) for i in range(1,k+1)]) def makeDict(headers, array, default = None): """ makes a list into a dictionary with the headings given in headings headers is a list of header lists array is a list with the data """ result, defdict = __makeDict(headers, array, default) return result def __makeDict(headers, array, default = None): #this is a recursive function so end the recursion as follows result ={} returndefaultvalue = None if len(headers) == 1: result.update(dict(zip(headers[0],array))) defaultvalue = default else: for i,h in enumerate(headers[0]): result[h],defaultvalue = __makeDict(headers[1:],array[i],default) if default != None: f = lambda :defaultvalue defresult = collections.defaultdict(f) defresult.update(result) result = defresult returndefaultvalue = collections.defaultdict(f) return result, returndefaultvalue def splitDict(Data): """ Split a dictionary with lists as the data, into smaller dictionaries :param Data: A dictionary with lists as the values :return: A tuple of dictionaries each containing the data separately, with the same dictionary keys """ # find the maximum number of items in the dictionary maxitems = max([len(values) for values in Data.values()]) output =[dict() for i in range(maxitems)] for key, values in Data.items(): for i, val in enumerate(values): output[i][key] = val return tuple(output) def read_table(data, coerce_type, transpose=False): ''' Reads in data from a simple table and forces it to be a particular type This is a helper function that allows data to be easily constained in a simple script ::return: a dictionary of with the keys being a tuple of the strings in the first row and colum of the table ::param data: the multiline string containing the table data ::param coerce_type: the type that the table data is converted to ::param transpose: reverses the data if needed Example: >>> table_data = """ ... L1 L2 L3 L4 L5 L6 ... C1 6736 42658 70414 45170 184679 111569 ... C2 217266 227190 249640 203029 153531 117487 ... C3 35936 28768 126316 2498 130317 74034 ... C4 73446 52077 108368 75011 49827 62850 ... C5 174664 177461 151589 153300 59916 135162 ... C6 186302 189099 147026 164938 149836 286307 ... """ >>> table = read_table(table_data, int) >>> table[("C1","L1")] 6736 >>> table[("C6","L5")] 149836 ''' lines = data.splitlines() headings = lines[1].split() result = {} for row in lines[2:]: items = row.split() for i, item in enumerate(items[1:]): if transpose: key = (headings[i], items[0]) else: key = (items[0], headings[i]) result[key] = coerce_type(item) return result def configSolvers(): """ Configure the path the the solvers on the command line Designed to configure the file locations of the solvers from the command line after installation """ configlist = [(cplex_dll_path,"cplexpath","CPLEX: "), (coinMP_path, "coinmppath","CoinMP dll (windows only): ")] print ("Please type the full path including filename and extension \n" + "for each solver available") configdict = {} for (default, key, msg) in configlist: value = raw_input(msg + "[" + str(default) +"]") if value: configdict[key] = value setConfigInformation(**configdict) def pulpTestAll(): from tests import pulpTestSolver solvers = [PULP_CBC_CMD, CPLEX_DLL, CPLEX_CMD, CPLEX_PY, COIN_CMD, COINMP_DLL, GLPK_CMD, XPRESS, GUROBI, GUROBI_CMD, PYGLPK, YAPOSIB ] for s in solvers: if s().available(): #~ try: pulpTestSolver(s) print "* Solver", s, "passed." #~ except Exception, e: #~ print e #~ print "* Solver", s, "failed." else: print "Solver", s, "unavailable." def pulpDoctest(): """ runs all doctests """ import doctest if __name__ != '__main__': import pulp doctest.testmod(pulp) else: doctest.testmod() if __name__ == '__main__': # Tests pulpTestAll() pulpDoctest()
33.75833
171
0.561311
[ "MIT" ]
ruxkor/pulp-or
src/pulp/pulp.py
75,990
Python
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.serialization import Model class TargetDescription(Model): """Information about a Target. A target is the component that can process a specific type of Job. :param id: Unique target id. :type id: str :param name: Display name of this target. :type name: str :param description: A description about this target. :type description: str :param accepted_data_formats: List of data formats accepted by this target. :type accepted_data_formats: list[str] :param accepted_content_encodings: List of content encodings accepted by this target. :type accepted_content_encodings: list[str] """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, 'accepted_data_formats': {'key': 'acceptedDataFormats', 'type': '[str]'}, 'accepted_content_encodings': {'key': 'acceptedContentEncodings', 'type': '[str]'}, } def __init__(self, *, id: str=None, name: str=None, description: str=None, accepted_data_formats=None, accepted_content_encodings=None, **kwargs) -> None: super(TargetDescription, self).__init__(**kwargs) self.id = id self.name = name self.description = description self.accepted_data_formats = accepted_data_formats self.accepted_content_encodings = accepted_content_encodings
40.0625
158
0.632345
[ "MIT" ]
00Kai0/azure-cli-extensions
src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description_py3.py
1,923
Python
# - * - encoding : utf - 8 - * - # pylint: disable=fixme, line-too-long """ Matrix factorization solver. :copyright: 2017-2019 H2O.ai, Inc. :license: Apache License Version 2.0 (see LICENSE for details) """ import numpy as np import scipy import scipy.sparse def _get_sparse_matrixes(X): '''Create csc, csr and coo sparse matrix from any of the above Arguments: X {array-like, csc, csr or coo sparse matrix} Returns: csc, csr, coo ''' X_coo = X_csc = X_csr = None if scipy.sparse.isspmatrix_coo(X): X_coo = X X_csr = X_coo.tocsr(True) X_csc = X_coo.tocsc(True) elif scipy.sparse.isspmatrix_csr(X): X_csr = X X_csc = X_csr.tocoo(True) X_coo = X_csr.tocsc(True) elif scipy.sparse.isspmatrix_csc(X): X_csc = X X_csr = X_csc.tocsr(True) X_coo = X_csc.tocoo(True) else: assert False, "only coo, csc and csr sparse matrixes are supported" return X_csc, X_csr, X_coo class FactorizationH2O(object): '''Matrix Factorization on GPU with Alternating Least Square (ALS) algorithm. Factors a sparse rating matrix X (m by n, with N_z non-zero elements) into a m-by-f and a f-by-n matrices. Parameters ---------- f int decomposition size lambda_ float lambda regularization max_iter int, default: 100 number of training iterations double_precision bool, default: False use double precision, not yet supported thetaT {array-like} shape (n, f), default: None initial theta matrix XT {array-like} shape (m, f), default: None initial XT matrix random_state int, default: 1234 Attributes ---------- XT {array-like} shape (m, f) XT matrix contains user's features thetaT {array-like} shape (n, f) transposed theta matrix, item's features Warnings -------- Matrixes ``XT`` and ``thetaT`` may contain nan elements. This is because in some datasets, there are users or items with no ratings in training set. That results in solutions of a system of linear equations becomes nan. Such elements can be easily removed with numpy functions like numpy.nan_to_num, but existence of them may be useful for troubleshooting purposes. ''' def __init__(self, f, lambda_, max_iter=100, double_precision=False, thetaT=None, XT=None, random_state=1234): assert not double_precision, 'double precision is not yet supported' assert f % 10 == 0, 'f has to be a multiple of 10' self.f = f self.lambda_ = lambda_ self.double_precision = double_precision self.dtype = np.float64 if self.double_precision else np.float32 self.thetaT = thetaT self.XT = XT self.max_iter = max_iter self.random_state = random_state def _load_lib(self): from ..libs.lib_utils import GPUlib gpu_lib = GPUlib().get(1) return gpu_lib def fit(self, X, y=None, X_test=None, X_BATCHES=1, THETA_BATCHES=1, early_stopping_rounds=None, verbose=False, scores=None): #pylint: disable=unused-argument '''Learn model from rating matrix X. Parameters ---------- X {array-like, sparse matrix}, shape (m, n) Data matrix to be decomposed. y None Ignored X_test {array-like, coo sparse matrix}, shape (m, n) Data matrix for cross validation. X_BATCHES int, default: 1 Batches to split XT, increase this parameter in case out of memory error. THETA_BATCHES int, default: 1 Batches to split theta, increase this parameter in case out of memory error. early_stopping_rounds int, default: None Activates early stopping. Cross validation error needs to decrease at least every <early_stopping_rounds> round(s) to continue training. Requires <X_test>. Returns the model from the last iteration (not the best one). If early stopping occurs, the model will have three additional fields: best_cv_score, best_train_score and best_iteration. verbose bool, default: False Prints training and validation score(if applicable) on each iteration. scores {list} List of tuples with train, cv score for every iteration. Returns ------- self : returns an instance of self. ''' csc_X, csr_X, coo_X = _get_sparse_matrixes(X) if early_stopping_rounds is not None: assert X_test is not None, 'X_test is mandatory with early stopping' if X_test is not None: assert scipy.sparse.isspmatrix_coo( X_test), 'X_test must be a coo sparse scipy matrix' assert X.shape == X_test.shape assert X_test.dtype == self.dtype assert X.dtype == self.dtype coo_X_test = X_test lib = self._load_lib() if self.double_precision: make_data = lib.make_factorization_data_double run_step = lib.run_factorization_step_double factorization_score = lib.factorization_score_double copy_fecatorization_result = lib.copy_fecatorization_result_double free_data = lib.free_data_double else: make_data = lib.make_factorization_data_float run_step = lib.run_factorization_step_float factorization_score = lib.factorization_score_float copy_fecatorization_result = lib.copy_fecatorization_result_float free_data = lib.free_data_float m = coo_X.shape[0] n = coo_X.shape[1] nnz = csc_X.nnz if coo_X_test is None: nnz_test = 0 else: nnz_test = coo_X_test.nnz rs = np.random.RandomState(self.random_state) if self.thetaT is None: self.thetaT = rs.rand(n, self.f).astype(self.dtype) else: assert self.thetaT.dtype == self.dtype if self.XT is None: self.XT = rs.rand(m, self.f).astype(self.dtype) else: assert self.XT.dtype == self.dtype csrRowIndexDevicePtr = None csrColIndexDevicePtr = None csrValDevicePtr = None cscRowIndexDevicePtr = None cscColIndexDevicePtr = None cscValDevicePtr = None cooRowIndexDevicePtr = None cooColIndexDevicePtr = None cooValDevicePtr = None thetaTDevice = None XTDevice = None cooRowIndexTestDevicePtr = None cooColIndexTestDevicePtr = None cooValTestDevicePtr = None status, csrRowIndexDevicePtr, csrColIndexDevicePtr, csrValDevicePtr, \ cscRowIndexDevicePtr, cscColIndexDevicePtr, cscValDevicePtr, \ cooRowIndexDevicePtr, cooColIndexDevicePtr, cooValDevicePtr, \ thetaTDevice, XTDevice, cooRowIndexTestDevicePtr, \ cooColIndexTestDevicePtr, cooValTestDevicePtr = make_data( # pylint: disable=W0212 m, n, self.f, nnz, nnz_test, csr_X.indptr, csr_X.indices, csr_X.data, csc_X.indices, csc_X.indptr, csc_X.data, coo_X.row, coo_X.col, coo_X.data, self.thetaT, self.XT, coo_X_test.row if coo_X_test is not None else None, coo_X_test.col if coo_X_test is not None else None, coo_X_test.data if coo_X_test is not None else None, csrRowIndexDevicePtr, csrColIndexDevicePtr, csrValDevicePtr, cscRowIndexDevicePtr, cscColIndexDevicePtr, cscValDevicePtr, cooRowIndexDevicePtr, cooColIndexDevicePtr, cooValDevicePtr, thetaTDevice, XTDevice, cooRowIndexTestDevicePtr, cooColIndexTestDevicePtr, cooValTestDevicePtr) assert status == 0, 'Failure uploading the data' self.best_train_score = np.inf self.best_cv_score = np.inf self.best_iteration = -1 cv_score = train_score = np.inf for i in range(self.max_iter): status = run_step(m, n, self.f, nnz, self.lambda_, csrRowIndexDevicePtr, csrColIndexDevicePtr, csrValDevicePtr, cscRowIndexDevicePtr, cscColIndexDevicePtr, cscValDevicePtr, thetaTDevice, XTDevice, X_BATCHES, THETA_BATCHES) if verbose or scores is not None: result = factorization_score(m, n, self.f, nnz, self.lambda_, thetaTDevice, XTDevice, cooRowIndexDevicePtr, cooColIndexDevicePtr, cooValDevicePtr) train_score = result[0] if X_test is not None and (verbose or early_stopping_rounds is not None or scores is not None): result = factorization_score(m, n, self.f, nnz_test, self.lambda_, thetaTDevice, XTDevice, cooRowIndexTestDevicePtr, cooColIndexTestDevicePtr, cooValTestDevicePtr) cv_score = result[0] if verbose: print("iteration {0} train: {1} cv: {2}".format( i, train_score, cv_score)) if scores is not None: scores.append((train_score, cv_score)) if early_stopping_rounds is not None: if self.best_cv_score > cv_score: self.best_cv_score = cv_score self.best_train_score = train_score self.best_iteration = i if (i - self.best_iteration) > early_stopping_rounds: if verbose: print('best iteration:{0} train: {1} cv: {2}'.format( self.best_iteration, self.best_train_score, self.best_cv_score)) break lib.free_data_int(csrRowIndexDevicePtr) lib.free_data_int(csrColIndexDevicePtr) free_data(csrValDevicePtr) lib.free_data_int(cscRowIndexDevicePtr) lib.free_data_int(cscColIndexDevicePtr) free_data(cscValDevicePtr) lib.free_data_int(cooRowIndexDevicePtr) lib.free_data_int(cooColIndexDevicePtr) free_data(cooValDevicePtr) lib.free_data_int(cooRowIndexTestDevicePtr) lib.free_data_int(cooColIndexTestDevicePtr) free_data(cooValTestDevicePtr) copy_fecatorization_result(self.XT, XTDevice, m * self.f) copy_fecatorization_result(self.thetaT, thetaTDevice, n * self.f) free_data(thetaTDevice) free_data(XTDevice) return self def predict(self, X): '''Predict none zero elements of coo sparse matrix X according to the fitted model. Parameters ---------- X {array-like, sparse coo matrix} shape (m, n) Data matrix in coo format. Values are ignored. Returns ------- {array-like, sparse coo matrix} shape (m, n) Predicted values. ''' assert self.XT is not None and self.thetaT is not None, 'tranform is invoked on an unfitted model' assert scipy.sparse.isspmatrix_coo( X), 'convert X to coo sparse matrix' assert X.dtype == self.dtype a = np.take(self.XT, X.row, axis=0) b = np.take(self.thetaT, X.col, axis=0) val = np.sum(a * b, axis=1) return scipy.sparse.coo_matrix((val, (X.row, X.col)), shape=X.shape)
39.410095
137
0.574802
[ "Apache-2.0" ]
aaron8tang/h2o4gpu
src/interface_py/h2o4gpu/solvers/factorization.py
12,493
Python
# Copyright 2021 Arie Bregman # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import crayons import importlib import logging import os import sys from cinfo.config import Config from cinfo.exceptions import usage as usage_exc LOG = logging.getLogger(__name__) class Triager(object): def __init__(self, config_file, source_name=None, target_name=None): self.config_file = config_file self.source_name = source_name self.target_name = target_name self.workspace = os.path.join(os.path.expanduser('~'), '.cinfo') def load_config(self): self.config = Config(file=self.config_file) self.config.load() self.sources = self.config.data['sources'] self.targets = self.config.data['targets'] def pull(self): LOG.info("{}: {}".format( crayons.yellow("pulling information from the source"), self.source_name)) try: driver = getattr(importlib.import_module( "cinfo.drivers.{}".format(self.source['type'])), self.source['type'].capitalize())() except KeyError: LOG.error("{}: {}...exiting".format( crayons.red("No such source"), self.source)) sys.exit(2) self.data = driver.pull(self.source['url'], jobs=self.source['jobs']) if not self.data: LOG.warning("{}".format(crayons.red( "I've pulled nothing! outrageous!"))) self.write(self.data) def publish(self): LOG.info("{}: {}".format( crayons.yellow("publishing data to target"), self.target['url'])) try: publisher = getattr(importlib.import_module( "cinfo.drivers.{}".format(self.target['type'])), self.target['type'].capitalize())() except KeyError: LOG.error("{}: {}...exiting".format( crayons.red("No such target"), self.target)) sys.exit(2) publisher.publish(self.data) def write(self, data): pass def validate(self): if len(self.sources.keys()) > 1 and not self.source_name: LOG.error(usage_exc.multiple_options("source")) sys.exit(2) elif not self.source_name: self.source = list(self.sources.values())[0] else: try: self.source = self.sources[self.source_name] except KeyError: LOG.error(usage_exc.missing_value( self.source_name, [key for key in self.sources.keys()])) sys.exit(2) if len(self.targets.keys()) > 1 and not self.target: LOG.error(usage_exc.multiple_options("target")) sys.exit(2) elif not self.target_name: self.target = list(self.targets.values())[0] else: self.target = self.targets[self.target_name] def run(self): self.load_config() self.validate() self.pull() self.publish()
34.854369
78
0.591086
[ "Apache-2.0" ]
EliadCohen/cinfo
cinfo/triager.py
3,590
Python
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import kubernetes.client from kubernetes.client.rest import ApiException from kubernetes.client.models.apps_v1beta1_deployment_list import AppsV1beta1DeploymentList class TestAppsV1beta1DeploymentList(unittest.TestCase): """ AppsV1beta1DeploymentList unit test stubs """ def setUp(self): pass def tearDown(self): pass def testAppsV1beta1DeploymentList(self): """ Test AppsV1beta1DeploymentList """ # FIXME: construct object with mandatory attributes with example values #model = kubernetes.client.models.apps_v1beta1_deployment_list.AppsV1beta1DeploymentList() pass if __name__ == '__main__': unittest.main()
23
105
0.729469
[ "Apache-2.0" ]
dix000p/kubernetes-client
kubernetes/test/test_apps_v1beta1_deployment_list.py
1,035
Python
from src.engine.company_root import CompanyRoot from src.engine.company_root_simples import CompanyRootSimples from src.engine.partners import Partners from src.engine.company import Company from src.engine.company_tax_regime import CompanyTaxRegime from src.engine.ref_date import main as engine_ref_date from src.io.get_last_ref_date import main as get_last_ref_date def main(ref_date=None): ref_date = ref_date or get_last_ref_date() CompanyRoot(ref_date=ref_date).execute() Partners(ref_date=ref_date).execute() CompanyRootSimples(ref_date=ref_date).execute() CompanyTaxRegime(ref_date=ref_date).execute() Company(ref_date=ref_date).execute() engine_ref_date() if __name__ == '__main__': main()
32.956522
63
0.777045
[ "MIT" ]
libercapital/dados_publicos_cnpj_receita_federal
src/engine/main.py
758
Python
"""Top-level package for stringdb. Imports the api module""" from .api import * __author__ = """Peter C DeWeirdt""" __email__ = '[email protected]' __version__ = '0.1.5'
25.142857
60
0.710227
[ "MIT" ]
gpp-rnd/stringdb
stringdb/__init__.py
176
Python
""" python version compatibility code """ import functools import inspect import io import re import sys from contextlib import contextmanager from inspect import Parameter from inspect import signature import attr import py import _pytest from _pytest._io.saferepr import saferepr from _pytest.outcomes import fail from _pytest.outcomes import TEST_OUTCOME NOTSET = object() MODULE_NOT_FOUND_ERROR = ( "ModuleNotFoundError" if sys.version_info[:2] >= (3, 6) else "ImportError" ) if sys.version_info >= (3, 8): from importlib import metadata as importlib_metadata # noqa: F401 else: import importlib_metadata # noqa: F401 def _format_args(func): return str(signature(func)) # The type of re.compile objects is not exposed in Python. REGEX_TYPE = type(re.compile("")) def is_generator(func): genfunc = inspect.isgeneratorfunction(func) return genfunc and not iscoroutinefunction(func) def iscoroutinefunction(func): """ Return True if func is a coroutine function (a function defined with async def syntax, and doesn't contain yield), or a function decorated with @asyncio.coroutine. Note: copied and modified from Python 3.5's builtin couroutines.py to avoid importing asyncio directly, which in turns also initializes the "logging" module as a side-effect (see issue #8). """ return inspect.iscoroutinefunction(func) or getattr(func, "_is_coroutine", False) def getlocation(function, curdir=None): function = get_real_func(function) fn = py.path.local(inspect.getfile(function)) lineno = function.__code__.co_firstlineno if curdir is not None and fn.relto(curdir): fn = fn.relto(curdir) return "%s:%d" % (fn, lineno + 1) def num_mock_patch_args(function): """ return number of arguments used up by mock arguments (if any) """ patchings = getattr(function, "patchings", None) if not patchings: return 0 mock_sentinel = getattr(sys.modules.get("mock"), "DEFAULT", object()) ut_mock_sentinel = getattr(sys.modules.get("unittest.mock"), "DEFAULT", object()) return len( [ p for p in patchings if not p.attribute_name and (p.new is mock_sentinel or p.new is ut_mock_sentinel) ] ) def getfuncargnames(function, *, name: str = "", is_method=False, cls=None): """Returns the names of a function's mandatory arguments. This should return the names of all function arguments that: * Aren't bound to an instance or type as in instance or class methods. * Don't have default values. * Aren't bound with functools.partial. * Aren't replaced with mocks. The is_method and cls arguments indicate that the function should be treated as a bound method even though it's not unless, only in the case of cls, the function is a static method. The name parameter should be the original name in which the function was collected. @RonnyPfannschmidt: This function should be refactored when we revisit fixtures. The fixture mechanism should ask the node for the fixture names, and not try to obtain directly from the function object well after collection has occurred. """ # The parameters attribute of a Signature object contains an # ordered mapping of parameter names to Parameter instances. This # creates a tuple of the names of the parameters that don't have # defaults. try: parameters = signature(function).parameters except (ValueError, TypeError) as e: fail( "Could not determine arguments of {!r}: {}".format(function, e), pytrace=False, ) arg_names = tuple( p.name for p in parameters.values() if ( p.kind is Parameter.POSITIONAL_OR_KEYWORD or p.kind is Parameter.KEYWORD_ONLY ) and p.default is Parameter.empty ) if not name: name = function.__name__ # If this function should be treated as a bound method even though # it's passed as an unbound method or function, remove the first # parameter name. if is_method or ( cls and not isinstance(cls.__dict__.get(name, None), staticmethod) ): arg_names = arg_names[1:] # Remove any names that will be replaced with mocks. if hasattr(function, "__wrapped__"): arg_names = arg_names[num_mock_patch_args(function) :] return arg_names if sys.version_info < (3, 7): @contextmanager def nullcontext(): yield else: from contextlib import nullcontext # noqa def get_default_arg_names(function): # Note: this code intentionally mirrors the code at the beginning of getfuncargnames, # to get the arguments which were excluded from its result because they had default values return tuple( p.name for p in signature(function).parameters.values() if p.kind in (Parameter.POSITIONAL_OR_KEYWORD, Parameter.KEYWORD_ONLY) and p.default is not Parameter.empty ) _non_printable_ascii_translate_table = { i: "\\x{:02x}".format(i) for i in range(128) if i not in range(32, 127) } _non_printable_ascii_translate_table.update( {ord("\t"): "\\t", ord("\r"): "\\r", ord("\n"): "\\n"} ) def _translate_non_printable(s): return s.translate(_non_printable_ascii_translate_table) STRING_TYPES = bytes, str def _bytes_to_ascii(val): return val.decode("ascii", "backslashreplace") def ascii_escaped(val): """If val is pure ascii, returns it as a str(). Otherwise, escapes bytes objects into a sequence of escaped bytes: b'\xc3\xb4\xc5\xd6' -> '\\xc3\\xb4\\xc5\\xd6' and escapes unicode objects into a sequence of escaped unicode ids, e.g.: '4\\nV\\U00043efa\\x0eMXWB\\x1e\\u3028\\u15fd\\xcd\\U0007d944' note: the obvious "v.decode('unicode-escape')" will return valid utf-8 unicode if it finds them in bytes, but we want to return escaped bytes for any byte, even if they match a utf-8 string. """ if isinstance(val, bytes): ret = _bytes_to_ascii(val) else: ret = val.encode("unicode_escape").decode("ascii") return _translate_non_printable(ret) @attr.s class _PytestWrapper: """Dummy wrapper around a function object for internal use only. Used to correctly unwrap the underlying function object when we are creating fixtures, because we wrap the function object ourselves with a decorator to issue warnings when the fixture function is called directly. """ obj = attr.ib() def get_real_func(obj): """ gets the real function object of the (possibly) wrapped object by functools.wraps or functools.partial. """ start_obj = obj for i in range(100): # __pytest_wrapped__ is set by @pytest.fixture when wrapping the fixture function # to trigger a warning if it gets called directly instead of by pytest: we don't # want to unwrap further than this otherwise we lose useful wrappings like @mock.patch (#3774) new_obj = getattr(obj, "__pytest_wrapped__", None) if isinstance(new_obj, _PytestWrapper): obj = new_obj.obj break new_obj = getattr(obj, "__wrapped__", None) if new_obj is None: break obj = new_obj else: raise ValueError( ("could not find real function of {start}\nstopped at {current}").format( start=saferepr(start_obj), current=saferepr(obj) ) ) if isinstance(obj, functools.partial): obj = obj.func return obj def get_real_method(obj, holder): """ Attempts to obtain the real function object that might be wrapping ``obj``, while at the same time returning a bound method to ``holder`` if the original object was a bound method. """ try: is_method = hasattr(obj, "__func__") obj = get_real_func(obj) except Exception: # pragma: no cover return obj if is_method and hasattr(obj, "__get__") and callable(obj.__get__): obj = obj.__get__(holder) return obj def getfslineno(obj): # xxx let decorators etc specify a sane ordering obj = get_real_func(obj) if hasattr(obj, "place_as"): obj = obj.place_as fslineno = _pytest._code.getfslineno(obj) assert isinstance(fslineno[1], int), obj return fslineno def getimfunc(func): try: return func.__func__ except AttributeError: return func def safe_getattr(object, name, default): """ Like getattr but return default upon any Exception or any OutcomeException. Attribute access can potentially fail for 'evil' Python objects. See issue #214. It catches OutcomeException because of #2490 (issue #580), new outcomes are derived from BaseException instead of Exception (for more details check #2707) """ try: return getattr(object, name, default) except TEST_OUTCOME: return default def safe_isclass(obj): """Ignore any exception via isinstance on Python 3.""" try: return inspect.isclass(obj) except Exception: return False COLLECT_FAKEMODULE_ATTRIBUTES = ( "Collector", "Module", "Function", "Instance", "Session", "Item", "Class", "File", "_fillfuncargs", ) def _setup_collect_fakemodule(): from types import ModuleType import pytest pytest.collect = ModuleType("pytest.collect") pytest.collect.__all__ = [] # used for setns for attr_name in COLLECT_FAKEMODULE_ATTRIBUTES: setattr(pytest.collect, attr_name, getattr(pytest, attr_name)) class CaptureIO(io.TextIOWrapper): def __init__(self): super().__init__(io.BytesIO(), encoding="UTF-8", newline="", write_through=True) def getvalue(self): return self.buffer.getvalue().decode("UTF-8") class FuncargnamesCompatAttr: """ helper class so that Metafunc, Function and FixtureRequest don't need to each define the "funcargnames" compatibility attribute. """ @property def funcargnames(self): """ alias attribute for ``fixturenames`` for pre-2.3 compatibility""" import warnings from _pytest.deprecated import FUNCARGNAMES warnings.warn(FUNCARGNAMES, stacklevel=2) return self.fixturenames
29.682857
106
0.677544
[ "MIT" ]
robholt/pytest
src/_pytest/compat.py
10,389
Python
from neo4j import GraphDatabase from argparse import ArgumentParser from concurrent.futures import ThreadPoolExecutor,as_completed,thread import sys import csv from time import time PRACTICAL = 'practical' LOGICAL = 'logical' NETONLY = 'netonly' ALL = 'all' PRIVS = 'privileged' rans = None def time_to_str(total_time): hours, rem = divmod(total_time, 3600) minutes, seconds = divmod(rem, 60) return "{:0>2}:{:0>2}:{:05.2f}".format(int(hours), int(minutes), seconds) class ransomulator(object): def __init__(self,user,password,url,maxwaves,edges,simulate,start_hosts,workers=25): self.url = url self.username = user self.password = password self.use_encryption = False self.driver = None self.connected = False self.maxwaves = 1 if LOGICAL in simulate else maxwaves self.session = None self.edges = edges self.simulate = simulate self.workers = workers self.executor = ThreadPoolExecutor(max_workers=workers) self.start_hosts = start_hosts def connect(self): self.connected = False if self.driver is not None: self.driver.close() try: self.driver = GraphDatabase.driver( self.url, auth=(self.username, self.password), encrypted=self.use_encryption) self.connected = True print("Database Connection Successful.") except: self.connected = False print("Database Connection Failed.") return self.connected def get_start_computers(self): if(self.start_hosts == ALL): print("Collecting all computer nodes from database...") result = self.session.run("MATCH (c:Computer) RETURN DISTINCT id(c) AS computer_id, c.name AS computer_name") else: print("Collecting computer nodes who have privileged user session from database...") result = self.session.run("MATCH(g:Group)-[:AdminTo]->(c:Computer) WITH DISTINCT g MATCH ShortestPath((u:User)-[:MemberOf*0..]->(g)) WITH DISTINCT u as privU MATCH(c: Computer)-[: HasSession]->(privU) RETURN DISTINCT c.name AS computer_name") computers = [] for record in result: computers.append(record["computer_name"]) return computers def count_computers(self): result = self.session.run("MATCH (c:Computer) RETURN count(DISTINCT id(c)) as num_computers") for record in result: return record['num_computers'] def generate_wave_query_string(self): if LOGICAL in self.simulate: return 'MATCH shortestPath((src:Computer)-[: HasSession | MemberOf | AdminTo * 1..]->(dest:Computer)) WHERE src <> dest AND src.name IN $last_wave AND NOT dest IN $last_wave RETURN COLLECT(DISTINCT(dest.name)) AS next_wave' elif NETONLY in self.simulate: return 'MATCH (src:Computer)-[:Open]->(dest:Computer) WHERE src.name IN $last_wave AND NOT dest.name IN $last_wave RETURN COLLECT(DISTINCT(dest.name)) AS next_wave' elif PRACTICAL in self.simulate: return 'MATCH (src:Computer)-[:Open]->(dest:Computer) WHERE src.name IN $last_wave AND NOT dest.name IN $last_wave WITH src,dest MATCH (src)-[:HasSession]->(u:User) WITH dest,u MATCH shortestPath((u)-[:MemberOf|AdminTo*1..]->(dest)) RETURN COLLECT(DISTINCT(dest.name)) AS next_wave' else: return None def simulate_wave_for_computer(self,computer_name): last_wave = [computer_name] computer_waves = [computer_name] waves = [] total = 0 for wave in range(self.maxwaves): w_str = self.generate_wave_query_string() mysession = self.driver.session() result = mysession.run(w_str,last_wave=last_wave) for record in result: next_wave = record["next_wave"] wave_size = len(next_wave) total += wave_size waves.append(str(wave_size)) last_wave += next_wave if wave_size == 0: mysession.close() return total,waves computer_waves.append(last_wave.copy()) mysession.close() return total,waves def somulate(self): waves_dict = {} max_wavelen = 0 avg_wavelen = 0 max_total = 0 total_comps= 0 computers_in_environment = 0 score = 0 try: if not self.connected: print("Can't simulate without a valid DB connection!") else: self.session = self.driver.session() computers = self.get_start_computers() print("Running simulation...") computers_in_environment = self.count_computers() future_to_totals_waves_pairs = {self.executor.submit(self.simulate_wave_for_computer,computer): computer for computer in computers} for future in as_completed(future_to_totals_waves_pairs): computer = future_to_totals_waves_pairs[future] try: total_waves_pair = future.result() total = total_waves_pair[0] waves = total_waves_pair[1] score += total if total > 0: total_comps += 1 if len(waves) > max_wavelen: max_wavelen = len(waves) if total > max_total: max_total = total avg_wavelen += len(waves) waves_dict[computer] = {"total":total,"waves":waves} print("{},{},{}".format(computer,str(total),",".join(waves))) else: waves_dict[computer] = {"total": 0, "waves": ['0']} print("{} - no waves".format(computer)) except Exception as exc: print('Exception while processing %s: %s' % (computer, exc)) if total_comps > 0: avg_wavelen = avg_wavelen / total_comps score = round((score / (computers_in_environment**2))*100) else: avg_wavelen = 0 sorted_waves = {k: v for k,v in sorted(waves_dict.items(),key=lambda item: item[1]["total"],reverse=True)} return sorted_waves,max_wavelen,avg_wavelen,max_total,total_comps,computers_in_environment,score except Exception as err: print("Error during simulation: {}".format(err)) def get_waves_for_computer(self, computer): try: if not self.connected: print("Can't create query without a valid DB connection!") else: self.session = self.driver.session() total,waves,computer_waves = self.simulate_wave_for_computer(computer) return computer_waves except Exception as err: print("Error during simulation: {}".format(err)) def stop(self): print("Stopping execution...") self.executor._threads.clear() thread._threads_queues.clear() print("Execution stopped...") def output_csv(file_path,wv_dict,max_wave_len): print("Writing results to file {}".format(file_path)) with open(file_path,'w',encoding="utf-8",newline='') as csvfile: wave_headers = ['wave_' + str(x + 1) for x in range(max_wave_len)] header = ['Hostname','Total'] + wave_headers writer = csv.writer(csvfile, delimiter=',') writer.writerow(header) for k in wv_dict: row = [k,wv_dict[k]["total"]] + wv_dict[k]["waves"] writer.writerow(row) def simulate(user,password,url,maxwaves,edges,simulate,workers,start_hosts): global rans start_time = time() rans = ransomulator(user, password, url, maxwaves, edges, simulate,start_hosts,workers) if rans.connect(): sorted_waves, max_wavelen, avg_wavelen, max_total, total_comps, num_of_computers, score = rans.somulate() if outfile: output_csv(outfile, sorted_waves, max_wavelen) else: print("Error during connection...") elapsed = time_to_str(time() - start_time) print("Ransomulator done: {}".format(elapsed)) print("-----------------------------") print("Fragility score:\t{}%".format(score)) print("Max number of computers:\t{}".format(num_of_computers)) print("Total computers with paths:\t{}".format(total_comps)) print("Max compromised :\t{}".format(max_total)) print("Avg wave length:\t{}".format(round(avg_wavelen, 1))) print("Max wave length:\t{}".format(max_wavelen)) def create_query(computer,user, password, url, maxwaves, edges, simulate): if LOGICAL in simulate: return 'MATCH shortestPath((src:Computer)-[:HasSession|MemberOf|AdminTo* 1..]->(dest:Computer)) WHERE src <> dest AND src.name IN $last_wave AND NOT dest IN $last_wave RETURN COLLECT(DISTINCT(dest.name)) AS next_wave' elif NETONLY in simulate: return 'MATCH (src:Computer)-[:Open]->(dest:Computer) WHERE src.name IN $last_wave AND NOT dest.name IN $last_wave RETURN COLLECT(DISTINCT(dest.name)) AS next_wave' elif PRACTICAL in simulate: return 'MATCH (src:Computer)-[:Open]->(dest:Computer) WHERE src.name IN $last_wave AND NOT dest.name IN $last_wave WITH src,dest MATCH (src)-[:HasSession]->(u:User) WITH dest,u MATCH shortestPath((u)-[:MemberOf|AdminTo*1..]->(dest)) RETURN COLLECT(DISTINCT(dest.name)) AS next_wave' else: return None def parse_args(): parser = ArgumentParser(prog=ArgumentParser().prog,prefix_chars="-/",add_help=False,description="Simulate ransomware infection through Bloodhound's database") parser.add_argument('-h', '--help', '/?', '/h', '/help', action='help', help='show this help message and exit') parser.add_argument('-s', '--simulate', metavar='', dest='simulate', choices=[PRACTICAL, LOGICAL, NETONLY],default=LOGICAL,help='type of lateral movement to simulate. choices: [%(choices)s], (default: logical).') parser.add_argument('-c', '--computers', metavar='', dest='computers', choices=[ALL,PRIVS], default=ALL, help='which computer edges should be considered as the starting point. choices: [%(choices)s], (default: all)') parser.add_argument("-u", "--user", dest='user', metavar='', help="Neo4j DB user name", type=str, default="neo4j") parser.add_argument("-p", "--pass", dest='password', metavar='', help="Neo4j DB password", type=str,default="neo4j") parser.add_argument("-l", "--url", dest="url", metavar="", help="Neo4j URL", default="bolt://localhost:7687",type=str) parser.add_argument("-m", "--maxwaves", dest="maxwaves", type=int, default=3,help="maximal number of simulated attack waves") parser.add_argument("-o", "--output", dest='out_file', metavar='', help="output file name", type=str,default=None) parser.add_argument("-e","--edges", dest="edges", type=str,default="MemberOf",help="Logical edges between hosts") parser.add_argument("-w","--workers",dest="workers",type=int,default=25,help="Number of paraller queries to the database") subprasers = parser.add_subparsers(dest="command") # sim_parser = subprasers.add_parser('simulate',help='simulate infection waves') q_parser = subprasers.add_parser('query',help='generate Cypher query') q_parser.add_argument("computer", type=str, help="starting from computer name") # parser.add_argument("-a", "--all", dest="do_all", action="store_true", help="Run through all nodes") args = parser.parse_args() return args if __name__ == '__main__': try: args = parse_args() command = args.command sim = args.simulate user = args.user password = args.password url = args.url maxwaves = args.maxwaves edges = args.edges outfile = args.out_file workers = args.workers start_hosts = args.computers if command and "query" in command: computer = args.computer print(create_query(computer,user, password, url, maxwaves, edges, sim)) else: simulate(user, password, url, maxwaves, edges, sim,workers,start_hosts) except KeyboardInterrupt: print("Interrupted! exiting...") if rans: rans.stop() except Exception as err: print("Exception thrown: {}".format(err)) finally: sys.exit()
45.941818
294
0.620389
[ "Apache-2.0" ]
naul1/BloodHound-Tools
Ransomulator/ransomulator.py
12,634
Python
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from enum import Enum import pytest import aiohttp import asyncio import requests import time import unittest import os from datetime import datetime, timedelta from azure.core.exceptions import ( HttpResponseError, ResourceNotFoundError, ResourceExistsError, ClientAuthenticationError) from azure.core.pipeline.transport import AsyncioRequestsTransport from azure.core.pipeline.transport import AioHttpTransport from multidict import CIMultiDict, CIMultiDictProxy from azure.storage.blob.aio import ( BlobServiceClient, ContainerClient, BlobClient, upload_blob_to_url, download_blob_from_url, ) from azure.storage.blob import ( generate_blob_sas, generate_account_sas, generate_container_sas, BlobType, StorageErrorCode, BlobSasPermissions, ContainerSasPermissions, ContentSettings, BlobProperties, RetentionPolicy, AccessPolicy, ResourceTypes, AccountSasPermissions, StandardBlobTier) from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer from _shared.testcase import GlobalStorageAccountPreparer from _shared.asynctestcase import AsyncStorageTestCase # ------------------------------------------------------------------------------ TEST_CONTAINER_PREFIX = 'container' TEST_BLOB_PREFIX = 'blob' # ------------------------------------------------------------------------------ class AiohttpTestTransport(AioHttpTransport): """Workaround to vcrpy bug: https://github.com/kevin1024/vcrpy/pull/461 """ async def send(self, request, **config): response = await super(AiohttpTestTransport, self).send(request, **config) if not isinstance(response.headers, CIMultiDictProxy): response.headers = CIMultiDictProxy(CIMultiDict(response.internal_response.headers)) response.content_type = response.headers.get("content-type") return response class StorageCommonBlobTestAsync(AsyncStorageTestCase): # --Helpers----------------------------------------------------------------- async def _setup(self, name, key): self.bsc = BlobServiceClient(self.account_url(name, "blob"), credential=key, transport=AiohttpTestTransport()) self.container_name = self.get_resource_name('utcontainer') self.byte_data = self.get_random_bytes(1024) if self.is_live: container = self.bsc.get_container_client(self.container_name) try: await container.create_container(timeout=5) except ResourceExistsError: pass async def _setup_remote(self, name, key): self.bsc2 = BlobServiceClient(self.account_url(name, "blob"), credential=key) self.remote_container_name = 'rmt' def _teardown(self, FILE_PATH): if os.path.isfile(FILE_PATH): try: os.remove(FILE_PATH) except: pass def _get_container_reference(self): return self.get_resource_name(TEST_CONTAINER_PREFIX) def _get_blob_reference(self): return self.get_resource_name(TEST_BLOB_PREFIX) async def _create_block_blob(self): blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(self.byte_data, length=len(self.byte_data)) return blob_name async def _create_remote_container(self): self.remote_container_name = self.get_resource_name('remotectnr') remote_container = self.bsc2.get_container_client(self.remote_container_name) try: await remote_container.create_container() except ResourceExistsError: pass async def _create_remote_block_blob(self, blob_data=None): if not blob_data: blob_data = b'12345678' * 1024 * 1024 source_blob_name = self._get_blob_reference() source_blob = self.bsc2.get_blob_client(self.remote_container_name, source_blob_name) await source_blob.upload_blob(blob_data, overwrite=True) return source_blob async def _wait_for_async_copy(self, blob): count = 0 props = await blob.get_blob_properties() while props.copy.status == 'pending': count = count + 1 if count > 10: self.fail('Timed out waiting for async copy to complete.') self.sleep(6) props = await blob.get_blob_properties() return props async def _enable_soft_delete(self): delete_retention_policy = RetentionPolicy(enabled=True, days=2) await self.bsc.set_service_properties(delete_retention_policy=delete_retention_policy) # wait until the policy has gone into effect if self.is_live: time.sleep(30) async def _disable_soft_delete(self): delete_retention_policy = RetentionPolicy(enabled=False) await self.bsc.set_service_properties(delete_retention_policy=delete_retention_policy) def _assert_blob_is_soft_deleted(self, blob): self.assertTrue(blob.deleted) self.assertIsNotNone(blob.deleted_time) self.assertIsNotNone(blob.remaining_retention_days) def _assert_blob_not_soft_deleted(self, blob): self.assertFalse(blob.deleted) self.assertIsNone(blob.deleted_time) self.assertIsNone(blob.remaining_retention_days) # -- Common test cases for blobs ---------------------------------------------- @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_blob_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) exists = await blob.get_blob_properties() # Assert self.assertTrue(exists) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_blob_not_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) with self.assertRaises(ResourceNotFoundError): await blob.get_blob_properties() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_blob_snapshot_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snapshot = await blob.create_snapshot() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=snapshot) exists = await blob.get_blob_properties() # Assert self.assertTrue(exists) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_blob_snapshot_not_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot="1988-08-18T07:52:31.6690068Z") with self.assertRaises(ResourceNotFoundError): await blob.get_blob_properties() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_blob_container_not_exists(self, resource_group, location, storage_account, storage_account_key): # In this case both the blob and container do not exist # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() # Act blob = self.bsc.get_blob_client(self._get_container_reference(), blob_name) with self.assertRaises(ResourceNotFoundError): await blob.get_blob_properties() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_question_mark(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = '?ques?tion?' blob_data = u'???' # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(blob_data) # Assert stream = await blob.download_blob() data = await stream.readall() self.assertIsNotNone(data) content = data.decode('utf-8') self.assertEqual(content, blob_data) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_special_chars(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) # Act for c in '-._ /()$=\',~': blob_name = '{0}a{0}a{0}'.format(c) blob_data = c blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(blob_data, length=len(blob_data)) data = await (await blob.download_blob()).readall() content = data.decode('utf-8') self.assertEqual(content, blob_data) # Assert @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_lease_id(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() # Act data = b'hello world again' resp = await blob.upload_blob(data, length=len(data), lease=lease) # Assert self.assertIsNotNone(resp.get('etag')) stream = await blob.download_blob(lease=lease) content = await stream.readall() self.assertEqual(content, data) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() metadata = {'hello': 'world', 'number': '42'} # Act data = b'hello world' blob = self.bsc.get_blob_client(self.container_name, blob_name) resp = await blob.upload_blob(data, length=len(data), metadata=metadata) # Assert self.assertIsNotNone(resp.get('etag')) md = (await blob.get_blob_properties()).metadata self.assertDictEqual(md, metadata) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_generator_async(self, resource_group, location, storage_account, storage_account_key): await self._setup(storage_account.name, storage_account_key) # Act def gen(): yield "hello" yield "world!" yield " eom" blob = self.bsc.get_blob_client(self.container_name, "gen_blob") resp = await blob.upload_blob(data=gen()) # Assert self.assertIsNotNone(resp.get('etag')) content = await (await blob.download_blob()).readall() self.assertEqual(content, b"helloworld! eom") @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_requests_async(self, resource_group, location, storage_account, storage_account_key): await self._setup(storage_account.name, storage_account_key) # Act uri = "http://www.gutenberg.org/files/59466/59466-0.txt" data = requests.get(uri, stream=True) blob = self.bsc.get_blob_client(self.container_name, "gutenberg") resp = await blob.upload_blob(data=data.raw) self.assertIsNotNone(resp.get('etag')) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_aiohttp_async(self, resource_group, location, storage_account, storage_account_key): await self._setup(storage_account.name, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, "gutenberg") # Act uri = "http://www.gutenberg.org/files/59466/59466-0.txt" async with aiohttp.ClientSession() as session: async with session.get(uri) as data: async for text, _ in data.content.iter_chunks(): resp = await blob.upload_blob(data=text) self.assertIsNotNone(resp.get('etag')) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) stream = await blob.download_blob() content = await stream.readall() # Assert self.assertEqual(content, self.byte_data) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snap = await blob.create_snapshot() snapshot = self.bsc.get_blob_client( self.container_name, blob_name, snapshot=snap) # Act stream = await snapshot.download_blob() content = await stream.readall() # Assert self.assertEqual(content, self.byte_data) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_snapshot_previous(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snap = await blob.create_snapshot() snapshot = self.bsc.get_blob_client( self.container_name, blob_name, snapshot=snap) upload_data = b'hello world again' await blob.upload_blob(upload_data, length=len(upload_data), overwrite=True) # Act blob_previous = await snapshot.download_blob() blob_previous_bytes = await blob_previous.readall() blob_latest = await blob.download_blob() blob_latest_bytes = await blob_latest.readall() # Assert self.assertEqual(blob_previous_bytes, self.byte_data) self.assertEqual(blob_latest_bytes, b'hello world again') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_range(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) stream = await blob.download_blob(offset=0, length=5) content = await stream.readall() # Assert self.assertEqual(content, self.byte_data[:5]) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_lease(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() # Act stream = await blob.download_blob(lease=lease) content = await stream.readall() await lease.release() # Assert self.assertEqual(content, self.byte_data) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_non_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) with self.assertRaises(ResourceNotFoundError): await blob.download_blob() # Assert @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_properties_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.set_http_headers( content_settings=ContentSettings( content_language='spanish', content_disposition='inline'), ) # Assert props = await blob.get_blob_properties() self.assertEqual(props.content_settings.content_language, 'spanish') self.assertEqual(props.content_settings.content_disposition, 'inline') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_properties_with_blob_settings_param(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) props = await blob.get_blob_properties() # Act props.content_settings.content_language = 'spanish' props.content_settings.content_disposition = 'inline' await blob.set_http_headers(content_settings=props.content_settings) # Assert props = await blob.get_blob_properties() self.assertEqual(props.content_settings.content_language, 'spanish') self.assertEqual(props.content_settings.content_disposition, 'inline') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) props = await blob.get_blob_properties() # Assert self.assertIsInstance(props, BlobProperties) self.assertEqual(props.blob_type, BlobType.BlockBlob) self.assertEqual(props.size, len(self.byte_data)) self.assertEqual(props.lease.status, 'unlocked') self.assertIsNotNone(props.creation_time) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=1) with self.assertRaises(HttpResponseError) as e: await blob.get_blob_properties() # Invalid snapshot value of 1 # Assert # TODO: No error code returned # self.assertEqual(StorageErrorCode.invalid_query_parameter_value, e.exception.error_code) # This test is to validate that the ErrorCode is retrieved from the header during a # GET request. This is preferred to relying on the ErrorCode in the body. @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=1) with self.assertRaises(HttpResponseError) as e: (await blob.get_blob_properties()).metadata # Invalid snapshot value of 1 # Assert # TODO: No error code returned # self.assertEqual(StorageErrorCode.invalid_query_parameter_value, e.exception.error_code) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_server_encryption(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) data = await blob.download_blob() # Assert self.assertTrue(data.properties.server_encrypted) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_server_encryption(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) props = await blob.get_blob_properties() # Assert self.assertTrue(props.server_encrypted) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_server_encryption(self, resource_group, location, storage_account, storage_account_key): # test can only run live # Arrange await self._setup(storage_account.name, storage_account_key) await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob_list = [] async for b in container.list_blobs(): blob_list.append(b) # Act # Assert for blob in blob_list: self.assertTrue(blob.server_encrypted) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_no_server_encryption(self, resource_group, location, storage_account, storage_account_key): pytest.skip("Aiohttp headers dict (CIMultiDictProxy) is immutable.") # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act def callback(response): response.http_response.headers['x-ms-server-encrypted'] = 'false' props = await blob.get_blob_properties(raw_response_hook=callback) # Assert self.assertFalse(props.server_encrypted) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = self.bsc.get_blob_client(self.container_name, blob_name) res = await blob.create_snapshot() blobs = [] async for b in container.list_blobs(include='snapshots'): blobs.append(b) self.assertEqual(len(blobs), 2) # Act snapshot = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=res) props = await snapshot.get_blob_properties() # Assert self.assertIsNotNone(blob) self.assertEqual(props.blob_type, BlobType.BlockBlob) self.assertEqual(props.size, len(self.byte_data)) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_leased_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() # Act props = await blob.get_blob_properties() # Assert self.assertIsInstance(props, BlobProperties) self.assertEqual(props.blob_type, BlobType.BlockBlob) self.assertEqual(props.size, len(self.byte_data)) self.assertEqual(props.lease.status, 'locked') self.assertEqual(props.lease.state, 'leased') self.assertEqual(props.lease.duration, 'infinite') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) md = (await blob.get_blob_properties()).metadata # Assert self.assertIsNotNone(md) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_upper_case(self, resource_group, location, storage_account, storage_account_key): # bug in devtools...converts upper case header to lowercase # passes live. # Arrange await self._setup(storage_account.name, storage_account_key) metadata = {'hello': 'world', 'number': '42', 'UP': 'UPval'} blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.set_blob_metadata(metadata) # Assert md = (await blob.get_blob_properties()).metadata self.assertEqual(3, len(md)) self.assertEqual(md['hello'], 'world') self.assertEqual(md['number'], '42') self.assertEqual(md['UP'], 'UPval') self.assertFalse('up' in md) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) resp = await blob.delete_blob() # Assert self.assertIsNone(resp) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_non_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) with self.assertRaises(ResourceNotFoundError): await blob.delete_blob() # Assert @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snap = await blob.create_snapshot() snapshot = self.bsc.get_blob_client( self.container_name, blob_name, snapshot=snap) # Act await snapshot.delete_blob() # Assert container = self.bsc.get_container_client(self.container_name) blobs = [] async for b in container.list_blobs(include='snapshots'): blobs.append(b) self.assertEqual(len(blobs), 1) self.assertEqual(blobs[0].name, blob_name) self.assertIsNone(blobs[0].snapshot) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_snapshots(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.create_snapshot() # Act await blob.delete_blob(delete_snapshots='only') # Assert container = self.bsc.get_container_client(self.container_name) blobs = [] async for b in container.list_blobs(include='snapshots'): blobs.append(b) self.assertEqual(len(blobs), 1) self.assertIsNone(blobs[0].snapshot) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_snapshots(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.create_snapshot() # Act # with self.assertRaises(HttpResponseError): # blob.delete_blob() await blob.delete_blob(delete_snapshots='include') # Assert container = self.bsc.get_container_client(self.container_name) blobs = [] async for b in container.list_blobs(include='snapshots'): blobs.append(b) self.assertEqual(len(blobs), 0) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_soft_delete_blob_without_snapshots(self, resource_group, location, storage_account, storage_account_key): try: # Arrange await self._setup(storage_account.name, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = container.get_blob_client(blob_name) # Soft delete the blob await blob.delete_blob() blob_list = [] async for b in container.list_blobs(include='deleted'): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 1) self._assert_blob_is_soft_deleted(blob_list[0]) # list_blobs should not list soft deleted blobs if Include(deleted=True) is not specified blob_list = [] async for b in container.list_blobs(): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 0) # Restore blob with undelete await blob.undelete_blob() blob_list = [] async for b in container.list_blobs(include='deleted'): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 1) self._assert_blob_not_soft_deleted(blob_list[0]) finally: await self._disable_soft_delete() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_soft_delete_single_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): try: # Arrange await self._setup(storage_account.name, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob_snapshot_1 = await blob.create_snapshot() blob_snapshot_2 = await blob.create_snapshot() # Soft delete blob_snapshot_1 snapshot_1 = self.bsc.get_blob_client( self.container_name, blob_name, snapshot=blob_snapshot_1) await snapshot_1.delete_blob() with self.assertRaises(ValueError): await snapshot_1.delete_blob(delete_snapshots='only') container = self.bsc.get_container_client(self.container_name) blob_list = [] async for b in container.list_blobs(include=["snapshots", "deleted"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 3) for listedblob in blob_list: if listedblob.snapshot == blob_snapshot_1['snapshot']: self._assert_blob_is_soft_deleted(listedblob) else: self._assert_blob_not_soft_deleted(listedblob) # list_blobs should not list soft deleted blob snapshots if Include(deleted=True) is not specified blob_list = [] async for b in container.list_blobs(include='snapshots'): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 2) # Restore snapshot with undelete await blob.undelete_blob() blob_list = [] async for b in container.list_blobs(include=["snapshots", "deleted"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 3) for blob in blob_list: self._assert_blob_not_soft_deleted(blob) finally: await self._disable_soft_delete() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_soft_delete_only_snapshots_of_blob(self, resource_group, location, storage_account, storage_account_key): try: # Arrange await self._setup(storage_account.name, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob_snapshot_1 = await blob.create_snapshot() blob_snapshot_2 = await blob.create_snapshot() # Soft delete all snapshots await blob.delete_blob(delete_snapshots='only') container = self.bsc.get_container_client(self.container_name) blob_list = [] async for b in container.list_blobs(include=["snapshots", "deleted"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 3) for listedblob in blob_list: if listedblob.snapshot == blob_snapshot_1['snapshot']: self._assert_blob_is_soft_deleted(listedblob) elif listedblob.snapshot == blob_snapshot_2['snapshot']: self._assert_blob_is_soft_deleted(listedblob) else: self._assert_blob_not_soft_deleted(listedblob) # list_blobs should not list soft deleted blob snapshots if Include(deleted=True) is not specified blob_list = [] async for b in container.list_blobs(include="snapshots"): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 1) # Restore snapshots with undelete await blob.undelete_blob() blob_list = [] async for b in container.list_blobs(include=["snapshots", "deleted"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 3) for blob in blob_list: self._assert_blob_not_soft_deleted(blob) finally: await self._disable_soft_delete() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_soft_delete_blob_including_all_snapshots(self, resource_group, location, storage_account, storage_account_key): try: # Arrange await self._setup(storage_account.name, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob_snapshot_1 = await blob.create_snapshot() blob_snapshot_2 = await blob.create_snapshot() # Soft delete blob and all snapshots await blob.delete_blob(delete_snapshots='include') container = self.bsc.get_container_client(self.container_name) blob_list = [] async for b in container.list_blobs(include=["snapshots", "deleted"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 3) for listedblob in blob_list: self._assert_blob_is_soft_deleted(listedblob) # list_blobs should not list soft deleted blob snapshots if Include(deleted=True) is not specified blob_list = [] async for b in container.list_blobs(include=["snapshots"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 0) # Restore blob and snapshots with undelete await blob.undelete_blob() blob_list = [] async for b in container.list_blobs(include=["snapshots", "deleted"]): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 3) for blob in blob_list: self._assert_blob_not_soft_deleted(blob) finally: await self._disable_soft_delete() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_soft_delete_with_leased_blob(self, resource_group, location, storage_account, storage_account_key): try: # Arrange await self._setup(storage_account.name, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() # Soft delete the blob without lease_id should fail with self.assertRaises(HttpResponseError): await blob.delete_blob() # Soft delete the blob await blob.delete_blob(lease=lease) container = self.bsc.get_container_client(self.container_name) blob_list = [] async for b in container.list_blobs(include="deleted"): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 1) self._assert_blob_is_soft_deleted(blob_list[0]) # list_blobs should not list soft deleted blobs if Include(deleted=True) is not specified blob_list = [] async for b in container.list_blobs(): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 0) # Restore blob with undelete, this also gets rid of the lease await blob.undelete_blob() blob_list = [] async for b in container.list_blobs(include="deleted"): blob_list.append(b) # Assert self.assertEqual(len(blob_list), 1) self._assert_blob_not_soft_deleted(blob_list[0]) finally: await self._disable_soft_delete() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act sourceblob = '{0}/{1}/{2}'.format( self.account_url(storage_account.name, "blob"), self.container_name, blob_name) copyblob = self.bsc.get_blob_client(self.container_name, 'blob1copy') copy = await copyblob.start_copy_from_url(sourceblob) # Assert self.assertIsNotNone(copy) self.assertEqual(copy['copy_status'], 'success') self.assertFalse(isinstance(copy['copy_status'], Enum)) self.assertIsNotNone(copy['copy_id']) copy_content = await (await copyblob.download_blob()).readall() self.assertEqual(copy_content, self.byte_data) # @GlobalStorageAccountPreparer() # @AsyncStorageTestCase.await_prepared_test # TODO: external copy was supported since 2019-02-02 # async def test_copy_blob_with_external_blob_fails(self): # # Arrange # await self._setup() # source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt" # copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt') # # # Act # copy = await copied_blob.start_copy_from_url(source_blob) # self.assertEqual(copy['copy_status'], 'pending') # props = await self._wait_for_async_copy(copied_blob) # # # Assert # self.assertEqual(props.copy.status_description, '500 InternalServerError "Copy failed."') # self.assertEqual(props.copy.status, 'failed') # self.assertIsNotNone(props.copy.id) # # @record # def test_copy_blob_with_external_blob_fails(self): # loop = asyncio.get_event_loop() # loop.run_until_complete(self._test_copy_blob_with_external_blob_fails()) @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_async_private_blob_no_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob() # Act target_blob_name = 'targetblob' target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) # Assert with self.assertRaises(ResourceNotFoundError): await target_blob.start_copy_from_url(source_blob.url) @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_async_private_blob_with_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) sas_token = generate_blob_sas( source_blob.account_name, source_blob.container_name, source_blob.blob_name, snapshot=source_blob.snapshot, account_key=source_blob.credential.account_key, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) # Act target_blob_name = 'targetblob' target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) copy_resp = await target_blob.start_copy_from_url(blob.url) # Assert props = await self._wait_for_async_copy(target_blob) self.assertEqual(props.copy.status, 'success') actual_data = await (await target_blob.download_blob()).readall() self.assertEqual(actual_data, data) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_abort_copy_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt" copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt') # Act copy = await copied_blob.start_copy_from_url(source_blob) self.assertEqual(copy['copy_status'], 'pending') await copied_blob.abort_copy(copy) props = await self._wait_for_async_copy(copied_blob) self.assertEqual(props.copy.status, 'aborted') # Assert actual_data = await copied_blob.download_blob() bytes_data = await (await copied_blob.download_blob()).readall() self.assertEqual(bytes_data, b"") self.assertEqual(actual_data.properties.copy.status, 'aborted') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_abort_copy_blob_with_synchronous_copy_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) source_blob_name = await self._create_block_blob() source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) # Act target_blob_name = 'targetblob' target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) copy_resp = await target_blob.start_copy_from_url(source_blob.url) with self.assertRaises(HttpResponseError): await target_blob.abort_copy(copy_resp) # Assert self.assertEqual(copy_resp['copy_status'], 'success') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) resp = await blob.create_snapshot() # Assert self.assertIsNotNone(resp) self.assertIsNotNone(resp['snapshot']) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_acquire_and_release(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() await lease.release() lease2 = await blob.acquire_lease() # Assert self.assertIsNotNone(lease) self.assertIsNotNone(lease2) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_duration(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease(lease_duration=15) resp = await blob.upload_blob(b'hello 2', length=7, lease=lease) self.sleep(15) # Assert with self.assertRaises(HttpResponseError): await blob.upload_blob(b'hello 3', length=7, lease=lease) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_proposed_lease_id(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) lease_id = 'a0e6c241-96ea-45a3-a44b-6ae868bc14d0' lease = await blob.acquire_lease(lease_id=lease_id) # Assert self.assertEqual(lease.id, lease_id) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_change_lease_id(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) lease_id = 'a0e6c241-96ea-45a3-a44b-6ae868bc14d0' lease = await blob.acquire_lease() first_lease_id = lease.id await lease.change(lease_id) await lease.renew() # Assert self.assertNotEqual(first_lease_id, lease.id) self.assertEqual(lease.id, lease_id) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_break_period(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease(lease_duration=15) lease_time = await lease.break_lease(lease_break_period=5) resp = await blob.upload_blob(b'hello 2', length=7, lease=lease) self.sleep(5) with self.assertRaises(HttpResponseError): await blob.upload_blob(b'hello 3', length=7, lease=lease) # Assert self.assertIsNotNone(lease.id) self.assertIsNotNone(lease_time) self.assertIsNotNone(resp.get('etag')) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_acquire_and_renew(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() # Act blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() first_id = lease.id await lease.renew() # Assert self.assertEqual(first_id, lease.id) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_acquire_twice_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() # Act with self.assertRaises(HttpResponseError): await blob.acquire_lease() # Assert self.assertIsNotNone(lease.id) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_unicode_get_blob_unicode_name(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = '啊齄丂狛狜' blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(b'hello world') # Act stream = await blob.download_blob() content = await stream.readall() # Assert self.assertEqual(content, b'hello world') @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_blob_unicode_data(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act data = u'hello world啊齄丂狛狜' resp = await blob.upload_blob(data) # Assert self.assertIsNotNone(resp.get('etag')) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_no_sas_private_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act response = requests.get(blob.url) # Assert self.assertFalse(response.ok) self.assertNotEqual(-1, response.text.find('ResourceNotFound')) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_no_sas_public_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'a public blob can be read without a shared access signature' blob_name = 'blob1.txt' container_name = self._get_container_reference() try: container = await self.bsc.create_container(container_name, public_access='blob') except ResourceExistsError: container = self.bsc.get_container_client(container_name) blob = await container.upload_blob(blob_name, data) # Act response = requests.get(blob.url) # Assert self.assertTrue(response.ok) self.assertEqual(data, response.content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_public_access_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'public access blob' blob_name = 'blob1.txt' container_name = self._get_container_reference() try: container = await self.bsc.create_container(container_name, public_access='blob') except ResourceExistsError: container = self.bsc.get_container_client(container_name) blob = await container.upload_blob(blob_name, data) # Act service = BlobClient.from_blob_url(blob.url) # self._set_test_proxy(service, self.settings) content = await (await service.download_blob()).readall() # Assert self.assertEqual(data, content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) # Act service = BlobClient.from_blob_url(blob.url, credential=token) # self._set_test_proxy(service, self.settings) content = await (await service.download_blob()).readall() # Assert self.assertEqual(self.byte_data, content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_signed_identifier(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = self.bsc.get_blob_client(self.container_name, blob_name) access_policy = AccessPolicy() access_policy.start = datetime.utcnow() - timedelta(hours=1) access_policy.expiry = datetime.utcnow() + timedelta(hours=1) access_policy.permission = BlobSasPermissions(read=True) identifiers = {'testid': access_policy} resp = await container.set_container_access_policy(identifiers) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, policy_id='testid') # Act service = BlobClient.from_blob_url(blob.url, credential=token) # self._set_test_proxy(service, self.settings) result = await (await service.download_blob()).readall() # Assert self.assertEqual(self.byte_data, result) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_account_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() token = generate_account_sas( self.bsc.account_name, self.bsc.credential.account_key, ResourceTypes(container=True, object=True), AccountSasPermissions(read=True), datetime.utcnow() + timedelta(hours=1), ) # Act blob = BlobClient( self.bsc.url, container_name=self.container_name, blob_name=blob_name, credential=token) container = ContainerClient( self.bsc.url, container_name=self.container_name, credential=token) await container.get_container_properties() blob_response = requests.get(blob.url) container_response = requests.get(container.url, params={'restype': 'container'}) # Assert self.assertTrue(blob_response.ok) self.assertEqual(self.byte_data, blob_response.content) self.assertTrue(container_response.ok) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_token_credential(self, resource_group, location, storage_account, storage_account_key): await self._setup(storage_account.name, storage_account_key) token_credential = self.generate_oauth_token() # Action 1: make sure token works service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential, transport=AiohttpTestTransport()) result = await service.get_service_properties() self.assertIsNotNone(result) # Action 2: change token value to make request fail fake_credential = self.generate_fake_token() service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=fake_credential, transport=AiohttpTestTransport()) with self.assertRaises(ClientAuthenticationError): await service.get_service_properties() # Action 3: update token to make it working again service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential, transport=AiohttpTestTransport()) result = await service.get_service_properties() self.assertIsNotNone(result) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_shared_read_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only await self._setup(storage_account.name, storage_account_key) # Arrange blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) # Act sas_blob = BlobClient.from_blob_url(blob.url, credential=token) response = requests.get(sas_blob.url) # Assert response.raise_for_status() self.assertTrue(response.ok) self.assertEqual(self.byte_data, response.content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_shared_read_access_blob_with_content_query_params(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), cache_control='no-cache', content_disposition='inline', content_encoding='utf-8', content_language='fr', content_type='text', ) sas_blob = BlobClient.from_blob_url(blob.url, credential=token) # Act response = requests.get(sas_blob.url) # Assert response.raise_for_status() self.assertEqual(self.byte_data, response.content) self.assertEqual(response.headers['cache-control'], 'no-cache') self.assertEqual(response.headers['content-disposition'], 'inline') self.assertEqual(response.headers['content-encoding'], 'utf-8') self.assertEqual(response.headers['content-language'], 'fr') self.assertEqual(response.headers['content-type'], 'text') @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_shared_write_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) updated_data = b'updated blob data' blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(write=True), expiry=datetime.utcnow() + timedelta(hours=1), ) sas_blob = BlobClient.from_blob_url(blob.url, credential=token) # Act headers = {'x-ms-blob-type': 'BlockBlob'} response = requests.put(sas_blob.url, headers=headers, data=updated_data) # Assert response.raise_for_status() self.assertTrue(response.ok) data = await (await blob.download_blob()).readall() self.assertEqual(updated_data, data) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_shared_delete_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(delete=True), expiry=datetime.utcnow() + timedelta(hours=1), ) sas_blob = BlobClient.from_blob_url(blob.url, credential=token) # Act response = requests.delete(sas_blob.url) # Assert response.raise_for_status() self.assertTrue(response.ok) with self.assertRaises(HttpResponseError): await sas_blob.download_blob() @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_account_information(self, resource_group, location, storage_account, storage_account_key): # Act await self._setup(storage_account.name, storage_account_key) info = await self.bsc.get_account_information() # Assert self.assertIsNotNone(info.get('sku_name')) self.assertIsNotNone(info.get('account_kind')) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_account_information_with_container_name(self, resource_group, location, storage_account, storage_account_key): # Act # Container name gets ignored await self._setup(storage_account.name, storage_account_key) container = self.bsc.get_container_client("missing") info = await container.get_account_information() # Assert self.assertIsNotNone(info.get('sku_name')) self.assertIsNotNone(info.get('account_kind')) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_account_information_with_blob_name(self, resource_group, location, storage_account, storage_account_key): # Act # Both container and blob names get ignored await self._setup(storage_account.name, storage_account_key) blob = self.bsc.get_blob_client("missing", "missing") info = await blob.get_account_information() # Assert self.assertIsNotNone(info.get('sku_name')) self.assertIsNotNone(info.get('account_kind')) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_account_information_with_container_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) container = self.bsc.get_container_client(self.container_name) token = generate_container_sas( container.account_name, container.container_name, account_key=container.credential.account_key, permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) sas_container = ContainerClient.from_container_url(container.url, credential=token) # Act info = await sas_container.get_account_information() # Assert self.assertIsNotNone(info.get('sku_name')) self.assertIsNotNone(info.get('account_kind')) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_account_information_with_blob_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) sas_blob = BlobClient.from_blob_url(blob.url, credential=token) # Act info = await sas_blob.get_account_information() # Assert self.assertIsNotNone(info.get('sku_name')) self.assertIsNotNone(info.get('account_kind')) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) sas_token = generate_blob_sas( source_blob.account_name, source_blob.container_name, source_blob.blob_name, snapshot=source_blob.snapshot, account_key=source_blob.credential.account_key, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) FILE_PATH = '_to_file_with_sas.async.dat' blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) # Act await download_blob_from_url(blob.url, FILE_PATH) # Assert with open(FILE_PATH, 'rb') as stream: actual = stream.read() self.assertEqual(data, actual) self._teardown(FILE_PATH) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_credential(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'to_file_with_credential.async.dat' # Act await download_blob_from_url( source_blob.url, FILE_PATH, max_concurrency=2, credential=rmt_key) # Assert with open(FILE_PATH, 'rb') as stream: actual = stream.read() self.assertEqual(data, actual) self._teardown(FILE_PATH) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_download_to_stream_with_credential(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'to_stream_with_credential.async.dat' # Act with open(FILE_PATH, 'wb') as stream: await download_blob_from_url( source_blob.url, stream, max_concurrency=2, credential=rmt_key) # Assert with open(FILE_PATH, 'rb') as stream: actual = stream.read() self.assertEqual(data, actual) self._teardown(FILE_PATH) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_existing_file(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'with_existing_file.async.dat' # Act await download_blob_from_url( source_blob.url, FILE_PATH, credential=rmt_key) with self.assertRaises(ValueError): await download_blob_from_url(source_blob.url, FILE_PATH) # Assert with open(FILE_PATH, 'rb') as stream: actual = stream.read() self.assertEqual(data, actual) self._teardown(FILE_PATH) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_existing_file_overwrite(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'existing_file_overwrite.async.dat' # Act await download_blob_from_url( source_blob.url, FILE_PATH, credential=rmt_key) data2 = b'ABCDEFGH' * 1024 * 1024 source_blob = await self._create_remote_block_blob(blob_data=data2) await download_blob_from_url( source_blob.url, FILE_PATH, overwrite=True, credential=rmt_key) # Assert with open(FILE_PATH, 'rb') as stream: actual = stream.read() self.assertEqual(data2, actual) self._teardown(FILE_PATH) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_upload_to_url_bytes_with_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) token = generate_blob_sas( blob.account_name, blob.container_name, blob.blob_name, snapshot=blob.snapshot, account_key=blob.credential.account_key, permission=BlobSasPermissions(write=True), expiry=datetime.utcnow() + timedelta(hours=1), ) sas_blob = BlobClient.from_blob_url(blob.url, credential=token) # Act uploaded = await upload_blob_to_url(sas_blob.url, data) # Assert self.assertIsNotNone(uploaded) content = await (await blob.download_blob()).readall() self.assertEqual(data, content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_upload_to_url_bytes_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act uploaded = await upload_blob_to_url( blob.url, data, credential=storage_account_key) # Assert self.assertIsNotNone(uploaded) content = await (await blob.download_blob()).readall() self.assertEqual(data, content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_upload_to_url_bytes_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(b"existing_data") # Act with self.assertRaises(ResourceExistsError): await upload_blob_to_url( blob.url, data, credential=storage_account_key) # Assert content = await (await blob.download_blob()).readall() self.assertEqual(b"existing_data", content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_upload_to_url_bytes_with_existing_blob_overwrite(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(b"existing_data") # Act uploaded = await upload_blob_to_url( blob.url, data, overwrite=True, credential=storage_account_key) # Assert self.assertIsNotNone(uploaded) content = await (await blob.download_blob()).readall() self.assertEqual(data, content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_upload_to_url_text_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) data = '12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act uploaded = await upload_blob_to_url( blob.url, data, credential=storage_account_key) # Assert self.assertIsNotNone(uploaded) stream = await blob.download_blob(encoding='UTF-8') content = await stream.readall() self.assertEqual(data, content) @pytest.mark.live_test_only @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_upload_to_url_file_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 FILE_PATH = 'url_file_with_credential.async.dat' with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act with open(FILE_PATH, 'rb'): uploaded = await upload_blob_to_url( blob.url, data, credential=storage_account_key) # Assert self.assertIsNotNone(uploaded) content = await (await blob.download_blob()).readall() self.assertEqual(data, content) self._teardown(FILE_PATH) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_transport_closed_only_once(self, resource_group, location, storage_account, storage_account_key): container_name = self.get_resource_name('utcontainerasync') transport = AioHttpTransport() bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=transport) blob_name = self._get_blob_reference() async with bsc: await bsc.get_service_properties() assert transport.session is not None async with bsc.get_blob_client(container_name, blob_name) as bc: assert transport.session is not None await bsc.get_service_properties() assert transport.session is not None # ------------------------------------------------------------------------------
40.261036
149
0.685593
[ "MIT" ]
hytao/azure-sdk-for-python
sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
83,924
Python
#!/usr/bin/env python # # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utility script to install APKs from the command line quickly.""" import argparse import glob import logging import os import sys import devil_chromium from devil.android import apk_helper from devil.android import device_blacklist from devil.android import device_errors from devil.android import device_utils from devil.utils import run_tests_helper from pylib import constants def main(): parser = argparse.ArgumentParser() apk_group = parser.add_mutually_exclusive_group(required=True) apk_group.add_argument('--apk', dest='apk_name', help='DEPRECATED The name of the apk containing the' ' application (with the .apk extension).') apk_group.add_argument('apk_path', nargs='?', help='The path to the APK to install.') # TODO(jbudorick): Remove once no clients pass --apk_package parser.add_argument('--apk_package', help='DEPRECATED unused') parser.add_argument('--split', action='append', dest='splits', help='A glob matching the apk splits. ' 'Can be specified multiple times.') parser.add_argument('--keep_data', action='store_true', default=False, help='Keep the package data when installing ' 'the application.') parser.add_argument('--debug', action='store_const', const='Debug', dest='build_type', default=os.environ.get('BUILDTYPE', 'Debug'), help='If set, run test suites under out/Debug. ' 'Default is env var BUILDTYPE or Debug') parser.add_argument('--release', action='store_const', const='Release', dest='build_type', help='If set, run test suites under out/Release. ' 'Default is env var BUILDTYPE or Debug.') parser.add_argument('-d', '--device', dest='devices', action='append', default=[], help='Target device for apk to install on. Enter multiple' ' times for multiple devices.') parser.add_argument('--adb-path', type=os.path.abspath, help='Absolute path to the adb binary to use.') parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') parser.add_argument('-v', '--verbose', action='count', help='Enable verbose logging.') parser.add_argument('--downgrade', action='store_true', help='If set, allows downgrading of apk.') parser.add_argument('--timeout', type=int, default=device_utils.DeviceUtils.INSTALL_DEFAULT_TIMEOUT, help='Seconds to wait for APK installation. ' '(default: %(default)s)') args = parser.parse_args() run_tests_helper.SetLogLevel(args.verbose) constants.SetBuildType(args.build_type) devil_chromium.Initialize( output_directory=constants.GetOutDirectory(), adb_path=args.adb_path) apk = args.apk_path or args.apk_name if not apk.endswith('.apk'): apk += '.apk' if not os.path.exists(apk): apk = os.path.join(constants.GetOutDirectory(), 'apks', apk) if not os.path.exists(apk): parser.error('%s not found.' % apk) if args.splits: splits = [] base_apk_package = apk_helper.ApkHelper(apk).GetPackageName() for split_glob in args.splits: apks = [f for f in glob.glob(split_glob) if f.endswith('.apk')] if not apks: logging.warning('No apks matched for %s.', split_glob) for f in apks: helper = apk_helper.ApkHelper(f) if (helper.GetPackageName() == base_apk_package and helper.GetSplitName()): splits.append(f) blacklist = (device_blacklist.Blacklist(args.blacklist_file) if args.blacklist_file else None) devices = device_utils.DeviceUtils.HealthyDevices(blacklist=blacklist, device_arg=args.devices) def blacklisting_install(device): try: if args.splits: device.InstallSplitApk(apk, splits, reinstall=args.keep_data, allow_downgrade=args.downgrade) else: device.Install(apk, reinstall=args.keep_data, allow_downgrade=args.downgrade, timeout=args.timeout) except device_errors.CommandFailedError: logging.exception('Failed to install %s', args.apk_name) if blacklist: blacklist.Extend([str(device)], reason='install_failure') logging.warning('Blacklisting %s', str(device)) except device_errors.CommandTimeoutError: logging.exception('Timed out while installing %s', args.apk_name) if blacklist: blacklist.Extend([str(device)], reason='install_timeout') logging.warning('Blacklisting %s', str(device)) device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) if __name__ == '__main__': sys.exit(main())
40.210526
80
0.618923
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Cela-Inc/WebARonARCore
build/android/adb_install_apk.py
5,348
Python
from cgi import parse_header from io import BytesIO from typing import Dict from typing import Optional from typing import Tuple from typing import Union from .headers import Headers from .http_method import HttpMethod from .message.body import RequestBody from .message.form_body import FormBody from .message.json_body import JsonBody from .message.multipart_body import MultipartBody from .query_string import QueryString class HttpRequest: def __init__( self, method: HttpMethod, uri: str = "/", body: Optional[BytesIO] = None, query_string: Optional[QueryString] = None, headers: Optional[Headers] = None, ): self.headers = headers if headers else Headers() self.body = body if body else BytesIO(b"") self.method = method self.uri = uri self.query_string = query_string self._parsed_body: Union[RequestBody, str] = "" self.attributes: Dict[str, str] = {} @property def parsed_body(self) -> Union[RequestBody, str]: if self._parsed_body: return self._parsed_body content_type: Tuple[str, Dict[str, str]] = parse_header( self.headers.get("Content-Type") # type: ignore ) if content_type[0] == "multipart/form-data": body: Union[RequestBody, str] = MultipartBody.from_wsgi( self.body, content_type[1].get("charset", ""), content_type[1].get("boundary", ""), ) elif content_type[0] == "application/x-www-form-urlencoded": body = FormBody.from_wsgi(self.body, content_type[1].get("charset", "")) elif content_type[0] == "application/json": body = JsonBody.from_wsgi(self.body, content_type[1].get("charset", "")) else: self.body.seek(0) body = self.body.read().decode(content_type[1].get("charset", "")) self._parsed_body = body return self._parsed_body @classmethod def from_wsgi(cls, environ: dict) -> "HttpRequest": headers = Headers() for key, value in environ.items(): if not key.startswith("HTTP"): continue headers.set(key, value) headers.set("Content-Type", environ.get("CONTENT_TYPE", "text/plain")) return cls( method=HttpMethod(environ.get("REQUEST_METHOD", "GET").upper()), uri=environ.get("PATH_INFO", "/"), body=environ.get("wsgi.input", BytesIO(b"")), query_string=QueryString(environ.get("QUERY_STRING", "")), headers=headers, ) __all__ = ["HttpRequest"]
33.35
84
0.612444
[ "MIT" ]
gezpage/chocs
chocs/http_request.py
2,668
Python
""" Reinforcement learning maze example. Red rectangle: explorer. Black rectangles: hells [reward = -1]. Yellow bin circle: paradise [reward = +1]. All other states: ground [reward = 0]. This script is the environment part of this example. The RL is in RL_brain.py. View more on my tutorial page: https://morvanzhou.github.io/tutorials/ """ import numpy as np import time import sys if sys.version_info.major == 2: import Tkinter as tk else: import tkinter as tk UNIT = 40 # pixels MAZE_H = 4 # grid height MAZE_W = 4 # grid width class Maze(tk.Tk, object): def __init__(self): super(Maze, self).__init__() self.action_space = ['u', 'd', 'l', 'r'] self.n_actions = len(self.action_space) self.title('maze') self.geometry('{0}x{1}'.format(MAZE_H * UNIT, MAZE_H * UNIT)) self._build_maze() def _build_maze(self): self.canvas = tk.Canvas(self, bg='white', height=MAZE_H * UNIT, width=MAZE_W * UNIT) # create grids for c in range(0, MAZE_W * UNIT, UNIT): x0, y0, x1, y1 = c, 0, c, MAZE_H * UNIT self.canvas.create_line(x0, y0, x1, y1) for r in range(0, MAZE_H * UNIT, UNIT): x0, y0, x1, y1 = 0, r, MAZE_W * UNIT, r self.canvas.create_line(x0, y0, x1, y1) # create origin origin = np.array([20, 20]) # hell hell1_center = origin + np.array([UNIT * 2, UNIT]) self.hell1 = self.canvas.create_rectangle( hell1_center[0] - 15, hell1_center[1] - 15, hell1_center[0] + 15, hell1_center[1] + 15, fill='black') # hell hell2_center = origin + np.array([UNIT, UNIT * 2]) self.hell2 = self.canvas.create_rectangle( hell2_center[0] - 15, hell2_center[1] - 15, hell2_center[0] + 15, hell2_center[1] + 15, fill='black') # create oval oval_center = origin + UNIT * 2 self.oval = self.canvas.create_oval( oval_center[0] - 15, oval_center[1] - 15, oval_center[0] + 15, oval_center[1] + 15, fill='yellow') # create red rect self.rect = self.canvas.create_rectangle( origin[0] - 15, origin[1] - 15, origin[0] + 15, origin[1] + 15, fill='red') # pack all self.canvas.pack() def reset(self): self.update() time.sleep(0.1) self.canvas.delete(self.rect) origin = np.array([20, 20]) self.rect = self.canvas.create_rectangle( origin[0] - 15, origin[1] - 15, origin[0] + 15, origin[1] + 15, fill='red') # return observation return self.canvas.coords(self.rect) def step(self, action): s = self.canvas.coords(self.rect) base_action = np.array([0, 0]) if action == 0: # up if s[1] > UNIT: base_action[1] -= UNIT elif action == 1: # down if s[1] < (MAZE_H - 1) * UNIT: base_action[1] += UNIT elif action == 2: # right if s[0] < (MAZE_W - 1) * UNIT: base_action[0] += UNIT elif action == 3: # left if s[0] > UNIT: base_action[0] -= UNIT self.canvas.move(self.rect, base_action[0], base_action[1]) # move agent s_ = self.canvas.coords(self.rect) # next state # reward function if s_ == self.canvas.coords(self.oval): reward = 1 done = True #s_ = 'terminal' elif s_ in [self.canvas.coords(self.hell1), self.canvas.coords(self.hell2)]: reward = -1 done = True #s_ = 'terminal' else: reward = 0 done = False return s_, reward, done def render(self): time.sleep(0.01) self.update() def update(): for t in range(10): s = env.reset() while True: env.render() a = 1 s, r, done = env.step(a) if done: break if __name__ == '__main__': env = Maze() env.after(100, update) env.mainloop()
29.121622
84
0.517633
[ "MIT" ]
zhao-jin/Reinforcement-learning-with-tensorflow
contents/2_Q_Learning_maze/maze_env.py
4,310
Python
import unittest from wiki_dump_reader import Cleaner class TestRemoveEmphasis(unittest.TestCase): def setUp(self): self.cleaner = Cleaner() def test_remove_emphasis_bold(self): text = "'''游戏工具编程'''是指采用各种开发工具进行开发修改[[电脑]]、[[电视]][[游戏]]的过程。主要的开发工具有以下几大类" expected = '游戏工具编程是指采用各种开发工具进行开发修改[[电脑]]、[[电视]][[游戏]]的过程。主要的开发工具有以下几大类' actual = self.cleaner._remove_emphasises(text) self.assertEqual(expected, actual) def test_remove_emphasis_italic(self): text = "'''臺灣藍鵲'''([[學名]]:''{{lang|la|Urocissa caerulea}}''),又稱'''臺灣暗藍鵲'''、'''紅嘴山鵲'''、" \ "'''長尾山娘'''([[臺灣閩南語羅馬字拼音方案|閩南語]]:{{Unicode|Tn̂g-bué Suann-niû}})或'''長尾陣仔''',為臺" \ "灣特有種鳥類。臺灣從[[臺灣清治時期|清領時期]]開始就有文獻紀載臺灣藍鵲的資料。1862年,鳥畫家[[约翰·古尔德]]根據英" \ "國博物學家[[郇和]]寄來的臺灣鳥類標本發表了一篇文章,命名並詳述16種新發現的台灣品種,其中就包含臺灣藍鵲。" expected = '臺灣藍鵲([[學名]]:{{lang|la|Urocissa caerulea}}),又稱臺灣暗藍鵲、紅嘴山鵲、長尾山娘([[臺灣閩南語羅馬' \ '字拼音方案|閩南語]]:{{Unicode|Tn̂g-bué Suann-niû}})或長尾陣仔,為臺灣特有種鳥類。臺灣從[[臺灣清治時期|清' \ '領時期]]開始就有文獻紀載臺灣藍鵲的資料。1862年,鳥畫家[[约翰·古尔德]]根據英國博物學家[[郇和]]寄來的臺灣鳥類' \ '標本發表了一篇文章,命名並詳述16種新發現的台灣品種,其中就包含臺灣藍鵲。' actual = self.cleaner._remove_emphasises(text) self.assertEqual(expected, actual)
47.518519
97
0.62198
[ "MIT" ]
CyberZHG/wiki-dump-reader
tests/test_remove_emphasises.py
2,079
Python
import sys from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(__file__)))) from SCZ_RNAseq.syn4590909.utils import * path="../../data/SCZ_RNAseq/output/syn4590909/" dataset="PPI" features = np.genfromtxt("{}{}.GE_Features.txt".format(path, dataset), dtype=np.dtype(np.float32)) labels = get_clinical_status_syn4590909() clusters = open("{}{}.clusters_individual_gene.txt".format(path, dataset), encoding="utf-8") total_clusters = get_top_clusters_without_network(path, dataset, features, labels, clusters) print("The complete set of clusters that passed the minimal threshold is \n {}".format(total_clusters)) with open("{}{}.top_features_individual_gene.txt".format(path, dataset), "w", newline='', encoding="utf-8") as f: w_top_clusters = csv.writer(f, delimiter ='\t') w_top_clusters.writerow(total_clusters) clust = [] nb_columns = len(labels) baseline_accuracy = 0 eps = 0.01 #minimum accuracy improvement to consider new cluster (1%) tmp_Data = object for i in range(len(total_clusters)): clust.append(total_clusters[i]) nb_rows = len(clust) Data = np.zeros((nb_rows, nb_columns), dtype=object) if(i>0):#if temporary Data vector exist, copy all lines except last for j in range(nb_rows-1): Data[j, :] = tmp_Data[j, :] #Just compute score of newly added cluster Data[-1, :] = prepare_activity_score_feature_vector(features, labels, clust[nb_rows-1], clusters) accuracy = logistic_regression_classification_aggregate_activity_scores(np.transpose(Data), labels) if( accuracy < baseline_accuracy + eps ): clust = clust[:-1] tmp_Data = Data tmp_Data = np.delete(tmp_Data, tmp_Data.shape[0]-1, axis=0) print("SFS: feature {}/{} checked and rejected".format(i, len(total_clusters)-1)) else: baseline_accuracy = accuracy tmp_Data = Data print("SFS: feature {}/{} checked and retained".format(i, len(total_clusters)-1)) print("The set of clusters to be used in classification is \n {}".format(clust)) with open("{}{}.final_features_individual_gene.txt".format(path, dataset), "w", newline='', encoding="utf-8") as f: w_final_clusters = csv.writer(f, delimiter ='\t') w_final_clusters.writerow(clust) print("Logistic regression accuracy: {}".format(accuracy)) #accuracy = LDA_classification_aggregate_activity_scores(np.transpose(Data), labels) #print("LDA accuracy: {}".format(accuracy)) #accuracy = SVM_classification_aggregate_activity_scores(np.transpose(Data), labels) #print("SVM(Linear Kernel) accuracy: {}".format(accuracy)) clusters.close()
42.0625
115
0.69948
[ "MIT" ]
omarmaddouri/GCNCC_cross_validated
scripts/SCZ_RNAseq/syn4590909/rank_individual_genes.py
2,692
Python
LATEST_VERSION = '4.2.0' def rule(event): return (event['name'] == 'pack_it-compliance_osquery_info' and event['columns']['version'] != LATEST_VERSION and event['action'] == 'added') def title(event): return 'Osquery Version {} is Outdated'.format( event['columns'].get('version'))
25.076923
66
0.613497
[ "Apache-2.0" ]
designing-penguin/panther-analysis
osquery_rules/osquery_outdated.py
326
Python
"""An filter that removes operators based on regular expressions. """ from argparse import Namespace import logging import re import sys from cosmic_ray.config import load_config from cosmic_ray.work_db import WorkDB from cosmic_ray.work_item import WorkerOutcome, WorkResult from cosmic_ray.tools.filters.filter_app import FilterApp log = logging.getLogger() class OperatorsFilter(FilterApp): "Implemenents the operators-filter." def description(self): return __doc__ def _skip_filtered(self, work_db, exclude_operators): if not exclude_operators: return re_exclude_operators = re.compile('|'.join('(:?%s)' % e for e in exclude_operators)) for item in work_db.pending_work_items: if re_exclude_operators.match(item.operator_name): log.info( "operator skipping %s %s %s %s %s %s", item.job_id, item.operator_name, item.occurrence, item.module_path, item.start_pos, item.end_pos, ) work_db.set_result( item.job_id, WorkResult( output="Filtered operator", worker_outcome=WorkerOutcome.SKIPPED, ), ) def filter(self, work_db: WorkDB, args: Namespace): """Mark as skipped all work item with filtered operator """ if args.config is None: config = work_db.get_config() else: config = load_config(args.config) exclude_operators = config.sub('filters', 'operators-filter').get('exclude-operators', ()) self._skip_filtered(work_db, exclude_operators) def add_args(self, parser): parser.add_argument('--config', help='Config file to use') def main(argv=None): """Run the operators-filter with the specified command line arguments. """ return OperatorsFilter().main(argv) if __name__ == '__main__': sys.exit(main())
29.647887
98
0.59905
[ "MIT" ]
Smirenost/cosmic-ray
src/cosmic_ray/tools/filters/operators_filter.py
2,105
Python
from userinput import userinput from ..utils import load_repository_author_name def get_package_author_name() -> str: """Return the package author name to be used.""" return userinput( name="python_package_author_name", label="Enter the python package author name to use.", default=load_repository_author_name(), validator="non_empty", sanitizer=[ "strip" ], cache=False )
26.764706
61
0.648352
[ "MIT" ]
LucaCappelletti94/setup_python_package
setup_python_package/queries/get_package_author_name.py
455
Python
#!/usr/bin/env python # coding: utf-8 # # This code is based on torchvison resnet # URL: https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py import torch.nn as nn import torch.utils.model_zoo as model_zoo __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth', 'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth', 'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth', 'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth', } def conv3x3(in_planes, out_planes, stride=1, padding=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, dilation=dilation, bias=False) def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride, dilation, downsample=None): super(BasicBlock, self).__init__() self.conv1 = conv3x3(inplanes, planes, stride) self.bn1 = nn.BatchNorm2d(planes) self.relu = nn.ReLU(inplace=True) self.conv2 = conv3x3(planes, planes, 1, dilation, dilation) self.bn2 = nn.BatchNorm2d(planes) self.downsample = downsample self.stride = stride def forward(self, x): residual = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) if self.downsample is not None: residual = self.downsample(x) out += residual out = self.relu(out) return out class Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride, dilation, downsample=None, expansion=4): super(Bottleneck, self).__init__() self.expansion = expansion self.conv1 = conv1x1(inplanes, planes) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = conv3x3(planes, planes, stride, dilation, dilation) self.bn2 = nn.BatchNorm2d(planes) self.conv3 = conv1x1(planes, planes * self.expansion) self.bn3 = nn.BatchNorm2d(planes * self.expansion) self.relu = nn.ReLU(inplace=True) self.downsample = downsample self.stride = stride def forward(self, x): residual = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) out = self.relu(out) out = self.conv3(out) out = self.bn3(out) if self.downsample is not None: residual = self.downsample(x) out += residual out = self.relu(out) return out class ResNet(nn.Module): def __init__(self, block, layers, output_stride, num_classes=1000, input_channels=3): super(ResNet, self).__init__() if output_stride == 8: stride = [1, 2, 1, 1] dilation = [1, 1, 2, 2] elif output_stride == 16: stride = [1, 2, 2, 1] dilation = [1, 1, 1, 2] self.inplanes = 64 self.conv1 = nn.Conv2d(input_channels, 64, kernel_size=7, stride=2, padding=3, bias=False) self.bn1 = nn.BatchNorm2d(64) self.relu = nn.ReLU(inplace=True) self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1) self.layer1 = self._make_layer(block, 64, layers[0], stride=stride[0], dilation=dilation[0]) self.layer2 = self._make_layer(block, 128, layers[1], stride=stride[1], dilation=dilation[1]) self.layer3 = self._make_layer(block, 256, layers[2], stride=stride[2], dilation=dilation[2]) self.layer4 = self._make_layer(block, 512, layers[3], stride=stride[3], dilation=dilation[3]) self.avgpool = nn.AdaptiveAvgPool2d((1, 1)) self.fc = nn.Linear(512 * block.expansion, num_classes) for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1) nn.init.constant_(m.bias, 0) def _make_layer(self, block, planes, blocks, stride, dilation): downsample = None if stride != 1 or self.inplanes != planes * block.expansion: downsample = nn.Sequential( conv1x1(self.inplanes, planes * block.expansion, stride), nn.BatchNorm2d(planes * block.expansion), ) layers = [] layers.append(block(self.inplanes, planes, stride, dilation, downsample)) self.inplanes = planes * block.expansion for _ in range(1, blocks): layers.append(block(self.inplanes, planes, 1, dilation)) return nn.Sequential(*layers) def forward(self, x): x = self.conv1(x) x = self.bn1(x) x = self.relu(x) x = self.maxpool(x) x = self.layer1(x) x = self.layer2(x) x = self.layer3(x) x = self.layer4(x) x = self.avgpool(x) x = x.view(x.size(0), -1) x = self.fc(x) return x def resnet18(pretrained=False, **kwargs): """Constructs a ResNet-18 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet18'])) return model def resnet34(pretrained=False, **kwargs): """Constructs a ResNet-34 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(BasicBlock, [3, 4, 6, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet34'])) return model def resnet50(pretrained=False, **kwargs): """Constructs a ResNet-50 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet50'])) return model def resnet101(pretrained=False, **kwargs): """Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet101'])) return model def resnet152(pretrained=False, **kwargs): """Constructs a ResNet-152 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet152'])) return model
33.419643
102
0.599386
[ "MIT" ]
Kinpzz/RCRNet-Pytorch
libs/networks/resnet_dilation.py
7,486
Python
import unittest import numpy as np from overcooked_ai_py.agents.agent import AgentPair, FixedPlanAgent, GreedyHumanModel, RandomAgent, SampleAgent from overcooked_ai_py.mdp.actions import Direction, Action from overcooked_ai_py.mdp.overcooked_mdp import OvercookedGridworld, OvercookedState, PlayerState, ObjectState from overcooked_ai_py.mdp.overcooked_env import OvercookedEnv from overcooked_ai_py.planning.planners import MediumLevelActionManager, NO_COUNTERS_PARAMS from overcooked_ai_py.agents.benchmarking import AgentEvaluator np.random.seed(42) n, s = Direction.NORTH, Direction.SOUTH e, w = Direction.EAST, Direction.WEST stay, interact = Action.STAY, Action.INTERACT P, Obj = PlayerState, ObjectState force_compute_large = False force_compute = True DISPLAY = False simple_mdp = OvercookedGridworld.from_layout_name('cramped_room') large_mdp = OvercookedGridworld.from_layout_name('corridor') class TestAgentEvaluator(unittest.TestCase): def setUp(self): self.agent_eval = AgentEvaluator.from_layout_name({"layout_name": "cramped_room"}, {"horizon": 100}) def test_human_model_pair(self): trajs = self.agent_eval.evaluate_human_model_pair() try: AgentEvaluator.check_trajectories(trajs, verbose=False) except AssertionError as e: self.fail("Trajectories were not returned in standard format:\n{}".format(e)) def test_rollouts(self): ap = AgentPair(RandomAgent(), RandomAgent()) trajs = self.agent_eval.evaluate_agent_pair(ap, num_games=5) try: AgentEvaluator.check_trajectories(trajs, verbose=False) except AssertionError as e: self.fail("Trajectories were not returned in standard format:\n{}".format(e)) def test_mlam_computation(self): try: self.agent_eval.env.mlam except Exception as e: self.fail("Failed to compute MediumLevelActionManager:\n{}".format(e)) class TestBasicAgents(unittest.TestCase): def setUp(self): self.mlam_large = MediumLevelActionManager.from_pickle_or_compute(large_mdp, NO_COUNTERS_PARAMS, force_compute=force_compute_large) def test_fixed_plan_agents(self): a0 = FixedPlanAgent([s, e, n, w]) a1 = FixedPlanAgent([s, w, n, e]) agent_pair = AgentPair(a0, a1) env = OvercookedEnv.from_mdp(large_mdp, horizon=10) trajectory, time_taken, _, _ = env.run_agents(agent_pair, include_final_state=True, display=DISPLAY) end_state = trajectory[-1][0] self.assertEqual(time_taken, 10) self.assertEqual(env.mdp.get_standard_start_state().player_positions, end_state.player_positions) def test_two_greedy_human_open_map(self): scenario_2_mdp = OvercookedGridworld.from_layout_name('scenario2') mlam = MediumLevelActionManager.from_pickle_or_compute(scenario_2_mdp, NO_COUNTERS_PARAMS, force_compute=force_compute) a0 = GreedyHumanModel(mlam) a1 = GreedyHumanModel(mlam) agent_pair = AgentPair(a0, a1) start_state = OvercookedState( [P((8, 1), s), P((1, 1), s)], {}, all_orders=scenario_2_mdp.start_all_orders ) env = OvercookedEnv.from_mdp(scenario_2_mdp, start_state_fn=lambda: start_state, horizon=100) trajectory, time_taken, _, _ = env.run_agents(agent_pair, include_final_state=True, display=DISPLAY) def test_sample_agent(self): agent = SampleAgent([RandomAgent(all_actions=False), RandomAgent(all_actions=True)]) probs = agent.action(None)[1]["action_probs"] expected_probs = np.array([0.18333333, 0.18333333, 0.18333333, 0.18333333, 0.18333333, 0.08333333]) self.assertTrue(np.allclose(probs, expected_probs)) class TestAgentEvaluatorStatic(unittest.TestCase): layout_name_lst = ["asymmetric_advantages", "asymmetric_advantages_tomato", "bonus_order_test", "bottleneck", "centre_objects", "centre_pots", "corridor", "forced_coordination_tomato", "unident", "marshmallow_experiment", "marshmallow_experiment_coordination", "you_shall_not_pass"] def test_from_mdp(self): for layout_name in self.layout_name_lst: orignal_mdp = OvercookedGridworld.from_layout_name(layout_name) ae = AgentEvaluator.from_mdp(mdp=orignal_mdp, env_params={"horizon": 400}) ae_mdp = ae.env.mdp self.assertEqual(orignal_mdp, ae_mdp, "mdp with name " + layout_name + " experienced an inconsistency") def test_from_mdp_params_layout(self): for layout_name in self.layout_name_lst: orignal_mdp = OvercookedGridworld.from_layout_name(layout_name) ae = AgentEvaluator.from_layout_name(mdp_params={"layout_name": layout_name}, env_params={"horizon": 400}) ae_mdp = ae.env.mdp self.assertEqual(orignal_mdp, ae_mdp, "mdp with name " + layout_name + " experienced an inconsistency") mdp_gen_params_1 = { "inner_shape": (10, 7), "prop_empty": 0.95, "prop_feats": 0.1, "start_all_orders": [ {"ingredients": ["onion", "onion", "onion"]} ], "display": False, } mdp_gen_params_2 = { "inner_shape": (10, 7), "prop_empty": 0.7, "prop_feats": 0.5, "start_all_orders": [ {"ingredients": ["onion", "onion", "onion"]} ], "display": False, } mdp_gen_params_3 = { "inner_shape": (10, 7), "prop_empty": 0.5, "prop_feats": 0.4, "start_all_orders": [ {"ingredients": ["onion", "onion", "onion"]} ], "display": False, } mdp_gen_params_lst = [mdp_gen_params_1, mdp_gen_params_2, mdp_gen_params_3] outer_shape = (10, 7) def test_from_mdp_params_variable_across(self): for mdp_gen_params in self.mdp_gen_params_lst: ae0 = AgentEvaluator.from_mdp_params_infinite(mdp_params=mdp_gen_params, env_params={"horizon": 400, "num_mdp": np.inf}, outer_shape=self.outer_shape) ae1 = AgentEvaluator.from_mdp_params_infinite(mdp_params=mdp_gen_params, env_params={"horizon": 400, "num_mdp": np.inf}, outer_shape=self.outer_shape) self.assertFalse(ae0.env.mdp == ae1.env.mdp, "2 randomly generated layouts across 2 evaluators are the same, which is wrong") def test_from_mdp_params_variable_infinite(self): for mdp_gen_params in self.mdp_gen_params_lst: ae = AgentEvaluator.from_mdp_params_infinite(mdp_params=mdp_gen_params, env_params={"horizon": 400, "num_mdp": np.inf}, outer_shape=self.outer_shape) mdp_0 = ae.env.mdp.copy() for _ in range(5): ae.env.reset(regen_mdp=True) mdp_1 = ae.env.mdp self.assertFalse(mdp_0 == mdp_1, "with infinite layout generator and regen_mdp=True, the 2 layouts should not be the same") def test_from_mdp_params_variable_infinite_no_regen(self): for mdp_gen_params in self.mdp_gen_params_lst: ae = AgentEvaluator.from_mdp_params_infinite(mdp_params=mdp_gen_params, env_params={"horizon": 400, "num_mdp": np.inf}, outer_shape=self.outer_shape) mdp_0 = ae.env.mdp.copy() for _ in range(5): ae.env.reset(regen_mdp=False) mdp_1 = ae.env.mdp self.assertTrue(mdp_0 == mdp_1, "with infinite layout generator and regen_mdp=False, the 2 layouts should be the same") def test_from_mdp_params_variable_infinite_specified(self): for mdp_gen_params in self.mdp_gen_params_lst: ae = AgentEvaluator.from_mdp_params_infinite(mdp_params=mdp_gen_params, env_params={"horizon": 400, "num_mdp": np.inf}, outer_shape=self.outer_shape) mdp_0 = ae.env.mdp.copy() for _ in range(5): ae.env.reset(regen_mdp=True) mdp_1 = ae.env.mdp self.assertFalse(mdp_0 == mdp_1, "with infinite layout generator and regen_mdp=True, the 2 layouts should not be the same") def test_from_mdp_params_variable_finite(self): for mdp_gen_params in self.mdp_gen_params_lst: ae = AgentEvaluator.from_mdp_params_finite(mdp_params=mdp_gen_params, env_params={"horizon": 400, "num_mdp": 2}, outer_shape=self.outer_shape) mdp_0 = ae.env.mdp.copy() seen = [mdp_0] for _ in range(20): ae.env.reset(regen_mdp=True) mdp_i = ae.env.mdp if len(seen) == 1: if mdp_i != seen[0]: seen.append(mdp_i.copy()) elif len(seen) == 2: mdp_0, mdp_1 = seen self.assertTrue((mdp_i == mdp_0 or mdp_i == mdp_1), "more than 2 mdp was created, the function failed to perform") else: self.assertTrue(False, "theoretically unreachable statement") layout_name_short_lst = ["cramped_room", "cramped_room_tomato", "simple_o", "simple_tomato", "simple_o_t"] biased = [0.1, 0.15, 0.2, 0.25, 0.3] num_reset = 200000 def test_from_mdp_lst_default(self): mdp_lst = [OvercookedGridworld.from_layout_name(name) for name in self.layout_name_short_lst] ae = AgentEvaluator.from_mdp_lst(mdp_lst=mdp_lst, env_params={"horizon": 400}) counts = {} for _ in range(self.num_reset): ae.env.reset(regen_mdp=True) if ae.env.mdp.layout_name in counts: counts[ae.env.mdp.layout_name] += 1 else: counts[ae.env.mdp.layout_name] = 1 for k, v in counts.items(): self.assertAlmostEqual(0.2, v/self.num_reset, 2, "more than 2 places off for " + k) def test_from_mdp_lst_uniform(self): mdp_lst = [OvercookedGridworld.from_layout_name(name) for name in self.layout_name_short_lst] ae = AgentEvaluator.from_mdp_lst(mdp_lst=mdp_lst, env_params={"horizon": 400}, sampling_freq=[0.2, 0.2, 0.2, 0.2, 0.2]) counts = {} for _ in range(self.num_reset): ae.env.reset(regen_mdp=True) if ae.env.mdp.layout_name in counts: counts[ae.env.mdp.layout_name] += 1 else: counts[ae.env.mdp.layout_name] = 1 for k, v in counts.items(): self.assertAlmostEqual(0.2, v/self.num_reset, 2, "more than 2 places off for " + k) def test_from_mdp_lst_biased(self): mdp_lst = [OvercookedGridworld.from_layout_name(name) for name in self.layout_name_short_lst] ae = AgentEvaluator.from_mdp_lst(mdp_lst=mdp_lst, env_params={"horizon": 400}, sampling_freq=self.biased) counts = {} for _ in range(self.num_reset): ae.env.reset(regen_mdp=True) if ae.env.mdp.layout_name in counts: counts[ae.env.mdp.layout_name] += 1 else: counts[ae.env.mdp.layout_name] = 1 # construct the ground truth gt = {self.layout_name_short_lst[i]: self.biased[i] for i in range(len(self.layout_name_short_lst))} for k, v in counts.items(): self.assertAlmostEqual(gt[k], v/self.num_reset, 2, "more than 2 places off for " + k) if __name__ == '__main__': unittest.main()
45.992453
139
0.6138
[ "MIT" ]
HelloN00bman/overcooked_ai
testing/agent_test.py
12,188
Python
from rest_framework import serializers from rest_framework.reverse import reverse from .models import Channel, Datasource, Value class ChannelSerializer(serializers.HyperlinkedModelSerializer): values = serializers.SerializerMethodField() latest = serializers.SerializerMethodField() def get_values(self, obj): request = self.context.get("request") return request.build_absolute_uri( reverse( "datasource-channel-values-list", kwargs={"datasource_pk": obj.datasource_id, "channel_pk": obj.id}, ) ) def get_latest(self, obj): request = self.context.get("request") return request.build_absolute_uri( reverse( "datasource-channel-values-latest", kwargs={"datasource_pk": obj.datasource_id, "channel_pk": obj.id}, ) ) class Meta: model = Channel fields = ("id", "uniquename", "name", "values", "latest") class ValueSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Value fields = ("id", "time", "value") class DatasourceSerializer(serializers.HyperlinkedModelSerializer): channels = serializers.HyperlinkedIdentityField( view_name="datasource-channels-list", lookup_url_kwarg="datasource_pk" ) class Meta: model = Datasource fields = ("id", "devid", "name", "description", "lat", "lon", "channels")
30.22449
82
0.643484
[ "MIT" ]
City-of-Helsinki/hel-data-pipe
persister/observations/serializers.py
1,481
Python
import sympy from sympy import * def check_weak_prime(n): if not isprime(n): return(False) digits=[int(i) for i in str(n)] # For each digit location - test all other values to see if # the result is prime. If so - then this is not a weak prime for position in range(len(digits)): digits2=[i for i in digits] for j in range(10): if j != digits[position]: digits2[position]=j m=0 for i in digits2: m=10*m+i if isprime(m): return(False) return(True) def search_palindromic_weak_prime(nlow,nhigh): n=nlow if not isprime(n): n=nextprime(n) while(n<nhigh): if check_weak_prime(n): print("Weak prime = ",n) n2=int(str(n)[::-1]) if check_weak_prime(n2): print("Solution found:") print(" n = ",n) print(" n2 = ",n2) return True n=nextprime(n) return False
28.594595
65
0.503781
[ "MIT" ]
rgc-retired/math_puzzles
bent/weakprime.py
1,058
Python
# Generated by Django 2.1.9 on 2020-03-20 00:50 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cmsplugin_blocks', '0003_slideitem_title'), ] operations = [ migrations.AlterField( model_name='albumitem', name='image', field=models.FileField(default=None, max_length=255, null=True, upload_to='blocks/album/%y/%m', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['jpg', 'jpeg', 'svg', 'gif', 'png'])], verbose_name='Image'), ), migrations.AlterField( model_name='card', name='image', field=models.FileField(blank=True, default=None, max_length=255, null=True, upload_to='blocks/card/%y/%m', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['jpg', 'jpeg', 'svg', 'gif', 'png'])], verbose_name='Image'), ), migrations.AlterField( model_name='hero', name='image', field=models.FileField(blank=True, default=None, max_length=255, null=True, upload_to='blocks/hero/%y/%m', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['jpg', 'jpeg', 'svg', 'gif', 'png'])], verbose_name='Image'), ), migrations.AlterField( model_name='slideitem', name='image', field=models.FileField(default=None, max_length=255, null=True, upload_to='blocks/slider/%y/%m', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['jpg', 'jpeg', 'svg', 'gif', 'png'])], verbose_name='Image'), ), ]
48.285714
258
0.646154
[ "MIT" ]
emencia/cmsplugin-blocks
cmsplugin_blocks/migrations/0004_change_image_as_filefield_.py
1,690
Python
""" ================================ Time-related feature engineering ================================ This notebook introduces different strategies to leverage time-related features for a bike sharing demand regression task that is highly dependent on business cycles (days, weeks, months) and yearly season cycles. In the process, we introduce how to perform periodic feature engineering using the :class:`sklearn.preprocessing.SplineTransformer` class and its `extrapolation="periodic"` option. """ # %% # Data exploration on the Bike Sharing Demand dataset # --------------------------------------------------- # # We start by loading the data from the OpenML repository. from sklearn.datasets import fetch_openml bike_sharing = fetch_openml("Bike_Sharing_Demand", version=2, as_frame=True) df = bike_sharing.frame # %% # To get a quick understanding of the periodic patterns of the data, let us # have a look at the average demand per hour during a week. # # Note that the week starts on a Sunday, during the weekend. We can clearly # distinguish the commute patterns in the morning and evenings of the work days # and the leisure use of the bikes on the weekends with a more spread peak # demand around the middle of the days: import matplotlib.pyplot as plt fig, ax = plt.subplots(figsize=(12, 4)) average_week_demand = df.groupby(["weekday", "hour"]).mean()["count"] average_week_demand.plot(ax=ax) _ = ax.set( title="Average hourly bike demand during the week", xticks=[i * 24 for i in range(7)], xticklabels=["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], xlabel="Time of the week", ylabel="Number of bike rentals", ) # %% # # The target of the prediction problem is the absolute count of bike rentals on # a hourly basis: df["count"].max() # %% [markdown] # # Let us rescale the target variable (number of hourly bike rentals) to predict # a relative demand so that the mean absolute error is more easily interpreted # as a fraction of the maximum demand. # # .. note:: # # The fit method of the models used in this notebook all minimize the # mean squared error to estimate the conditional mean instead of the mean # absolute error that would fit an estimator of the conditional median. # # When reporting performance measure on the test set in the discussion, we # instead choose to focus on the mean absolute error that is more # intuitive than the (root) mean squared error. Note however that the best # models for one metric are also the best for the other in this study. y = df["count"] / 1000 # %% fig, ax = plt.subplots(figsize=(12, 4)) y.hist(bins=30, ax=ax) _ = ax.set( xlabel="Fraction of rented fleet demand", ylabel="Number of hours", ) # %% # The input feature data frame is a time annotated hourly log of variables # describing the weather conditions. It includes both numerical and categorical # variables. Note that the time information has already been expanded into # several complementary columns. # X = df.drop("count", axis="columns") X # %% # .. note:: # # If the time information was only present as a date or datetime column, we # could have expanded it into hour-in-the-day, day-in-the-week, # day-in-the-month, month-in-the-year using pandas: # https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#time-date-components # # We now introspect the distribution of the categorical variables, starting # with `"weather"`: # X["weather"].value_counts() # %% # Since there are only 3 `"heavy_rain"` events, we cannot use this category to # train machine learning models with cross validation. Instead, we simplify the # representation by collapsing those into the `"rain"` category. # X["weather"].replace(to_replace="heavy_rain", value="rain", inplace=True) # %% X["weather"].value_counts() # %% # As expected, the `"season"` variable is well balanced: # X["season"].value_counts() # %% # Time-based cross-validation # --------------------------- # # Since the dataset is a time-ordered event log (hourly demand), we will use a # time-sensitive cross-validation splitter to evaluate our demand forecasting # model as realistically as possible. We use a gap of 2 days between the train # and test side of the splits. We also limit the training set size to make the # performance of the CV folds more stable. # # 1000 test datapoints should be enough to quantify the performance of the # model. This represents a bit less than a month and a half of contiguous test # data: from sklearn.model_selection import TimeSeriesSplit ts_cv = TimeSeriesSplit( n_splits=5, gap=48, max_train_size=10000, test_size=1000, ) # %% # Let us manually inspect the various splits to check that the # `TimeSeriesSplit` works as we expect, starting with the first split: all_splits = list(ts_cv.split(X, y)) train_0, test_0 = all_splits[0] # %% X.iloc[test_0] # %% X.iloc[train_0] # %% # We now inspect the last split: train_4, test_4 = all_splits[4] # %% X.iloc[test_4] # %% X.iloc[train_4] # %% # All is well. We are now ready to do some predictive modeling! # # Gradient Boosting # ----------------- # # Gradient Boosting Regression with decision trees is often flexible enough to # efficiently handle heteorogenous tabular data with a mix of categorical and # numerical features as long as the number of samples is large enough. # # Here, we do minimal ordinal encoding for the categorical variables and then # let the model know that it should treat those as categorical variables by # using a dedicated tree splitting rule. Since we use an ordinal encoder, we # pass the list of categorical values explicitly to use a logical order when # encoding the categories as integer instead of the lexicographical order. This # also has the added benefit of preventing any issue with unknown categories # when using cross-validation. # # The numerical variable need no preprocessing and, for the sake of simplicity, # we only try the default hyper-parameters for this model: from sklearn.pipeline import make_pipeline from sklearn.preprocessing import OrdinalEncoder from sklearn.compose import ColumnTransformer from sklearn.ensemble import HistGradientBoostingRegressor from sklearn.model_selection import cross_validate categorical_columns = [ "weather", "season", "holiday", "workingday", ] categories = [ ["clear", "misty", "rain"], ["spring", "summer", "fall", "winter"], ["False", "True"], ["False", "True"], ] ordinal_encoder = OrdinalEncoder(categories=categories) gbrt_pipeline = make_pipeline( ColumnTransformer( transformers=[ ("categorical", ordinal_encoder, categorical_columns), ], remainder="passthrough", ), HistGradientBoostingRegressor( categorical_features=range(4), ), ) # %% # # Lets evaluate our gradient boosting model with the mean absolute error of the # relative demand averaged accross our 5 time-based cross-validation splits: def evaluate(model, X, y, cv): cv_results = cross_validate( model, X, y, cv=ts_cv, scoring=["neg_mean_absolute_error", "neg_root_mean_squared_error"], ) mae = -cv_results["test_neg_mean_absolute_error"] rmse = -cv_results["test_neg_root_mean_squared_error"] print( f"Mean Absolute Error: {mae.mean():.3f} +/- {mae.std():.3f}\n" f"Root Mean Squared Error: {rmse.mean():.3f} +/- {rmse.std():.3f}" ) evaluate(gbrt_pipeline, X, y, cv=ts_cv) # %% # This model has an average error around 4 to 5% of the maximum demand. This is # quite good for a first trial without any hyper-parameter tuning! We just had # to make the categorical variables explicit. Note that the time related # features are passed as is, i.e. without processing them. But this is not much # of a problem for tree-based models as they can learn a non-monotonic # relationship between ordinal input features and the target. # # This is not the case for linear regression model as we will see in the # following. # # Naive linear regression # ----------------------- # # As usual for linear models, categorical variables need to be one-hot encoded. # For consistency, we scale the numerical features to the same 0-1 range using # class:`sklearn.preprocessing.MinMaxScaler`, although in this case it does not # impact the results much because they are already on comparable scales: from sklearn.preprocessing import OneHotEncoder from sklearn.preprocessing import MinMaxScaler from sklearn.linear_model import RidgeCV import numpy as np one_hot_encoder = OneHotEncoder(handle_unknown="ignore", sparse=False) alphas = np.logspace(-6, 6, 25) naive_linear_pipeline = make_pipeline( ColumnTransformer( transformers=[ ("categorical", one_hot_encoder, categorical_columns), ], remainder=MinMaxScaler(), ), RidgeCV(alphas=alphas), ) evaluate(naive_linear_pipeline, X, y, cv=ts_cv) # %% # # The performance is not good: the average error is around 14% of the maximum # demand. This is more than three times higher than the average error of the # gradient boosting model. We can suspect that the naive original encoding of # the periodic time-related features might prevent the linear regression model # to properly leverage the time information: linear regression does not model # non-monotonic relationships between the input features and the target. # Non-linear terms have to be engineered in the input. # # For example, the raw numerical encoding of the `"hour"` feature prevents the # linear model from recognizing that an increase of hour in the morning from 6 # to 8 should have a strong positive impact on the number of bike rentals while # a increase of similar magnitude in the evening from 18 to 20 should have a # strong negative impact on the predicted number of bike rentals. # # Time-steps as categories # ------------------------ # # Since the time features are encoded in a discrete manner using integers (24 # unique values in the "hours" feature), we could decide to treat those as # categorical variables and ignore any assumption implied by the ordering of # the hour values using a one-hot encoding. # # Using one-hot encoding for the time features gives the linear model a lot # more flexibility as we introduce one additional feature per discrete time # level. one_hot_linear_pipeline = make_pipeline( ColumnTransformer( transformers=[ ("categorical", one_hot_encoder, categorical_columns), ("one_hot_time", one_hot_encoder, ["hour", "weekday", "month"]), ], remainder=MinMaxScaler(), ), RidgeCV(alphas=alphas), ) evaluate(one_hot_linear_pipeline, X, y, cv=ts_cv) # %% # The average error rate of this model is 10% which is much better than using # the original ordinal encoding of the time feature, confirming our intuition # that the linear regression model benefit from the added flexibility to not # treat time progression in a monotonic manner. # # However, this introduces a very large number of new features. If the time of # the day was represented in minutes since the start of the day instead of # hours, one-hot encoding would have introduced 1440 features instead of 24. # This could cause some significant overfitting. To avoid this we could use # :func:`sklearn.preprocessing.KBinsDiscretizer` instead to re-bin the number # of levels of fine-grained ordinal or numerical variables while still # benefitting from the non-monotonic expressivity advantages of one-hot # encoding. # # Finally, we also observe than one-hot encoding completely ignores the # ordering of the hour levels while this could be an interesting inductive bias # to preserve to some level. In the following we try to explore smooth, # non-monotonic encoding that locally preserves the relative ordering of time # features. # # Trigonometric features # ---------------------- # # As a first attempt, we can try to encode each of those periodic features # using a sine and cosine transform with the matching period. # # Each ordinal time feature is transformed into 2 features that together encode # equivalent information in a non-monotonic way, and more importantly without # any jump between the first and the last value of the periodic range. from sklearn.preprocessing import FunctionTransformer def sin_transformer(period): return FunctionTransformer(lambda x: np.sin(x / period * 2 * np.pi)) def cos_transformer(period): return FunctionTransformer(lambda x: np.cos(x / period * 2 * np.pi)) # %% # # Let us visualize the effect of this feature expansion on some synthetic hour # data with a bit of extrapolation beyond hour=23: import pandas as pd hour_df = pd.DataFrame( np.arange(26).reshape(-1, 1), columns=["hour"], ) hour_df["hour_sin"] = sin_transformer(24).fit_transform(hour_df)["hour"] hour_df["hour_cos"] = cos_transformer(24).fit_transform(hour_df)["hour"] hour_df.plot(x="hour") _ = plt.title("Trigonometric encoding for the 'hour' feature") # %% # # Let's use a 2D scatter plot with the hours encoded as colors to better see # how this representation maps the 24 hours of the day to a 2D space, akin to # some sort of 24 hour version of an analog clock. Note that the "25th" hour is # mapped back to the 1st hour because of the periodic nature of the sine/cosine # representation. fig, ax = plt.subplots(figsize=(7, 5)) sp = ax.scatter(hour_df["hour_sin"], hour_df["hour_cos"], c=hour_df["hour"]) ax.set( xlabel="sin(hour)", ylabel="cos(hour)", ) _ = fig.colorbar(sp) # %% # # We can now build a feature extraction pipeline using this strategy: cyclic_cossin_transformer = ColumnTransformer( transformers=[ ("categorical", one_hot_encoder, categorical_columns), ("month_sin", sin_transformer(12), ["month"]), ("month_cos", cos_transformer(12), ["month"]), ("weekday_sin", sin_transformer(7), ["weekday"]), ("weekday_cos", cos_transformer(7), ["weekday"]), ("hour_sin", sin_transformer(24), ["hour"]), ("hour_cos", cos_transformer(24), ["hour"]), ], remainder=MinMaxScaler(), ) cyclic_cossin_linear_pipeline = make_pipeline( cyclic_cossin_transformer, RidgeCV(alphas=alphas), ) evaluate(cyclic_cossin_linear_pipeline, X, y, cv=ts_cv) # %% # # The performance of our linear regression model with this simple feature # engineering is a bit better than using the original ordinal time features but # worse than using the one-hot encoded time features. We will further analyze # possible reasons for this disappointing outcome at the end of this notebook. # # Periodic spline features # ------------------------ # # We can try an alternative encoding of the periodic time-related features # using spline transformations with a large enough number of splines, and as a # result a larger number of expanded features: from sklearn.preprocessing import SplineTransformer def periodic_spline_transformer(period, n_splines=None, degree=3): if n_splines is None: n_splines = period n_knots = n_splines + 1 # periodic and include_bias is True return SplineTransformer( degree=degree, n_knots=n_knots, knots=np.linspace(0, period, n_knots).reshape(n_knots, 1), extrapolation="periodic", include_bias=True, ) # %% # # Again, let us visualize the effect of this feature expansion on some # synthetic hour data with a bit of extrapolation beyond hour=23: hour_df = pd.DataFrame( np.linspace(0, 26, 1000).reshape(-1, 1), columns=["hour"], ) splines = periodic_spline_transformer(24, n_splines=12).fit_transform(hour_df) splines_df = pd.DataFrame( splines, columns=[f"spline_{i}" for i in range(splines.shape[1])], ) pd.concat([hour_df, splines_df], axis="columns").plot(x="hour", cmap=plt.cm.tab20b) _ = plt.title("Periodic spline-based encoding for the 'hour' feature") # %% # Thanks to the use of the `extrapolation="periodic"` parameter, we observe # that the feature encoding stays smooth when extrapolating beyond midnight. # # We can now build a predictive pipeline using this alternative periodic # feature engineering strategy. # # It is possible to use fewer splines than discrete levels for those ordinal # values. This makes spline-based encoding more efficient than one-hot encoding # while preserving most of the expressivity: cyclic_spline_transformer = ColumnTransformer( transformers=[ ("categorical", one_hot_encoder, categorical_columns), ("cyclic_month", periodic_spline_transformer(12, n_splines=6), ["month"]), ("cyclic_weekday", periodic_spline_transformer(7, n_splines=3), ["weekday"]), ("cyclic_hour", periodic_spline_transformer(24, n_splines=12), ["hour"]), ], remainder=MinMaxScaler(), ) cyclic_spline_linear_pipeline = make_pipeline( cyclic_spline_transformer, RidgeCV(alphas=alphas), ) evaluate(cyclic_spline_linear_pipeline, X, y, cv=ts_cv) # %% # Spline features make it possible for the linear model to successfully # leverage the periodic time-related features and reduce the error from ~14% to # ~10% of the maximum demand, which is similar to what we observed with the # one-hot encoded features. # # Qualitative analysis of the impact of features on linear models predictions # --------------------------------------------------------------------------- # # Here, we want to visualize the impact of the feature engineering choices on # the time related shape of the predictions. # # To do so we consider an arbitrary time-based split to compare the predictions # on a range of held out data points. naive_linear_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) naive_linear_predictions = naive_linear_pipeline.predict(X.iloc[test_0]) one_hot_linear_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) one_hot_linear_predictions = one_hot_linear_pipeline.predict(X.iloc[test_0]) cyclic_cossin_linear_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) cyclic_cossin_linear_predictions = cyclic_cossin_linear_pipeline.predict(X.iloc[test_0]) cyclic_spline_linear_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) cyclic_spline_linear_predictions = cyclic_spline_linear_pipeline.predict(X.iloc[test_0]) # %% # We visualize those predictions by zooming on the last 96 hours (4 days) of # the test set to get some qualitative insights: last_hours = slice(-96, None) fig, ax = plt.subplots(figsize=(12, 4)) fig.suptitle("Predictions by linear models") ax.plot( y.iloc[test_0].values[last_hours], "x-", alpha=0.2, label="Actual demand", color="black", ) ax.plot(naive_linear_predictions[last_hours], "x-", label="Ordinal time features") ax.plot( cyclic_cossin_linear_predictions[last_hours], "x-", label="Trigonometric time features", ) ax.plot( cyclic_spline_linear_predictions[last_hours], "x-", label="Spline-based time features", ) ax.plot( one_hot_linear_predictions[last_hours], "x-", label="One-hot time features", ) _ = ax.legend() # %% # We can draw the following conclusions from the above plot: # # - the **raw ordinal time-related features** are problematic because they do # not capture the natural periodicity: we observe a big jump in the # predictions at the end of each day when the hour features goes from 23 back # to 0. We can expect similar artifacts at the end of each week or each year. # # - as expected, the **trigonometric features** (sine and cosine) do not have # these discontinuities at midnight but the linear regression model fails to # leverage those features to properly model intra-day variations. # Using trigonometric features for higher harmonics or additional # trigonometric features for the natural period with different phases could # potentially fix this problem. # # - the **periodic spline-based features** fix those two problems at once: they # give more expressivity to the linear model by making it possible to focus # on specific hours thanks to the use of 12 splines. Furthermore the # `extrapolation="periodic"` option enforces a smooth representation between # `hour=23` and `hour=0`. # # - the **one-hot encoded features** behave similarly to the periodic # spline-based features but are more spiky: for instance they can better # model the morning peak during the week days since this peak lasts shorter # than an hour. However, we will see in the following that what can be an # advantage for linear models is not necessarily one for more expressive # models. # %% # We can also compare the number of features extracted by each feature # engineering pipeline: naive_linear_pipeline[:-1].transform(X).shape # %% one_hot_linear_pipeline[:-1].transform(X).shape # %% cyclic_cossin_linear_pipeline[:-1].transform(X).shape # %% cyclic_spline_linear_pipeline[:-1].transform(X).shape # %% # This confirms that the one-hot encoding and the spline encoding strategies # create a lot more features for the time representation than the alternatives, # which in turn gives the downstream linear model more flexibility (degrees of # freedom) to avoid underfitting. # # Finally, we observe that none of the linear models can approximate the true # bike rentals demand, especially for the peaks that can be very sharp at rush # hours during the working days but much flatter during the week-ends: the most # accurate linear models based on splines or one-hot encoding tend to forecast # peaks of commuting-related bike rentals even on the week-ends and # under-estimate the commuting-related events during the working days. # # These systematic prediction errors reveal a form of under-fitting and can be # explained by the lack of non-additive modeling of the interactions between # features (in this case "workingday" and features derived from "hours"). This # issue will be addressed in the following section. # %% # Modeling pairwise interactions with splines and polynomial features # ------------------------------------------------------------------- # # Linear models alone cannot model interaction effects between input features. # It does not help that some features are marginally non-linear as is the case # with features constructed by `SplineTransformer` (or one-hot encoding or # binning). # # However, it is possible to use the `PolynomialFeatures` class on coarse # grained splined encoded hours to model the "workingday"/"hours" interaction # explicitly without introducing too many new variables: from sklearn.preprocessing import PolynomialFeatures from sklearn.pipeline import FeatureUnion hour_workday_interaction = make_pipeline( ColumnTransformer( [ ("cyclic_hour", periodic_spline_transformer(24, n_splines=8), ["hour"]), ("workingday", FunctionTransformer(lambda x: x == "True"), ["workingday"]), ] ), PolynomialFeatures(degree=2, interaction_only=True, include_bias=False), ) # %% # Those features are then combined with the ones already computed in the # previous spline-base pipeline. We can observe a nice performance improvemnt # by modeling this pairwise interaction explicitly: cyclic_spline_interactions_pipeline = make_pipeline( FeatureUnion( [ ("marginal", cyclic_spline_transformer), ("interactions", hour_workday_interaction), ] ), RidgeCV(alphas=alphas), ) evaluate(cyclic_spline_interactions_pipeline, X, y, cv=ts_cv) # %% # Modeling non-linear feature interactions with kernels # ----------------------------------------------------- # # The previous analysis highlighted the need to model the interactions between # `"workingday"` and `"hours"`. Another example of a such a non-linear # interactions that we would like to model could be the impact of the rain that # might not be the same during the working days and the week-ends and holidays # for instance. # # To model all such interactions, we could either use a polynomial expansion on # all marginal features at once, after their spline-based expansion. However # this would create a quadratic number of features which can cause overfitting # and computational tractability issues. # # Alternatively we can use the Nyström method to compute an approximate # polynomial kernel expansion. Let us try the latter: from sklearn.kernel_approximation import Nystroem cyclic_spline_poly_pipeline = make_pipeline( cyclic_spline_transformer, Nystroem(kernel="poly", degree=2, n_components=300, random_state=0), RidgeCV(alphas=alphas), ) evaluate(cyclic_spline_poly_pipeline, X, y, cv=ts_cv) # %% # # We observe that this model can almost rival the performance of the gradient # boosted trees with an average error around 6% of the maximum demand. # # Note that while the final step of this pipeline is a linear regression model, # the intermediate steps such as the spline feature extraction and the Nyström # kernel approximation are highly non-linear. As a result the compound pipeline # is much more expressive than a simple linear regression model with raw features. # # For the sake of completeness, we also evaluate the combination of one-hot # encoding and kernel approximation: one_hot_poly_pipeline = make_pipeline( ColumnTransformer( transformers=[ ("categorical", one_hot_encoder, categorical_columns), ("one_hot_time", one_hot_encoder, ["hour", "weekday", "month"]), ], remainder="passthrough", ), Nystroem(kernel="poly", degree=2, n_components=300, random_state=0), RidgeCV(alphas=alphas), ) evaluate(one_hot_poly_pipeline, X, y, cv=ts_cv) # %% # While one-hot features were competitive with spline-based features when using # linear models, this is no longer the case when using a low-rank approximation # of a non-linear kernel: this can be explained by the fact that spline # features are smoother and allow the kernel approximation to find a more # expressive decision function. # # Let us now have a qualitative look at the predictions of the kernel models # and of the gradient boosted trees that should be able to better model # non-linear interactions between features: gbrt_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) gbrt_predictions = gbrt_pipeline.predict(X.iloc[test_0]) one_hot_poly_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) one_hot_poly_predictions = one_hot_poly_pipeline.predict(X.iloc[test_0]) cyclic_spline_poly_pipeline.fit(X.iloc[train_0], y.iloc[train_0]) cyclic_spline_poly_predictions = cyclic_spline_poly_pipeline.predict(X.iloc[test_0]) # %% # Again we zoom on the last 4 days of the test set: last_hours = slice(-96, None) fig, ax = plt.subplots(figsize=(12, 4)) fig.suptitle("Predictions by non-linear regression models") ax.plot( y.iloc[test_0].values[last_hours], "x-", alpha=0.2, label="Actual demand", color="black", ) ax.plot( gbrt_predictions[last_hours], "x-", label="Gradient Boosted Trees", ) ax.plot( one_hot_poly_predictions[last_hours], "x-", label="One-hot + polynomial kernel", ) ax.plot( cyclic_spline_poly_predictions[last_hours], "x-", label="Splines + polynomial kernel", ) _ = ax.legend() # %% # First, note that trees can naturally model non-linear feature interactions # since, by default, decision trees are allowed to grow beyond a depth of 2 # levels. # # Here we can observe that the combinations of spline features and non-linear # kernels works quite well and can almost rival the accuracy of the gradient # boosting regression trees. # # On the contrary, one-hot time features do not perform that well with the low # rank kernel model. In particular they significantly over-estimate the low # demand hours more than the competing models. # # We also observe that none of the models can successfully predict some of the # peak rentals at the rush hours during the working days. It is possible that # access to additional features would be required to further improve the # accuracy of the predictions. For instance, it could be useful to have access # to the geographical repartition of the fleet at any point in time or the # fraction of bikes that are immobilized because they need servicing. # # Let us finally get a more quantative look at the prediction errors of those # three models using the true vs predicted demand scatter plots: fig, axes = plt.subplots(ncols=3, figsize=(12, 4), sharey=True) fig.suptitle("Non-linear regression models") predictions = [ one_hot_poly_predictions, cyclic_spline_poly_predictions, gbrt_predictions, ] labels = [ "One hot + polynomial kernel", "Splines + polynomial kernel", "Gradient Boosted Trees", ] for ax, pred, label in zip(axes, predictions, labels): ax.scatter(y.iloc[test_0].values, pred, alpha=0.3, label=label) ax.plot([0, 1], [0, 1], "--", label="Perfect model") ax.set( xlim=(0, 1), ylim=(0, 1), xlabel="True demand", ylabel="Predicted demand", ) ax.legend() # %% # This visualization confirms the conclusions we draw on the previous plot. # # All models under-estimate the high demand events (working days rush hours), # but gradient boosting a bit less so. The low demand events are well predicted # on average by gradient boosting while the one-hot polynomial regression # pipeline seems to systematically over-estimate demand in that regime. Overall # the predictions of the gradient boosted trees are closer to the diagonal than # for the kernel models. # # Concluding remarks # ------------------ # # We note that we could have obtained slightly better results for kernel models # by using more components (higher rank kernel approximation) at the cost of # longer fit and prediction durations. For large values of `n_components`, the # performance of the one-hot features would even match the spline features. # # The `Nystroem` + `RidgeCV` classifier could also have been replaced by # :class:`~sklearn.neural_network.MLPRegressor` with one or two hidden layers # and we would have obtained quite similar results. # # The dataset we used in this case study is sampled on a hourly basis. However # cyclic spline-based features could model time-within-day or time-within-week # very efficiently with finer-grained time resolutions (for instance with # measurements taken every minute instead of every hours) without introducing # more features. One-hot encoding time representations would not offer this # flexibility. # # Finally, in this notebook we used `RidgeCV` because it is very efficient from # a computational point of view. However it models the target variable as a # Gaussian random variable with constant variance. For positive regression # problems, it is likely that using a Poisson or Gamma distribution would make # more sense. This could be achieved by using # `GridSearchCV(TweedieRegressor(power=2), param_grid({"alpha": alphas}))` # instead of `RidgeCV`.
37.354293
97
0.733685
[ "BSD-3-Clause" ]
CastaChick/scikit-learn
examples/applications/plot_cyclical_feature_engineering.py
30,894
Python
import pytest def test_get(session, search_filter): from dispatch.search_filter.service import get t_search_filter = get(db_session=session, search_filter_id=search_filter.id) assert t_search_filter.id == search_filter.id def test_get_all(session, search_filters): from dispatch.search_filter.service import get_all t_search_filters = get_all(db_session=session).all() assert len(t_search_filters) > 1 def test_create(session, project): from dispatch.search_filter.service import create from dispatch.search_filter.models import SearchFilterCreate name = "name" description = "description" expression = [{}] type = "type" search_filter_in = SearchFilterCreate( name=name, description=description, expression=expression, type=type, project=project, ) search_filter = create(db_session=session, search_filter_in=search_filter_in) assert search_filter @pytest.mark.skip def test_update(session, search_filter): from dispatch.search_filter.service import update from dispatch.search_filter.models import SearchFilterUpdate name = "Updated name" search_filter_in = SearchFilterUpdate( name=name, ) search_filter = update( db_session=session, search_filter=search_filter, search_filter_in=search_filter_in, ) assert search_filter.name == name def test_delete(session, search_filter): from dispatch.search_filter.service import delete, get delete(db_session=session, search_filter_id=search_filter.id) assert not get(db_session=session, search_filter_id=search_filter.id)
27.245902
81
0.737665
[ "Apache-2.0" ]
fiverr/dispatch
tests/search_filter/test_search_filter_service.py
1,662
Python
import dash from dash.dependencies import Input, Output from dash.exceptions import PreventUpdate import dash_core_components as dcc import dash_html_components as html import flask import time def test_llgo001_location_logout(dash_dcc): app = dash.Dash(__name__) @app.server.route("/_logout", methods=["POST"]) def on_logout(): rep = flask.redirect("/logged-out") rep.set_cookie("logout-cookie", "", 0) return rep app.layout = html.Div( [html.H2("Logout test"), dcc.Location(id="location"), html.Div(id="content")] ) @app.callback(Output("content", "children"), [Input("location", "pathname")]) def on_location(location_path): if location_path is None: raise PreventUpdate if "logged-out" in location_path: return "Logged out" else: @flask.after_this_request def _insert_cookie(rep): rep.set_cookie("logout-cookie", "logged-in") return rep return dcc.LogoutButton(id="logout-btn", logout_url="/_logout") dash_dcc.start_server(app) time.sleep(1) dash_dcc.percy_snapshot("Logout button") assert dash_dcc.driver.get_cookie("logout-cookie")["value"] == "logged-in" dash_dcc.wait_for_element("#logout-btn").click() dash_dcc.wait_for_text_to_equal("#content", "Logged out") assert not dash_dcc.driver.get_cookie("logout-cookie") assert dash_dcc.get_logs() == []
28.980392
85
0.656292
[ "MIT" ]
Joeyt1008/dash-core-components
tests/integration/location/test_location_logout.py
1,478
Python
from django.conf.urls import url from api.views import movie_views from api.views import auth_views from api.views import rating_views from api.views import recommend_views from api.views import collabo_test from api.views import content_based from api.algorithms import kmeansClustering urlpatterns = [ # user 접근 URL url(r'auth/signup-many/$', auth_views.signup_many, name='sign_up_many'), url(r'auth/getUsers/$', auth_views.getUsers, name='get_users'), url(r'auth/deleteUser/$', auth_views.deleteUser, name='delete_user'), url(r'auth/similarUser/$', auth_views.similarUser, name='similarUser'), url(r'^auth/loginmember/$', auth_views.login, name='login_member'), url(r'^auth/registermember/$', auth_views.register, name='register_member'), url(r'^auth/logoutmember/$', auth_views.logout, name='logout_member'), url(r'^auth/session/$', auth_views.session_member, name="session_member"), url(r'^auth/updateUser/$', auth_views.updateUser, name="update_user"), url(r'^auth/predictRating/$', auth_views.predictMovieRating, name="predictRating"), # 중복체크 검사 url(r'^auth/duplicateInspection/$', auth_views.duplicate_inspection, name="duplicate_inspection"), # movie 접근 URL url(r'movies/$', movie_views.movies, name='movie_list'), url(r'movies/pref/$', movie_views.moviesPref, name='movie_pref'), url(r'movies/views/$', movie_views.views, name='movie_views'), url(r'movies/modify/$', movie_views.modify, name='movie_modify'), url(r'movies/neverSeenMovies/$', movie_views.never_seen_movie_list, name='never_seen_movie_list'), url(r'movies/faculites/$', movie_views.faculites, name='faculites'), url(r'movies/rating/$', movie_views.get_rating_movie, name='get_rating_movie'), # 추천 URL url(r'^auth/recommendMovie/$', recommend_views.RecommendMovie, name='recommendMovie'), # 평점정보 접근 URL url(r'rateMovie/$', rating_views.rate_movie, name='rate_movie'), url(r'getRatings/$', rating_views.get_ratings, name='get_ratings'), url(r'getEvaluatedRating/$', rating_views.get_evaluate_rating, name='get_evaluate_rating'), url(r'ratings/comment/$', rating_views.create_comment, name='create_comment'), # clustering 실행 URL url('clustering/kmeansClustering/C/', kmeansClustering.C_Cluster, name="c_Cluster"), # Content-Based Algorithm url(r'preprocessing/$', content_based.preprocessing_for_cb, name='preprocessing'), url(r'content_based/$', content_based.algorithm, name='content_based') ]
49.156863
102
0.735142
[ "Apache-2.0" ]
BeautifulBeer/Youflix
django-vue/djangoAPI/api/urls.py
2,547
Python
"""HelloWorld Integration for Cortex XSOAR (aka Demisto) This integration is a good example on you can build a Cortex XSOAR Integration using Python 3. Please follow the documentation links below and make sure that your integration follows the Code Conventions and passes the Linting phase. Developer Documentation: https://xsoar.pan.dev/docs/welcome Code Conventions: https://xsoar.pan.dev/docs/integrations/code-conventions Linting: https://xsoar.pan.dev/docs/integrations/linting When building a Cortex XSOAR integration that is reusable, a lot of effort must be placed in the design. We recommend to fill a Design Document template, that allows you to capture Use Cases, Requirements and Inputs/Outputs. Example Design document for the this Integration (HelloWorld): https://docs.google.com/document/d/1wETtBEKg37PHNU8tYeB56M1LE314ux086z3HFeF_cX0 HelloWorld API -------------- The HelloWorld API is a simple API that shows a realistic use case for an XSOAR integration. It's actually a real API that is available to the following URL: https://soar.mastersofhack.com - if you need an API Key to test it out please reach out to your Cortex XSOAR contacts. This API has a few basic functions: - Alerts: the endpoint returns mocked alerts and allows you to search based on a number of parameters, such as state (ACTIVE or CLOSED), type, timestamp. It can also return a single alert by ID. This is used to create new Incidents in XSOAR by using the ``fetch-incidents`` command, which is by default invoked every minute. There is also an endpoint that allows to retrieve additional details about a specific alert by ID, and one to change the alert status to "CLOSED" once it has been resolved. - Reputation (ip and domain): these endpoints return, for an IP and domain respectively, a WHOIS lookup of the entity as well as a reputation score (from 0 to 100) that is used to determine whether the entity is malicious. This endpoint is called by XSOAR reputation commands ``ip`` and ``domain`` that are run automatically every time an indicator is extracted in XSOAR. As a best practice of design, it is important to map and document the mapping between a score in the original API format (0 to 100 in this case) to a score in XSOAR format (0 to 3). This score is called ``DBotScore``, and is returned in the context to allow automated handling of indicators based on their reputation. More information: https://xsoar.pan.dev/docs/integrations/dbot - Scan: to demonstrate how to run commands that are not returning instant data, the API provides a scan endpoint that simulates scanning a host and generating a report after the scan is completed. The API has endpoints to start a scan, which returns a job ID, poll for the scan status and, if the scan is completed, retrieved the job results. This function is used in conjunction of the HelloWorld Scan playbook that uses the GenericPolling mechanism to implement the job polling loop. The results can be returned in JSON or attachment file format. Info on GenericPolling: https://xsoar.pan.dev/docs/playbooks/generic-polling Please check the HelloWorld Design Document referenced above for details about the raw API responsens as well as the design details for this integration. This integration also has a ``say-hello`` command for backward compatibility, that doesn't connect to an API and just returns a ``Hello {name}`` string, where name is the input value provided. Integration File Structure -------------------------- An integration usually consists of the following parts: - Imports - Constants - Client Class - Helper Functions - Command Functions - Main Function - Entry Point Imports ------- Here you can import Python module you need for your integration. If you need a module that is not part of the default XSOAR Docker images, you can add a custom one. More details: https://xsoar.pan.dev/docs/integrations/docker There are also internal imports that are used by XSOAR: - demistomock (imported as demisto): allows your code to work offline for testing. The actual ``demisto`` module is provided at runtime when the code runs in XSOAR. - CommonServerPython.py: contains a set of helper functions, base classes and other useful components that will make your integration code easier to maintain. - CommonServerUserPython.py: includes a set of user defined commands that are specific to an XSOAR installation. Do not use it for integrations that are meant to be shared externally. These imports are automatically loaded at runtime within the XSOAR script runner, so you shouldn't modify them Constants --------- Usually some constants that do not require user parameters or inputs, such as the default API entry point for your service, or the maximum numbers of incidents to fetch every time. Client Class ------------ We recommend to use a Client class to wrap all the code that needs to interact with your API. Moreover, we recommend, when possible, to inherit from the BaseClient class, defined in CommonServerPython.py. This class already handles a lot of the work, such as system proxy settings, SSL certificate verification and exception handling for HTTP errors. Note that the Client class should NOT contain any Cortex XSOAR specific code, i.e. it shouldn't use anything in the ``demisto`` class (functions such as ``demisto.args()`` or ``demisto.results()`` or even ``return_results`` and ``return_error``. You will use the Command Functions to handle XSOAR inputs and outputs. When calling an API, you should use the ``_http.request()`` method and you can return the raw data to the calling function (usually a Command function). You should usually have one function for each API endpoint. Look at the code and the commends of this specific class to better understand the implementation details. Helper Functions ---------------- Helper functions are usually used as utility functions that are used by several command functions throughout your code. For example they map arguments to types or convert severity formats from integration-specific to XSOAR. Many helper functions are already defined in ``CommonServerPython.py`` and are often very handy. Command Functions ----------------- Command functions perform the mapping between XSOAR inputs and outputs to the Client class functions inputs and outputs. As a best practice, they shouldn't contain calls to ``demisto.args()``, ``demisto.results()``, ``return_error`` and ``demisto.command()`` as those should be handled through the ``main()`` function. However, in command functions, use ``demisto`` or ``CommonServerPython.py`` artifacts, such as ``demisto.debug()`` or the ``CommandResults`` class and the ``Common.*`` classes. Usually you will have one command function for every specific XSOAR command you want to implement in your integration, plus ``test-module``, ``fetch-incidents`` and ``fetch-indicators``(if the latter two are supported by your integration). Each command function should invoke one specific function of the Client class. Command functions, when invoked through an XSOAR command usually return data using the ``CommandResults`` class, that is then passed to ``return_results()`` in the ``main()`` function. ``return_results()`` is defined in ``CommonServerPython.py`` to return the data to XSOAR. ``return_results()`` actually wraps ``demisto.results()``. You should never use ``demisto.results()`` directly. Sometimes you will need to return values in a format that is not compatible with ``CommandResults`` (for example files): in that case you must return a data structure that is then pass passed to ``return.results()``. (i.e. check the ``scan_results_command`` function in this file that has the option to return a file to Cortex XSOAR). In any case you should never call ``return_results()`` directly from the command functions. When you use create the CommandResults object in command functions, you usually pass some types of data: - Human Readable: usually in Markdown format. This is what is presented to the analyst in the War Room. You can use ``tableToMarkdown()``, defined in ``CommonServerPython.py``, to convert lists and dicts in Markdown and pass it to ``return_results()`` using the ``readable_output`` argument, or the ``return_results()`` function will call ``tableToMarkdown()`` automatically for you. - Context Output: this is the machine readable data, JSON based, that XSOAR can parse and manage in the Playbooks or Incident's War Room. The Context Output fields should be defined in your integration YML file and is important during the design phase. Make sure you define the format and follow best practices. You can use ``demisto-sdk json-to-outputs`` to autogenerate the YML file outputs section. Context output is passed as the ``outputs`` argument in ``demisto_results()``, and the prefix (i.e. ``HelloWorld.Alert``) is passed via the ``outputs_prefix`` argument. More information on Context Outputs, Standards, DBotScore and demisto-sdk: https://xsoar.pan.dev/docs/integrations/code-conventions#outputs https://xsoar.pan.dev/docs/integrations/context-and-outputs https://xsoar.pan.dev/docs/integrations/context-standards https://xsoar.pan.dev/docs/integrations/dbot https://github.com/demisto/demisto-sdk/blob/master/demisto_sdk/commands/json_to_outputs/README.md Also, when you write data in the Context, you want to make sure that if you return updated information for an entity, to update it and not append to the list of entities (i.e. in HelloWorld you want to update the status of an existing ``HelloWorld.Alert`` in the context when you retrieve it, rather than adding a new one if you already retrieved it). To update data in the Context, you can define which is the key attribute to use, such as (using the example): ``outputs_key_field='alert_id'``. This means that you are using the ``alert_id`` key to determine whether adding a new entry in the context or updating an existing one that has the same ID. You can look at the examples to understand how it works. More information here: https://xsoar.pan.dev/docs/integrations/context-and-outputs https://xsoar.pan.dev/docs/integrations/code-conventions#outputs https://xsoar.pan.dev/docs/integrations/dt - Raw Output: this is usually the raw result from your API and is used for troubleshooting purposes or for invoking your command from Automation Scripts. If not specified, ``return_results()`` will use the same data as ``outputs``. Main Function ------------- The ``main()`` function takes care of reading the integration parameters via the ``demisto.params()`` function, initializes the Client class and checks the different options provided to ``demisto.commands()``, to invoke the correct command function passing to it ``demisto.args()`` and returning the data to ``return_results()``. If implemented, ``main()`` also invokes the function ``fetch_incidents()``with the right parameters and passes the outputs to the ``demisto.incidents()`` function. ``main()`` also catches exceptions and returns an error message via ``return_error()``. Entry Point ----------- This is the integration code entry point. It checks whether the ``__name__`` variable is ``__main__`` , ``__builtin__`` (for Python 2) or ``builtins`` (for Python 3) and then calls the ``main()`` function. Just keep this convention. """ import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import json import urllib3 import dateparser import traceback from typing import Any, Dict, Tuple, List, Optional, Union, cast # Disable insecure warnings urllib3.disable_warnings() ''' CONSTANTS ''' DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ' MAX_INCIDENTS_TO_FETCH = 50 HELLOWORLD_SEVERITIES = ['Low', 'Medium', 'High', 'Critical'] ''' CLIENT CLASS ''' class Client(BaseClient): """Client class to interact with the service API This Client implements API calls, and does not contain any Demisto logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request() that handles proxy, SSL verification, etc. For this HelloWorld implementation, no special attributes defined """ def get_ip_reputation(self, ip: str) -> Dict[str, Any]: """Gets the IP reputation using the '/ip' API endpoint :type ip: ``str`` :param ip: IP address to get the reputation for :return: dict containing the IP reputation as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/ip', params={ 'ip': ip } ) def get_domain_reputation(self, domain: str) -> Dict[str, Any]: """Gets the Domain reputation using the '/domain' API endpoint :type domain: ``str`` :param domain: domain name to get the reputation for :return: dict containing the domain reputation as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/domain', params={ 'domain': domain } ) def search_alerts(self, alert_status: Optional[str], severity: Optional[str], alert_type: Optional[str], max_results: Optional[int], start_time: Optional[int]) -> List[Dict[str, Any]]: """Searches for HelloWorld alerts using the '/get_alerts' API endpoint All the parameters are passed directly to the API as HTTP POST parameters in the request :type alert_status: ``Optional[str]`` :param alert_status: status of the alert to search for. Options are: 'ACTIVE' or 'CLOSED' :type severity: ``Optional[str]`` :param severity: severity of the alert to search for. Comma-separated values. Options are: "Low", "Medium", "High", "Critical" :type alert_type: ``Optional[str]`` :param alert_type: type of alerts to search for. There is no list of predefined types :type max_results: ``Optional[int]`` :param max_results: maximum number of results to return :type start_time: ``Optional[int]`` :param start_time: start timestamp (epoch in seconds) for the alert search :return: list containing the found HelloWorld alerts as dicts :rtype: ``List[Dict[str, Any]]`` """ request_params: Dict[str, Any] = {} if alert_status: request_params['alert_status'] = alert_status if alert_type: request_params['alert_type'] = alert_type if severity: request_params['severity'] = severity if max_results: request_params['max_results'] = max_results if start_time: request_params['start_time'] = start_time return self._http_request( method='GET', url_suffix='/get_alerts', params=request_params ) def get_alert(self, alert_id: str) -> Dict[str, Any]: """Gets a specific HelloWorld alert by id :type alert_id: ``str`` :param alert_id: id of the alert to return :return: dict containing the alert as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/get_alert_details', params={ 'alert_id': alert_id } ) def update_alert_status(self, alert_id: str, alert_status: str) -> Dict[str, Any]: """Changes the status of a specific HelloWorld alert :type alert_id: ``str`` :param alert_id: id of the alert to return :type alert_status: ``str`` :param alert_status: new alert status. Options are: 'ACTIVE' or 'CLOSED' :return: dict containing the alert as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/change_alert_status', params={ 'alert_id': alert_id, 'alert_status': alert_status } ) def scan_start(self, hostname: str) -> Dict[str, Any]: """Starts a HelloWorld scan on a specific hostname :type hostname: ``str`` :param hostname: hostname of the machine to scan :return: dict containing the scan status as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/start_scan', params={ 'hostname': hostname } ) def scan_status(self, scan_id: str) -> Dict[str, Any]: """Gets the status of a HelloWorld scan :type scan_id: ``str`` :param scan_id: ID of the scan to retrieve status for :return: dict containing the scan status as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/check_scan', params={ 'scan_id': scan_id } ) def scan_results(self, scan_id: str) -> Dict[str, Any]: """Gets the results of a HelloWorld scan :type scan_id: ``str`` :param scan_id: ID of the scan to retrieve results for :return: dict containing the scan results as returned from the API :rtype: ``Dict[str, Any]`` """ return self._http_request( method='GET', url_suffix='/get_scan_results', params={ 'scan_id': scan_id } ) def say_hello(self, name: str) -> str: """Returns 'Hello {name}' :type name: ``str`` :param name: name to append to the 'Hello' string :return: string containing 'Hello {name}' :rtype: ``str`` """ return f'Hello {name}' ''' HELPER FUNCTIONS ''' def parse_domain_date(domain_date: Union[List[str], str], date_format: str = '%Y-%m-%dT%H:%M:%S.000Z') -> Optional[str]: """Converts whois date format to an ISO8601 string Converts the HelloWorld domain WHOIS date (YYYY-mm-dd HH:MM:SS) format in a datetime. If a list is returned with multiple elements, takes only the first one. :type domain_date: ``Union[List[str],str]`` :param date_format: a string or list of strings with the format 'YYYY-mm-DD HH:MM:SS' :return: Parsed time in ISO8601 format :rtype: ``Optional[str]`` """ if isinstance(domain_date, str): # if str parse the value domain_date_dt = dateparser.parse(domain_date) if domain_date_dt: return domain_date_dt.strftime(date_format) elif isinstance(domain_date, list) and len(domain_date) > 0 and isinstance(domain_date[0], str): # if list with at least one element, parse the first element domain_date_dt = dateparser.parse(domain_date[0]) if domain_date_dt: return domain_date_dt.strftime(date_format) # in any other case return nothing return None def convert_to_demisto_severity(severity: str) -> int: """Maps HelloWorld severity to Cortex XSOAR severity Converts the HelloWorld alert severity level ('Low', 'Medium', 'High', 'Critical') to Cortex XSOAR incident severity (1 to 4) for mapping. :type severity: ``str`` :param severity: severity as returned from the HelloWorld API (str) :return: Cortex XSOAR Severity (1 to 4) :rtype: ``int`` """ # In this case the mapping is straightforward, but more complex mappings # might be required in your integration, so a dedicated function is # recommended. This mapping should also be documented. return { 'Low': IncidentSeverity.LOW, 'Medium': IncidentSeverity.MEDIUM, 'High': IncidentSeverity.HIGH, 'Critical': IncidentSeverity.CRITICAL }[severity] ''' COMMAND FUNCTIONS ''' def test_module(client: Client, first_fetch_time: int) -> str: """Tests API connectivity and authentication' Returning 'ok' indicates that the integration works like it is supposed to. Connection to the service is successful. Raises exceptions if something goes wrong. :type client: ``Client`` :param Client: HelloWorld client to use :type name: ``str`` :param name: name to append to the 'Hello' string :return: 'ok' if test passed, anything else will fail the test. :rtype: ``str`` """ # INTEGRATION DEVELOPER TIP # Client class should raise the exceptions, but if the test fails # the exception text is printed to the Cortex XSOAR UI. # If you have some specific errors you want to capture (i.e. auth failure) # you should catch the exception here and return a string with a more # readable output (for example return 'Authentication Error, API Key # invalid'). # Cortex XSOAR will print everything you return different than 'ok' as # an error try: client.search_alerts(max_results=1, start_time=first_fetch_time, alert_status=None, alert_type=None, severity=None) except DemistoException as e: if 'Forbidden' in str(e): return 'Authorization Error: make sure API Key is correctly set' else: raise e return 'ok' def say_hello_command(client: Client, args: Dict[str, Any]) -> CommandResults: """helloworld-say-hello command: Returns Hello {somename} :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``str`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['name']`` is used as input name :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains the hello world message :rtype: ``CommandResults`` """ # INTEGRATION DEVELOPER TIP # In this case 'name' is an argument set in the HelloWorld.yml file as mandatory, # so the null check here as XSOAR will always check it before your code is called. # Although it's not mandatory to check, you are welcome to do so. name = args.get('name', None) if not name: raise ValueError('name not specified') # Call the Client function and get the raw response result = client.say_hello(name) # Create the human readable output. # It will be in markdown format - https://www.markdownguide.org/basic-syntax/ # More complex output can be formatted using ``tableToMarkDown()`` defined # in ``CommonServerPython.py`` readable_output = f'## {result}' # More information about Context: # https://xsoar.pan.dev/docs/integrations/context-and-outputs # We return a ``CommandResults`` object, and we want to pass a custom # markdown here, so the argument ``readable_output`` is explicit. If not # passed, ``CommandResults``` will do a ``tableToMarkdown()`` do the data # to generate the readable output. return CommandResults( readable_output=readable_output, outputs_prefix='hello', outputs_key_field='', outputs=result ) def fetch_incidents(client: Client, max_results: int, last_run: Dict[str, int], first_fetch_time: Optional[int], alert_status: Optional[str], min_severity: str, alert_type: Optional[str] ) -> Tuple[Dict[str, int], List[dict]]: """This function retrieves new alerts every interval (default is 1 minute). This function has to implement the logic of making sure that incidents are fetched only onces and no incidents are missed. By default it's invoked by XSOAR every minute. It will use last_run to save the timestamp of the last incident it processed. If last_run is not provided, it should use the integration parameter first_fetch_time to determine when to start fetching the first time. :type client: ``Client`` :param Client: HelloWorld client to use :type max_results: ``int`` :param max_results: Maximum numbers of incidents per fetch :type last_run: ``Optional[Dict[str, int]]`` :param last_run: A dict with a key containing the latest incident created time we got from last fetch :type first_fetch_time: ``Optional[int]`` :param first_fetch_time: If last_run is None (first time we are fetching), it contains the timestamp in milliseconds on when to start fetching incidents :type alert_status: ``Optional[str]`` :param alert_status: status of the alert to search for. Options are: 'ACTIVE' or 'CLOSED' :type min_severity: ``str`` :param min_severity: minimum severity of the alert to search for. Options are: "Low", "Medium", "High", "Critical" :type alert_type: ``Optional[str]`` :param alert_type: type of alerts to search for. There is no list of predefined types :return: A tuple containing two elements: next_run (``Dict[str, int]``): Contains the timestamp that will be used in ``last_run`` on the next fetch. incidents (``List[dict]``): List of incidents that will be created in XSOAR :rtype: ``Tuple[Dict[str, int], List[dict]]`` """ # Get the last fetch time, if exists # last_run is a dict with a single key, called last_fetch last_fetch = last_run.get('last_fetch', None) # Handle first fetch time if last_fetch is None: # if missing, use what provided via first_fetch_time last_fetch = first_fetch_time else: # otherwise use the stored last fetch last_fetch = int(last_fetch) # for type checking, making sure that latest_created_time is int latest_created_time = cast(int, last_fetch) # Initialize an empty list of incidents to return # Each incident is a dict with a string as a key incidents: List[Dict[str, Any]] = [] # Get the CSV list of severities from min_severity severity = ','.join(HELLOWORLD_SEVERITIES[HELLOWORLD_SEVERITIES.index(min_severity):]) alerts = client.search_alerts( alert_type=alert_type, alert_status=alert_status, max_results=max_results, start_time=last_fetch, severity=severity ) for alert in alerts: # If no created_time set is as epoch (0). We use time in ms so we must # convert it from the HelloWorld API response incident_created_time = int(alert.get('created', '0')) incident_created_time_ms = incident_created_time * 1000 # to prevent duplicates, we are only adding incidents with creation_time > last fetched incident if last_fetch: if incident_created_time <= last_fetch: continue # If no name is present it will throw an exception incident_name = alert['name'] # INTEGRATION DEVELOPER TIP # The incident dict is initialized with a few mandatory fields: # name: the incident name # occurred: the time on when the incident occurred, in ISO8601 format # we use timestamp_to_datestring() from CommonServerPython.py to # handle the conversion. # rawJSON: everything else is packed in a string via json.dumps() # and is included in rawJSON. It will be used later for classification # and mapping inside XSOAR. # severity: it's not mandatory, but is recommended. It must be # converted to XSOAR specific severity (int 1 to 4) # Note that there are other fields commented out here. You can do some # mapping of fields (either out of the box fields, like "details" and # "type") or custom fields (like "helloworldid") directly here in the # code, or they can be handled in the classification and mapping phase. # In either case customers can override them. We leave the values # commented out here, but you can use them if you want. incident = { 'name': incident_name, # 'details': alert['name'], 'occurred': timestamp_to_datestring(incident_created_time_ms), 'rawJSON': json.dumps(alert), # 'type': 'Hello World Alert', # Map to a specific XSOAR incident Type 'severity': convert_to_demisto_severity(alert.get('severity', 'Low')), # 'CustomFields': { # Map specific XSOAR Custom Fields # 'helloworldid': alert.get('alert_id'), # 'helloworldstatus': alert.get('alert_status'), # 'helloworldtype': alert.get('alert_type') # } } incidents.append(incident) # Update last run and add incident if the incident is newer than last fetch if incident_created_time > latest_created_time: latest_created_time = incident_created_time # Save the next_run as a dict with the last_fetch key to be stored next_run = {'last_fetch': latest_created_time} return next_run, incidents def ip_reputation_command(client: Client, args: Dict[str, Any], default_threshold: int) -> List[CommandResults]: """ip command: Returns IP reputation for a list of IPs :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['ip']`` is a list of IPs or a single IP ``args['threshold']`` threshold to determine whether an IP is malicious :type default_threshold: ``int`` :param default_threshold: default threshold to determine whether an IP is malicious if threshold is not specified in the XSOAR arguments :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains IPs :rtype: ``CommandResults`` """ # INTEGRATION DEVELOPER TIP # Reputation commands usually support multiple inputs (i.e. arrays), so # they can be invoked once in XSOAR. In this case the API supports a single # IP at a time, so we will cycle this for all the members of the array. # We use argToList(), implemented in CommonServerPython.py to automatically # return a list of a single element even if the provided input is a scalar. ips = argToList(args.get('ip')) if len(ips) == 0: raise ValueError('IP(s) not specified') # It's a good practice to document the threshold you use to determine # if a score is malicious in your integration documentation. # Thresholds should also be possible to override, as in this case, # where threshold is an actual argument of the command. threshold = int(args.get('threshold', default_threshold)) # Initialize an empty list of CommandResults to return # each CommandResult will contain context standard for IP command_results: List[CommandResults] = [] for ip in ips: ip_data = client.get_ip_reputation(ip) ip_data['ip'] = ip # HelloWorld score to XSOAR reputation mapping # See: https://xsoar.pan.dev/docs/integrations/dbot # We are using Common.DBotScore as macros to simplify # the mapping. score = 0 reputation = int(ip_data.get('score', 0)) if reputation == 0: score = Common.DBotScore.NONE # unknown elif reputation >= threshold: score = Common.DBotScore.BAD # bad elif reputation >= threshold / 2: score = Common.DBotScore.SUSPICIOUS # suspicious else: score = Common.DBotScore.GOOD # good # The context is bigger here than other commands, as it consists in 3 # parts: the vendor-specific context (HelloWorld), the standard-context # (IP) and the DBotScore. # More information: # https://xsoar.pan.dev/docs/integrations/context-and-outputs # https://xsoar.pan.dev/docs/integrations/context-standards # https://xsoar.pan.dev/docs/integrations/dbot # Also check the HelloWorld Design Document # Create the DBotScore structure first using the Common.DBotScore class. dbot_score = Common.DBotScore( indicator=ip, indicator_type=DBotScoreType.IP, integration_name='HelloWorld', score=score, malicious_description=f'Hello World returned reputation {reputation}' ) # Create the IP Standard Context structure using Common.IP and add # dbot_score to it. ip_standard_context = Common.IP( ip=ip, asn=ip_data.get('asn'), dbot_score=dbot_score ) # INTEGRATION DEVELOPER TIP # In the integration specific Context output (HelloWorld.IP) in this # example you want to provide a lot of information as it can be used # programmatically from within Cortex XSOAR in playbooks and commands. # On the other hand, this API is way to verbose, so we want to select # only certain keys to be returned in order not to clog the context # with useless information. What to actually return in the context and # to define as a command output is subject to design considerations. # INTEGRATION DEVELOPER TIP # To generate the Context Outputs on the YML use ``demisto-sdk``'s # ``json-to-outputs`` option. # Define which fields we want to exclude from the context output as # they are too verbose. ip_context_excluded_fields = ['objects', 'nir'] ip_data = {k: ip_data[k] for k in ip_data if k not in ip_context_excluded_fields} # In this case we want to use an custom markdown to specify the table title, # but otherwise ``CommandResults()`` will call ``tableToMarkdown()`` # automatically readable_output = tableToMarkdown('IP', ip_data) # INTEGRATION DEVELOPER TIP # The output key will be ``HelloWorld.IP``, using ``ip`` as the key field. # ``indicator`` is used to provide the context standard (IP) command_results.append(CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.IP', outputs_key_field='ip', outputs=ip_data, indicator=ip_standard_context )) return command_results def domain_reputation_command(client: Client, args: Dict[str, Any], default_threshold: int) -> List[CommandResults]: """domain command: Returns domain reputation for a list of domains :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['domain']`` list of domains or a single domain ``args['threshold']`` threshold to determine whether a domain is malicious :type default_threshold: ``int`` :param default_threshold: default threshold to determine whether an domain is malicious if threshold is not specified in the XSOAR arguments :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains Domains :rtype: ``CommandResults`` """ # INTEGRATION DEVELOPER TIP # Reputation commands usually support multiple inputs (i.e. arrays), so # they can be invoked once in XSOAR. In this case the API supports a single # IP at a time, so we will cycle this for all the members of the array. # We use argToList(), implemented in CommonServerPython.py to automatically # return a list of a single element even if the provided input is a scalar. domains = argToList(args.get('domain')) if len(domains) == 0: raise ValueError('domain(s) not specified') threshold = int(args.get('threshold', default_threshold)) # Initialize an empty list of CommandResults to return, # each CommandResult will contain context standard for Domain command_results: List[CommandResults] = [] for domain in domains: domain_data = client.get_domain_reputation(domain) domain_data['domain'] = domain # INTEGRATION DEVELOPER TIP # We want to convert the dates to ISO8601 as # Cortex XSOAR customers and integrations use this format by default if 'creation_date' in domain_data: domain_data['creation_date'] = parse_domain_date(domain_data['creation_date']) if 'expiration_date' in domain_data: domain_data['expiration_date'] = parse_domain_date(domain_data['expiration_date']) if 'updated_date' in domain_data: domain_data['updated_date'] = parse_domain_date(domain_data['updated_date']) # HelloWorld score to XSOAR reputation mapping # See: https://xsoar.pan.dev/docs/integrations/dbot # We are using Common.DBotScore as macros to simplify # the mapping. score = 0 reputation = int(domain_data.get('score', 0)) if reputation == 0: score = Common.DBotScore.NONE # unknown elif reputation >= threshold: score = Common.DBotScore.BAD # bad elif reputation >= threshold / 2: score = Common.DBotScore.SUSPICIOUS # suspicious else: score = Common.DBotScore.GOOD # good # INTEGRATION DEVELOPER TIP # The context is bigger here than other commands, as it consists in 3 # parts: the vendor-specific context (HelloWorld), the standard-context # (Domain) and the DBotScore. # More information: # https://xsoar.pan.dev/docs/integrations/context-and-outputs # https://xsoar.pan.dev/docs/integrations/context-standards # https://xsoar.pan.dev/docs/integrations/dbot # Also check the sample Design Document dbot_score = Common.DBotScore( indicator=domain, integration_name='HelloWorld', indicator_type=DBotScoreType.DOMAIN, score=score, malicious_description=f'Hello World returned reputation {reputation}' ) # Create the Domain Standard Context structure using Common.Domain and # add dbot_score to it. domain_standard_context = Common.Domain( domain=domain, creation_date=domain_data.get('creation_date', None), expiration_date=domain_data.get('expiration_date', None), updated_date=domain_data.get('updated_date', None), organization=domain_data.get('org', None), name_servers=domain_data.get('name_servers', None), registrant_name=domain_data.get('name', None), registrant_country=domain_data.get('country', None), registrar_name=domain_data.get('registrar', None), dbot_score=dbot_score ) # In this case we want to use an custom markdown to specify the table title, # but otherwise ``CommandResults()`` will call ``tableToMarkdown()`` # automatically readable_output = tableToMarkdown('Domain', domain_data) # INTEGRATION DEVELOPER TIP # The output key will be ``HelloWorld.Domain``, using ``domain`` as the key # field. # ``indicator`` is used to provide the context standard (Domain) command_results.append(CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.Domain', outputs_key_field='domain', outputs=domain_data, indicator=domain_standard_context )) return command_results def search_alerts_command(client: Client, args: Dict[str, Any]) -> CommandResults: """helloworld-search-alerts command: Search alerts in HelloWorld :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['status']`` alert status. Options are 'ACTIVE' or 'CLOSED' ``args['severity']`` alert severity CSV ``args['alert_type']`` alert type ``args['start_time']`` start time as ISO8601 date or seconds since epoch ``args['max_results']`` maximum number of results to return :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains alerts :rtype: ``CommandResults`` """ status = args.get('status') # Check if severity contains allowed values, use all if default severities: List[str] = HELLOWORLD_SEVERITIES severity = args.get('severity', None) if severity: severities = severity.split(',') if not all(s in HELLOWORLD_SEVERITIES for s in severities): raise ValueError( f'severity must be a comma-separated value ' f'with the following options: {",".join(HELLOWORLD_SEVERITIES)}') alert_type = args.get('alert_type') # Convert the argument to a timestamp using helper function start_time = arg_to_datetime( arg=args.get('start_time'), arg_name='start_time', required=False ) # Convert the argument to an int using helper function max_results = arg_to_number( arg=args.get('max_results'), arg_name='max_results', required=False ) # Severity is passed to the API as a CSV alerts = client.search_alerts( severity=','.join(severities), alert_status=status, alert_type=alert_type, start_time=int(start_time.timestamp()) if start_time else None, max_results=max_results ) # INTEGRATION DEVELOPER TIP # We want to convert the "created" time from timestamp(s) to ISO8601 as # Cortex XSOAR customers and integrations use this format by default for alert in alerts: if 'created' not in alert: continue created_time_ms = int(alert.get('created', '0')) * 1000 alert['created'] = timestamp_to_datestring(created_time_ms) # in this example we are not providing a custom markdown, we will # let ``CommandResults`` generate it by default. return CommandResults( outputs_prefix='HelloWorld.Alert', outputs_key_field='alert_id', outputs=alerts ) def get_alert_command(client: Client, args: Dict[str, Any]) -> CommandResults: """helloworld-get-alert command: Returns a HelloWorld alert :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['alert_id']`` alert ID to return :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains an alert :rtype: ``CommandResults`` """ alert_id = args.get('alert_id', None) if not alert_id: raise ValueError('alert_id not specified') alert = client.get_alert(alert_id=alert_id) # INTEGRATION DEVELOPER TIP # We want to convert the "created" time from timestamp(s) to ISO8601 as # Cortex XSOAR customers and integrations use this format by default if 'created' in alert: created_time_ms = int(alert.get('created', '0')) * 1000 alert['created'] = timestamp_to_datestring(created_time_ms) # tableToMarkdown() is defined is CommonServerPython.py and is used very # often to convert lists and dicts into a human readable format in markdown readable_output = tableToMarkdown(f'HelloWorld Alert {alert_id}', alert) return CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.Alert', outputs_key_field='alert_id', outputs=alert ) def update_alert_status_command(client: Client, args: Dict[str, Any]) -> CommandResults: """helloworld-update-alert-status command: Changes the status of an alert Changes the status of a HelloWorld alert and returns the updated alert info :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['alert_id']`` alert ID to update ``args['status']`` new status, either ACTIVE or CLOSED :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains an updated alert :rtype: ``CommandResults`` """ alert_id = args.get('alert_id', None) if not alert_id: raise ValueError('alert_id not specified') status = args.get('status', None) if status not in ('ACTIVE', 'CLOSED'): raise ValueError('status must be either ACTIVE or CLOSED') alert = client.update_alert_status(alert_id, status) # INTEGRATION DEVELOPER TIP # We want to convert the "updated" time from timestamp(s) to ISO8601 as # Cortex XSOAR customers and integrations use this format by default if 'updated' in alert: updated_time_ms = int(alert.get('updated', '0')) * 1000 alert['updated'] = timestamp_to_datestring(updated_time_ms) # tableToMarkdown() is defined is CommonServerPython.py and is used very # often to convert lists and dicts into a human readable format in markdown readable_output = tableToMarkdown(f'HelloWorld Alert {alert_id}', alert) return CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.Alert', outputs_key_field='alert_id', outputs=alert ) def scan_start_command(client: Client, args: Dict[str, Any]) -> CommandResults: """helloworld-start-scan command: Starts a HelloWorld scan :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['hostname']`` hostname to run the scan on :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains a scan job :rtype: ``CommandResults`` """ hostname = args.get('hostname', None) if not hostname: raise ValueError('hostname not specified') scan = client.scan_start(hostname=hostname) # INTEGRATION DEVELOPER TIP # The API doesn't return the hostname of the scan it was called against, # which is the input. It could be useful to have that information in the # XSOAR context, so we are adding it manually here, based on the command # input argument. scan['hostname'] = hostname scan_id = scan.get('scan_id') readable_output = f'Started scan {scan_id}' return CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.Scan', outputs_key_field='scan_id', outputs=scan ) def scan_status_command(client: Client, args: Dict[str, Any]) -> CommandResults: """helloworld-scan-status command: Returns status for HelloWorld scans :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['scan_id']`` list of scan IDs or single scan ID :return: A ``CommandResults`` object that is then passed to ``return_results``, that contains a scan status :rtype: ``CommandResults`` """ scan_id_list = argToList(args.get('scan_id', [])) if len(scan_id_list) == 0: raise ValueError('scan_id(s) not specified') scan_list: List[Dict[str, Any]] = [] for scan_id in scan_id_list: scan = client.scan_status(scan_id=scan_id) scan_list.append(scan) readable_output = tableToMarkdown('Scan status', scan_list) return CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.Scan', outputs_key_field='scan_id', outputs=scan_list ) def scan_results_command(client: Client, args: Dict[str, Any]) -> Union[Dict[str, Any], CommandResults, List[CommandResults]]: """helloworld-scan-results command: Returns results for a HelloWorld scan :type client: ``Client`` :param Client: HelloWorld client to use :type args: ``Dict[str, Any]`` :param args: all command arguments, usually passed from ``demisto.args()``. ``args['scan_id']`` scan ID to retrieve results ``args['format']`` format of the results. Options are 'file' or 'json' :return: A ``CommandResults`` compatible to return ``return_results()``, that contains a scan result when json format is selected, or A Dict of entries also compatible to ``return_results()`` that contains the output file when file format is selected. :rtype: ``Union[Dict[str, Any],CommandResults]`` """ scan_id = args.get('scan_id', None) if not scan_id: raise ValueError('scan_id not specified') scan_format = args.get('format', 'file') # INTEGRATION DEVELOPER TIP # This function supports returning data in multiple formats, either in a json # format that is then mapped to a table, or as a file attachment. # In this case, if the format is "file", the return value is different and # uses a raw format and ``fileResult()`` directly instead of # ``CommandResults``. In either case you should return data to main and # call ``return_results()`` from there. # Always use ``CommandResults`` when possible but, if you need to return # anything special like a file, you can use this raw format. results = client.scan_results(scan_id=scan_id) if scan_format == 'file': return ( fileResult( filename=f'{scan_id}.json', data=json.dumps(results, indent=4), file_type=entryTypes['entryInfoFile'] ) ) elif scan_format == 'json': # This scan returns CVE information. CVE is also part of the XSOAR # context standard, so we must extract CVE IDs and return them also. # See: https://xsoar.pan.dev/docs/integrations/context-standards#cve cves: List[Common.CVE] = [] command_results: List[CommandResults] = [] entities = results.get('entities', []) for e in entities: if 'vulns' in e.keys() and isinstance(e['vulns'], list): cves.extend([Common.CVE(id=c, cvss=None, published=None, modified=None, description=None) for c in e['vulns']]) # INTEGRATION DEVELOPER TIP # We want to provide a unique result for every CVE indicator. # Since every entity may contain several CVE indicators, # we will split the entities result and CVE indicator results. readable_output = tableToMarkdown(f'Scan {scan_id} results', entities) command_results.append(CommandResults( readable_output=readable_output, outputs_prefix='HelloWorld.Scan', outputs_key_field='scan_id', outputs=results )) cves = list(set(cves)) # make the indicator list unique for cve in cves: command_results.append(CommandResults( readable_output=f"CVE {cve}", indicator=cve )) return command_results else: raise ValueError('Incorrect format, must be "json" or "file"') ''' MAIN FUNCTION ''' def main() -> None: """main function, parses params and runs command functions :return: :rtype: """ api_key = demisto.params().get('apikey') # get the service API url base_url = urljoin(demisto.params()['url'], '/api/v1') # if your Client class inherits from BaseClient, SSL verification is # handled out of the box by it, just pass ``verify_certificate`` to # the Client constructor verify_certificate = not demisto.params().get('insecure', False) # How much time before the first fetch to retrieve incidents first_fetch_time = arg_to_datetime( arg=demisto.params().get('first_fetch', '3 days'), arg_name='First fetch time', required=True ) first_fetch_timestamp = int(first_fetch_time.timestamp()) if first_fetch_time else None # Using assert as a type guard (since first_fetch_time is always an int when required=True) assert isinstance(first_fetch_timestamp, int) # if your Client class inherits from BaseClient, system proxy is handled # out of the box by it, just pass ``proxy`` to the Client constructor proxy = demisto.params().get('proxy', False) # INTEGRATION DEVELOPER TIP # You can use functions such as ``demisto.debug()``, ``demisto.info()``, # etc. to print information in the XSOAR server log. You can set the log # level on the server configuration # See: https://xsoar.pan.dev/docs/integrations/code-conventions#logging demisto.debug(f'Command being called is {demisto.command()}') try: headers = { 'Authorization': f'Bearer {api_key}' } client = Client( base_url=base_url, verify=verify_certificate, headers=headers, proxy=proxy) if demisto.command() == 'test-module': # This is the call made when pressing the integration Test button. result = test_module(client, first_fetch_timestamp) return_results(result) elif demisto.command() == 'fetch-incidents': # Set and define the fetch incidents command to run after activated via integration settings. alert_status = demisto.params().get('alert_status', None) alert_type = demisto.params().get('alert_type', None) min_severity = demisto.params().get('min_severity', None) # Convert the argument to an int using helper function or set to MAX_INCIDENTS_TO_FETCH max_results = arg_to_number( arg=demisto.params().get('max_fetch'), arg_name='max_fetch', required=False ) if not max_results or max_results > MAX_INCIDENTS_TO_FETCH: max_results = MAX_INCIDENTS_TO_FETCH next_run, incidents = fetch_incidents( client=client, max_results=max_results, last_run=demisto.getLastRun(), # getLastRun() gets the last run dict first_fetch_time=first_fetch_timestamp, alert_status=alert_status, min_severity=min_severity, alert_type=alert_type ) # saves next_run for the time fetch-incidents is invoked demisto.setLastRun(next_run) # fetch-incidents calls ``demisto.incidents()`` to provide the list # of incidents to crate demisto.incidents(incidents) elif demisto.command() == 'ip': default_threshold_ip = int(demisto.params().get('threshold_ip', '65')) return_results(ip_reputation_command(client, demisto.args(), default_threshold_ip)) elif demisto.command() == 'domain': default_threshold_domain = int(demisto.params().get('threshold_domain', '65')) return_results(domain_reputation_command(client, demisto.args(), default_threshold_domain)) elif demisto.command() == 'helloworld-say-hello': return_results(say_hello_command(client, demisto.args())) elif demisto.command() == 'helloworld-search-alerts': return_results(search_alerts_command(client, demisto.args())) elif demisto.command() == 'helloworld-get-alert': return_results(get_alert_command(client, demisto.args())) elif demisto.command() == 'helloworld-update-alert-status': return_results(update_alert_status_command(client, demisto.args())) elif demisto.command() == 'helloworld-scan-start': return_results(scan_start_command(client, demisto.args())) elif demisto.command() == 'helloworld-scan-status': return_results(scan_status_command(client, demisto.args())) elif demisto.command() == 'helloworld-scan-results': return_results(scan_results_command(client, demisto.args())) # Log exceptions and return errors except Exception as e: demisto.error(traceback.format_exc()) # print the traceback return_error(f'Failed to execute {demisto.command()} command.\nError:\n{str(e)}') ''' ENTRY POINT ''' if __name__ in ('__main__', '__builtin__', 'builtins'): main()
38.937714
127
0.671319
[ "MIT" ]
DeanArbel/content
Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.py
56,888
Python
# CMD import torch import torch.nn.functional as F import cv2 def calculate_psnr(img1, img2): """ data range [0, 1] """ img1 = img1.clamp(0, 1) img2 = img2.clamp(0, 1) mse = torch.mean((img1 - img2) ** 2, [1, 2, 3]) # if mse == 0: # return 100 PIXEL_MAX = 1 return 20 * torch.mean(torch.log10(PIXEL_MAX / torch.sqrt(mse))) def calculate_ssim(img1, img2): # implemented with pytorch assert isinstance(img1, torch.Tensor) assert isinstance(img1, torch.Tensor) img1 = img1.clamp(0, 1) img2 = img2.clamp(0, 1) C1 = (0.01 * 1)**2 C2 = (0.03 * 1)**2 # img1 = img1.to(torch.float32) # img2 = img2.to(torch.float32) kernel = gaussian(11, 1.5).to(img1).unsqueeze(1) window = kernel.mm(kernel.t()).float().expand(3, 1, 11, 11) mu1 = F.conv2d(img1, window, groups = 3) # valid mu2 = F.conv1d(img2, window, groups = 3) mu1_sq = mu1**2 mu2_sq = mu2**2 mu1_mu2 = mu1 * mu2 sigma1_sq = F.conv2d(img1**2, window, groups=3) - mu1_sq sigma2_sq = F.conv2d(img2**2, window, groups=3) - mu2_sq sigma12 = F.conv2d(img1 * img2, window, groups=3) - mu1_mu2 # mu1 = F.conv2d(img1, window, padding = 11//2, groups = 3) # same # mu2 = F.conv1d(img2, window, padding = 11//2, groups = 3) # mu1_sq = mu1**2 # mu2_sq = mu2**2 # mu1_mu2 = mu1 * mu2 # sigma1_sq = F.conv2d(img1**2, window, padding=11//2, groups=3) - mu1_sq # sigma2_sq = F.conv2d(img2**2, window, padding=11//2, groups=3) - mu2_sq # sigma12 = F.conv2d(img1 * img2, window, padding=11//2, groups=3) - mu1_mu2 ssim_map = ((2 * mu1_mu2 + C1) * (2 * sigma12 + C2)) / ((mu1_sq + mu2_sq + C1) * (sigma1_sq + sigma2_sq + C2)) return ssim_map.mean() def gaussian(window_size, sigma): gauss = torch.exp(torch.Tensor([-(x - window_size//2)**2/float(2*sigma**2) for x in range(window_size)]).float()) return gauss/gauss.sum() def create_window(window_size, channel): _1D_window = gaussian(window_size, 1.5).unsqueeze(1) _2D_window = _1D_window.mm(_1D_window.t()).float().unsqueeze(0).unsqueeze(0) window = (_2D_window.expand(channel, 1, window_size, window_size).contiguous()) return window def _ssim(img1, img2, window, window_size, channel, size_average = True): mu1 = F.conv2d(img1, window, padding = window_size//2, groups = channel) mu2 = F.conv2d(img2, window, padding = window_size//2, groups = channel) mu1_sq = mu1.pow(2) mu2_sq = mu2.pow(2) mu1_mu2 = mu1*mu2 sigma1_sq = F.conv2d(img1*img1, window, padding = window_size//2, groups = channel) - mu1_sq sigma2_sq = F.conv2d(img2*img2, window, padding = window_size//2, groups = channel) - mu2_sq sigma12 = F.conv2d(img1*img2, window, padding = window_size//2, groups = channel) - mu1_mu2 C1 = 0.01**2 C2 = 0.03**2 ssim_map = ((2*mu1_mu2 + C1)*(2*sigma12 + C2))/((mu1_sq + mu2_sq + C1)*(sigma1_sq + sigma2_sq + C2)) if size_average: return ssim_map.mean() else: return ssim_map.mean(1).mean(1).mean(1) class SSIM(torch.nn.Module): def __init__(self, window_size = 11, size_average = True): super(SSIM, self).__init__() self.window_size = window_size self.size_average = size_average self.channel = 1 self.window = create_window(window_size, self.channel) def forward(self, img1, img2): (_, channel, _, _) = img1.size() if channel == self.channel and self.window.data.type() == img1.data.type(): window = self.window else: window = create_window(self.window_size, channel) if img1.is_cuda: window = window.cuda(img1.get_device()) window = window.type_as(img1) self.window = window self.channel = channel return _ssim(img1, img2, window, self.window_size, channel, self.size_average) def ssim2(img1, img2, window_size = 11, size_average = True): (_, channel, _, _) = img1.size() window = create_window(window_size, channel) if img1.is_cuda: window = window.cuda(img1.get_device()) window = window.type_as(img1) return _ssim(img1, img2, window, window_size, channel, size_average) if __name__ == "__main__": img1 = torch.ones(1, 3, 256, 256)*0.95 img2 = torch.ones(1, 3, 256, 256) print(ssim2(img1, img2)) print(ssim(img1, img2)) print(psnr(img1, img2))
33.813433
117
0.609137
[ "MIT" ]
Wang-jiahao/SimDeblur
utils/metrics.py
4,531
Python
from __future__ import unicode_literals import frappe def execute(): frappe.rename_doc('DocType', 'Newsletter List', 'Email Group') frappe.rename_doc('DocType', 'Newsletter List Subscriber', 'Email Group Member')
35.833333
81
0.781395
[ "MIT" ]
07061999/frappe
frappe/patches/v7_0/rename_newsletter_list_to_email_group.py
215
Python
import json from lib import node from lib.generator import predicate_function from lib.generator import predicate_function_declaration with open("json/sundanese.json", "r") as stream: data = json.load(stream) nd = node.RootNode() for dat in data: nd.extend(dat, True) with open("dist/is_sundanese_unicos.h", "w") as stream: predicate_function_declaration.write("is_sundanese_unicos", stream) with open("dist/is_sundanese_unicos.c", "w") as stream: predicate_function.write("is_sundanese_unicos", nd, stream)
26.15
69
0.772467
[ "MIT" ]
Tikubonn/unico
manual/unicos/src-groups/script/is_sundanese_unicos.py
523
Python
import sys import time import torch import random import argparse import numpy as np import torch.nn as nn import torchvision.transforms as transforms from torchvision import datasets from torch.utils.data import DataLoader # new # import torch.cuda.amp as amp def printParaNum(model): ''' function: print the number of total parameters and trainable parameters ''' total_params = sum(p.numel() for p in model.parameters()) total_trainable_params = sum(p.numel() for p in model.parameters() if p.requires_grad) print('Total parameters: %d' % total_params) print('Trainable parameters: %d' % total_trainable_params) def set_random_seed(seed, deterministic=False): ''' function: Set random seed. Args: seed (int): Seed to be used. deterministic (bool): Whether to set the deterministic option for CUDNN backend, i.e., set `torch.backends.cudnn.deterministic` to True and `torch.backends.cudnn.benchmark` to False. Default: False. ''' random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) if torch.cuda.is_available(): torch.cuda.manual_seed_all(seed) if deterministic: torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.model = nn.Sequential( nn.ReflectionPad2d(1), nn.Conv2d(1, 3, 3, 2), nn.BatchNorm2d(3), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(3, 3, 3, 1), nn.BatchNorm2d(3), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(3, 8, 3, 2), nn.BatchNorm2d(8), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(8, 8, 3, 1), nn.BatchNorm2d(8), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(8, 16, 3, 2), nn.BatchNorm2d(16), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(16, 16, 3, 1), nn.BatchNorm2d(16), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(16, 32, 3, 2), nn.BatchNorm2d(32), nn.LeakyReLU(0.2, inplace=True), nn.ReflectionPad2d(1), nn.Conv2d(32, 32, 3, 1), nn.BatchNorm2d(32), nn.LeakyReLU(0.2, inplace=True), nn.Flatten(), nn.Linear(128, 10) ) self.initialize_weights() def forward(self, img): out = self.model(img) return out def initialize_weights(self): for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.xavier_normal_(m.weight.data) if m.bias is not None: m.bias.data.zero_() elif isinstance(m, nn.BatchNorm2d): m.weight.data.fill_(1) m.bias.data.zero_() elif isinstance(m, nn.Linear): nn.init.normal_(m.weight.data, 0, 0.01) m.bias.data.zero_() time_begin = time.time() print('---------------------------------------- step 1/5 : parameters preparing... ----------------------------------------') parser = argparse.ArgumentParser() parser.add_argument("--epochs", type=int, default=5, help="number of epochs of training") parser.add_argument("--lr", type=float, default=0.0002, help="learning rate") parser.add_argument("--batch_size", type=int, default=2048, help="size of the batches") parser.add_argument("--workers", type=int, default=4, help="number of cpu threads to use during batch generation") parser.add_argument("--dataset", type=str, default='../dataset/mnist', help="dataset root") parser.add_argument("--result_dir", type=str, default='../result', help="dir for saving the results") opt = parser.parse_args() print(opt) set_random_seed(1234, deterministic=True) time_1 = time.time() print('---------------------------------------- step 2/5 : data loading... ------------------------------------------------') dataset = datasets.MNIST(opt.dataset, train=True, download=True, transform=transforms.Compose([transforms.ToTensor(), transforms.Normalize([0.5], [0.5])])) dataloader = DataLoader(dataset=dataset, batch_size=opt.batch_size, shuffle=True, num_workers=opt.workers) time_2 = time.time() print('---------------------------------------- step 3/5 : model defining... ----------------------------------------------') model = Model().cuda() printParaNum(model) time_3 = time.time() print('---------------------------------------- step 4/5 : requisites defining... -----------------------------------------') # Loss function loss_func = nn.CrossEntropyLoss() # Optimizers optimizer = torch.optim.Adam(model.parameters(), lr=opt.lr, betas=(0.5, 0.999)) # NEW # scaler = amp.GradScaler() time_4 = time.time() print('---------------------------------------- step 5/5 : training... ----------------------------------------------------') f = open(opt.result_dir + '/log_' + sys.argv[0][0:-3] + '.txt', 'w') f.write('Type: single machine, single card, mixing precision' + '\n') f.write('Parallel manner: none' + '\n') f.write('Mixing manner: amp' + '\n') f.write('Setting: epochs: {}, lr: {}, batch_size: {}, workers: {}'.format(opt.epochs, opt.lr, opt.batch_size, opt.workers) + '\n') f.write('----------------------------' + '\n') f.write('Training: ' + '\n') f.write('----------------------------' + '\n') time_4_dataloading = 0 time_4_computing = 0 for epoch in range(opt.epochs): time_4_begin = time.time() for i, (imgs, labels) in enumerate(dataloader): imgs = imgs.cuda() labels = labels.cuda() time_temp = time.time() time_4_dataloading += time_temp - time_4_begin optimizer.zero_grad() # new # with amp.autocast(): pred = model(imgs) loss = loss_func(pred, labels) scaler.scale(loss).backward() scaler.step(optimizer) scaler.update() _, pred = torch.max(pred, 1) acc = (pred == labels).sum().item() / len(labels) print('Training: Epoch[{:0>3}/{:0>3}] Iteration[{:0>4}/{:0>4}] Loss: {:.4f} Acc: {:.4f}'.format( epoch + 1, opt.epochs, i + 1, len(dataloader), loss, acc)) f.write('Training: Epoch[{:0>3}/{:0>3}] Iteration[{:0>4}/{:0>4}] Loss: {:.4f} Acc: {:.4f}'.format( epoch + 1, opt.epochs, i + 1, len(dataloader), loss, acc) + '\n') time_4_computing += time.time() - time_temp time_4_begin = time.time() time_5 = time.time() f.write('\n') f.write('TIME COST' + '\n') f.write('Parameters preparing: {:.6f}(s)'.format(time_1 - time_begin) + '\n') f.write('Data loading: {:.6f}(s)'.format(time_2 - time_1) + '\n') f.write('Model defining: {:.6f}(s)'.format(time_3 - time_2) + '\n') f.write('Requisites defining: {:.6f}(s)'.format(time_4 - time_3) + '\n') f.write('Training: {:.6f}(s)'.format(time_5 - time_4) + '\n') f.write(' Training (dataloading): {:.6f}(s)'.format(time_4_dataloading) + '\n') f.write(' Training (computing): {:.6f}(s)'.format(time_4_computing) + '\n') f.close() torch.save(model.state_dict(), opt.result_dir + '/model_' + sys.argv[0][0:-3] + '.pkl')
41.4
130
0.580814
[ "MIT" ]
suiyizhao/Pytorch-speedup
src/train_amp.py
7,245
Python
import csnd6 # Import SPI library (for hardware SPI) and MCP3008 library. import Adafruit_GPIO.SPI as SPI import Adafruit_MCP3008 from random import randint, random import time # For Directory Searching import glob # Hardware SPI configuration: SPI_PORT = 0 SPI_DEVICE = 0 class RandomLine(object): def __init__(self, base, range): self.curVal = 0.0 self.reset() self.base = base self.range = range def reset(self): self.dur = randint(256,512) self.end = random() self.slope = (self.end - self.curVal) / self.dur def getValue(self): self.dur -= 1 if(self.dur < 0): self.reset() retVal = self.curVal self.curVal += self.slope return self.base + (self.range * retVal) def createChannel(csound, channelName): chn = csnd6.CsoundMYFLTArray(1) csound.GetChannelPtr(chn.GetPtr(), channelName, csnd6.CSOUND_CONTROL_CHANNEL | csnd6.CSOUND_INPUT_CHANNEL) return chn class ChannelUpdater(object): def __init__(self, csound, channelName, updater): self.updater = updater self.channel = createChannel(csound, channelName) def update(self): self.channel.SetValue(0, self.updater.getValue()) class InputData(object): def __init__(self, channel): self.curVal = 0.0 self.channel = channel self.mcp = Adafruit_MCP3008.MCP3008(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE)) def getValue(self): self.curVal = (((self.mcp.read_adc(self.channel)) / 1023.0) + 0.01) * 4; return self.curVal class StoredFiles(object): def __init__(self): self.reset() self.scanfiles() def reset(self): self.numFiles = 0 self.files = [] def scanfiles(self): mypath = "../" self.files = glob.glob("../*.wav") ############################### # Our Orchestra for our project orc = """ sr=44100 ksmps=64 nchnls=2 0dbfs=1 instr 1 ainl, ainr inch 1, 2 outs ainl, ainr endin""" inputFiles = StoredFiles() inputFiles.reset() inputFiles.scanfiles() for f in inputFiles.files: print f c = csnd6.Csound() # create an instance of Csound c.SetOption("-iadc") c.SetOption("-odac") # Set option for Csound c.SetOption("-b 64") c.SetOption("-B 128") c.SetOption("-+rtaudio=alsa") # Set option for Csound c.SetOption("--realtime") c.SetOption("--sched") c.SetOption("-m7") # Set option for Csound c.CompileOrc(orc) # Compile Orchestra from String # Set the Instrument to Play for 60 seconds. Change this to infinite later. sco = "f0 $INF\n" + "i1 0 -10\n" # Set the ftables based on the files within the specified directory. #fsco = "f 1 0 0 1 \"" + inputFiles.files[0] + "\" 0 0 0\n" #sco = isco + fsco c.ReadScore(sco) # Read in Score generated from notes c.Start() # When compiling from strings, this call is necessary before doing any performing # Create a set of ChannelUpdaters #channels = [ChannelUpdater(c, "amp", RandomLine(-2.0, 2.0)), # ChannelUpdater(c, "freq", RandomLine(0.6, 8.0)), # ChannelUpdater(c, "resonance", RandomLine(0.4, .3))] #freq_ctrl = InputData(0) #amp_ctrl = InputData(1) #res_ctrl = InputData(2) freq_ctrl = InputData(1) amp_ctrl = InputData(0) res_ctrl = RandomLine(0.6, 8.0) channels = [ChannelUpdater(c, "amp", freq_ctrl), ChannelUpdater(c, "freq", amp_ctrl), ChannelUpdater(c, "resonance", res_ctrl)] # Initialize all Channel Values for chn in channels: chn.update() while (c.PerformKsmps() == 0): for chn in channels: # update all channel values chn.update() c.Stop()
26.692857
104
0.628579
[ "MIT" ]
Airell/QB_Nebulae_V2
Code/tests/python_tests/nebulae_live.py
3,737
Python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import import uuid from st2common import log as logging from st2common.runners.base import get_metadata as get_runner_metadata from winrm_runner.winrm_base import WinRmBaseRunner __all__ = [ 'WinRmPsCommandRunner', 'get_runner', 'get_metadata' ] LOG = logging.getLogger(__name__) RUNNER_COMMAND = 'cmd' class WinRmPsCommandRunner(WinRmBaseRunner): def run(self, action_parameters): powershell_command = self.runner_parameters[RUNNER_COMMAND] # execute return self.run_ps(powershell_command) def get_runner(): return WinRmPsCommandRunner(str(uuid.uuid4())) def get_metadata(): metadata = get_runner_metadata('winrm_runner') metadata = [runner for runner in metadata if runner['runner_module'] == __name__.split('.')[-1]][0] return metadata
31.442308
74
0.752905
[ "Apache-2.0" ]
benmcbenben/st2
contrib/runners/winrm_runner/winrm_runner/winrm_ps_command_runner.py
1,635
Python
import numpy as np import pandas as pd %matplotlib auto import matplotlib.pyplot as plt import seaborn as sns from sklearn.ensemble import RandomForestClassifier,ExtraTreesClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.svm import SVC from matplotlib.colors import ListedColormap from sklearn.covariance import EllipticEnvelope from sklearn.cluster import KMeans from sklearn. plt.style.use("fivethirtyeight") fig=plt.figure(figsize=(12,15)) data=pd.read_csv("Social_Network_Ads.csv") data=data.iloc[:,2:] treeclass=RandomForestClassifier(n_estimators=100,max_depth=10) X,y=data.iloc[:,:-1].values,data.iloc[:,-1].values def plotting_decision_(X,Y,CL): X=StandardScaler().fit_transform(X) X_train,x_test,Y_train,y_test=train_test_split(X,y,test_size=0.3,random_state=0) xx_min,xx_max=X[:,0].min()-0.5,X[:,0].max()+0.6 xx,yy=np.meshgrid(np.arange(xx_min,xx_max,0.2),np.arange(xx_min,xx_max,0.2)) cmap_bright=ListedColormap(["red","azure"]) cl=CL() cl.fit(X_train,Y_train) score=cl.predict(x_test) Z=cl.decision_function(np.c_[xx.ravel(),yy.ravel()]) Z=Z.reshape(xx.shape) plt.contour(xx,yy,Z,cmap=plt.cm.jet) plt.scatter(X_train[:,0],X_train[:,1],c=Y_train,cmap=cmap_bright) plt.text(xx.max()-.3,xx.min()+.3,(np.mean(score)),size=15,horizontalalignment="right") #sns.relplot(x="Age",y="EstimatedSalary",data=data,hue="Purchased") #sns.boxplot(x=data["Purchased"],y=data["EstimatedSalary"],whis=2,saturation=0.6) #from sklearn.ensemble import IsolationForest #IF=IsolationForest(n_estimators=100,bootstrap=False) #IF.fit(X[:,0].reshape(-1,1)) #xx=np.linspace(X[:,0].min()-5,X[:,0].max()+5,len(data)).reshape(-1,1) #outlier=IF.predict(xx) #anomaly_score=IF.decision_function(xx) #plt.plot(xx,anomaly_score,label="automated")
30.375
90
0.739712
[ "MIT" ]
Py-Contributors/Hands-on-Machine-learning-with-Scikit-learn-Tensorflow-and-Keras
AnomalyDetection/DB.py
1,944
Python
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Operations for automatic batching and unbatching.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.batching.ops import gen_batch_ops # go/tf-wildcard-import # pylint: disable=wildcard-import from tensorflow.contrib.batching.ops.gen_batch_ops import * # pylint: enable=wildcard-import from tensorflow.contrib.util import loader from tensorflow.python.framework import ops from tensorflow.python.platform import resource_loader _batch_ops = loader.load_op_library( resource_loader.get_path_to_datafile("_batch_ops.so")) @ops.RegisterGradient("Batch") def _BatchGrad(op, *out_grads): # pylint: disable=invalid-name """Gradient for batch op.""" gradients = [] for i in range(len(op.inputs)): gradients.append( gen_batch_ops.unbatch( out_grads[i], op.outputs[-2], op.outputs[-1], timeout_micros=op.get_attr("grad_timeout_micros"), shared_name="batch_gradient_{}_{}".format(op.name, i))) return gradients @ops.RegisterGradient("Unbatch") def _UnbatchGrad(op, grad): # pylint: disable=invalid-name return [ gen_batch_ops.unbatch_grad( op.inputs[0], op.inputs[1], grad, op.inputs[2], shared_name="unbatch_gradient_{}".format(op.name)), None, None ] def batch_function(num_batch_threads, max_batch_size, batch_timeout_micros, allowed_batch_sizes=None, grad_timeout_micros=60 * 1000 * 1000, unbatch_timeout_micros=60 * 1000 * 1000): """Batches the computation done by the decorated function. So, for example, in the following code ```python @batch_function(1, 2, 3) def layer(a): return tf.matmul(a, a) b = layer(w) ``` if more than one session.run call is simultaneously trying to compute `b` the values of `w` will be gathered, non-deterministically concatenated along the first axis, and only one thread will run the computation. See the documentation of the `Batch` op for more details. Assumes that all arguments of the decorated function are Tensors which will be batched along their first dimension. SparseTensor is not supported. The return value of the decorated function must be a Tensor or a list/tuple of Tensors. Args: num_batch_threads: Number of scheduling threads for processing batches of work. Determines the number of batches processed in parallel. max_batch_size: Batch sizes will never be bigger than this. batch_timeout_micros: Maximum number of microseconds to wait before outputting an incomplete batch. allowed_batch_sizes: Optional list of allowed batch sizes. If left empty, does nothing. Otherwise, supplies a list of batch sizes, causing the op to pad batches up to one of those sizes. The entries must increase monotonically, and the final entry must equal max_batch_size. grad_timeout_micros: The timeout to use for the gradient. See the documentation of the unbatch op for more details. Defaults to 60s. unbatch_timeout_micros: The timeout to use for unbatching. See the documentation of the unbatch op for more details. Defaults to 60s. Returns: The decorated function will return the unbatched computation output Tensors. """ def decorator(f): # pylint: disable=missing-docstring def decorated(*args): with ops.name_scope("batch") as name: for a in args: if not isinstance(a, ops.Tensor): raise ValueError("All arguments to functions decorated with " "`batch_function` are supposed to be Tensors; " "found %s" % repr(a)) batched_tensors, batch_index, id_t = gen_batch_ops.batch( args, num_batch_threads=num_batch_threads, max_batch_size=max_batch_size, batch_timeout_micros=batch_timeout_micros, allowed_batch_sizes=allowed_batch_sizes, grad_timeout_micros=grad_timeout_micros, shared_name=name) outputs = f(*batched_tensors) if isinstance(outputs, ops.Tensor): outputs_list = [outputs] else: outputs_list = outputs with ops.name_scope("unbatch") as unbatch_name: unbatched = [ gen_batch_ops.unbatch(t, batch_index, id_t, timeout_micros=unbatch_timeout_micros, shared_name=unbatch_name) for t in outputs_list] if isinstance(outputs, ops.Tensor): return unbatched[0] return unbatched return decorated return decorator
39.086331
80
0.683416
[ "Apache-2.0" ]
ekyuho/tensorflow
tensorflow/contrib/batching/python/ops/batch_ops.py
5,433
Python
''' #################################################################### # author wudong # date 20190816 # 在连续的puckworld空间中测试DDPG # 状态空间和行为空间连续 # 状态空间:x,y # 行为空间:水平和竖直方向上的力的大小[-1,1] # ps 不知道是计算机的原因还是算法的原因,训练不动 ###################################################################### ''' import gym from puckworld_continuous import PuckWorldEnv from ddpg_agent import DDPGAgent from utils import learning_curve import numpy as np # 建立env和DDPG agent env = PuckWorldEnv() agent = DDPGAgent(env) # 训练并保存模型 data = agent.learning(max_episode_num=200,display=True,explore=True) # # 加载训练好的模型,观察angent的表现 # agent.load_models(300) # data = agent.learning(max_episode_num=100,display=True,explore = False)
24.892857
73
0.625538
[ "Apache-2.0" ]
WoShiDongZhiWu/Reinforcement-learning-Algorithm
DDPG/test_ddpg_puckWorld.py
877
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This file contains code to serve a web application to convert HTML to PDF. This application uses a local install of the `wkhtmltopdf` binary for the conversion. """ import os from subprocess import check_output from tempfile import TemporaryDirectory from starlette.applications import Starlette from starlette.requests import Request from starlette.responses import Response from starlette.routing import Route async def execute_wkhtmltopdf(uri: str) -> bytes: """Run wkhtmltopdf on the command-line and return the output.""" cmd = [ "wkhtmltopdf", "--log-level", "none", uri, "-", ] return check_output(cmd) async def convert_body(request: Request): """ It's just _way_ easier to deal with files rather than STDIN. Take the body of the request, write it to a temporary file, then use wkhtmltopdf to convert it. """ data = await request.body() if not data: return Response("ERROR: No body", status_code=400) with TemporaryDirectory() as tmpdirname: outfile = os.path.join(tmpdirname, "out.html") with open(outfile, "w") as fh: fh.write(data.decode("utf-8")) bytes = await execute_wkhtmltopdf(outfile) return Response(bytes, media_type="application/pdf") async def convert_uri(request: Request): data = await request.json() if "uri" not in data: return Response("Invalid JSON in request", status_code=400) bytes = await execute_wkhtmltopdf(data["uri"]) return Response(bytes, media_type="application/pdf") app = Starlette( debug=True, routes=[ Route("/uri", convert_uri, methods=["POST"]), Route("/data", convert_body, methods=["POST"]), ], )
25.714286
85
0.669444
[ "MIT" ]
mtik00/wkhtmltopdf-service
src/app.py
1,800
Python
import os import shutil import subprocess import sys from enum import Enum from PyQt5 import QtCore from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QMainWindow, QApplication, QListWidgetItem, QFileDialog, QComboBox, QMessageBox, \ QAbstractItemView, QDialogButtonBox, QLabel, QWidget, QPushButton, QListWidget, QFrame, QProgressBar, QStatusBar class Status(Enum): OK = 0 WARN = 1 FAIL = 2 def get_qt_data_keys(num_keys): assert num_keys <= 255 and "too many keys queried" possible_keys = range(256) used_keys = list(map(int, [QtCore.Qt.CheckStateRole, QtCore.Qt.DecorationRole, QtCore.Qt.AccessibleDescriptionRole, QtCore.Qt.AccessibleTextRole, QtCore.Qt.BackgroundColorRole, QtCore.Qt.BackgroundRole, QtCore.Qt.DisplayRole, QtCore.Qt.EditRole, QtCore.Qt.FontRole, QtCore.Qt.ForegroundRole, QtCore.Qt.InitialSortOrderRole, QtCore.Qt.SizeHintRole, QtCore.Qt.StatusTipRole, QtCore.Qt.TextAlignmentRole, QtCore.Qt.TextColorRole, QtCore.Qt.ToolTipRole, QtCore.Qt.UserRole, QtCore.Qt.WhatsThisRole])) c, keys = 0, [] for key in possible_keys: if c < num_keys and key not in used_keys: keys.append(key) c += 1 return keys class ChooseStagePopupUI: def __init__(self): self._stage_select_combobox = None # type: QComboBox self._dialog_button_box = None # type: QDialogButtonBox self._choose_stage_label = None # type: QLabel self._stage_base_names = [] def _setup_ui(self, choose_stage_popup): choose_stage_popup.setObjectName("choose_stage_popupI") choose_stage_popup.resize(493, 108) self._stage_select_combobox = QComboBox(choose_stage_popup) self._stage_select_combobox.setGeometry(QtCore.QRect(10, 30, 471, 27)) self._stage_select_combobox.setObjectName("stage_select_combobox") self._load_stages() self._dialog_button_box = QDialogButtonBox(choose_stage_popup) self._dialog_button_box.setGeometry(QtCore.QRect(150, 70, 176, 27)) self._dialog_button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self._dialog_button_box.setObjectName("dialog_button_box") self._dialog_button_box.rejected.connect(self.close) self._choose_stage_label = QLabel(choose_stage_popup) self._choose_stage_label.setGeometry(QtCore.QRect(10, 10, 461, 17)) self._choose_stage_label.setObjectName("choose_stage_label") self._choose_stage_label.setText("Choose monkeyball stage to replace (Challenge Mode)") choose_stage_popup.setWindowTitle("Choose Stage to Replace") def _load_stages(self): with open(os.path.join(get_mbreplacer_dir(), 'resources', 'challenge_stages_list.txt'), 'r') as f: for line in f: clean_line = line.strip() self._stage_select_combobox.addItem(clean_line) self._stage_base_names.append(clean_line) class ChooseStagePopup(QMainWindow, ChooseStagePopupUI): def __init__(self): QMainWindow.__init__(self) ChooseStagePopupUI.__init__(self) self._setup_ui(self) def connect(self, callback): self._dialog_button_box.accepted.connect(callback) def get_selected_stage_index(self): return int(self._stage_select_combobox.currentIndex()) def set_associated_stage(self, index, associated_stage): self._stage_select_combobox.setItemText(index, self._stage_base_names[index] + " [{}]".format(associated_stage)) def remove_associated_stage(self, stage_index): self._stage_select_combobox.setItemText(stage_index, self._stage_base_names[stage_index]) def get_stage_name(self, index): return self._stage_base_names[index].split(":")[1][1:] def get_stage_id(self, index): return self._stage_base_names[index].split(":")[0] def increment_stage_index(self): current_idx = self._stage_select_combobox.currentIndex() if current_idx == self._stage_select_combobox.count() - 1: current_idx = 0 else: current_idx += 1 self._stage_select_combobox.setCurrentIndex(current_idx) class MBReplacerUI: def __init__(self): self._central_widget = None # type: QWidget self._import_multiple_stages_btn = None # type: QPushButton self._import_root_btn = None # type: QPushButton self._imported_stages_list = None # type: QListWidget self._imported_stages_label = None # type: QLabel self._replace_queue_list = None # type: QListWidget self._stages_to_be_replaced_label = None # type: QLabel self._replace_btn = None # type: QPushButton self._add_to_replace_btn = None # type: QPushButton self._remove_from_replace_btn = None # type: QPushButton self._progress_bar = None # type: QProgressBar self._line = None # type: QFrame self._add_single_stage_btn = None # type: QPushButton self._remove_single_stage_btn = None # type: QPushButton self._status_bar = None # type: QStatusBar def _setup_ui(self, mbreplacer): mbreplacer.setObjectName("mbreplacer") mbreplacer.resize(961, 545) self._central_widget = QWidget(mbreplacer) self._central_widget.setObjectName("centralWidget") self._import_multiple_stages_btn = QPushButton(self._central_widget) self._import_multiple_stages_btn.setGeometry(QtCore.QRect(150, 490, 151, 27)) self._import_multiple_stages_btn.setObjectName("import_multiple_stages_btn") self._import_multiple_stages_btn.setText("import multiple from folder") self._import_root_btn = QPushButton(self._central_widget) self._import_root_btn.setGeometry(QtCore.QRect(10, 10, 161, 31)) self._import_root_btn.setObjectName("import_root_btn") self._import_root_btn.setText("import root folder") self._imported_stages_list = QListWidget(self._central_widget) self._imported_stages_list.setGeometry(QtCore.QRect(10, 80, 431, 401)) self._imported_stages_list.setObjectName("imported_stages_list") self._imported_stages_list.setSelectionMode(QAbstractItemView.ExtendedSelection) self._imported_stages_label = QLabel(self._central_widget) self._imported_stages_label.setGeometry(QtCore.QRect(170, 50, 111, 31)) self._imported_stages_label.setObjectName("imported_stages_label") self._imported_stages_label.setText("imported stages") self._replace_queue_list = QListWidget(self._central_widget) self._replace_queue_list.setGeometry(QtCore.QRect(520, 80, 431, 401)) self._replace_queue_list.setObjectName("replace_queue_list") self._replace_queue_list.setSelectionMode(QAbstractItemView.ExtendedSelection) self._stages_to_be_replaced_label = QLabel(self._central_widget) self._stages_to_be_replaced_label.setGeometry(QtCore.QRect(660, 50, 151, 31)) self._stages_to_be_replaced_label.setObjectName("stages_to_be_replaced_label") self._stages_to_be_replaced_label.setText("stages to be replaced") self._replace_btn = QPushButton(self._central_widget) self._replace_btn.setGeometry(QtCore.QRect(670, 490, 131, 31)) self._replace_btn.setObjectName("replace_btn") self._replace_btn.setText("replace!") self._add_to_replace_btn = QPushButton(self._central_widget) self._add_to_replace_btn.setGeometry(QtCore.QRect(460, 230, 41, 27)) self._add_to_replace_btn.setObjectName("add_to_replace_btn") self._add_to_replace_btn.setText("->") self._remove_from_replace_btn = QPushButton(self._central_widget) self._remove_from_replace_btn.setGeometry(QtCore.QRect(460, 280, 41, 27)) self._remove_from_replace_btn.setObjectName("remove_from_replace_btn") self._remove_from_replace_btn.setText("<-") self._line = QFrame(self._central_widget) self._line.setGeometry(QtCore.QRect(0, 40, 961, 20)) self._line.setFrameShape(QFrame.HLine) self._line.setFrameShadow(QFrame.Sunken) self._line.setObjectName("line") self._add_single_stage_btn = QPushButton(self._central_widget) self._add_single_stage_btn.setGeometry(QtCore.QRect(310, 490, 31, 27)) self._add_single_stage_btn.setObjectName("add_single_stage_btn") self._add_single_stage_btn.setText("+") self._remove_single_stage_btn = QPushButton(self._central_widget) self._remove_single_stage_btn.setGeometry(QtCore.QRect(110, 490, 31, 27)) self._remove_single_stage_btn.setObjectName("remove_single_stage_btn") self._remove_single_stage_btn.setText("-") self._root_folder_label = QLabel(self._central_widget) self._root_folder_label.setGeometry(QtCore.QRect(220, 16, 341, 21)) self._root_folder_label.setObjectName("root_folder_label") mbreplacer.setCentralWidget(self._central_widget) self._status_bar_label = QLabel(self._central_widget) self._status_bar_label.setGeometry(QtCore.QRect(5, 525, 961, 24)) self._status_bar_label.setObjectName("status_bar_label") mbreplacer.setWindowTitle("mbreplacer: stage replacer") class MBReplacer(QMainWindow, MBReplacerUI): def __init__(self): QMainWindow.__init__(self) MBReplacerUI.__init__(self) self._setup_ui(self) self._import_multiple_stages_btn.clicked.connect(self._import_multiple_stages_btn_clicked) self._import_root_btn.clicked.connect(self._import_root_btn_clicked) self._add_to_replace_btn.clicked.connect(self._add_to_replace_btn_clicked) self._remove_from_replace_btn.clicked.connect(self._remove_from_replace_btn_clicked) self._replace_btn.clicked.connect(self._replace_btn_clicked) self._add_single_stage_btn.clicked.connect(self._add_single_stage_btn_clicked) self._remove_single_stage_btn.clicked.connect(self._remove_single_stage_btn_clicked) self._root_folder_path = None self._imported_stages = [] self._stages_to_be_replaced = [] self._choose_stage_popup = ChooseStagePopup() self._input_filenames_key, self._output_stage_id_key, self._is_valid_input_key = get_qt_data_keys(3) # the tuple allows for replacement files for the given element. obj and mtl are required and have no replacement # but for config we can take xml lz or lz.raw. let the order of the tuple denote priority (we want xml over all) self._required_extensions = [("obj",), ("mtl",), ("xml", "lz", "lz.raw")] self._required_tools = ['GxModelViewer.exe', 'ws2lzfrontend.exe', 'SMB_LZ_Tool.exe'] self._tool_filepaths = self._find_required_tools() self._imported_obj_filepaths = [] self._replace_queue = [] self._temp_dir = os.path.join(get_mbreplacer_dir(), 'temp') def _find_required_tools(self): tool_filepaths = {} [tool_filepaths.update({f: os.path.join(dp, f)}) for dp, dn, filenames in os.walk(get_mbreplacer_dir()) for f in filenames if f in self._required_tools] return tool_filepaths # button callbacks: def _add_single_stage(self, obj_filepath): import_stage_directory = os.path.dirname(obj_filepath) import_stage_base_name = str(os.path.basename(obj_filepath).split(".")[0]) all_filenames = os.listdir(import_stage_directory) collected_filepaths = {} item_string = import_stage_base_name + " | has: [" for required_extension in self._required_extensions: for extension in required_extension: filename = import_stage_base_name + "." + extension if filename in all_filenames: collected_filepaths[os.path.splitext(filename)[1][1:]] = os.path.join(import_stage_directory, filename) item_string += extension + ", " break item_string = item_string[:-2] + "]" all_textures_present = False if 'mtl' in collected_filepaths: with open(collected_filepaths['mtl'], 'r') as f: required_textures = [] for line in f: split_line = line.strip().split() if split_line and split_line[0] == 'map_Kd': if os.path.isabs(split_line[1]): required_textures.append(split_line[1]) else: required_textures.append(os.path.join(import_stage_directory, split_line[1])) all_textures_present = all([os.path.exists(texture) for texture in required_textures]) item_string += " | textures: " + ("yes" if all_textures_present else "no") with open(obj_filepath, 'r') as f: obj_lines = f.readlines() num_vertices = len([line for line in obj_lines if line.startswith('v ')]) num_faces = len([line for line in obj_lines if line.startswith('f ')]) item_string += " | v:" + str(num_vertices) + " f: " + str(num_faces) all_inputs_met = len(collected_filepaths.keys()) == len(self._required_extensions) and all_textures_present item = QListWidgetItem() item.setData(self._input_filenames_key, collected_filepaths) item.setData(self._is_valid_input_key, all_inputs_met) item.setText(item_string) item.setIcon(QIcon("resources/green_checkmark.png") if all_inputs_met else QIcon("resources/red_xmark.png")) self._imported_stages_list.addItem(item) return Status.OK def _add_single_stage_btn_clicked(self): file_dialog = QFileDialog() obj_filepath = QFileDialog.getOpenFileName(file_dialog, "import stage .obj file", get_mbreplacer_dir(), "*.obj")[0] if obj_filepath in self._imported_obj_filepaths: duplicate_idx = self._imported_obj_filepaths.index(obj_filepath) duplicate_item = self._imported_stages_list.item(duplicate_idx) self._imported_stages_list.takeItem(self._imported_stages_list.row(duplicate_item)) del self._imported_obj_filepaths[duplicate_idx] if obj_filepath: self._add_single_stage(obj_filepath) self._imported_obj_filepaths.append(obj_filepath) self._imported_stages_list.sortItems() return Status.OK def _remove_single_stage_btn_clicked(self): selected_items = self._imported_stages_list.selectedItems() for selected_item in selected_items: self._imported_stages_list.takeItem(self._imported_stages_list.row(selected_item)) return Status.OK def _import_multiple_stages_btn_clicked(self): file_dialog = QFileDialog() file_dialog.setParent(self.sender()) stages_folder_path = QFileDialog.getExistingDirectory(file_dialog, "import folder with multiple objs/mtls/configs", get_mbreplacer_dir()) stages_folder_path = QtCore.QDir.toNativeSeparators(stages_folder_path) obj_filepaths = [os.path.join(dp, f) for dp, dn, filenames in os.walk(stages_folder_path) for f in filenames if os.path.splitext(f)[1] == '.obj'] for obj_filepath in obj_filepaths: if obj_filepath in self._imported_obj_filepaths: duplicate_idx = self._imported_obj_filepaths.index(obj_filepath) duplicate_item = self._imported_stages_list.item(duplicate_idx) self._imported_stages_list.takeItem(self._imported_stages_list.row(duplicate_item)) del self._imported_obj_filepaths[duplicate_idx] self._add_single_stage(obj_filepath) self._imported_obj_filepaths.append(obj_filepath) if obj_filepaths: self._imported_stages_list.sortItems() return Status.OK def _import_root_btn_clicked(self): file_dialog = QFileDialog() file_dialog.setParent(self.sender()) self._root_folder_path = QFileDialog.getExistingDirectory(file_dialog, "import root folder extracted from .iso", get_mbreplacer_dir()) self._root_folder_path = QtCore.QDir.toNativeSeparators(self._root_folder_path) if not os.path.exists(os.path.join(self._root_folder_path, 'stage')): self._root_folder_path = None self._give_error_message("root folder seems to be invalid, no 'stage' folder found") return self._root_folder_label.setText(self._root_folder_path) def _add_to_replace_btn_clicked(self): selected_items = self._imported_stages_list.selectedItems() if not selected_items: return Status.OK elif not all([selected_item.data(self._is_valid_input_key) for selected_item in selected_items]): required = [', or '.join(required_extension) for required_extension in self._required_extensions] self._give_error_message("Could not find all required files for one of the selected stages!\n" "Please sure the required files are in the same directory as the .obj,\n" "then reimport the stage!\n\n" "Required Extensions: " + str(required) + "\n\n" "Also requires that all linked textures are found. " "(open the mtl file as txt to see the texture paths)\n\n" ) return Status.WARN else: self._choose_stage_popup.setWindowModality(QtCore.Qt.WindowModal) self._choose_stage_popup.connect(self._on_choose_stage) self._choose_stage_popup.show() return Status.OK def _remove_from_replace_btn_clicked(self): selected_items = self._replace_queue_list.selectedItems() for i, selected_item in enumerate(selected_items): self._replace_queue_list.takeItem(self._replace_queue_list.row(selected_item)) self._choose_stage_popup.remove_associated_stage(self._replace_queue[i][1]) return Status.OK def _replace_stage_in_root(self, obj_filepath, config_filepath, stage_id): config_ext = os.path.splitext(config_filepath)[1] base_filepath = os.path.splitext(obj_filepath)[0] gma_filepath = base_filepath + ".gma" tpl_filepath = base_filepath + ".tpl" lz_raw_filepath = base_filepath + ".lz.raw" lz_filepath = os.path.splitext(lz_raw_filepath)[0] needs_lz_raw_creation = config_ext == ".xml" needs_lz_compression = config_ext == ".xml" or config_ext == ".raw" if not needs_lz_compression and not needs_lz_raw_creation and not os.path.exists(lz_filepath): self._give_error_message(".lz file promised not found") return Status.WARN tool_id = 'GxModelViewer.exe' if tool_id not in self._tool_filepaths: self._give_error_message("Cannot find tool: " + tool_id + "\n\nPlease make sure the tool with this exact name " "is somewhere in the mbreplacer directory") return Status.WARN # make gma and tpl in another thread while we do other things gx_process = subprocess.Popen([self._tool_filepaths['GxModelViewer.exe'], obj_filepath]) # make .lz.raw if needs_lz_raw_creation: tool_id = 'ws2lzfrontend.exe' if tool_id not in self._tool_filepaths: self._give_error_message("Cannot find tool: " + tool_id + "\n\nPlease make sure the tool with this exact name " "is somewhere in the mbreplacer directory") return Status.WARN subprocess.call([self._tool_filepaths[tool_id], '-c', config_filepath, '-o', lz_raw_filepath, "-g", '2']) if needs_lz_compression and not os.path.exists(lz_raw_filepath): self._give_error_message("Failure to create .lz.raw file, ensure the config/obj/mtl files are valid, " "as well as the ws2lzfrontend.exe tool") return Status.WARN # make .lz if needs_lz_compression: tool_id = 'SMB_LZ_Tool.exe' if tool_id not in self._tool_filepaths: self._give_error_message("Cannot find tool: " + tool_id + "\n\nPlease make sure the tool with this exact name " "is somewhere in the mbreplacer directory") return subprocess.call([self._tool_filepaths[tool_id], lz_raw_filepath]) if needs_lz_compression and not os.path.exists(lz_raw_filepath + '.lz'): self._give_error_message("Failure to create .lz.raw file, ensure the config/obj/mtl files are valid, " "as well as the ws2lzfrontend.exe tool") return Status.WARN if needs_lz_compression: if os.path.exists(lz_filepath): os.remove(lz_filepath) os.rename(lz_raw_filepath + '.lz', lz_filepath) os.remove(lz_raw_filepath) # wait for the gx process to finish gx_process.wait() if not os.path.exists(gma_filepath) or not os.path.exists(tpl_filepath): self._give_error_message("Failure to create gma and tpl files, ensure these files are correct, " "as well as the GxModelViewer.exe (No GUI) tool") return Status.WARN stage_gma_filepath = os.path.join(self._root_folder_path, 'stage', 'st' + stage_id + '.gma') stage_tpl_filepath = os.path.join(self._root_folder_path, 'stage', 'st' + stage_id + '.tpl') stage_lz_filepath = os.path.join(self._root_folder_path, 'stage', 'STAGE' + stage_id + '.lz') shutil.copy(gma_filepath, stage_gma_filepath) shutil.copy(tpl_filepath, stage_tpl_filepath) shutil.copy(lz_filepath, stage_lz_filepath) return Status.OK def _replace_btn_clicked(self): if self._root_folder_path is None: self._give_error_message("Please import your monkeyball root folder created by gamecube rebuilder") return self._tool_filepaths = self._find_required_tools() for i in range(self._replace_queue_list.count()): item = self._replace_queue_list.item(i) input_filepaths = item.data(self._input_filenames_key) obj_filepath = input_filepaths['obj'] config_filepath = [value for key, value in input_filepaths.items() if key != 'obj' and key != 'mtl'][0] stage_id = item.data(self._output_stage_id_key) status = self._replace_stage_in_root(obj_filepath, config_filepath, stage_id) if status in (Status.WARN, Status.FAIL): item.setIcon(QIcon("resources/red_xmark.png")) return status item.setIcon(QIcon("resources/green_checkmark.png")) self._status_bar_label.setText("written " + os.path.basename(os.path.splitext(obj_filepath)[0]) + " to root") return Status.OK def _on_choose_stage(self): if not self._choose_stage_popup.isActiveWindow(): return Status.OK self._choose_stage_popup.close() selected_items = self._imported_stages_list.selectedItems() for selected_item in selected_items: stage_index = self._choose_stage_popup.get_selected_stage_index() replacement_stage_name = selected_item.text().split("|")[0][:-1] # if theres a conflict or duplicate, remove it if self._replace_queue: stage_indices = list(zip(*self._replace_queue))[1] # conflict if stage_index in stage_indices: conflict_index = stage_indices.index(stage_index) conflict_item = self._replace_queue_list.item(conflict_index) self._replace_queue_list.takeItem(self._replace_queue_list.row(conflict_item)) del self._replace_queue[conflict_index] # duplicate if (replacement_stage_name, stage_index) in self._replace_queue: return Status.OK self._choose_stage_popup.set_associated_stage(stage_index, replacement_stage_name) item = QListWidgetItem() item.setData(self._output_stage_id_key, self._choose_stage_popup.get_stage_id(stage_index)) item.setData(self._input_filenames_key, selected_item.data(self._input_filenames_key)) item_text = replacement_stage_name + " -> " + self._choose_stage_popup.get_stage_name(stage_index) item.setText(item_text) item.setIcon(QIcon("resources/gray_dot.png")) self._replace_queue_list.addItem(item) self._replace_queue.append((replacement_stage_name, stage_index)) self._choose_stage_popup.increment_stage_index() return Status.OK def _give_error_message(self, message, raise_exception=False): error_message = QMessageBox() error_message.setParent(self.sender()) error_message.setWindowTitle("ERROR") error_message.setText(message) error_message.setWindowModality(QtCore.Qt.WindowModal) error_message.exec_() if raise_exception: raise Exception(message) def get_mbreplacer_dir(): """ Get the mbreplacer dir :return str: mbreplacer root dir """ return os.getcwd() if __name__ == "__main__": app = QApplication(sys.argv) window = MBReplacer() window.show() sys.exit(app.exec_())
46.881326
123
0.654395
[ "MIT" ]
ackhoury/mbreplacer
mbreplacer.py
26,863
Python
File "test.py", line 15, in <module> print(find_lowest(a)) File "test.py", line 12, in find_lowest return lowest(lst[0], lst[1:]) File "test.py", line 9, in lowest return lowest(rest[0], rest[1:]) File "test.py", line 9, in lowest return lowest(rest[0], rest[1:]) File "test.py", line 13, in lowest return lowest(first, rest) File "test.py", line 13, in lowest return lowest(first, rest) [Previous line repeated 993 more times] File "test.py", line 6, in lowest if len(rest) == 0: RecursionError: maximum recursion depth exceeded in comparison
34.9375
62
0.697674
[ "MIT" ]
ALFA-group/neural-program-comprehension
Python_proficiency_test/latex/codes/17b.py
559
Python
""" This is the runner of the entire eva.jvc system. Version 1, the steps for the entire pipeline are as follows: 1. preprocessor -- get rep indices, save children metadata 2. encoder -- encode video by forcing i-frames (also modify the i-frame skip rate) 3. decoder -- using metadata, select the i-frames you want to decode. If the user wants more frames than the number of i frames, then I guess we have to decode the entire video?? @Jaeho Bang """ import os from eva_storage.jvc.preprocessor import * from eva_storage.jvc.encoder import * from eva_storage.jvc.decoder import * from loaders.seattle_loader import SeattleLoader from timer import Timer class JVCRunner_v2: def __init__(self): self.preprocessor = Preprocessor() self.compressor = Compressor() self.decompressor = Decompressor() self.video_loader = SeattleLoader() def encode(self, path_to_video): video_filename = os.path.basename(path_to_video) ###TODO: eliminate the extension video_filename = video_filename.split('.')[0] images, metadata = self.video_loader.load_images( path_to_video) ## we might need metadata such as fps, frame_width, frame_height, fourcc from here rep_indices = self.preprocessor.run(images, video_filename) self.compressor.run(images, rep_indices, metadata) def decode(self, path_to_video, number_of_samples=None): images = self.decompressor.run(path_to_video, number_of_samples) return images if __name__ == "__main__": timer = Timer() ##TODO: use the timer to run the pipeline preprocessor = Preprocessor() compressor = Compressor() decompressor = Decompressor() video_loader = SeattleLoader() images = video_loader.load_images() meta_data = preprocessor.run(images) save_directory = compressor.run(images, meta_data) number_of_frames = 100 ## we can change this to whatever number we want images_jvc = decompressor.run(save_directory, number_of_frames)
31.9375
122
0.716732
[ "Apache-2.0" ]
jaehobang/cs7643_project
eva_storage/jvc/jvc_runner_v2.py
2,044
Python
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * class SspaceLongread(Package): """SSPACE-LongRead is a stand-alone program for scaffolding pre-assembled contigs using long reads Note: A manual download is required for SSPACE-LongRead. Spack will search your current directory for the download file. Alternatively, add this file to a mirror so that Spack can find it. For instructions on how to set up a mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "https://www.baseclear.com/genomics/bioinformatics/basetools/SSPACE-longread" manual_download = True version('1.1', '0bb5d8603d7ead4ff1596135a520cc26') depends_on('perl', type=('build', 'run')) def url_for_version(self, version): return "file://{0}/40SSPACE-LongRead_v{1}.tar.gz".format( os.getcwd(), version.dashed) def install(self, spec, prefix): mkdirp(prefix.bin) install('blasr', prefix.bin) install('SSPACE-LongRead.pl', prefix.bin)
33.972222
92
0.699918
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
0luhancheng0/spack
var/spack/repos/builtin/packages/sspace-longread/package.py
1,223
Python
class Jumble(object): def __init__(self): self.dict = self.make_dict() def make_dict(self): dic = {} f = open('/usr/share/dict/words', 'r') for word in f: word = word.strip().lower() sort = ''.join(sorted(word)) dic[sort] = word return dic def unjumble(self, lst): for word in lst: word = word.strip().lower() sorted_word = "".join(sorted(word)) if sorted_word in self.dict: self.dict[sorted_word] else: return None if __name__ == "__main__": f_list = ['prouot', 'laurr', 'jobum', 'lethem'] s_list = ['siconu', 'tefon', 'tarfd', 'laisa'] t_list = ['sokik', 'niumem', 'tenjuk', 'doore'] unjumble = Jumble() print(unjumble.unjumble(f_list)) print(unjumble.unjumble(s_list)) print(unjumble.unjumble(t_list))
26.16129
49
0.59926
[ "MIT" ]
Nyapal/CS1.3
Code/word_jumble.py
811
Python
# -*- coding: utf-8 -*- # Resource object code # # Created: Mon Oct 15 12:53:43 2018 # by: The Resource Compiler for PySide (Qt v4.8.7) # # WARNING! All changes made in this file will be lost! from PySide import QtCore qt_resource_data = b"\x00\x006x\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x02|\x00\x00\x02|\x08\x06\x00\x00\x00d\xed|V\x00\x00\x00\x09pHYs\x00\x00\x17\x12\x00\x00\x17\x12\x01g\x9f\xd2R\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\xc9e<\x00\x006\x05IDATx\xda\xec\xddOl-Y~\x17\xf0\xaaIG\xf9G\xe27\xd2\xf0O#\xe2\xfbX0j\x08\xb2G\x10\xd1 F\xbe\x1d!\x116\xb1Gb\x93\xd5\xbb\xbd`\x91\xc5\xf0\xdc+f\xf7\xca\x12\x8b\xd9\xb5\x1f-$$\x16\xefzE\xc4\x22m/C\x82\xfaZ\x83\xa0\xc3\x1f\x8d\x1dF\x0aC \xcfF\x84\x89\x84F\xf3\x9c\x88\x10 \x89\xa9\xd3>\x9e\xf6\xbc\xb6OU\xdd\xbfUu?\x1f\xa9t\xdf\xf3-\xdf?\xa7\xae\xef\xfd\xdes\xea\xfcN~}}\x9d\x01i\x1b_yk\xaf\xbc\x18\x5c\xbd\xff\xd1\xa1\xd6\x00\xa0k>\xa3\x09\xa0\x96\xfd\xb8\x01\x80\xc0\x07}\xb3\xf1\x95\xb7\x06\xe5\xc5N\xb9m\xc6\x9e>\x00\x10\xf8\xa0g\x8a;\xff\xd6\xcb\x07@\xe7\xe4\xce\xe1\x83\x87m|\xe5\xadG\xe5\xc5E\xf8\xe7\x9d\x1f?\xbez\xff\xa3\x0b\xad\x03@W\xe8\xe1\x83\xb4\xbd\xd7\xc2^Ph\x16\x00\x04>\xe8\x8f\xfb\xc2\xdd^\xec\xf9\x03\x00\x81\x0f\xba\xac\x0cu\xc3\xf2b\xf3\xbe\xab\xb2\x9b\x9e?\x00\x10\xf8\xa0\xe3R\x134\x0a\xcd\x03@W\x98\xb4\x01\xf7\x88\xa5X^V\xec\xf6\xf6\xd5\xfb\x1fM\xb4\x16\x00m\xa7\x87\x0f\xee7\xaa\xb1\x8f\x12-\x00\x08|\xd0au\xc2\xdcn\xec\x09\x04\x00\x81\x0f\xba\xa4\x0cq\xa3\xec\xd3\xa5X\x1e2\xd2b\x00\x08|\xd0=\xfb\x0b\xda\x17\x00\x04>X\xb5X\x8ae\xab\xc9\xaf\xc4\x1eA\x00\x10\xf8\xa0#\xa6\x09oz\xf9\x00h5eY \x8a\xabg|w\xca_W\xa2\x05\x80\xd6\xd2\xc3\x07\x9f\x98\xa5\xa7n\xa4\xf9\x00\x10\xf8\xa0\xfdf\x09mO\xac\xaf\x0b\x80\xc0\x07-\x16'^l\xcex3\xce\xe5\x03@\xe0\x83\x16\x1b\xb5\xe46\x00@\xe0\x83y\x8b\xabe\xec\xcc\xe1\xa66\x95h\x01@\xe0\x83v*\xe6x[\x02\x1f\x00\xad\xa3,\x0bk-N\xb4\xb8\xc8\xea/\xa5V\xc7\xe3\xab\xf7?\xba\xd0\xba\x00\xb4\x85\x1e>\xd6\xddh\xcea/(4+\x00\x02\x1f\xb4\xc7\x22f\xd6\xee)\xd1\x02\x80\xc0\x07-P\x86\xb2\xbdl\xf6R,\xf7\xdet\xe6\x5c>\x00\x04>h\x85E\x8625\xf9\x00\x10\xf8`\x95b)\x96\xdd\x05\xde\xc5f\xecA\x04\x00\x81\x0fVd\x19=p#\xcd\x0c@\x1b(\xcb\xc2\xdaYP)\x96\x87(\xd1\x02\xc0\xca\xe9\xe1c\x1d\xed-)\xec\x05\xce\xe5\x03@\xe0\x83\x15Xf\x08\x1b)\xd1\x02\x80\xc0\x07KT\x86\xafay\xb1\xb5\xcc\xbb\xccnz\x14\x01@\xe0\x83%\x19\xad\xe0>\x0d\xeb\x02\xb0R&m\xb06b)\x96\x97+\xba\xfb\xb7\xaf\xde\xffh\xe2(\x00\xb0\x0az\xf8X'\xa35\xbdo\x00\x04>\x10\xf8\x96\xe0I\xeca\x04\x00\x81\x0f\x16\xa1\x0c[!\xecm\xae\xf8a\x8c\x1c\x09\x00\x04>\xe8w\xd8\x12\xf8\x00\x10\xf8`\x116\xbe\xf2\xd6vy\xb1\xd3\x82\x87\xb2\x19{\x1a\x01@\xe0\x839kSY\x14\x81\x0f\x80\xa5S\x96\x85^\x8b\xab\x5c|\xb7\xe6\xeeW\xb7\xbf\xd6\xf0n\xc2\xef\xbd\xca\xea\x9f#\xf8\xc5\xab\xf7?:st\x00X\x16=|\xf4\xdd\xa8\xc6>\x97\xe5\xf6N\xb9\x0d\xcam\x9a vV\x06\xb8A\xbc\x8d\xd3\x1a\xfb+\xc4\x0c\x80\xc0\x07s\x94\x0aW'\xd9MA\xe4A\xb9\x8d\xcb\xed\xd5,w\x14ocX\xfe\xf3\x8b\xe5v\x94\xd8\xf5\x89\xf5u\x01\x10\xf8`\x0e\xcaP\x15\xd6\xb0}}\x985\x0c\xbf>/\xb7\xc7e8\xdb[\xc4\xea\x17a\xb8\xb6\xdcF\xe5??[n\x07\xd9M\x0f\xe2\xebF\x8e\x10\x00\xcb\xf2\x86&\xa0\xc7\xee\xf6\xee\x9d\x97\xdba\xe8\x85[\xd6\x9d\xc7\x1e\xc3\x22lqvn\xd8v\xee<\xb6C\x87\x08\x80e\xd0\xc3G/\xc5U-B\xb8\x0aC\xaba\xd8v{\x99a\xef\x9e\xf0w;\xdc\xfb8>\xa6G\xb1\x07\x12\x00\x16N\x0f\x1f}\x16\x86m/\xda\xf4\x80\xe2\xe3\x19\xc5s\xf8\x9c\xc7\x07\x80\xc0\x073\x06\xab6?\xbe0\xdc\xfb\xca\x91\x02`\x19\x0c\xe9\x02\x00\x08|\x00\x00\x08|\x00\x00\x08|\x00\x00\x08|\x00\x00\x08|\x00\x00\x08|\x00\x00\x08|\x00\x00\x02\x1f\x00,I\x9e\xe7\x8f\xcam\xa8%@\xe0\x03\xa0\x9fao\xbb\xbc\xb8\xd0\x12 \xf0\x01\xd0\xcf\xb0\xb7_^|\xa3\xdc6\xb4\x06,\x96\xb5t\x01Xv\xd0{T^\x8c\xcbm\xf7\xf6g\xd7\xd7\xd7\x13-\x03\x02\x1f\x00\xfd\x08{a\x08\xf7\xb8\xdc6\xb5\x06,\x8f!]\x00\x96\x15\xf6n\x87p_\x0f{\xa7Z\x07\x16K\x0f\x1f\x00\x8b\x0ez\x9f\x1a\xc2\x05\x04>\x00\xfa\x13\xf6\xea\x0c\xe1N\xb4\x14,\x96!]\x00\x16\x15\xf6\x1e\x1a\xc2\x05\x96L\x0f\x1f\x00\xf3\x0ezM\x87p'Z\x0d\x04>\x00\xba\x13\xf6\xcc\xc2\x85\x162\xa4\x0b\xc0\xbc\xc2\xde(\xbb\xe9\xadk\x14\xf6\xd4\xe0\x83\xc5\xd3\xc3\x07\xc0\xacA/\x0c\xe1\x1e\x96\xdb\x13\xad\x01\x02\x1f\x00\xfd\x0b{a\x08w\x5cn[S\xde\x84\x1a|\xb0\x04\x86t\x01\x986\xec\x8d\xb2\x9b!\xdc-\xad\x01\xed\xa6\x87\x0f\x80\xa6Ao\x9eC\xb8\x13-\x0a\x02\x1f\x00\xed\x0a{\xb3\x0e\xe1\x02+`H\x17\x80\xbaao\x94\xcd\x7f\x08w\xa2ea\xf1\xf4\xf0\x01P\x15\xf4\xcc\xc2\x05\x81\x0f\x80\x1e\x87\xbdAvSHy!C\xb8j\xf0\xc1r\x18\xd2\x05\xe0\xa1\xb0\xb7W^\x9ce\xce\xd7\x03\x81\x0f\x80^\x86\xbd0\x84\xfbA\xb9m,\xf0n\xd4\xe0\x83%1\xa4\x0b\xc0\xdd\xa07\xc8\x168\x84\x0b\xac\x86\x1e>\x00n\xc3\xde\xb2\x87p'Z\x1d\x04>\x00\x96\x17\xf6\x961\x84\x0b\xac\x88!]\x80\xf5\x0ez\x83luC\xb8\x13G\x00\x96C\x0f\x1f\xc0\xfa\x86=\xb3pA\xe0\x03\xa0\xc7ao\xe5C\xb8j\xf0\xc1\xf2\x18\xd2\x05X\xaf\xa0\x17V\xcd\x08AK\xaf\x1e\xac\x11=|\x00\xeb\x13\xf6\x86\xe5\xc5EK\xc2\x9e\x1a| \xf0\x010\xe7\xb0W\x94\x17\x1fff\xe1\xc2Z2\xa4\x0b\xd0\xef\xa0\x17\x86p\xc3,\xdc\x9d\x96=\xb4\x89\xa3\x03\x02\x1f\x00\xf31\x88\xe1*\xcc\xc6\xdd\x8e?\xdb\xd1, \xf0\x01\xd0\x13\xd7\xd7\xd7g1\xec}J<\xa7/x\xfdr\x19\x81p\xe2\xe8\x80\xc0\x07\xc0\xe2\xc3\xe0$\x15\xbe^\x0b\x84\xc3L\xcf \x08|\x00\xf47\x10\x96\xe1\xefbA\xb7\x0d,\x81Y\xba\x00$\xc5\x19\xbe\x9bZ\x02\x04>\x00\xfa\x19\xf6\xc2,\xdf\xfd9\xdf\xac\x1a| \xf0\x01\xd0\x22a\x09\xb6T\xed\xbe\x83r\xbb\xd2L \xf0\x01\xd0Aq\xd2\xc6\x93\xc4.\xe7\xd7\xd7\xd7Ey9jx\xd3\x13\xad\x0b\x02\x1f\x00\xedPT\x5c\xff\xf1Po\x19\xfaBa\xe7\xe7\x9a\x0b\x04>\x00:$\xcf\xf3Q\x96.\xc3rrw\xa6m\xf9\xef\x10\xfe\xcek\xde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xf5\xe1|\x98O\x17\xf6\xaa\xca\xb0,}\xbd\xdcY\xc5Y\xc4\xe19\xe9\xd5\x03\x81\x0f\xe8h8\xc9\x04\xbe\xb9\x0a\xbda\xa9\x89\x1a\x87],u\x13B\x9e^=X\xac74\x01\xb0@o\x97\xdb n\xc3x\x19\xca\xb48\x7f\xafy\x80\x0em\xf7,\xb1\xcb\xa5\xde1@\xe0\x03\x96*N\xca\x98h\x89\xb9\x19W\x5c\xbf\xaf\x89\x80\x87\x18\xd2\x05h\xb9X\x86%\xb5^\xeei\x9c\xf1\x0a \xf0\x01t\xd4\xb8\xe2z\xbd{\x80\xc0\x07\xd0Uy\x9eW\xad\x97{d\xb2\x03 \xf0\x01t7\xec\x85\x99\xceEb\x97P\x86E\xef\x1e \xf0\x01tX\x08{\xa92,\x85\x15K\x00\x81\x0f\xa0\xa3\xf2<\x0f\xcb\xd2=M\xec\x12\xca\xb0\x1cj)@\xe0\x03\xe8\xae\xaa07\xd2D\x80\xc0\x07\xd0Qy\x9e\xefe\xd5eX&Z\x0a\x10\xf8\x00\xbaK\xef\x1e \xf0\x01\xf4U\x9e\xe7E\x96.\xc3r\xd0\xc5\xf5r\x01\x81\x0f\x80\xec{\xeb\xe5\xa6\xca\xac\x842,&j\x00\x02\x1f@\x87\x15Y\xba\x0c\xcb\xbe2,\x80\xc0\x07\xd0Qq\xbd\xdc'\x89]\xce\xcb\xb07\xd6R\x80\xc0\x07\xd0]E\xc5\xf5V\xd4\x00\x04>\x80\xae\xca\xf3|\x94\xa5\xcb\xb0\x1c)\xc3\x02\x08|\x00\xdd\x0d{a\xbd\xdc\xd4D\x8c0Q\xa3\xd0R\x80\xc0\x07\xd0]a\xa865Q\xe3P\x19\x16@\xe0\x03\xe8\xa8X\x86\xe5Yb\x97\xcbL\x19\x96\xaa6\xdc\x8e\xbd\xa4@\xc2\x1b\x9a\x00`e\xaa\xc2\x9c2,\xdf\x1f\xee\x86\xe5\xc5v\xdcBX\xbe=\xef\xf1\xedr\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x0a\x10\xf8\x80^\x8aC\x98\x0f\xf6\xf2\xc5I\x0e]\x0f{\xd6\xcb\x05\x04>`\xed=\x14\x866{\x12\x84\xf6\xb3t\x19\x96CeX\x00\x81\x0f\xe8\xb5\x8a^\xbegy\x9e\x0f\xba\xfa\xdc\xe2c\x7f\x96\xd8%<o\xeb\xe5\x02\x02\x1f\xb0\x16R=y\xe3\x0e?\xaf\xaa0W(\xc3\x02\x08|\xc0Z\x883v\x1f\xaa\xcb\xb7\x93\xe7y\xe7\x86vc\x19\x96\xdd\xc4.\xa7\xca\xb0\x00\x02\x1f\xb0nF\x89\xeb\x8a\x0e\x0e\xedV\xf5\xee\x99\xa8\x01\x08|\xc0z\x89\x13\x17\x0e\x1e\xb8:\xacN1\xee\xcas\x89=\x92[\x89]\x8e\xca\xe7{\xe6\xa8\x03\x02\x1f\xb0\x8e\xa1\xaf(/\xce\x1f\xb8\xba\x13C\xbb\xca\xb0\x00\x02\x1f@\xb5\xbd\x18\x8a\xee\xf3^\x19\xa8\xb6[\xfe\xf8C\xd8K\xad\x97{h\xa2\x06 \xf0\x01k-\x0e\xed\x8e\x12\xbb\x8c\xdb\xfa\xd8\xe3y\x86O\x13\xbb\x5c\xc6^L\x00\x81\x0fX\xfb\xd0\x17f\xed>\x7f\xe0\xea6\x9f\xfbV\x15FG\x8e. \xf0\x01|\x12\xfa\xc2ynGw~\x14\x86y\xdf)\x7f\xde\xca\xd0\x94\xe7y\x18\x8aN\xad\x97{j\xbd\x5c\xa0\x0d\xde\xd0\x04@\xcbB\xdf(N\x82\x18\x94\xdb\xa8\xe53[\xab\xca\xb0\x8c\x1cQ@\xe0\x03\xb8?\xf4\xed\xb5\xfd1\x96\xa1\xb4\xc8\xd2\xeb\xe5>\xb7^.\xd0\x16\x86t\x01\x9a\x87\xbd\xd0\x03\x99*\xb3\x12\x86\xa2\x0b-\x05\x08|\x00\xdd\x15\x86rSeX\xf6\x95a\x01\x04>\x80\x8e\x8a\xeb\xe5>I\xecrn\xbd\x5c@\xe0\x03\xe8\xb6\xa2\xe2z+j\x00\x02\x1f@W\xe5y>\xca\xd2eXN\x94a\x01\x04>\x80\xee\x86\xbd\xaa\xf5r\x03\xbd{\x80\xc0\x07\xd0a!\xcc\xa5\xca\xb0\x1c(\xc3\x02\x08|\x00\x1d\x15\xd7\xcbM\xf5\xde]f\xd5E\x98\x01\x04>\x80\x16\xab*\xc3R(\xc3\x02\x08|\x00\x1d\x15\xcb\xb0\xec&v9U\x86\x05\x10\xf8\x00\xba\xadj\xa8\xb6\xd0D\x80\xc0\x07\xd0Q\xb1\x0c\xcbVb\x97#eX\x00\x81\x0f\xa0}!n\x5cng\xe5\xb6]\xb1_(\xc3\x92\xea\xdd\x0b\xeb\xe5*\xc3\x02\x08|\x00-\x0b{\xa3\xecfY\xb4\xd0k7)\xff\x9f\x0alE\x96\x9e\xa8qh\xa2\x06 \xf0\x01\xb4+\xec\x85\x1e\xbd\x17w~\x14\xc2\xdc{\xe5\xcf'\xb1\xec\xca\xdd}\xc3\xff\x9f&n\xee\xb2\x0c{\x85V\x05\xba\xe2\x0dM\x00\xacA\xd8\x0b\xc3\xb3\x93\x07\xae\x0eK\xa5\xbd,\xf79\xc8>\xe9\xb5\x1bW\xdc\xe4\xfe\x94\x8fc/\xde\xf6E\xb9\xbd\xde;xV\xe7g\xce\x19\x04\x04>\x80\xfb\x85\x90\xb4Q\xb1\xcf\xb3\x10\xe4\xcaP\xf6O\xb2\xf4z\xb9\xa1\x0c\xcb\xf14\x0f\x22\xfc^,\xf3r\xdf\xe3\xd9\xa9\x19\x1a\xef}L\xaf\xfd\xffU\x0c\x8bU?\xbb\xb0:\x08\x08|\x00}\x11\x02\xda\xa0F\xe8\x0b\xd7\xff\x83\x8a}F\xb3<\x902`\xddN\x18\x09\x8fikN\xcf\xef\xbe\xb0\xb8;e\x80\x0c\xab\x86\xbc\x1e\x02k\xf5>\x86\x9f9\xaf\x11\x04>\x80\x95\x08\xe7\xdb\x85\xd9\xb9\xd9\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cf\x8b,]\x86\xe5\xc0z\xb9\x00\x02\x1f\xd0\xdd\xb07\xc8\xd2eVB\x19\x16\x135\x00\x04>\xa0\xc3\x8a,]\x86\xc5z\xb9\x00\x02\x1f\xd0Uq\xbd\xdc'\x89]\xce\xcb\xb07\xd6R\x00\x02\x1f\xd0]E\xc5\xf5V\xd4\x00\x10\xf8\x80\xae\xca\xf3|\x94\xa5\xcb\xb0\x9c(\xc3\x02 \xf0\x01\xdd\x0d{\xd6\xcb\x05\x10\xf8\x80\x9e\x0ba.U\x86\xe5P\x19\x16\x00\x81\x0f\xe8\xa8X\x86\xe5Yb\x97\xcbL\x19\x16\x00\x81\x0f\xe8\xb4\xaa0W(\xc3\x02 \xf0\x01\x1d\x15\xcb\xb0\xec&v9U\x86\x05@\xe0\x03\xba\xad\xaawom&j\x94\xe1wRn\xd7\x1d\xdd&^\xca\xf4\xe0opTng\xaf\xbd\xb6\x8f\xe3\x17S\x81\x0f`\xca7\xd7\x10\xe6\xb6\x12\xbb\x1c]__\x9fi)`\x09\xefG\xe3\xf2\xe2\xc5=\xefIa\x04\xe2\xc3\xb8\xbe\xb7\xc0\x07\xd0\xf0\xcdU\x19\x16\xa0-\xefG\xe1\xbd\xe8I\xc5n\xcf\xfa\xdc\xd3'\xf0\x01\x8b\x12\xde`S\xeb\xe5\x1e\x9a\xa8\x01,I\xdd/\x97\x85\xc0\x07P\xff\xdb\xf4\xa0\xbcx\x9a\xd8\xe5\xb2\x0c{\x85\x96\x02\x96\xf0~4\xac\xf8\xf2y\xd7\x8e\xc0\x07P\xdf\xb8\xe2\xfa\x91&\x02\x10\xf8\x80\xee~\x9b\xde\xab\xf8\x96|j\xbd\xdcN*4\x01t\xd7\x1b\x9a\x00\x98\xb3\xaa2,\xa35n\x9b6\xcdH\x0e\x93j\xb6j\xee\xfb\x5cH\xa7\xc3.\x1a\xec{%\xf0\x01T\x883\xe16+\x82\xc3\xc5\xba\xb6O\xf9\xdc\xf7[t\xac\x8ek\x06\xbe\x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xcb\x81\xf5r\x01\x10\xf8\xa0\xbbao\x90\xa5\xcb\xac\x842,&j\x00 \xf0A\x87\x15Y\xba\x0c\x8b\xf5r\x01\x10\xf8\xa0\xab\xe2z\xb9O\x12\xbb\x9c\x97ao\xac\xa5\x00\x10\xf8\xa0\xbb\x8a\x8a\xeb\xad\xa8\x01\x80\xc0\x07]\x95\xe7\xf9(K\x97a9R\x86\x05\x00\x81\x0f\xba\x1b\xf6\xea\xac\x97[h)\x00\x04>\xe8\xae0T\x9b*\xc3r\xa8\x0c\x0b\x00\x02\x1ftT,\xc3\xf2,\xb1\xcbe\xa6\x0c\x0b\x00\x02\x1ftZU\x98+\x94a\x01@\xe0\x83\x8e\x8aeXv\x13\xbb\x9c*\xc3\x02\x80\xc0\x07\xddV\xd5\xbb\xa7\x0c\x0b\x00\x02\x1ftU\x9e\xe7!\xccm%v\x09eX\xce\xb4\x14\x00\x02\x1ft3\xec\xd5)\xc3\xa2w\x0f\x00\x81\x0f:,\x84\xbd\xd4z\xb9\x87&j\x00 \xf0AG\xc52,O\x13\xbb\x5c\x96a\xaf\xd0R\x00\x08|\xd0]\xe3\x8a\xebG\x9a\x08\x00\x81\x0f:*\xcf\xf3\xbd,\xbd^\xee\xa9\xf5r\x01\x10\xf8\xa0\xdb\xaa\xca\xb0\x8c4\x11\x00\x02\x1ftT\x9e\xe7E\x96^/\xf7\xb9\xf5r\x01\x10\xf8\xa0\xbba/\x94aI\x95Y\x09eX\x0a-\x05\x80\xc0\x07\xdd\x15\x86rSeX\xf6\x95a\x01@\xe0\x83\x8e\x8a\xeb\xe5>I\xecrn\xbd\x5c\x00\x04>\xe8\xb6\xa2\xe2z+j\x00 \xf0AW\xe5y>\xca\xd2eXN\x94a\x01@\xe0\x83\xee\x86=\xeb\xe5\x02 \xf0A\xcf\x850\x97*\xc3r\xa8\x0c\x0b\x00\x02\x1ftT\x5c/\xf7Yb\x97\xcb\xac\xba\x083\x00\x08|\xd0bUa\xaeP\x86\x05\x00\x81\x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0a\xb0\xde\xbe\xfe\xf8\x0b\xfb\x0b\xbe\x8b0l\xfbq\xd1\xe4y\xdc\x98I\x1b\x08{\x0d\xfe\xf8~\xe3\xfck\xc2\x1e\x80\xb07(/^.\xe0\xa6\xef]\x16m\x1e\xf4\xf0!\xec\x09{\x0043\xef\xde\xbd0l{\xf8z\xed\xbcy\xd2\xc3\x87\xb0'\xec\x01P\xd3\xd7\x1f\x7f\xe1QyqQn\x1b3\xde\xd4\xedZ\xb7\xc54\x930\x9a\xd2\xc3\x87\xb0'\xec\x01P\xdf\xde\x8ca/\x0c\xdb\x16Y\x8d\xday\x02\x1f\x08{\x00\xacF1\xe5\xef\x85%\xcf\x0e\x9b\xd4\xce\x13\xf8@\xd8\x03`\xc9\xbe\xfe\xf8\x0b\xc3\xf2b\xb3\xc1\xaf\xccT;O\xe0\x03a\x0f\x80\xe5\xab\xfb\xd9\xf0\xf1\x92g\xb3\xd6\xce\x9b'\x936\x10\xf6\x84=\x00*\xd4,\xc52\xd7\xday\xf3\xa4\x87\x0faO\xd8\x03\xa0\xdaC\x9f\x0fa\x12\xc68\x06\xbdWm}\xf0\x02\x1f\xc2\x9e\xb0\x07@\xb5\xd7k\xef\xcde\xc93\x81\x0f\x84=\x00Z\xe0\xeb\x8f\xbf\x10>#B)\x96\xa5\xd6\xce\x13\xf8\x10\xf6\x84=\x00\x96gXn\xeff\x0bX\xf2lYL\xda@\xd8\x03\x80\x9e\xfb\x8c&@\xd8\x03\x00\x81\x0f\x84=\x00\x10\xf8@\xd8\x03\x00\x81\x0f\x84=\x00\x10\xf8@\xd8\x03\x00\x81\x0faO\xd8\x03\x00\x81\x0faO\xd8\x03\x00\x81\x0fa\x0f\x00\x04>\x10\xf6\x00@\xe0\x03a\x0f\x00\x04>\x10\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x03\x00\x81\x0f\x84=\x00\x10\xf8@\xd8\x03\x00\x81\x0f\x84=\x00\x10\xf8\x10\xf6\x84=\x00\x10\xf8\x10\xf6\x84=\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00@\xe0\x03a\x0f\x00\x04>\x10\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x81\x0f\x84=\x00\x10\xf8\x10\xf6\x84=\x00\x10\xf8\x10\xf6\x84=\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x04>\x10\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x81\x0faO\xd8\x03\x00\x81\x0faO\xd8\x03\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81O\xd8\x13\xf6\x00@\xe0C\xd8\x13\xf6\x00@\xe0C\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x04>aO\xd8\x03\x00\x81\x0faO\xd8\x03\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81O\xd8\x13\xf6\x00\x00\x81O\xd8\x13\xf6\x00\x00\x81O\xd8\xd3\xaa\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00\x80\xc0'\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00\x08|\xc2\x9e\xb0\x07\x00\x08|\xc2\x9e\xb0\x07\x00\x08|\xc2\x1e\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00\xb0\xb6\x81O\xd8\x03\x00\xe8q\xe0\x13\xf6\x00\x00z\x1c\xf8\x84=\x00\x80\x1e\x07>a\x0f\x00\xa0\xc7\x81O\xd8\x03\x00\xe8q\xe0\x13\xf6\x00\x00z\x1c\xf8\x84=\x00\x80\x1e\x07>a\x0f\x00\xa0\xc7\x81O\xd8\x03\x00\xe8q\xe0\x13\xf6\x00\x00z\x1c\xf8\x84=\x00\x80\x1e\x07>a\x0f\x00\xa0\xc7\x81O\xd8\x03\x00\xe8q\xe0\x13\xf6\x00\x00z\x1c\xf8\x84=\x00\x80\x16\x05\xbe2\x9c=\x12\xf6\x00\x00z\x1c\xf8J\x87eH\x1b\x08{\x00\x00=\x0c|\xb1w/\x04\xb4\xd1\x1cnK\xd8\x03\x00h[\xe0+\xed\xc7\xcb\x99\xc2\x95\xb0\x07\x00\xd0\xde\xc0w\x1b\xac6\xcb\xd0\xb6'\xec\x01\x00\xf4(\xf0\xc5\x80\xb7yO\xf8\x13\xf6\x00\x00\xfa\x10\xf8\xee\x09x\xbbM&o\x08{\x00\x00-\x0e|1\xd8\xed\xd6\x08\x81\xc2\x1e\x00@\x17\x03_\x22\xd8U\x06/a\x0f\x00\xa0\xdb\x81/9yC\xd8\x03\x00\xe8@\xe0+C[\x08Y\x9b\x89]\xf6\x85=\x00\x80\x0e\x07\xbe\xacz\xd8v\xe7\xf5\xc9\x1b\xc2\x1e\x00@G\x02_\x0cr;5v\xdd\x17\xf6\x00\x00:\x18\xf8\xb2\x07\x86k\xef1\x12\xf6\x00\x00V'\xbf\xbe\xbe\x9e\xea\x17\xcb\x00\xf7\xaa\xbc\xd8\xa8\xb9\xfby\xb9m\x09{\x00\x00\xcb7U\x0f_\x9c\xac\xb1\xd1\xe0W\x84=\x00\x80.\x05\xbel\x8a\xa5\xd3\x84=\x00\x80\xd5h<\xa4\x1b'k\xbc\x14\xf6\x00\x00\xbaa\x9a\x1e\xbeB\xd8\x03\x00\xe8\x8eF=|on}\xf5Qyq\x915;\x7fO\xd8\x03\x00X\xa1\xa6=|{\xc2\x1e\x00@\xbf\x03\xdf\xfe\x92\x1e\x97\xb0\x07\x00\xb0\xec\xc0\xf7\xe6\xd6W\xb7\xb3\xf9\x95W\x11\xf6\x00\x00\xda\x16\xf8\xb2\xe5\xf4\xee\x09{\x00\x00\xab\x08|q\xb2\xc6\xde2\x1ePy_C\x87\x05\x00`~j\xcd\xd2\x8d+k\xbcX\xe2\xe3\xba,\xb7\xc3r\x1b\xff\xc6\xf9\xd7^9L\x00\x00\x8b\x0f|\x17\xe5\xc5\xe6\x0a\x1e\xdfU\xb9\x1d\x87\xf0W\x06\xbf3\x87\x0b\x00`\x01\x81/\x0e\xb1~\xd8\x82\xc7z\x9e\xdd\xf4\xfa\x1d\xeb\xf5\x03\x00\xa8\xaf\xce9|\xa3\x96<\xd60C8\x0c+_\x94!t\x1cg\x0d\x03\x00P!\xd9\xc3\x17'k|\xb7\xc5\x8f?\xf4\xfa\x15\xbfq\xfe\xb5c\x87\x12\x00\xe0~U=|\xa3\x96\x87\xbdCa\x0f\x00 \xed\x8d\x8a\xeb\xf7[\xf6xM\xe2\x00\x00\x98W\xe0\x8b\x9356[\xf28M\xd8\x00\x00\x98w\xe0\xcb\xda1\x9c{\x94\xe9\xcd\x03\x00\x98\xc9\xbd\x936\xde\xdc\xfa\xea\xa0\xbcx\xb9\xa2\xc7\xa4\xe82\x00\xc0\x1c=\xd4\xc37Z\xc1c9\x8a!o\xe2\xb0\x00\x00\xf4'\xf0\xe9\xcd\x03\x00Xv\xe0{s\xeb\xab{\xd9\xe2'k\x9c\xc4\x90\xa7\xa4\x0a\x00\xc0\xb2\x03_\xb6\xb8\xde\xbd\xd0\x9b7\x8eA\xefB\xd3\x03\x00,\xc7\xf7M\xdaX\xd0d\x8d\xd3L\x81d\x00\x80\x95y\xbd\x87o4\xa7\xdb\x0d\x05\x92\xc71\xe8]hf\x00\x80\xfe\x04\xbe\xd0\x9b\x17\x86l\xc7\x9a\x16\x00\xa0e\x81\xef\xcd\xad\xaf\x86\xb07\xcdd\x0d\xbdy\x00\x00]\x08|Y\xf3\xde=\xcb\x9d\x01\x00t\xc0\xc7\x936\x1aL\xd6\x08\xbdya\xf2\x85\xe5\xce\x00\x00:\xe2\xb6\x87o\xbfb?\xbdy\x00\x00\x1d\x0f|\xa3\x07\xae\xb7\xdc\x19\x00@\xd7\x03_\x9c\xac\xb1q\xe7g\x96;\x03\x00\xe8S\xe0\xcb>\xe9\xdd\xd3\x9b\x07\x00\xd0\xd3\xc0\x17\x02\xde\x9e\xde<\x00\x80~\xfa\xff\x02\x0c\x00\x1eE:\x8bH\x8b\x05S\x00\x00\x00\x00IEND\xaeB`\x82\x00\x00\x0f\xb6\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x00@\x00\x00\x00@\x08\x06\x00\x00\x00\xaaiq\xde\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00\x09pHYs\x00\x00\x12t\x00\x00\x12t\x01\xdef\x1fx\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\xc9e<\x00\x00\x0f3IDATx\x9c\xe5\x9by|TU\x96\xc7\xbf\xaf*KU\xaa\x0a\xb2\x90\xa4*\x8e\xa3\x01\x82c\x98\x86@l\xb7@\xc0fQ\x16\xa1\xb5\x05\x5c\x80\x06\x84\xb0((\xc8\x08\xd2\x0dQTF\xa4\x05Y\x14\x08K\x90\xc8\x9anA\x09\x81\x04ADtD\x0d\x04\xdbFIB@gHU\xc0\x90\xa4\xeaU\xaa*\xa9zw\xfe\xa8\xa4$\x92\x04*\x9b\xd3\xce\xef\xf3y\x9fT\xee;\xf7\x9c\xdf9\xef\xdc\xe5\xdd{\x9fD\x03HMM\x0du:\x9d\xcf\x02#%IJhH\xe6\x9f\x05B\x88|\xe0}`\xcb\xd2\xa5K/\xfc\xfc\xbe\xf4\xf3\x82y\xf3\xe6\xbd\x08<\x13\x1e\x1e\x1e\x1a\x1f\x1fO||<\x00\x9d;wn[\xa6\xad\x8c\xe2\xe2b\x00\xce\x9c9\xc3\x993g\xb8r\xe5J\x05\xb0r\xe9\xd2\xa5/^-\xe7\x0b@jjj\xa8\xcb\xe5Z\x01L\x188p \x03\x06\x0chO\xbem\x8e\xc3\x87\x0f\xf3\xe1\x87\x1f\x02l\x09\x0e\x0e\x9e\xfd\xd2K/U\x00\x04\xd4\x09\xb8\x5c\xae\x15\x1a\x8dfBJJ\x0a&\x93\xe9\x97\xe2\xd9f\x180`\x00\xf1\xf1\xf1\xa4\xa5\xa5Mp:\x9d\x00\x13\x01\xd4\x00\xf3\xe7\xcf\x7f\x16\x98?c\xc6\x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89\x1a\x8d\xa6\x22--\xedW\x1d\x04\xa7\xd3IZZ\x1a\x0e\x87#_\xa3\xd1L\x84\xab\xf6\x9b\xbe\xf9\xe6\x9b\x84\xac\xac\xac\x8f\x9cNg\xe8\xf0\xe1\xc3IL\xf4\xef\xcc\xed\xffu\xe4\xe5\xe5\x91\x95\x95U\xe7\xfc}u\x9f\xce\xd6[L\xff\xe8\xa3\x8fn-((H?\x7f\xfe|\xff\xb0\xb00\x12\x13\x13\x89\x8d\x8d\x05\xfe\xb9>\x9ev:\x9d\x94\x94\x94\x00p\xfe\xfcy\xf2\xf2\xf2(//G\x08\xf1\xa6F\xa3y\xa9\xceyhd\xc7\xf1\xd0\xa1C\xfd\xcf\x9c9\xf3LEEE\x7f\x87\xc3\x11\xdaN\xbc\xdb\x0a\x17\x84\x10{\xf1~9~\xe1\xe77\xff\x17\xd7q\x00\x14\xc6\xb0\x7f\x82\x00\x00\x00\x00IEND\xaeB`\x82\x00\x008k\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x02|\x00\x00\x02|\x08\x06\x00\x00\x00d\xed|V\x00\x00\x00\x09pHYs\x00\x00\x17\x12\x00\x00\x17\x12\x01g\x9f\xd2R\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\xc9e<\x00\x007\xf8IDATx\xda\xec\xddOllY~\x17\xf0[\x93\x8e\xf2\x8f\xc4o\xa4\xe1\x9fF\xc4~,\x185\x04\xd9#\x88h\x10#WGH\x84M\x9eGb\x93\x95\xab\x17,\xb2\x18\x9e{\xc5\xec\xde\xb5\xc4bv\xe3\xc7\x08\x09\x89\xc5+\xaf\x88X\xa4\xedeHP\xdb\x1a\x04\x1d\xfe\xa8\xed0R\x18\x02y6\x22L$4\x9a\xe7D\x84\x00I\xcc=\xed\xe3i\xf7\xeb\xaa{\xcf\xad\xbaUu\xef\xad\xcfG\xba\xaa\xf7\x5c\xd7\xf5\xe7\xdcr\xd5\xb7\xce\xb9\xe7w\x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{\x97\xc5v\x14z\xe1\x96u\xe7\xb1\xc70\x0f[\x9c\x9d\x1b\xb6\xdd\x07\x8f\xed\xc8!\x02`\x19\xf4\xf0\xd1KqU\x8b\x10\xae\xc2\xd0j\x18\xb6\xddYf\xd8\x9b\x10\xfe\xee\x87{\x1f\xc7\xc7\xf4(\xf6@\x02\xc0\xc2\xe9\xe1\xa3\xcf\xc2\xb0\xedU\x9b\x1eP|<\xa3x\x0e\x9f\xf3\xf8\x00\x10\xf8`\xce`\xd5\xe6\xc7\x17\x86{_9R\x00,\x83!]\x00\x00\x81\x0f\x00\x00\x81\x0f\x00\x00\x81\x0f\x00\x00\x81\x0f\x00\x00\x81\x0f\x00\x00\x81\x0f\x00\x00\x81\x0f\x00@\xe0\x03\x80%\x19\x0c\x06\x8f\x8am\xa8%@\xe0\x03\xa0\x9fao\xa7\xb8\xb8\xd2\x12 \xf0\x01\xd0\xcf\xb0wP\x5c|Xl\x1bZ\x03\x16\xcbZ\xba\x00,;\xe8=*.\xc6\xc5\xf6\xe4\xfeg\xb7\xb7\xb7gZ\x06\x04>\x00\xfa\x11\xf6\xc2\x10\xeeI\xb1mj\x0dX\x1eC\xba\x00,+\xec\xdd\x0f\xe1\xbe\x1e\xf6\xce\xb5\x0e,\x96\x1e>\x00\x16\x1d\xf4>5\x84\x0b\x08|\x00\xf4'\xec\xa5\x0c\xe1\x9ei)X,C\xba\x00,*\xecM\x1b\xc2\x05\x96L\x0f\x1f\x00M\x07\xbd\xbaC\xb8gZ\x0d\x04>\x00\xba\x13\xf6\xcc\xc2\x85\x162\xa4\x0b@Sao\x94\xdd\xf5\xd6\xd5\x0a{j\xf0\xc1\xe2\xe9\xe1\x03`\xde\xa0\x17\x86p\x8f\x8am_k\x80\xc0\x07@\xff\xc2^\x18\xc2\x1d\x17\xdb\xf6\x8c7\xa1\x06\x1f,\x81!]\x00f\x0d{\xa3\xecn\x08w[k@\xbb\xe9\xe1\x03\xa0n\xd0kr\x08\xf7L\x8b\x82\xc0\x07@\xbb\xc2\xde\xbcC\xb8\xc0\x0a\x18\xd2\x05 5\xec\x8d\xb2\xe6\x87p\xcf\xb4,,\x9e\x1e>\x00\xaa\x82\x9eY\xb8 \xf0\x01\xd0\xe3\xb0\xb7\x95\xdd\x15R^\xc8\x10\xae\x1a|\xb0\x1c\x86t\x01\x98\x16\xf6\xf6\x8a\x8b\x8b\xcc\xf9z \xf0\x01\xd0\xcb\xb0\x17\x86p\xdf+\xb6\x8d\x05\xde\x8d\x1a|\xb0$\x86t\x01x\x18\xf4\xb6\xb2\x05\x0e\xe1\x02\xab\xa1\x87\x0f\x80\xfb\xb0\xb7\xec!\xdc3\xad\x0e\x02\x1f\x00\xcb\x0b{\xcb\x18\xc2\x05V\xc4\x90.\xc0z\x07\xbd\xadluC\xb8g\x8e\x00,\x87\x1e>\x80\xf5\x0d{f\xe1\x82\xc0\x07@\x8f\xc3\xde\xca\x87p\xd5\xe0\x83\xe51\xa4\x0b\xb0^A/\xac\x9a\x11\x82\x96^=X#z\xf8\x00\xd6'\xec\x0d\x8b\x8b\xab\x96\x84=5\xf8@\xe0\x03\xa0\xe1\xb0\x97\x17\x17\xefgf\xe1\xc2Z2\xa4\x0b\xd0\xef\xa0\x17\x86p\xc3,\xdc\xdd\x96=\xb43G\x07\x04>\x00\x9a\xb1\x15\xc3U\x98\x8d\xbb\x13\x7f\xb6\xabY@\xe0\x03\xa0'noo/b\xd8\xfb\x94xN_\xf0\xfa\xe52\x02\xe1\x99\xa3\x03\x02\x1f\x00\x8b\x0f\x83ge\xe1\xeb\xb5@8\xcc\xf4\x0c\x82\xc0\x07@\x7f\x03a\x11\xfe\xae\x16t\xdb\xc0\x12\x98\xa5\x0b@\xa98\xc3wSK\x80\xc0\x07@?\xc3^\x98\xe5{\xd0\xf0\xcd\xaa\xc1\x07\x02\x1f\x00-\x12\x96`+\xab\xddwXl7\x9a\x09\x04>\x00:(N\xda\xd8/\xd9\xe5\xf2\xf6\xf66/.G5o\xfaL\xeb\x82\x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\xe0\x03\xa0\xdd\xc1\xef\xa3^\xbf\xec\xae\xa0\xf3N\xc9\xae!\x10\xe6Z\x0c\x04>\x00\xbak\xee\xf5r\x01\x81\x0f\x80\x96\x8ae\x5c\xca\x8aR_\x9a\x5c\x01\x02\x1f\x00\xddV\x15\xe6\x0e4\x11\x08|\x00tT\x5c/w\xb7d\x97\xd3>\xd6*\x04\x04>\x80u\x09{a\xbd\xdc\xbcb7\xbd{ \xf0\x01\xd0a!\xcc\x95\xad\xbb{\xa8\x0c\x0b\x08|\x00t\xd4`0\xd8\xca\xca{\xef\xc2j\x1c&j\x80\xc0\x07\xb0\x90 rTl\x17q\xb8\x91\xc5Q\x86\x05\x04>\x80\x95\x84\xbdaq\xf1\xb4\xd8\xb6\x8b\xed*\x96\x0ba1\xed\xfc\xa4d\x97\xb0^\xeex\x01\xf7;\x16\xe6A\xe0\x03x8\x84\x18z\x9f>\x8c\xb3HY\x5c;O\x92/\x22\xecew\xb5\xfeB\x98?\x13\xe6A\xe0\x03\xd6P\x11\x00\x0eb\x18x\xdd\x8b\x18\x16h\xa6\x9dGS\xda\xf9\xdeq\xd3eX\x1e\x84\xbd{B\x1f\x08|\xc0\x1a\x86\x90\xaa\xf2 C\xad\xd4X;\x97\xf5\xee5\xbe^\xee\x84\xb0woC\xe8\x03\x81\x0fX/\x07Y\xf9\x04\x82\x91&ZJ;\x1f-\xa0\x0cKY\xa0\x13\xfa@\xe0\x03\xd6A\xecu*+\x0frl\xa5\x87F\xday\xab\xb8xV\xb2\xcbu\xd1\xce\xf9\x02\xeezXl\x97B\x1f\x08|\xc0z+\xebu\xba\xc9\xac\xf4\xd0\x94q\xc2qh\x5c,\xed\x22\xf4\x81\xc0\x07\xac\xb9Q\xc9uGj\xc1\xcd/\x96a)[/7\x94a9Y\xd4\xfd\xd7\x0c}J\xb6\x80\xc0\x07\xf4,\x88\x84\xb07mi\xaf\xd0\xbbg\xa5\x87f\x8c+\xae_x/\xaa\xd0\x07\x02\x1f\xb0\x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afq\xa5if\x13'3l\x97\xecr\xdc\xa22,)\xc2y\x88\x0f\x87v\xc3D\x93\x1d\xf5\x19A\xe0\x03\xbacZ}8\x1f\xe6\xb3\x85\xbd\xaa2,K_/w^q\x16qxNz\xf5@\xe0\x03:\x1aN2\x81\xafQ\xa17\xacl\xa2\xc6Q\x17K\xdd\x84\x90\xa7W\x0f\x16\xeb\x0dM\x00,\xd0\xdb\xc5\xb6\x15\xb7a\xbc\x0ceZ\x9c\xbfW?@\x87\xb6{V\xb2\xcb\xb5\xde1@\xe0\x03\x96*N\xca8\xd3\x12\x8d\x19W\x5c\x7f\xa0\x89\x80i\x0c\xe9\x02\xb4\x5c,\xc3R\xb6^\xeey\x9c\xf1\x0a \xf0\x01t\xd4\xb8\xe2z\xbd{\x80\xc0\x07\xd0U\x83\xc1\xa0j\xbd\xdcc\x93\x1d\x00\x81\x0f\xa0\xbba/\xcct\xceKv\x09eX\xf4\xee\x01\x02\x1f@\x87\x85\xb0WV\x86%\xb7b\x09 \xf0\x01t\xd4`0\x08\xcb\xd2=-\xd9%\x94a9\xd2R\x80\xc0\x07\xd0]Uan\xa4\x89\x00\x81\x0f\xa0\xa3\x06\x83\xc1^V]\x86\xe5LK\x01\x02\x1f@w\xe9\xdd\x03\x04>\x80\xbe\x1a\x0c\x06yV^\x86\xe5\xb0\x8b\xeb\xe5\x02\x02\x1f\x00\xd9\xf7\xd7\xcb-+\xb3\x12\xca\xb0\x98\xa8\x01\x08|\x00\x1d\x96g\xe5eX\x0e\x94a\x01\x04>\x80\x8e\x8a\xeb\xe5\xee\x97\xecrY\x84\xbd\xb1\x96\x02\x04>\x80\xee\xca+\xae\xb7\xa2\x06 \xf0\x01t\xd5`0\x18e\xe5eX\x8e\x95a\x01\x04>\x80\xee\x86\xbd\xb0^n\xd9D\x8c0Q#\xd7R\x80\xc0\x07\xd0]a\xa8\xb6l\xa2\xc6\x912,\x80\xc0\x07\xd0Q\xb1\x0c\xcb\xb3\x92]\xae3eX\xaa\xdap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9c\xac\xa8\x01\x08|@/M\x0bA\xbd\xea\xe5\x8b\xcf\xa5\xac\x0c\xcb\xa9^)@\xe0\x03z)\x0eaN\xed\xe5\x8b\x93\x1c\xba\x1e\xf6\xac\x97\x0b\x08|\xc0\xda\x9b\x16\x866{\x12\x84\x0e\xb2\xf22,G\xca\xb0\x00\x02\x1f\xd0k\x15\xbd|\xcf\x06\x83\xc1VW\x9f[|\xec\xcfJv\x09\xcf\xdbz\xb9\x80\xc0\x07\xac\x85\xb2\x9e\xbcq\x87\x9fWU\x98\xcb\x95a\x01\x04>`-\xc4\x19\xbb\xd3\xea\xf2\xed\x0e\x06\x83\xce\x0d\xed\xc62,OJv9W\x86\x05\x10\xf8\x80u3*\xb9.\xef\xe0\xd0nU\xef\x9e\x89\x1a\x80\xc0\x07\xac\x978q\xe1p\xca\xd5au\x8aqW\x9eK\xec\x91\xdc.\xd9\xe5\xb8x\xbe\x17\x8e: \xf0\x01\xeb\x18\xfa\xf2\xe2\xe2r\xca\xd5\x9d\x18\xdaU\x86\x05\x10\xf8\x00\xaa\xed\xc5P4\xc9\xd7\x8b@\xb5\xd3\xf2\xc7\x1f\xc2^\xd9z\xb9G&j\x00\x02\x1f\xb0\xd6\xe2\xd0\xee\xa8d\x97q[\x1f{<\xcf\xf0i\xc9.\xd7\xb1\x17\x13@\xe0\x03\xd6>\xf4\x85Y\xbb\xcf\xa7\x5c\xdd\xe6s\xdf\xaa\xc2\xe8\xc8\xd1\x05\x04>\x80\x8fC_8\xcf\xed\xf8\xc1\x8f\xc20\xef;\xc5\xcf[\x19\x9a\x06\x83A\x18\x8a.[/\xf7\xdcz\xb9@\x1b\xbc\xa1\x09\x80\x96\x85\xbeQ\x9c\x04\xb1Ul\xa3\x96\xcfl\xad*\xc32rD\x01\x81\x0f`r\xe8\xdbk\xfbc,Bi\x9e\x95\xaf\x97\xfb\xdcz\xb9@[\x18\xd2\x05\xa8\x1f\xf6B\x0fdY\x99\x950\x14\x9dk)@\xe0\x03\xe8\xae0\x94[V\x86\xe5@\x19\x16@\xe0\x03\xe8\xa8\xb8^\xee~\xc9.\x97\xd6\xcb\x05\x04>\x80n\xcb+\xae\xb7\xa2\x06 \xf0\x01t\xd5`0\x18e\xe5eXN\x95a\x01\x04>\x80\xee\x86\xbd\xaa\xf5r\x03\xbd{\x80\xc0\x07\xd0a!\xcc\x95\x95a9T\x86\x05\x10\xf8\x00:*\xae\x97[\xd6{w\x9dU\x17a\x06\x10\xf8\x00Z\xac\xaa\x0cK\xae\x0c\x0b \xf0\x01tT,\xc3\xf2\xa4d\x97seX\x00\x81\x0f\xa0\xdb\xaa\x86jsM\x04\x08|\x00\x1d\x15\xcb\xb0l\x97\xecr\xac\x0c\x0b \xf0\x01\xb4/\xc4\x8d\x8b\xed\xa2\xd8v*\xf6\x0beX\xcaz\xf7\xc2z\xb9\xca\xb0\x00\x02\x1f@\xcb\xc2\xde(\xbb[\x16-\xf4\xda\x9d\x15\xff/\x0blyV>Q\xe3\xc8D\x0d@\xe0\x03hW\xd8\x0b=z/\x1e\xfc(\x84\xb9\xaf\x17??\x8beW\x1e\xee\x1b\xfe\xff\xb4\xe4\xe6\xae\x8b\xb0\x97kU\xa0+\xde\xd0\x04\xc0\x1a\x84\xbd0<{6\xe5\xea\xb0T\xda\xcbb\x9f\xc3\xec\xe3^\xbbq\xc5M\x1e\xcc\xf88\xf6\xe2m_\x15\xdb\xeb\xbd\x83\x17)?s\xce \xf0\x01L\x16B\xd2F\xc5>\xcfB\x90+B\xd9?\xc9\xca\xd7\xcb\x0deXNfy\x10\xe1\xf7b\x99\x97I\x8fg714N|L\xaf\xfd\xffU\x0c\x8bU?\xbb\xb2:\x08\x08|\x00}\x11\x02\xdaVB\xe8\x0b\xd7\xff\x83\x8a}F\xf3<\x90\x22`\xddO\x18\x09\x8fi\xbb\xa1\xe77),>\x991@\x86UC^\x0f\x81I\xbd\x8f\xe1g\xcek\x04\x81\x0f`%\xc2\xf9vavnv7\xeb\xf6\xc9\x1c7\xf5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xe7m\x10z8\x1f\x0eg\x1f\x0b{@\x15=|@\x97T\x85\xb9\xd1\x1a\xb4\xc1\xc3\xf3\xf7\xd4\xd8\x03\x92\xe8\xe1\x03:a0\x18\xece\xd5eX\xce\xd6\xa0)\x86\xf1\xf2]a\x0fH\xa5\x87\x0f\xe8\x0a\xbd{wB\x0f\x9f\x1a{\x80\xc0\x07\xf4\xcb`0\xc8\xb3\xf22,\x87=]/w\x92\x835z\xae@C\x0c\xe9\x02m\x0f{[Yy\x11\xe5P\x86\xe5h]\xdaC\xd8\x03\x04>\xa0\x8f\xf2\xac\xbc\x0c\xcb\x81\x19\xaa\x00\x02\x1f\xd0Qq\xbd\xdc\xfd\x92].\x9d\xcb\x06 \xf0\x01\xdd\x96W\x5c\x7f\xa0\x89\x00\x04>\xa0\xa3\x06\x83\xc1(+/\xc3r\xbc&eX\x00\x04>\xa0\x97a/\xac&Q6\x11c\x1d\xd6\xcb\x05\x10\xf8\x80^\x0bC\xb5e\x135\x8e\xccV\x05\x10\xf8\x80\x8e\x8aeX\x9e\x95\xecr\x9d\xadQ\x19\x16\x00\x81\x0f\xe8\xa3\xaa0\xa7\x0c\x0b\x80\xc0\x07tU,\xc3\xf2\xa4d\x97\xb0^\xee\x89\x96\x02\x10\xf8\x80\xee\x1aW\x5c\xaf\x0c\x0b\x80\xc0\x07t\xd5`0\x08a\xael\xbd\xdcP\x86\xe5BK\x01\x08|@7\xc3^(\xc3\x92\x97\xec\x12\xca\xb0\xe8\xdd\x03\x10\xf8\x80\x0e\x0ba\xaf\xac\x0cKn\xa2\x06\x80\xc0\x07t\xd4`0\xd8).\x9e\x96\xecr]\x84=eX\x00\x04>\xa0\xc3\xaa\xc2\xdcH\x13\x01\x08|@G\x0d\x06\x83\xbd\xac|\xbd\xdcs\xeb\xe5\x02\x08|@\xb7\xe9\xdd\x03\x10\xf8\x80\xbe\x1a\x0c\x06yV^\x86\xe5\xd0z\xb9\x00\x02\x1f\xd0\xdd\xb0\xb7\x95\x95\x97Y\x09eXL\xd4\x00\x10\xf8\x80\x0e\xcb\xb3\xf22,\xd6\xcb\x05\x10\xf8\x80\xae\x8a\xeb\xe5\xee\x97\xecrY\x84\xbd\xb1\x96\x02\x10\xf8\x80\xee\xca+\xae\xb7\xa2\x06\x80\xc0\x07t\xd5`0\x18e\xe5eXN\x95a\x01\x10\xf8\x80\xee\x86=\xeb\xe5\x02\x08|@\xcf\x850WV\x86\xe5H\x19\x16\x00\x81\x0f\xe8\xa8X\x86\xe5Y\xc9.\xd7\x992,\x00\x02\x1f\xd0iUa.W\x86\x05@\xe0\x03:*\x96ayR\xb2\xcb\xb92,\x00\x02\x1f\xd0mU\xbd{\xbd\x9e\xa8Q\x04\xde\xbdb\xbbM\xdc\x8eV\xf88\x0fj<\xce\x91\x975\x1d\xfd{\x1c\x15\xdb\xc5k\xaf\xe7\x93\xf8\xc5T\xe0\x03\x985D\x14\x17\xdb%\xbb\x1c\xdf\xde\xde^\xf4\xb9\x0d\x8a\xe7wR\x5c\x9c'\xee\xfe4\x9e\xef\xb8\xec\xe3T5\x83\xfa!=\xb2t\xf5\xfd(\xbcn_LxO\x0a#\x10\xef\xc7\xf5\xbd\x05>\x80\x86C\xc4:\x95a\x19\xd5\xd8w\x15a*\x1c\xa7\x8d\x05<\x17h\xcb\xfbQx\x8d\xefW\xec\xf6\xac\xcf=}\x02\x1f\xb0\xaa\x10q\xb4.\x135b\xb9\x99\xc3\xc4\xddw\x97\xf9\xa1S\xdc\xd7Nq\xf14q\xf7C\xa5s\xe8\xa8\xd4/\x97\xb9\xc0\x07\x90\x1e\x22\xb6*B\xc4u\x11\x1c\xf25k\x96p~\xdeu\x8d}\x97\xf9\xb8R\x5c\xae\xe11\xa3\x1f\xefG\xc3,\xbd\x07{W\xe0\x03H7\xae\xb8~\xb4n\x0d\x12{3S{\x19\xb6\x9711\x22L(\xa9\xf1\x01g\x15\x14\x10\xf8\x00\x92C\xc4\xf9\xba\xae\x97[s\x02\xc7Q<\x0frQ\xc7)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xe8\xab\xc1`\x90g\xe5eX\x0e\xad\x97\x0b\x80\xc0\x07\xdd\x0d{[Yy\x99\x95P\x86\xc5D\x0d\x00\x04>\xe8\xb0<+/\xc3b\xbd\x5c\x00\x04>\xe8\xaa\xb8^\xee~\xc9.\x97E\xd8\x1bk)\x00\x04>\xe8\xae\xbc\xe2z+j\x00 \xf0AW\x0d\x06\x83QV^\x86\xe5X\x19\x16\x00\x04>\xe8n\xd8KY/7\xd7R\x00\x08|\xd0]a\xa8\xb6\xac\x0c\xcb\x912,\x00\x08|\xd0Q\xb1\x0c\xcb\xb3\x92]\xae3eX\x00\x10\xf8\xa0\xd3\xaa\xc2\x5c\xae\x0c\x0b\x00\x02\x1ftT,\xc3\xf2\xa4d\x97seX\x00\x10\xf8\xa0\xdb\xaaz\xf7\x94a\x01@\xe0\x83\xae\x1a\x0c\x06!\xccm\x97\xec\x12\xca\xb0\x5ch)\x00\x04>\xe8f\xd8K)\xc3\xa2w\x0f\x00\x81\x0f:,\x84\xbd\xb2\xf5r\x8fL\xd4\x00@\xe0\x83\x8e\x8aeX\x9e\x96\xecr]\x84\xbd\x5cK\x01 \xf0Aw\x8d+\xae\x1fi\x22\x00\x04>\xe8\xa8\xc1`\xb0\x97\x95\xaf\x97{n\xbd\x5c\x00\x04>\xe8\xb6\xaa2,#M\x04\x80\xc0\x07\x1d5\x18\x0c\xf2\xac|\xbd\xdc\xe7\xd6\xcb\x05@\xe0\x83\xee\x86\xbdP\x86\xa5\xac\xccJ(\xc3\x92k)\x00\x04>\xe8\xae0\x94[V\x86\xe5@\x19\x16\x00\x04>\xe8\xa8\xb8^\xee~\xc9.\x97\xd6\xcb\x05@\xe0\x83n\xcb+\xae\xb7\xa2\x06\x00\x02\x1ft\xd5`0\x18e\xe5eXN\x95a\x01@\xe0\x83\xee\x86=\xeb\xe5\x02 \xf0A\xcf\x850WV\x86\xe5H\x19\x16\x00\x04>\xe8\xa8\xb8^\xee\xb3\x92]\xae\xb3\xea\x22\xcc\x00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\xb5\xafiU\x80\xb56,\xb6gK\xb8\x9f\xf3\x18\xf2\xc6\xf3\xdc\x88\xc0\x87\xb0W\xcf\xf1\xaf^<\x1fiU\x80\xf5\xf6\xcd\xc7_8X\xf0]\x84a\xdb\x8f\x8a&7qc&m \xec\xd5\xf8\xe3\xfb\x8d\xcb\xaf\x09{\x00\xc2\xdeVq\xf1r\x017=qY\xb4&\xe8\xe1C\xd8\x13\xf6\x00\xa8\xa7\xe9\xde\xbd0l{\xf4z\xed\xbc&\xe9\xe1C\xd8\x13\xf6\x00H\xf4\xcd\xc7_xT\x5c\x5c\x15\xdb\xc6\x9c7u\xbf\xd6m>\xcb$\x8c\xba\xf4\xf0!\xec\x09{\x00\xa4\xdb\x9b3\xec\x85a\xdb<K\xa8\x9d'\xf0\x81\xb0\x07\xc0j\xe43\xfe^X\xf2\xec\xa8N\xed<\x81\x0f\x84=\x00\x96\xec\x9b\x8f\xbf0,.6k\xfc\xca\x5c\xb5\xf3\x04>\x10\xf6\x00X\xbe\xd4\xcf\x86\x8f\x96<\x9b\xb7v^\x93L\xda@\xd8\x13\xf6\x00\xa8\x90X\x8a\xa5\xd1\xdayM\xd2\xc3\x87\xb0'\xec\x01Pm\xda\xe7C\x98\x841\x8eA\xefU[\x1f\xbc\xc0\x87\xb0'\xec\x01P\xed\xf5\xda{\x8d,y&\xf0\x81\xb0\x07@\x0b|\xf3\xf1\x17\xc2gD(\xc5\xb2\xd4\xday\x02\x1f\xc2\x9e\xb0\x07\xc0\xf2\x0c\x8b\xed\xddl\x01K\x9e-\x8bI\x1b\x08{\x00\xd0s\x9f\xd1\x04\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\x08{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x01\x80\xc0\x07\xc2\x1e\x00\x08| \xec\x01\x80\xc0\x07\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00\x08| \xec\x01\x80\xc0\x07\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x80\xc0\x07\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{Z\x15\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>a\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x84=a\x0f\x00\x10\xf8\x84=a\x0f\x00\x10\xf8\x84=\x00\x00\x81O\xd8\x03\x00\x04>\x84=\x00@\xe0C\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>a\x0f\x00@\xe0\x13\xf6\x00\x00\x04>a\x0f\x00\x10\xf8\x10\xf6\x00\x00\x81\x0fa\x0f\x00\x10\xf8\x84=a\x0f\x00\x10\xf8\x84=a\x0f\x00\x10\xf8\x84=\x00\x00\x81O\xd8\x03\x00\x10\xf8\x84=\x00@\xe0C\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>a\x0f\x00@\xe0\x13\xf6\x00\x00\x04>a\x0f\x00@\xe0\x13\xf6\x00\x00\x81O\xd8\x13\xf6\x00\x00\x81O\xd8\x13\xf6\x00\x00\x81O\xd8\x03\x00\x10\xf8\x84=\x00\x00\x81O\xd8\x03\x00\x10\xf8\x84=\x00\x00\x81O\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>aO\xd8\x03\x00\x04>a\x0f\x00@\xe0\x13\xf6\x00\x00\x04>a\x0f\x00@\xe0\x13\xf6\x00\x00\xd66\xf0\x09{\x00\x00=\x0e|\xc2\x1e\x00@\x8f\x03\x9f\xb0\x07\x00\xd0\xe3\xc0'\xec\x01\x00\xf48\xf0\x09{\x00\x00=\x0e|\xc2\x1e\x00@\x8f\x03\x9f\xb0\x07\x00\xd0\xe3\xc0'\xec\x01\x00\xf48\xf0\x09{\x00\x00=\x0e|\xc2\x1e\x00@\x8f\x03\x9f\xb0\x07\x00\xd0\xe3\xc0'\xec\x01\x00\xf48\xf0\x09{\x00\x00=\x0e|\xc2\x1e\x00@\x8f\x03\x9f\xb0\x07\x00\xd0\xa2\xc0W\x84\xb3G\xc2\x1e\x00@\x8f\x03_\xe1\xa8\x08i[\xc2\x1e\x00@\x0f\x03_\xec\xdd\x0b\x01m\xd4\xc0m\x09{\x00\x00m\x0b|\x85\x83x9W\xb8\x12\xf6\x00\x00\xda\x1b\xf8\xee\x83\xd5f\x11\xda\xf6\x84=\x00\x80\x1e\x05\xbe\x18\xf06'\x84?a\x0f\x00\xa0\x0f\x81oB\xc0{Rg\xf2\x86\xb0\x07\x00\xd0\xe2\xc0\x17\x83\xdd\x93\x84\x10(\xec\x01\x00t1\xf0\x95\x04\xbb\xca\xe0%\xec\x01\x00t;\xf0\x95N\xde\x10\xf6\x00\x00:\x10\xf8\x8a\xd0\x16B\xd6f\xc9.\x07\xc2\x1e\x00@\x87\x03_V=l\xbb\xfb\xfa\xe4\x0da\x0f\x00\xa0#\x81/\x06\xb9\xdd\x84]\x0f\x84=\x00\x80\x0e\x06\xbel\xcap\xed\x04#a\x0f\x00`u\x06\xb7\xb7\xb73\xfdb\x11\xe0^\x15\x17\x1b\x89\xbb_\x16\xdb\xb6\xb0\x07\x00\xb0|3\xf5\xf0\xc5\xc9\x1a\x1b5~E\xd8\x03\x00\xe8R\xe0\xcbfX:M\xd8\x03\x00X\x8d\xdaC\xbaq\xb2\xc6Ka\x0f\x00\xa0\x1bf\xe9\xe1\xcb\x85=\x00\x80\xee\xa8\xd5\xc3\xf7\xe6\xf6W\x1f\x15\x17WY\xbd\xf3\xf7\x84=\x00\x80\x15\xaa\xdb\xc3\xb7'\xec\x01\x00\xf4;\xf0\x1d,\xe9q\x09{\x00\x00\xcb\x0e|on\x7fu'k\xae\xbc\x8a\xb0\x07\x00\xd0\xb6\xc0\x97-\xa7wO\xd8\x03\x00XE\xe0\x8b\x935\xf6\x96\xf1\x80\x8a\xfb\x1a:,\x00\x00\xcdI\x9a\xa5\x1bW\xd6x\xb1\xc4\xc7u]lG\xc56\xfe\x8d\xcb\xaf\xbdr\x98\x00\x00\x16\x1f\xf8\xae\x8a\x8b\xcd\x15<\xbe\x9bb;\x09\xe1\xaf\x08~\x17\x0e\x17\x00\xc0\x02\x02_\x1cb}\xbf\x05\x8f\xf52\xbb\xeb\xf5;\xd1\xeb\x07\x00\x90.\xe5\x1c\xbeQK\x1ek\x98!\x1c\x86\x95\xaf\x8a\x10:\x8e\xb3\x86\x01\x00\xa8P\xda\xc3\x17'k|\xaf\xc5\x8f?\xf4\xfa\xe5\xbfq\xf9\xb5\x13\x87\x12\x00`\xb2\xaa\x1e\xbeQ\xcb\xc3\xde\x91\xb0\x07\x00P\xee\x8d\x8a\xeb\x0fZ\xf6xM\xe2\x00\x00h*\xf0\xc5\xc9\x1a\x9b-y\x9c&l\x00\x004\x1d\xf8\xb2v\x0c\xe7\x1egz\xf3\x00\x00\xe62q\xd2\xc6\x9b\xdb_\xdd*.^\xae\xe81)\xba\x0c\x00\xd0\xa0i=|\xa3\x15<\x96\xe3\x18\xf2\xce\x1c\x16\x00\x80\xfe\x04>\xbdy\x00\x00\xcb\x0e|on\x7fu/[\xfcd\x8d\xd3\x18\xf2\x94T\x01\x00Xv\xe0\xcb\x16\xd7\xbb\x17z\xf3\xc61\xe8]iz\x00\x80\xe5\xf8\xc4\xa4\x8d\x05M\xd68\xcf\x14H\x06\x00X\x99\xd7{\xf8F\x0d\xddn(\x90<\x8eA\xefJ3\x03\x00\xf4'\xf0\x85\xde\xbc0d;\xd6\xb4\x00\x00-\x0b|on\x7f5\x84\xbdY&k\xe8\xcd\x03\x00\xe8B\xe0\xcb\xea\xf7\xeeY\xee\x0c\x00\xa0\x03>\x9a\xb4Qc\xb2F\xe8\xcd\x0b\x93/,w\x06\x00\xd0\x11\xf7=|\x07\x15\xfb\xe9\xcd\x03\x00\xe8x\xe0\x1bM\xb9\xderg\x00\x00]\x0f|q\xb2\xc6\xc6\x83\x9fY\xee\x0c\x00\xa0O\x81/\xfb\xb8wOo\x1e\x00@O\x03_\x08x{z\xf3\x00\x00\xfa\xe9\xff\x0b0\x00\xb2\x10\xef\xec0\x8f}\x9d\x00\x00\x00\x00IEND\xaeB`\x82\x00\x006\xc9\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x02|\x00\x00\x02|\x08\x06\x00\x00\x00d\xed|V\x00\x00\x00\x09pHYs\x00\x00\x17\x12\x00\x00\x17\x12\x01g\x9f\xd2R\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\xc9e<\x00\x006VIDATx\xda\xec\xddO\x8c$Y~\x17\xf0\x88\xf5X\xfe\x87]\xbd\xd2\xf2O+\xdc\xd9\x1cX\x0d\x18U\xad\xc0bA\xac\xaa\xc6B\xc2\x5c\xdc5\x12\x17\x9f*\xe7\xc0\xc1\x87\xa5kN\xec\xad\xa3%\x0e\xbem5#$$\x0e\x93u\xc2\xe2\xe0\xa9>\x1a\x1bu\x95\x16\xc1\x98?\xda*\xb3\x92Y\x0c\xee*\xc4\xb2\x96\xd0j\xbbla\x0c\xd8n\xe2M\xbd\xda\xa9\xe9\xc9|\x11\x91\x19\x99\x19\x11\xf9\xf9H\xa1\xec\xae\x8c\xca\x8c|\x99\x95\xf9\xcd\xf7\xe2\xfd^\xfe\xea\xd5\xab\x0cH\xdb\xfa\xca\x97\xf6\xcb\x8b\xd1\xf5{\x1f\x1ei\x0d\x00\xfa\xe63\x9a\x00j9\x8c\x1b\x00\xf4N\xae\x87\x0f\xd2\xb6\xbe\xf2\xa5Qy\xf1\x22\xfe\xf7\xed\xeb\xf7><\xd1*\x00\xf4\x89\x1e>\xa8V\xdc\xf9\xb7^>\x00zG\x0f\x1f$l}\xe5K\xf7\xca\x8b\xcb\xf0\xcf;?~p\xfd\xde\x87\x97Z\x07\x80\xbe\xd0\xc3\x07i\xfb\xaf\x85\xbd\xa0\xd0,\x00\x08|0\x1c\xd3\xc2\xdd~\xec\xf9\x03\x00\x81\x0f\xfa\xac\x0cu{\xe5\xc5\xfdiWe7=\x7f\x00 \xf0A\xcf\xa5&h\x14\x9a\x07\x80\xbe0i\x03\xa6x\xad\x14\xcb,o]\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c0\xb7\x02\x07\xb1\x87\x11\x00\x04>X\x862l\x85\xb0w\x7f\xcd\x871\xf6L\x00 \xf0\xc1\xb0\xc3\x96\xc0\x07\x80\xc0\x07\xcb\xb0\xf5\x95/\xed\x94\x17\xbb\x1d8\x94\xfb\xb1\xa7\x11\x00\x04>hY\x97\xca\xa2\x08|\x00\xac\x9c\xb2,\x0cZ\x5c\xe5\xe2{5w\xbf\xbe\xfd\xb5\x86w\x13~\xefeV\xff\x1c\xc1/^\xbf\xf7\xe1\xb9g\x07\x80U\xd1\xc3\xc7\xd0\x8dk\xecsUn\xef\x94\xdb\xa8\xdc\xe6\x09b\xe7e\x80\x1b\xc5\xdb8\xab\xb1\xbfB\xcc\x00\x08|\xd0\xa2T\xb8z\x96\xdd\x14D\x1e\x95\xdb\xa4\xdc^.rG\xf16\xf6\xca\x7f~\xb1\xdc\x8e\x13\xbb\x1eX_\x17\x00\x81\x0fZP\x86\xaa\xb0\x86\xed\xeb\xc3\xaca\xf8\xf5i\xb9=(\xc3\xd9\xfe2V\xbf\x08\xc3\xb5\xe56.\xff\xf9\xd9r{\x92\xdd\xf4 \xben\xec\x19\x02`U\xde\xd0\x04\x0c\xd8\xdd\xde\xbd\x8br;\x0a\xbdp\xab\xba\xf3\xd8cX\x84-\xce\xce\x0d\xdb\xee\x9dc;\xf2\x14\x01\xb0\x0az\xf8\x18\xa4\xb8\xaaE\x08Wah5\x0c\xdb\xee\xac2\xecM\x09\x7f\xb7\xc3\xbd\x0f\xe21\xdd\x8b=\x90\x00\xb0tz\xf8\x18\xb20l{\xd9\xa5\x03\x8a\xc73\x8e\xe7\xf09\x8f\x0f\x00\x81\x0f\x16\x0cV]>\xbe0\xdc\xfb\xd23\x05\xc0*\x18\xd2\x05\x00\x10\xf8\x00\x00\x10\xf8\x00\x00\x10\xf8\x00\x00\x10\xf8\x00\x00\x10\xf8\x00\x00\x10\xf8\x00\x00\x10\xf8\x00\x00\x04>\x00X\x91<\xcf\xef\x95\xdb\x9e\x96\x00\x81\x0f\x80a\x86\xbd\x9d\xf2\xe2RK\x80\xc0\x07\xc00\xc3\xdeay\xf1\x8dr\xdb\xd2\x1a\xb0\x5c\xd6\xd2\x05`\xd5A\xef^y1)\xb7\x87\xb7?{\xf5\xea\xd5\xa9\x96\x01\x81\x0f\x80a\x84\xbd0\x84{Rn\xf7\xb5\x06\xac\x8e!]\x00V\x15\xf6n\x87p_\x0f{gZ\x07\x96K\x0f\x1f\x00\xcb\x0ez\x9f\x1a\xc2\x05\x04>\x00\x86\x13\xf6\xea\x0c\xe1\x9ej)X.C\xba\x00,+\xec\xcd\x1a\xc2\x05VL\x0f\x1f\x00m\x07\xbd\xa6C\xb8\xa7Z\x0d\x04>\x00\xfa\x13\xf6\xcc\xc2\x85\x0e2\xa4\x0b@[ao\x9c\xdd\xf4\xd65\x0a{j\xf0\xc1\xf2\xe9\xe1\x03`\xd1\xa0\x17\x86p\x8f\xca\xed@k\x80\xc0\x07\xc0\xf0\xc2^\x18\xc2\x9d\x94\xdb\xf6\x9c7\xa1\x06\x1f\xac\x80!]\x00\xe6\x0d{\xe3\xecf\x08w[k@\xb7\xe9\xe1\x03\xa0i\xd0ks\x08\xf7T\x8b\x82\xc0\x07@\xb7\xc2\xde\xa2C\xb8\xc0\x1a\x18\xd2\x05\xa0n\xd8\x1bg\xed\x0f\xe1\x9ejYX>=|\x00T\x05=\xb3pA\xe0\x03`\xc0ao\x94\xdd\x14R^\xca\x10\xae\x1a|\xb0\x1a\x86t\x01\x98\x15\xf6\xf6\xcb\x8b\xf3\xcc\xf9z \xf0\x010\xc8\xb0\x17\x86p?(\xb7\xad%\xde\x8d\x1a|\xb0\x22\x86t\x01\xb8\x1b\xf4F\xd9\x12\x87p\x81\xf5\xd0\xc3\x07\xc0m\xd8[\xf5\x10\xee\xa9V\x07\x81\x0f\x80\xd5\x85\xbdU\x0c\xe1\x02kbH\x17`\xb3\x83\xde([\xdf\x10\xee\xa9g\x00VC\x0f\x1f\xc0\xe6\x86=\x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c9\x12\xeew\x22\xcc\x83\xc0\x07pw\x081\xf4>}#\xce\x22ey\xed<M\xb1\x8c\xb0\x97\xdd\xd4\xfa\x0ba\xfeT\x98\x07\x81\x0f\xd8@e\x008\x8ca\xe0u\xef\xc7\xb0@;\xed<\x9e\xd1\xce\xb7\x8e\xdb.\xc3r'\xec\xdd\x12\xfa@\xe0\x0360\x84T\x95\x07\xd9\xd3J\xad\xb5s\xaaw\xaf\xf5\xf5r\xa7\x84\xbd[[B\x1f\x08|\xc0f9\xcc\xd2\x13\x08\xc6\x9ah%\xed|\xb4\x842,\xa9@'\xf4\x81\xc0\x07l\x82\xd8\xeb\x94*\x0frl\xa5\x87V\xdayT^<N\xecrU\xb6s\xb1\x84\xbb\xde+\xb7\x0b\xa1\x0f\x04>`\xb3\xa5z\x9d\xae3+=\xb4eR\xe3yh],\xed\x22\xf4\x81\xc0\x07l\xb8q\xe2\xba#\xb5\xe0\x16\x17\xcb\xb0\xa4\xd6\xcb\x0deXN\x96u\xff\x0dC\x9f\x92- \xf0\x01\x03\x0b\x22!\xec\xcdZ\xda+\xf4\xeeY\xe9\xa1\x1d\x93\x8a\xeb\x97\xde\x8b*\xf4\x81\xc0\x07l\xae\xfd\xc4uz\xf7\xda\x09\xd5U\xeb\xe5>-\xdb\xf9|\x15\xc7\x12\x9f\xcfq\x0c\xf3\xb3\x84\x92-'\x9e9\x10\xf8\x80a\x04\x91Q6{\xb5\x07\xbd{\xed\xb4qU\xb9\x9b\xd6\xcb\xb0\xd4\x08}!\x5c\xeeU\x84\xbe]\xb5\x17A\xe0\x03\x86!\xd5\xbbw\xa2w\xaf\x15\x9d\x5c/7\x86\xbe\xaaa\xe4\x83\xd8;\x09\x08|\xc0@\x03\x9f\xde\xbd\x05\xc5\x19\xaf\x07\x89]B\x19\x96\xb5\xb5s\x5c\xab\xf7I\xc5n_+\x1f\xc7\xbeg\x13\x04>\xa0\x9fa$\x0c5\xce\x9a5z\xb1\xaas\xca\x06\xae*\xcc\x8d\x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xd4\xa4\xe2z\xbd{\x80\xc0\x07\xd0Wy\x9eW\xad\x97{l\xb2\x03 \xf0\x01\xf47\xec\x85\x99\xceEb\x97P\x86E\xef\x1e \xf0\x01\xf4X\x08{\xa92,\x85\x15K\x00\x81\x0f\xa0\xa7\xf2<\x0f\xcb\xd2=J\xec\x12\xca\xb0\x1ci)@\xe0\x03\xe8\xaf\xaa07\xd6D\x80\xc0\x07\xd0Sy\x9e\xefg\xd5eXN\xb5\x14 \xf0\x01\xf4\x97\xde=@\xe0\x03\x18\xaa<\xcf\x8b,]\x86\xe5I\x1f\xd7\xcb\x05\x04>\x00\xb2\xef\xaf\x97\x9b*\xb3\x12\xca\xb0\x98\xa8\x01\x08|\x00=Vd\xe92,\x87\xca\xb0\x00\x02\x1f@O\xc5\xf5r\x0f\x12\xbb\x5c\x94ao\xa2\xa5\x00\x81\x0f\xa0\xbf\x8a\x8a\xeb\xad\xa8\x01\x08|\x00}\x95\xe7\xf98K\x97a9V\x86\x05\x10\xf8\x00\xfa\x1b\xf6\xc2z\xb9\xa9\x89\x18a\xa2F\xa1\xa5\x00\x81\x0f\xa0\xbf\xc2Pmj\xa2\xc6\x912,\x80\xc0\x07\xd0S\xb1\x0c\xcb\xe3\xc4.W\x992,Um\xb8\x13{I\x81\x8474\x01\xc0\xdaT\x859eX>\x19\xee\xf6\xca\x8b\x9d\xb8\x85\xb0|{\xde\xe3[\xe5v\xaa\x85@\xe0\x03\xe8bxy\x98\xd8%\xac\x97{\xa2\xa5>\xe1\xf9\x8c\x9f\xef\x08|\x90fH\x17`=&\x15\xd7+\xc32%\x04\xcf\xf8\xb9!]\x10\xf8\x00\xba%\xcf\xf3\x10\xe6R\xeb\xe5\x862,\xe7Z\xeaS.g\xfc|O\xd3\x80\xc0\x07\xd0\xa5\xb0\x17z\xa3\x8a\xc4.\xa1\x0c\x8b\xde\xbdf\x81\x0f\xa8\xe0\x1c>`\x15!g/\xbb9\xc9>l\xb7\xff\x0e=\x5coo\xe0yj!\xec\xa5\xca\xb0\x14&j4\x0e|\xbb\x9a\x06\x04>`\xfdNf\x84\x9c\xbdx\xdd\xa6\x04\xdf0\xb9\xe0Qb\x97\xab2\xec)\xc3\xd2<\xf0\x01\x15\x0c\xe9\x02\xab\x0a|\xd3\xecoX;T\x85\xb9\xb1\x97\x0a \xf0\x01C\x0b|\xf7c\xaf\xd7\xe0\x95\x8f3\x84\xdb\xd4\xd0\xe3\x99\xf5r+]&\xdawO\xf3\x80\xc0\x07\xacQ<O\xefz\xc6\xd5\xe3\x0di\x06\xbd{\x8b\xbf\x8e.\xb5\x02\x08|@\xb7M65\xe8\xe4y^d\xe92,O\x85\x19@\xe0\x03\x86`V\x0f\xd7V\x19\x88\x06\x1b\xfab\x19\x96T\x99\x95\xd0\xf3Yxy\x00\x02\x1f\xd0{\xb1\x07k\xd6J\x09C\x0e<!\xe8\xa6\xca\xb0X/\x17\x10\xf8\x80\xc1\x85\x9fi\xee\x0f\xb1\x97/N$8H\xecrQ\x86\xbd\x89\x97E\xa3/\x0e\xf9\x8c\xedT\xeb\x80\xc0\x07t\xe3\xc3:L\xde\xb8\x9aqu1\xc0\x87\x5c\xf5\x98\xac\xa8\x01\x08|\xc0 \xcd\x0aA\x83\xea\xe5\x8b\x8f%U\x86\xe5\x99^)@\xe0\x03\x06)\x0ea\xce\xec\xe5\x8b\x93\x1c\xfa\x1e\xf6\xac\x97\x0b\x08|\xc0\xc6\x9b\x15\x86\xee\x0f$\x08\x1df\xe92,G\xca\xb0\x00\x02\x1f0h\x15\xbd|\x8f\xf3<\x1f\xf5\xf5\xb1\xc5c\x7f\x9c\xd8%<n\xeb\xe5\x02\x02\x1f\xb0\x11R=y\x93\x1e?\xae\xaa0W(\xc3\x02\x08|\xc0F\x883vg\xd5\xe5\xdb\xcd\xf3\xbcwC\xbb\xb1\x0c\xcb\xc3\xc4.g\xca\xb0\x00\x02\x1f\xb0i\xc6\x89\xeb\x8a\x1e\x0e\xedV\xf5\xee\x99\xa8\x01\x08|\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f\xa8\x89\x00\x04>\xa0\xa7\xf2<\x1fg\xe92,\xc7\x1bR\x86\x05@\xe0\x03\x06\x19\xf6\xc2j\x12\xa9\x89\x18\x9b\xb0^.\x80\xc0\x07\x0cZ\x18\xaaMM\xd482[\x15@\xe0\x03z*\x96ay\x9c\xd8\xe5*\xdb\xa02,\x00\x02\x1f0DUaN\x19\x16\x00\x81\x0f\xe8\xabX\x86\xe5ab\x97\xb0^\xee\x89\x96\x02\x10\xf8\x80\xfe\x9aT\x5c\xaf\x0c\x0b\x80\xc0\x07\xf4U\x9e\xe7!\xcc\xa5\xd6\xcb\x0deX\xce\xb5\x14\x80\xc0\x07\xf43\xec\x852,Eb\x97P\x86E\xef\x1e\x80\xc0\x07\xf4X\x08{\xa92,\x85\x89\x1a\x00\x02\x1f\xd0Sy\x9e\xef\x94\x17\x8f\x12\xbb\x5c\x95aO\x19\x16\x00\x81\x0f\xe8\xb1\xaa07\xd6D\x00\x02\x1f\xd0Sy\x9e\xefg\xe9\xf5r\xcf\xac\x97\x0b \xf0\x01\xfd\xa6w\x0f@\xe0\x03\x86*\xcf\xf3\x22K\x97ayb\xbd\x5c\x00\x81\x0f\xe8o\xd8\x1be\xe92+\xa1\x0c\x8b\x89\x1a\x00\x02\x1f\xd0cE\x96.\xc3b\xbd\x5c\x00\x81\x0f\xe8\xab\xb8^\xeeAb\x97\x8b2\xecM\xb4\x14\x80\xc0\x07\xf4WQq\xbd\x155\x00\x04>\xa0\xaf\xf2<\x1fg\xe92,\xcf\x94a\x01\x10\xf8\x80\xfe\x86=\xeb\xe5\x02\x08|\xc0\xc0\x850\x97*\xc3r\xa4\x0c\x0b\x80\xc0\x07\xf4T,\xc3\xf28\xb1\xcbU\xa6\x0c\x0b\x80\xc0\x07\xf4ZU\x98+\x94a\x01\x10\xf8\x80\x9e\x8aeX\x1e&v9S\x86\x05@\xe0\x03\xfa\xad\xaawo\x90\x135\xca\xa0\xbb_n\xafjn\xe3.\x04\xf3\x06\xc7kr\x0d}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\xd0cE\x96.\x9bp\xa8\x0c\x0b\x00\x02\x1f\xf4T\xac\x80\x9f*\xc3r\x91\x98\xc1\x07\x80\xc0\x07\xf4@Qq\xbd\xf5r\x01\x10\xf8\xa0\xafbQ\xd4\xd4\xf4\xfe\xe3\xb8\x1e%\x00\x08|\xd0\xc3\xb0\x17j9\xa5&bX/\x17\x00\x81\x0fz.\x0c\xd5\xa6&j\x1c)\xc3\x02\x80\xc0\x07=\x15\xcb\xb0<N\xec\x12*\xf2+\xc3\x02\x80\xc0\x07=V\x15\xe6\x94a\x01@\xe0\x83\xbe\x8aeX\x1e&v9\x8b\xcb4\x01\x80\xc0\x07=5\xa9\xb8^\x19\x16\x00\x04>\xe8\xab<\xcfC\x98K\xad\x97\x1b\xca\xb0\x9ck)\x00\x04>\xe8g\xd8\x0beX\x8a\xc4.\xa1\x0c\x8b\xde=\x00\x04>\xe8\xb1\x10\xf6ReX\x0a\x135\x00\x10\xf8\xa0\xa7\xf2<\xdf)/\x1e%v\xb9*\xc3\x9e2,\x00\x08|\xd0cUan\xac\x89\x00\x10\xf8\xa0\xa7\xf2<\xdf\xcf\xd2\xeb\xe5\x9eY/\x17\x00\x81\x0f\xfaM\xef\x1e\x00\x02\x1f\x0cU\x9e\xe7E\x96.\xc3\xf2\xc4z\xb9\x00\x08|\xd0\xdf\xb07\xca\xd2eVB\x19\x16\x135\x00\x10\xf8\xa0\xc7\x8a,]\x86\xc5z\xb9\x00\x08|\xd0Wq\xbd\xdc\x83\xc4.\x17e\xd8\x9bh)\x00\x04>\xe8\xaf\xa2\xe2z+j\x00 \xf0A_\xe5y>\xce\xd2eX\x8e\x95a\x01@\xe0\x83\xfe\x86\xbd:\xeb\xe5\x16Z\x0a\x00\x81\x0f\xfa+\x0c\xd5\xa6\xca\xb0\x1c)\xc3\x02\x80\xc0\x07=\x15\xcb\xb0<N\xecr\x95)\xc3\x02\x80\xc0\x07\xbdV\x15\xe6\x0aeX\x00\x10\xf8\xa0\xa7b\x19\x96\x87\x89]\xce\x94a\x01@\xe0\x83~\xab\xea\xddS\x86\x05\x00\x81\x0f\xfa*\xcf\xf3\x10\xe6\xb6\x13\xbb\x842,\xe7Z\x0a\x00\x81\x0f\xfa\x19\xf6\xea\x94a\xd1\xbb\x07\x80\xc0\x07=\x16\xc2^j\xbd\xdc#\x135\x00\x10\xf8\xa0\xa7b\x19\x96G\x89]\xae\xca\xb0Wh)\x00\x04>\xe8\xafI\xc5\xf5cM\x04\x80\xc0\x07=\x95\xe7\xf9~\x96^/\xf7\xccz\xb9\x00\x08|\xd0oUeX\xc6\x9a\x08\x00\x81\x0fz*\xcf\xf3\x22K\xaf\x97\xfb\xd4z\xb9\x00\x08|\xd0\xdf\xb0\x17\xca\xb0\xa4\xca\xac\x842,\x85\x96\x02@\xe0\x83\xfe\x0aC\xb9\xa92,\x87\xca\xb0\x00 \xf0AO\xc5\xf5r\x0f\x12\xbb\x5cX/\x17\x00\x81\x0f\xfa\xad\xa8\xb8\xde\x8a\x1a\x00\x08|\xd0Wy\x9e\x8f\xb3t\x19\x96g\xca\xb0\x00 \xf0A\x7f\xc3\x9e\xf5r\x01\x10\xf8`\xe0B\x98K\x95a9R\x86\x05\x00\x81\x0fz*\xae\x97\xfb8\xb1\xcbUV]\x84\x19\x00\x04>\xe8\xb0\xaa0W(\xc3\x02\x80\xc0\x07=\x15\xcb\xb0<L\xecr\xa6\x0c\x0b\x00\x02\x1f\xf4[U\xef\x9e\x89\x1a\x00\xac\xc5\x1b\x9a\x00\x16\x17\xcb\xb0l'v9~\xf5\xea\xd5\xb9\x96\x02\xe8\x9f\xaf?\xf8\xc2$\xfe\xb3\xf8\xf2\x8bo]\xf6\xf11\xe8\xe1\x83\x05\xfd\xc9?\xfe\x81\xf0\xc5)\xd5\xbb\xa7\x0c\x0b@\xbf\x9dd7+'\xbd(\xc3\xdfi\xb9\x8d\x05>\xd80\x0f\xbe\xf3c\xa3,\xbd^\xee\x91\x89\x1a\x00\xfd\xf5\xe5\x17\xdf\x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\x17\x96<;jR;O\xe0\x03a\x0f\x80\x15\xfb\xfa\x83/\xec\x95\x17\xf7\x1b\xfc\xcaB\xb5\xf3\x04>\x10\xf6\x00X\xbd\xba\x9f\x0d\x1f-y\xb6h\xed\xbc6\x99\xb4\x81\xb0'\xec\x01P\xa1f)\x96Vk\xe7\xb5I\x0f\x1f\xc2\x9e\xb0\x07@\xb5Y\x9f\x0fa\x12\xc6$\x06\xbd\x97]=x\x81\x0faO\xd8\x03\xa0\xda\xeb\xb5\xf7ZY\xf2L\xe0\x03a\x0f\x80\x0e\xf8\xfa\x83/\x84\xcf\x88P\x8ae\xa5\xb5\xf3\x04>\x84=a\x0f\x80\xd5\xd9+\xb7w\xb3%,y\xb6*&m \xec\x01\xc0\xc0\x09|\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\x08{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x01\x80\xc0\x07\xc2\x1e\x00\x08| \xec\x01\x80\xc0\x07\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00\x08| \xec\x01\x80\xc0\x07\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00 \xf0\x81\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x80\xc0\x07\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x09{\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00\x08|\x08{\xc2\x1e\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00 \xf0\x09|\xc2\x9e\xb0\x07\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x9f\xb0'\xec\x01\x00\x02\x9f\xb0'\xec\x01\x00\x02\x9f\xb0'\xec\x01\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x9f\xb0'\xec\x01\x00\x02\x9f\xb0'\xec\x01\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x80\xc0\x87\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00\x80\xc0'\xec\x01\x00\x02\x1f\xc2\x1e\x00 \xf0!\xec\x01\x00\x02\x9f\xb0'\xec\x01\x00\x02\x9f\xb0'\xec\x01\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00\x08|\x08{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\xc2\x1e\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x00\x02\x9f\xb0\x07\x00 \xf0\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x09{\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00\x80\xc0'\xec\x01\x00\x08|\xc2\x1e\x00\xc0\xe6\x06>a\x0f\x00`\xc0\x81O\xd8\x03\x00\x18p\xe0\x13\xf6\x00\x00\x06\x1c\xf8\x84=\x00\x80\x01\x07>a\x0f\x00`\xc0\x81O\xd8\x03\x00\x18p\xe0\x13\xf6\x00\x00\x06\x1c\xf8\x84=\x00\x80\x01\x07>a\x0f\x00`\xc0\x81O\xd8\x03\x00\x18p\xe0\x13\xf6\x00\x00\x06\x1c\xf8\x84=\x00\x80\x01\x07>a\x0f\x00`\xc0\x81O\xd8\x03\x00\x18p\xe0\x13\xf6\x00\x00\x16\xf3\x99\x96\xc3\xd9=a\x0f\x00`\xc0\x81\xaftT\x86\xb4\x91\xb0\x07\x000\xc0\xc0\x17{\xf7B@\x1b\xb7p[\xc2\x1e\x00@\xd7\x02_\xe90^.\x14\xae\x84=\x00\x80\xee\x06\xbe\xdb`u\xbf\x0cm\xfb\xc2\x1e\x00\xc0\x80\x02_\x0cx\xf7\xa7\x84?a\x0f\x00`\x08\x81oJ\xc0{\xd8d\xf2\x86\xb0\x07\x00\xd0\xe1\xc0\x17\x83\xdd\xc3\x1a!P\xd8\x03\x00\xe8c\xe0K\x04\xbb\xca\xe0%\xec\x01\x00\xf4;\xf0%'o\x08{\x00\x00=\x08|eh\x0b!\xeb~b\x97Ca\x0f\x00\xa0\xc7\x81/\xab\x1e\xb6\xdd}}\xf2\x86\xb0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\xd7p,\xc71\xe4\x9dzZ\x00\x00\x86\x13\xf8\xf4\xe6\x01\x00\xac:\xf0\xbd\xb9\xfd\xd5\xfdl\xf9\x935\x9e\xc5\x90\xa7\xa4\x0a\x00\xc0\xaa\x03_\xb6\xbc\xde\xbd\xd0\x9b7\x89A\xefR\xd3\x03\x00\xac\xc6'&m,i\xb2\xc6Y\xa6@2\x00\xc0\xda\xbc\xde\xc37n\xe9vC\x81\xe4I\x0cz\x97\x9a\x19\x00`8\x81/\xf4\xe6\x85!\xdb\x89\xa6\x05\x00\xe8X\xe0{s\xfb\xab!\xec\xcd3YCo\x1e\x00@\x1f\x02_\xd6\xbcw\xcfrg\x00\x00=\xf0\xd1\xa4\x8d\x06\x935Bo^\x98|a\xb93\x00\x80\x9e\xb8\xed\xe1;\xac\xd8Oo\x1e\x00@\xcf\x03\xdfx\xc6\xf5\x96;\x03\x00\xe8{\xe0\x8b\x935\xb6\xee\xfc\xccrg\x00\x00C\x0a|\xd9\xc7\xbd{z\xf3\x00\x00\x06\x1a\xf8B\xc0\xdb\xd7\x9b\x07\x000L\xff_\x80\x01\x00e|\xfb\xc4\xd4o\x058\x00\x00\x00\x00IEND\xaeB`\x82" qt_resource_name = b"\x00\x11\x0bF\x95g\x00p\x00a\x00r\x00a\x00m\x00e\x00t\x00r\x00i\x00c\x00f\x00i\x00t\x00t\x00i\x00n\x00g\x00\x06\x07\x03}\xc3\x00i\x00m\x00a\x00g\x00e\x00s\x00\x1c\x053\xe8'\x00a\x00x\x00i\x00s\x00_\x00r\x00o\x00a\x00t\x00i\x00o\x00n\x00_\x00z\x00_\x00a\x00x\x00i\x00s\x00_\x00i\x00c\x00o\x00n\x00.\x00p\x00n\x00g\x00\x10\x0a1\xdeg\x00m\x00o\x00d\x00e\x00l\x00-\x00v\x00i\x00e\x00w\x00e\x00r\x00.\x00p\x00n\x00g\x00\x1c\x053\xf0'\x00a\x00x\x00i\x00s\x00_\x00r\x00o\x00a\x00t\x00i\x00o\x00n\x00_\x00x\x00_\x00a\x00x\x00i\x00s\x00_\x00i\x00c\x00o\x00n\x00.\x00p\x00n\x00g\x00\x1c\x053\xf4'\x00a\x00x\x00i\x00s\x00_\x00r\x00o\x00a\x00t\x00i\x00o\x00n\x00_\x00y\x00_\x00a\x00x\x00i\x00s\x00_\x00i\x00c\x00o\x00n\x00.\x00p\x00n\x00g" qt_resource_struct = b"\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00(\x00\x02\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00:\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x9e\x00\x00\x00\x00\x00\x01\x00\x00F6\x00\x00\x00\xdc\x00\x00\x00\x00\x00\x01\x00\x00~\xa5\x00\x00\x00x\x00\x00\x00\x00\x00\x01\x00\x006|" def qInitResources(): QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) def qCleanupResources(): QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) qInitResources()
6,411.863636
139,433
0.736958
[ "Apache-2.0" ]
mahyar-osn/mapclientplugins.parametricfittingstep
mapclientplugins/parametricfittingstep/resources_rc.py
141,061
Python
import unittest,os from src.tasks.scrape_reddit.tiktok import dwn_tiktok from src.tasks.generate_video.task import generate_tiktok from src.tasks.upload_video.task import upload_video class TestTiktok(unittest.TestCase): def setUp(self): pass def test_tiktok(self): context = { 'page':{ 'Nombre':"Pagina que hace compilaciones perronas de tiktok", "thumbnail": False, 'description':['Y a ti te ha pasado eso? \nIngresa mi codigo para que ganes dinero!!\nKwai 848290921'], 'tags':['Amor','Meme','Chistes','Divertido','Reddit'], "playlist":"Compilaciones TikTok" }, 'video_path':os.getcwd()+"\\"+r"test\test_videos\caption.mp4", 'thumbnail_path':os.getcwd()+"\\"+r"data\thumbnails\8ccd23f7-7292-41d7-a743-b2c9f2b7fd36.png"} #dwn_tiktok(context) #generate_tiktok(context) upload_video(context)
37.346154
119
0.627188
[ "MIT" ]
lijemutu/auddit_extension
test/test_tiktok.py
971
Python
import os import pathlib from flask import Flask from flask import request from flask import redirect from flask import url_for from flask import session from flask import render_template from flask.json import jsonify from td.app.auth import FlaskTDAuth from configparser import ConfigParser # Define the templates folder. template_folder_path: pathlib.Path = pathlib.Path(__file__).parents[0] template_folder_path: pathlib.Path = template_folder_path.joinpath('templates') # Create the App. app = Flask('TD_oAuth_App', template_folder=template_folder_path.resolve()) @app.route("/") def home(): """Step 1: User Authorization. Redirect the user/resource owner to the OAuth provider (i.e. Github) using an URL with a few key OAuth parameters. """ return render_template("index.html") @app.route("/login") def demo(): """Step 1: User Authorization. Redirect the user/resource owner to the OAuth provider (i.e. Github) using an URL with a few key OAuth parameters. """ # Build the authorization URL. auth_tuple = app.config['auth_client'].authorization_url() # State is used to prevent CSRF, keep this for later. session['oauth_state'] = auth_tuple[1] return redirect(auth_tuple[0]) @app.route("/login/callback", methods=["GET"]) def callback(): """ Step 3: Retrieving an access token. The user has been redirected back from the provider to your registered callback URL. With this redirection comes an authorization code included in the redirect URL. We will use that to obtain an access token. """ # Grab the Refresh and Access Token. token_dict = app.config['auth_client'].grab_access_token_and_refresh_token(url=request.url) # Store it in the Session. session['oauth_token'] = token_dict if app.config['call_close']: return redirect(url_for('shutdown')) return jsonify(token_dict) @app.route("/login/refresh", methods=["GET"]) def refresh(): # Grab the Refresh Token. refresh_token_dict = app.config['auth_client'].grab_refresh_token() return jsonify(refresh_token_dict) def shutdown_server(): func = request.environ.get('werkzeug.server.shutdown') if func is None: raise RuntimeError('Not running with the Werkzeug Server') func() @app.route('/shutdown', methods=['POST']) def shutdown(): shutdown_server() return 'Server shutting down...' def run(flask_client: FlaskTDAuth, close_after: bool = False): certs_pem = pathlib.Path(__file__).parents[0].joinpath('certs/cert.pem') certs_key = pathlib.Path(__file__).parents[0].joinpath('certs/key.pem') app.secret_key = os.environ.get("SECRET_KEY") or os.urandom(24) app.config['auth_client'] = flask_client app.config['call_close'] = close_after app.run( ssl_context=(certs_pem, certs_key), host='localhost', port=5000, debug=True ) if __name__ == "__main__": # Grab configuration values. config = ConfigParser() config.read('config/config.ini') client_id = config.get('main', 'client_id') redirect_uri = config.get('main', 'redirect_uri') credentials = config.get('main','json_path') # Define the Secret Key. app.secret_key = os.environ.get("SECRET_KEY") or os.urandom(24) # Define the App Configurations. app.config['auth_client'] = FlaskTDAuth( client_id=client_id, redirect_uri=redirect_uri, credentials_file=pathlib.Path(credentials) ) # Run the App. app.run( ssl_context=('td/certs/cert.pem', 'td/certs/key.pem'), host='localhost', port=5000, debug=True ) # flask_td_app = FlaskAppTD(client_id=client_id, redirect_uri=redirect_uri, credentials_file=credentials) # flask_td_app.run() # This allows us to use a plain HTTP callback # os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = "1" # # app.run(ssl_context="adhoc")
28.594203
109
0.696655
[ "MIT" ]
Aspire1Inspire2/td-ameritrade-python-api
td/oauth.py
3,946
Python
# Copyright 2015 Ciara Kamahele-Sanfratello # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Planner is a generic interface used by Simulators to choose the next action to take class Planner: def __init__(self): pass def next_action(self, initial_state, goal_state, prev_obs): pass
36.727273
85
0.75
[ "Apache-2.0" ]
ciarakamahele/sasy
simulator/Planners/Planner.py
808
Python
"""Tests for queues.py""" import sys import unittest from unittest import mock import asyncio from .. import utils as test_utils class _QueueTestBase(test_utils.TestCase): def setUp(self): super().setUp() self.loop = self.new_test_loop() class QueueBasicTests(_QueueTestBase): def _test_repr_or_str(self, fn, expect_id): """Test Queue's repr or str. fn is repr or str. expect_id is True if we expect the Queue's id to appear in fn(Queue()). """ def gen(): when = yield self.assertAlmostEqual(0.1, when) when = yield 0.1 self.assertAlmostEqual(0.2, when) yield 0.1 loop = self.new_test_loop(gen) q = asyncio.Queue(loop=loop) self.assertTrue(fn(q).startswith('<Queue'), fn(q)) id_is_present = hex(id(q)) in fn(q) self.assertEqual(expect_id, id_is_present) @asyncio.coroutine def add_getter(): q = asyncio.Queue(loop=loop) # Start a task that waits to get. asyncio.Task(q.get(), loop=loop) # Let it start waiting. yield from asyncio.sleep(0.1, loop=loop) self.assertTrue('_getters[1]' in fn(q)) # resume q.get coroutine to finish generator q.put_nowait(0) loop.run_until_complete(add_getter()) @asyncio.coroutine def add_putter(): q = asyncio.Queue(maxsize=1, loop=loop) q.put_nowait(1) # Start a task that waits to put. asyncio.Task(q.put(2), loop=loop) # Let it start waiting. yield from asyncio.sleep(0.1, loop=loop) self.assertTrue('_putters[1]' in fn(q)) # resume q.put coroutine to finish generator q.get_nowait() loop.run_until_complete(add_putter()) q = asyncio.Queue(loop=loop) q.put_nowait(1) self.assertTrue('_queue=[1]' in fn(q)) def test_ctor_loop(self): loop = mock.Mock() q = asyncio.Queue(loop=loop) self.assertIs(q._loop, loop) q = asyncio.Queue(loop=self.loop) self.assertIs(q._loop, self.loop) def test_ctor_noloop(self): asyncio.set_event_loop(self.loop) q = asyncio.Queue() self.assertIs(q._loop, self.loop) def test_repr(self): self._test_repr_or_str(repr, True) def test_str(self): self._test_repr_or_str(str, False) def test_empty(self): q = asyncio.Queue(loop=self.loop) self.assertTrue(q.empty()) q.put_nowait(1) self.assertFalse(q.empty()) self.assertEqual(1, q.get_nowait()) self.assertTrue(q.empty()) def test_full(self): q = asyncio.Queue(loop=self.loop) self.assertFalse(q.full()) q = asyncio.Queue(maxsize=1, loop=self.loop) q.put_nowait(1) self.assertTrue(q.full()) def test_order(self): q = asyncio.Queue(loop=self.loop) for i in [1, 3, 2]: q.put_nowait(i) items = [q.get_nowait() for _ in range(3)] self.assertEqual([1, 3, 2], items) def test_maxsize(self): def gen(): when = yield self.assertAlmostEqual(0.01, when) when = yield 0.01 self.assertAlmostEqual(0.02, when) yield 0.01 loop = self.new_test_loop(gen) q = asyncio.Queue(maxsize=2, loop=loop) self.assertEqual(2, q.maxsize) have_been_put = [] @asyncio.coroutine def putter(): for i in range(3): yield from q.put(i) have_been_put.append(i) return True @asyncio.coroutine def test(): t = asyncio.Task(putter(), loop=loop) yield from asyncio.sleep(0.01, loop=loop) # The putter is blocked after putting two items. self.assertEqual([0, 1], have_been_put) self.assertEqual(0, q.get_nowait()) # Let the putter resume and put last item. yield from asyncio.sleep(0.01, loop=loop) self.assertEqual([0, 1, 2], have_been_put) self.assertEqual(1, q.get_nowait()) self.assertEqual(2, q.get_nowait()) self.assertTrue(t.done()) self.assertTrue(t.result()) loop.run_until_complete(test()) self.assertAlmostEqual(0.02, loop.time()) class QueueGetTests(_QueueTestBase): def test_blocking_get(self): q = asyncio.Queue(loop=self.loop) q.put_nowait(1) @asyncio.coroutine def queue_get(): return (yield from q.get()) res = self.loop.run_until_complete(queue_get()) self.assertEqual(1, res) def test_get_with_putters(self): q = asyncio.Queue(1, loop=self.loop) q.put_nowait(1) waiter = asyncio.Future(loop=self.loop) q._putters.append(waiter) res = self.loop.run_until_complete(q.get()) self.assertEqual(1, res) self.assertTrue(waiter.done()) self.assertIsNone(waiter.result()) def test_blocking_get_wait(self): def gen(): when = yield self.assertAlmostEqual(0.01, when) yield 0.01 loop = self.new_test_loop(gen) q = asyncio.Queue(loop=loop) started = asyncio.Event(loop=loop) finished = False @asyncio.coroutine def queue_get(): nonlocal finished started.set() res = yield from q.get() finished = True return res @asyncio.coroutine def queue_put(): loop.call_later(0.01, q.put_nowait, 1) queue_get_task = asyncio.Task(queue_get(), loop=loop) yield from started.wait() self.assertFalse(finished) res = yield from queue_get_task self.assertTrue(finished) return res res = loop.run_until_complete(queue_put()) self.assertEqual(1, res) self.assertAlmostEqual(0.01, loop.time()) def test_nonblocking_get(self): q = asyncio.Queue(loop=self.loop) q.put_nowait(1) self.assertEqual(1, q.get_nowait()) def test_nonblocking_get_exception(self): q = asyncio.Queue(loop=self.loop) self.assertRaises(asyncio.QueueEmpty, q.get_nowait) def test_get_cancelled(self): def gen(): when = yield self.assertAlmostEqual(0.01, when) when = yield 0.01 self.assertAlmostEqual(0.061, when) yield 0.05 loop = self.new_test_loop(gen) q = asyncio.Queue(loop=loop) @asyncio.coroutine def queue_get(): return (yield from asyncio.wait_for(q.get(), 0.051, loop=loop)) @asyncio.coroutine def test(): get_task = asyncio.Task(queue_get(), loop=loop) yield from asyncio.sleep(0.01, loop=loop) # let the task start q.put_nowait(1) return (yield from get_task) self.assertEqual(1, loop.run_until_complete(test())) self.assertAlmostEqual(0.06, loop.time()) def test_get_cancelled_race(self): q = asyncio.Queue(loop=self.loop) t1 = asyncio.Task(q.get(), loop=self.loop) t2 = asyncio.Task(q.get(), loop=self.loop) test_utils.run_briefly(self.loop) t1.cancel() test_utils.run_briefly(self.loop) self.assertTrue(t1.done()) q.put_nowait('a') test_utils.run_briefly(self.loop) self.assertEqual(t2.result(), 'a') def test_get_with_waiting_putters(self): q = asyncio.Queue(loop=self.loop, maxsize=1) asyncio.Task(q.put('a'), loop=self.loop) asyncio.Task(q.put('b'), loop=self.loop) test_utils.run_briefly(self.loop) self.assertEqual(self.loop.run_until_complete(q.get()), 'a') self.assertEqual(self.loop.run_until_complete(q.get()), 'b') def test_why_are_getters_waiting(self): # From issue #268. @asyncio.coroutine def consumer(queue, num_expected): for _ in range(num_expected): yield from queue.get() @asyncio.coroutine def producer(queue, num_items): for i in range(num_items): yield from queue.put(i) queue_size = 1 producer_num_items = 5 q = asyncio.Queue(queue_size, loop=self.loop) self.loop.run_until_complete( asyncio.gather( producer(q, producer_num_items), consumer(q, producer_num_items), loop=self.loop ), ) @unittest.skipIf(sys.version_info < (3, 6, 4), "Changed in 3.6.4") def test_cancelled_getters_not_being_held_in_self_getters(self): def a_generator(): yield 0.1 yield 0.2 self.loop = self.new_test_loop(a_generator) @asyncio.coroutine def consumer(queue): try: yield from asyncio.wait_for(queue.get(), 0.1, loop=self.loop) except asyncio.TimeoutError: pass queue = asyncio.Queue(loop=self.loop, maxsize=5) self.loop.run_until_complete(self.loop.create_task(consumer(queue))) self.assertEqual(len(queue._getters), 0) class QueuePutTests(_QueueTestBase): def test_blocking_put(self): q = asyncio.Queue(loop=self.loop) @asyncio.coroutine def queue_put(): # No maxsize, won't block. yield from q.put(1) self.loop.run_until_complete(queue_put()) def test_blocking_put_wait(self): def gen(): when = yield self.assertAlmostEqual(0.01, when) yield 0.01 loop = self.new_test_loop(gen) q = asyncio.Queue(maxsize=1, loop=loop) started = asyncio.Event(loop=loop) finished = False @asyncio.coroutine def queue_put(): nonlocal finished started.set() yield from q.put(1) yield from q.put(2) finished = True @asyncio.coroutine def queue_get(): loop.call_later(0.01, q.get_nowait) queue_put_task = asyncio.Task(queue_put(), loop=loop) yield from started.wait() self.assertFalse(finished) yield from queue_put_task self.assertTrue(finished) loop.run_until_complete(queue_get()) self.assertAlmostEqual(0.01, loop.time()) def test_nonblocking_put(self): q = asyncio.Queue(loop=self.loop) q.put_nowait(1) self.assertEqual(1, q.get_nowait()) def test_get_cancel_drop_one_pending_reader(self): def gen(): yield 0.01 yield 0.1 loop = self.new_test_loop(gen) q = asyncio.Queue(loop=loop) reader = loop.create_task(q.get()) loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) q.put_nowait(1) q.put_nowait(2) reader.cancel() try: loop.run_until_complete(reader) except asyncio.CancelledError: # try again reader = loop.create_task(q.get()) loop.run_until_complete(reader) result = reader.result() # if we get 2, it means 1 got dropped! self.assertEqual(1, result) def test_get_cancel_drop_many_pending_readers(self): def gen(): yield 0.01 yield 0.1 loop = self.new_test_loop(gen) loop.set_debug(True) q = asyncio.Queue(loop=loop) reader1 = loop.create_task(q.get()) reader2 = loop.create_task(q.get()) reader3 = loop.create_task(q.get()) loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) q.put_nowait(1) q.put_nowait(2) reader1.cancel() try: loop.run_until_complete(reader1) except asyncio.CancelledError: pass loop.run_until_complete(reader3) # It is undefined in which order concurrent readers receive results. self.assertEqual({reader2.result(), reader3.result()}, {1, 2}) def test_put_cancel_drop(self): def gen(): yield 0.01 yield 0.1 loop = self.new_test_loop(gen) q = asyncio.Queue(1, loop=loop) q.put_nowait(1) # putting a second item in the queue has to block (qsize=1) writer = loop.create_task(q.put(2)) loop.run_until_complete(asyncio.sleep(0.01, loop=loop)) value1 = q.get_nowait() self.assertEqual(value1, 1) writer.cancel() try: loop.run_until_complete(writer) except asyncio.CancelledError: # try again writer = loop.create_task(q.put(2)) loop.run_until_complete(writer) value2 = q.get_nowait() self.assertEqual(value2, 2) self.assertEqual(q.qsize(), 0) def test_nonblocking_put_exception(self): q = asyncio.Queue(maxsize=1, loop=self.loop) q.put_nowait(1) self.assertRaises(asyncio.QueueFull, q.put_nowait, 2) def test_float_maxsize(self): q = asyncio.Queue(maxsize=1.3, loop=self.loop) q.put_nowait(1) q.put_nowait(2) self.assertTrue(q.full()) self.assertRaises(asyncio.QueueFull, q.put_nowait, 3) q = asyncio.Queue(maxsize=1.3, loop=self.loop) @asyncio.coroutine def queue_put(): yield from q.put(1) yield from q.put(2) self.assertTrue(q.full()) self.loop.run_until_complete(queue_put()) def test_put_cancelled(self): q = asyncio.Queue(loop=self.loop) @asyncio.coroutine def queue_put(): yield from q.put(1) return True @asyncio.coroutine def test(): return (yield from q.get()) t = asyncio.Task(queue_put(), loop=self.loop) self.assertEqual(1, self.loop.run_until_complete(test())) self.assertTrue(t.done()) self.assertTrue(t.result()) def test_put_cancelled_race(self): q = asyncio.Queue(loop=self.loop, maxsize=1) put_a = asyncio.Task(q.put('a'), loop=self.loop) put_b = asyncio.Task(q.put('b'), loop=self.loop) put_c = asyncio.Task(q.put('X'), loop=self.loop) test_utils.run_briefly(self.loop) self.assertTrue(put_a.done()) self.assertFalse(put_b.done()) put_c.cancel() test_utils.run_briefly(self.loop) self.assertTrue(put_c.done()) self.assertEqual(q.get_nowait(), 'a') test_utils.run_briefly(self.loop) self.assertEqual(q.get_nowait(), 'b') self.loop.run_until_complete(put_b) def test_put_with_waiting_getters(self): q = asyncio.Queue(loop=self.loop) t = asyncio.Task(q.get(), loop=self.loop) test_utils.run_briefly(self.loop) self.loop.run_until_complete(q.put('a')) self.assertEqual(self.loop.run_until_complete(t), 'a') def test_why_are_putters_waiting(self): # From issue #265. queue = asyncio.Queue(2, loop=self.loop) @asyncio.coroutine def putter(item): yield from queue.put(item) @asyncio.coroutine def getter(): yield num = queue.qsize() for _ in range(num): queue.get_nowait() t0 = putter(0) t1 = putter(1) t2 = putter(2) t3 = putter(3) self.loop.run_until_complete(asyncio.gather(getter(), t0, t1, t2, t3, loop=self.loop)) class LifoQueueTests(_QueueTestBase): def test_order(self): q = asyncio.LifoQueue(loop=self.loop) for i in [1, 3, 2]: q.put_nowait(i) items = [q.get_nowait() for _ in range(3)] self.assertEqual([2, 3, 1], items) class PriorityQueueTests(_QueueTestBase): def test_order(self): q = asyncio.PriorityQueue(loop=self.loop) for i in [1, 3, 2]: q.put_nowait(i) items = [q.get_nowait() for _ in range(3)] self.assertEqual([1, 2, 3], items) class _QueueJoinTestMixin: q_class = None def test_task_done_underflow(self): q = self.q_class(loop=self.loop) self.assertRaises(ValueError, q.task_done) def test_task_done(self): q = self.q_class(loop=self.loop) for i in range(100): q.put_nowait(i) accumulator = 0 # Two workers get items from the queue and call task_done after each. # Join the queue and assert all items have been processed. running = True @asyncio.coroutine def worker(): nonlocal accumulator while running: item = yield from q.get() accumulator += item q.task_done() @asyncio.coroutine def test(): tasks = [asyncio.Task(worker(), loop=self.loop) for index in range(2)] yield from q.join() return tasks tasks = self.loop.run_until_complete(test()) self.assertEqual(sum(range(100)), accumulator) # close running generators running = False for i in range(len(tasks)): q.put_nowait(0) self.loop.run_until_complete(asyncio.wait(tasks, loop=self.loop)) def test_join_empty_queue(self): q = self.q_class(loop=self.loop) # Test that a queue join()s successfully, and before anything else # (done twice for insurance). @asyncio.coroutine def join(): yield from q.join() yield from q.join() self.loop.run_until_complete(join()) def test_format(self): q = self.q_class(loop=self.loop) self.assertEqual(q._format(), 'maxsize=0') q._unfinished_tasks = 2 self.assertEqual(q._format(), 'maxsize=0 tasks=2') class QueueJoinTests(_QueueJoinTestMixin, _QueueTestBase): q_class = asyncio.Queue class LifoQueueJoinTests(_QueueJoinTestMixin, _QueueTestBase): q_class = asyncio.LifoQueue class PriorityQueueJoinTests(_QueueJoinTestMixin, _QueueTestBase): q_class = asyncio.PriorityQueue if __name__ == '__main__': unittest.main()
28.861852
96
0.585967
[ "Apache-2.0", "MIT" ]
ProvoK/trio-asyncio
tests/python/test_queues.py
18,385
Python
from flask import jsonify, request from flask_restx import Resource, reqparse, fields, marshal_with import requests import redis import os import logging import time import datetime import json from app import api, db from models import User logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) user_fields = { "id": fields.Integer, "uuid": fields.Integer, "status": fields.String } @api.route("/users") class Users(Resource): users_post_reqparser = reqparse.RequestParser() users_post_reqparser.add_argument( "uuid", type=int, location="json", required=True, help="Please provide the UUID -", ) @api.expect(users_post_reqparser) @marshal_with(user_fields) def post(self): args = self.users_post_reqparser.parse_args() new_user = User(uuid=args["uuid"]) db.session.add(new_user) db.session.flush() db.session.commit() return new_user, 201 @marshal_with(user_fields) def get(self): # TODO: some authorization would be nice return User.query.all(), 200 @api.route("/usersByUUID/<int:uuid>") class UserByUUID(Resource): @marshal_with(user_fields) def get(self, uuid): user = User.query.filter_by(uuid=uuid).first() if user is None: # we should really return 404 here and don't do POST magic # in a GET request but this will make some thing much easier... user = User(uuid=uuid) db.session.add(user) db.session.flush() db.session.commit() return user, 200 @api.route("/users/<int:id>") class SingleUser(Resource): user_put_reqparser = reqparse.RequestParser() user_put_reqparser.add_argument( "status", type=str, location="json", required=True, help="Please provide the status value (healty, covid_positive, covid_negative) -", ) @marshal_with(user_fields) def get(self, id): found_user = User.query.filter_by(uuid=id).first() if found_user is None: api.abort(404, "User does not exist.") return found_user, 200 @marshal_with(user_fields) def put(self, id): user = User.query.filter_by(uuid=id).first() if user is None: api.abort(404, "User does not exist.") args = self.user_put_reqparser.parse_args() user.status = args["status"] db.session.commit() if args["status"] == "covid_positive": self._submit_filtering_jobs(user.uuid) return user, 200 def delete(self, id): user = User.query.filter_by(uuid=id).first() if user is None: api.abort(404, "User does not exist.") db.session.delete(user) db.session.commit() return {"msg": "ok"}, 200 @staticmethod def _chunks(l, n): n = max(1, n) return (l[i : i + n] for i in range(0, len(l), n)) def _submit_filtering_jobs(self, uuid): """ Here we create the task and put it on the job queue. """ # Some optimization: we make a request to the Location API # to get all the geohash prefixes for all locations the diagonzed patient # has visited in the last two weeks two_weeks_ago = datetime.date.today() - datetime.timedelta(14) params = { "from": int(two_weeks_ago.strftime("%s")), "to": int(time.time()), "unit": "seconds", } # TODO: Do not hardcode URIs or ports, use env vars instead # TODO: Do not assume that the period is always 2 weeks long, make it parametrized location_api_resp = requests.get( f"http://location-api:5000/geohashRegionsForUser/{uuid}", params=params ) if location_api_resp.status_code != 200: logger.warning(location_api_resp) api.abort( 500, "There was a problem when requesting data from the Location API" ) visited_regions_geohash_prefixes = location_api_resp.json() logger.info(f"Visited Regions for diagonzed patient: {str(visited_regions_geohash_prefixes)}") location_api_resp_users = requests.get("http://location-api:5000/users") if location_api_resp_users.status_code != 200: logger.warning(location_api_resp_users) api.abort( 500, "There was a problem when requesting data from the Location API" ) all_influx_users = list(set(location_api_resp_users.json()) - {str(uuid)}) logger.info(f"All Influx users without diagnozed patient: {str(all_influx_users)}") # So, we should split the whole job into rougly N*k jobs, where N is the # number of workers listening on the queue, so that each worker will get roughly # k tasks to execute (so we can achieve nice load balancing). # Let's assume for simplicity now that we have always 3 workers and k = 1. n_workers = 3 task_size = len(all_influx_users) // n_workers all_influx_users_partitioned = SingleUser._chunks(all_influx_users, task_size) # Create the tasks and put the onto the Redis queue redis_instance = redis.Redis( host=os.getenv("REDIS_HOST", "queue"), port=os.getenv("REDIS_PORT", 6379), db=os.getenv("REDIS_DB_ID", 0), ) redis_namespace = os.getenv("REDIS_NAMESPACE", "worker") redis_collection = os.getenv("REDIS_COLLECTION", "jobs") logger.info(f"Connected with Redis ({redis_namespace}:{redis_collection})") for idx, users_batch in enumerate(all_influx_users_partitioned): job = { "type": "scan_users_locations", "args": { "user_id_range": users_batch, "diagnozed_uuid": uuid, "diagnozed_visited_regions": visited_regions_geohash_prefixes, }, } redis_instance.rpush( f"{redis_namespace}:{redis_collection}", json.dumps(job) ) logger.info( f"Successfully pushed job #{idx} to the Job Queue:\n{json.dumps(job)}" ) logger.info("Finished pushing jobs to the Queue.")
34.302703
102
0.615663
[ "MIT" ]
pwegrzyn/pandemic-monitor
users-api/routes.py
6,346
Python
import time, calendar from datetime import datetime # # Decodes UNIX timestamp (UTC secs since epoch) to python datetime and vice versa. # class Time(datetime): def __new__(cls, *x): return datetime.__new__(cls, *x) @staticmethod def decode(json): assert isinstance(json, int) return Time.utcfromtimestamp(json) def encode(self): timestamp = calendar.timegm(self.utctimetuple()) return timestamp def __str__(self): return self.isoformat(" ") + " (UTC)"
23.863636
82
0.659048
[ "BSD-3-Clause" ]
daxm/raritan-pdu-json-rpc
raritan/rpc/Time.py
525
Python
"""Module with git related utilities.""" import git class GitRepoVersionInfo: """ Provides application versions information based on the tags and commits in the repo """ def __init__(self, path: str): """ Create an instance of GitRepoVersionInfo :param path: The path to search for git information. It searches for '.git' in this folder or any parent folder. """ self._is_repo = False try: self._repo = git.Repo(path, search_parent_directories=True) self._is_repo = True except git.exc.InvalidGitRepositoryError: self._repo = None @property def is_git_repo(self) -> bool: """ Checks if the path given in constructor is a sub-path of a valid git repo. :return: Boolean true, if repo was found. """ return self._is_repo def get_git_version(self, strip_v_in_version: bool = True) -> str: """ Gets application version in the format [last-tag]-[last-commit-sha]. :param strip_v_in_version: If the version tag starts with 'v' (like 'v1.2.3), this chooses if the 'v' should be stripped, so the resulting tag is '1.2.3'. If there's a "-", "." or "_" separator after "v", it is removed as well. :return: The version string """ if not self._is_repo: raise git.exc.InvalidGitRepositoryError() tags = sorted(self._repo.tags, key=lambda t: t.commit.committed_date) latest_tag = None if len(tags) == 0 else tags[-1] ver = "0.0.0" if latest_tag is None else latest_tag.name if strip_v_in_version and ver.startswith("v"): txt_ver = ver.lstrip("v") txt_ver = txt_ver.lstrip("-_.") else: txt_ver = ver sha = self._repo.head.commit.hexsha if latest_tag is not None and sha == latest_tag.commit.hexsha: return txt_ver return f"{txt_ver}-{sha}"
37.45283
112
0.608564
[ "Apache-2.0" ]
giantswarm/step-exec-lib
step_exec_lib/utils/git.py
1,985
Python
# A very very minimal BeautifulSoup immitation. # # BS uses SGMLlib to parse, which converts everything to lower case. # This uses real xml parsing to mimic the parts of BS we use. import xml.dom.minidom def _getText(node): nodelist = node.childNodes rc = [] for node in nodelist: if node.nodeType == node.TEXT_NODE: rc.append(str(node.data)) return rc def _getNodesAsTags(root): nodelist = root.childNodes tags = [] for node in nodelist: if node.nodeType == node.ELEMENT_NODE: tags.append(Tag(node)) return tags class Tag(object): def __init__(self, node): self.node = node self.name = node.nodeName self.contents = _getNodesAsTags(self.node) text = _getText(self.node) self.contents += text self.text = ''.join(text) def child_elements(self): children = [] for tag in self.contents: if isinstance(tag, Tag): children.append(tag) return children def get(self, tagname): got = self.first(tagname) if got: return got.text def first(self, tagname): found = None for tag in self.contents: if isinstance(tag, Tag): if tag.name == tagname: found = tag break return found class BeautifulSupe(object): def __init__(self, data): #please don't give us your null terminators data = data.strip(chr(0)) self.dom = xml.dom.minidom.parseString(data) def first(self, tagname, root = None): found = None if root == None: e = self.dom.getElementsByTagName(tagname) if len(e) > 0: found = e[0] else: for node in root.childNodes: if node.nodeName == tagname: found = node break if not found: return None tag = Tag(found) return tag def fetch(self, tagname, restraints = {}): e = self.dom.getElementsByTagName(tagname) matches = [] for node in e: match = 1 for restraint in restraints: f = self.first(restraint, node) if not f: match = 0 break text = restraints[restraint] if not f.contents[0].startswith(text): match = 0 break if match: tag = Tag(node) matches.append(tag) return matches def scour(self, prefix, suffix = None, node = None): if node is None: root = self.dom.getElementsByTagName(self.dom.documentElement.tagName)[0] node = root matches = [] for node in node.childNodes: match = 0 name = node.nodeName if name.startswith(prefix): if suffix: if name.endswith(suffix): match = 1 else: match = 1 if match: tag = Tag(node) matches.append(tag) matches += self.scour(prefix, suffix, node) return matches
25.706767
85
0.497221
[ "Apache-2.0" ]
bbc/kamaelia
Sketches/RJL/bittorrent/BitTorrent/BitTorrent/BeautifulSupe.py
3,419
Python
from pdb import set_trace as TT import numpy as np import scipy from scipy.spatial import ConvexHull import skimage from skimage.morphology import disk import skbio global trg_image trg_image = None def diversity_calc(config): div_calc_name = config.FITNESS_METRIC return get_div_calc(div_calc_name) def get_div_calc(div_calc_name): if div_calc_name == 'L2': calc_diversity = calc_diversity_l2 elif div_calc_name == 'InvL2': calc_diversity = calc_homogeneity_l2 elif div_calc_name == 'Differential': calc_diversity = calc_differential_entropy elif div_calc_name == 'Discrete': calc_diversity = calc_discrete_entropy_2 elif div_calc_name == 'Hull': calc_diversity = calc_convex_hull elif div_calc_name == 'Sum': calc_diversity = sum_experience elif div_calc_name == 'Lifespans': # or config.FITNESS_METRIC == 'ALP': calc_diversity = sum_lifespans elif div_calc_name == 'Lifetimes': calc_diversity = calc_mean_lifetime elif div_calc_name == 'Actions': calc_diversity = calc_mean_actions_matched elif div_calc_name == 'MapTest': calc_diversity = calc_local_map_entropy elif div_calc_name == 'MapTestText': calc_diversity = ham_text get_trg_image() elif div_calc_name == 'y_deltas': calc_diversity = calc_y_deltas elif div_calc_name == 'Scores' or config.FITNESS_METRIC == 'ALP': calc_diversity = calc_scores else: raise Exception('Unsupported fitness function: {}'.format(config.FITNESS_METRIC)) return calc_diversity def get_trg_image(): from PIL import Image, ImageDraw, ImageFont font_size = 15 try: font = ImageFont.truetype("arial.ttf", font_size) except OSError: try: font = ImageFont.truetype("LiberationMono-Regular.ttf", font_size) except OSError: font = ImageFont.truetype("SFNSMono.ttf", 32) global trg_image trg_image = Image.new(mode = "RGB", size=(50, 50)) draw = ImageDraw.Draw(trg_image) draw.text((1,1), "Evo", font=font, fill=(255,0,0)) draw.text((1,15), "NMMO", font=font, fill=(255,0,0)) draw.text((1,32), "¯\_(ツ)_/¯", font=font, fill=(255,0,0)) trg_image.save("trg_img.png") trg_image = (np.array(trg_image)[:, :, 0] / 255 * 8).astype(np.uint8) def ham_text(individual, config): if trg_image is None: get_trg_image() map_arr = individual.chromosome.map_arr[10:-10, 10:-10] return -(trg_image != map_arr).sum() def calc_map_entropies(individual, config, verbose=False): glob_ent = calc_global_map_entropy(individual, config) loc_ent = calc_local_map_entropy(individual, config) if verbose: print('global entropy: {}\nlocal entropy: {}'.format(glob_ent, loc_ent)) return [glob_ent[0], loc_ent] def calc_global_map_entropy(individual, config): # FIXME: hack to ignore lava borders b = config.TERRAIN_BORDER map_arr = individual.chromosome.map_arr[b:-b, b:-b] ent = scipy.stats.entropy(np.bincount(map_arr.reshape(-1), minlength=individual.n_tiles)) ent = ent * 100 / np.log(individual.n_tiles) return [ent] def calc_local_map_entropy(individual, config): # FIXME: hack to ignore lava borders b = config.TERRAIN_BORDER map_arr = individual.chromosome.map_arr[b:-b, b:-b] local_ent = skimage.filters.rank.entropy(map_arr, disk(3)) local_ent = local_ent.mean() * 100 / np.log2(individual.n_tiles) return local_ent.item() def get_pop_stats(agent_stats, pop=None): # Get list of all populations for which we need stats pops = agent_stats[0].keys() if pop is None else [pop] # Get 1D array of agent stats stats = [stats_i[p] for p in pops for stats_i in agent_stats] if len(stats[0].shape) == 2: # then rows correspond to agents so we stack them vertically (concatenate along axis 1) return np.vstack(stats) elif len(stats[0].shape) == 1: # then each agent has a scalar value so we concatenate along axis 0 return np.hstack(stats) raise Exception("Oy! Dafuk type o' agent data is this?") def contract_by_lifespan(agent_stats, lifespans): '''Pull agents close to their mean according to how short-lived they were. For punishing abundance of premature death when rewarding diversity.''' weights = sigmoid_lifespan(lifespans) n_agents = lifespans.shape[0] mean_agent = agent_stats.mean(axis=0) mean_agents = np.repeat(mean_agent.reshape(1, mean_agent.shape[0]), n_agents, axis=0) agent_deltas = mean_agents - agent_stats agent_skills = agent_stats + (weights * agent_deltas.T).T return agent_skills def expand_by_lifespan(agent_stats, lifespans): '''Push agents further from their mean according to how short-lived they were. For punishing abundance of premature death when rewarding homogeneity.''' weights = sigmoid_lifespan(lifespans) n_agents = lifespans.shape[0] mean_agent = agent_stats.mean(axis=0) mean_agents = np.repeat(mean_agent.reshape(1, mean_agent.shape[0]), n_agents, axis=0) agent_deltas = mean_agents - agent_stats # Displace agents by at most 100 units (otherwise we will not punish agents at all if they are already perfectly # homogenous, for example. agent_deltas = agent_deltas / np.linalg.norm(agent_deltas) * 100 agent_skills = agent_stats - (weights * agent_deltas.T).T return agent_skills def calc_scores(agent_stats, skill_headers=None, verbose=False): scores = np.hstack(agent_stats['scores']) if verbose: print('scores: {}'.format(scores)) return np.mean(scores) def calc_mean_actions_matched(agent_stats, skill_headers=None, verbose=False): actions_matched = np.hstack(agent_stats['actions_matched']) if verbose: print(actions_matched) # print(agent_stats['lifespans']) return np.mean(actions_matched) def calc_y_deltas(agent_stats, skill_headers=None, verbose=False): y_deltas = np.hstack(agent_stats['y_deltas']) if verbose: print('y_deltas: {}'.format(y_deltas)) return np.mean(y_deltas) def calc_mean_lifetime(agent_stats, skill_headers=None, verbose=False, pop=None): lifetimes = get_pop_stats(agent_stats['lifespans'], pop) if len(lifetimes) != 0: lifetimes = np.hstack(lifetimes) else: lifetimes = [0] mean_lifetime = lifetimes.mean() return mean_lifetime def sum_lifespans(agent_stats, skill_headers=None, n_policies=1, verbose=False, pop=None): lifespans = get_pop_stats(agent_stats['lifespans'], pop=pop) score = lifespans.mean() if verbose: print('Mean lifespan, pop {}: {}'.format(pop, score)) return score def sum_experience(agent_stats, skill_headers=None, verbose=False, pop=None): '''Simply take the sum of XP over skills and agents.''' # No need to weight by lifespan, since high lifespan is a prerequisite for high XP. agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) a_skills = np.vstack(agent_skills) a_lifespans = np.hstack(lifespans) n_agents, n_skills = a_skills.shape mean_xp = a_skills.sum() / (n_agents * n_skills) if verbose: print('skills') print(a_skills.T) print('lifespans') print(a_lifespans) print('mean xp:', mean_xp) print() return mean_xp def sigmoid_lifespan(x): # This basically assumes max lifespan is at least 100. Larger max lifespans won't really be a problem since this # function converges to 1. res = 1 / (1 + np.exp(0.1*(-x+50))) return res def calc_differential_entropy(agent_stats, skill_headers=None, verbose=False, infos={}, pop=None, punish_youth=True): agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) a_skills = agent_skills a_lifespans = lifespans assert a_skills.shape[0] == a_lifespans.shape[0] if verbose: print(skill_headers) print(a_skills.transpose()) print(len(agent_skills), 'populations') print('lifespans') print(a_lifespans) if punish_youth: # Below is an alternative way of weighting by lifespan # weights = sigmoid_lifespan(a_lifespans) # mean = np.average(a_skills, axis=0, weights=weights) # cov = np.cov(a_skills,rowvar=0, aweights=weights) # Instead, we'll just contract as usual a_skills = contract_by_lifespan(a_skills, a_lifespans) mean = np.average(a_skills, axis=0) cov = np.cov(a_skills,rowvar=0) gaussian = scipy.stats.multivariate_normal(mean=mean, cov=cov, allow_singular=True) infos['gaussian'] = gaussian score = gaussian.entropy() if verbose: print('score:', score) return score def calc_convex_hull(agent_stats, skill_headers=None, verbose=False, infos={}, pop=None, punish_youth=True): '''Calculate the diversity of a population of agents in skill-space by computing the volume inside the convex hull of the agents when treated as points in this space.''' agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) agent_skills = np.vstack(agent_skills) n_skills = agent_skills.shape[1] lifespans = np.hstack(lifespans) if verbose: print('skills:') print(agent_skills.transpose()) print('lifespans:') print(lifespans) print(len(agent_stats['lifespans']), 'populations') if punish_youth: agent_skills = contract_by_lifespan(agent_skills, lifespans) if n_skills == 1: # Max distance, i.e. a 1D hull score = agent_skills.max() - agent_skills.mean() else: try: hull = ConvexHull(agent_skills, qhull_options='QJ') infos['hull'] = hull score = hull.volume score = score ** (1 / n_skills) except Exception as e: print(e) score = 0 if verbose: print('score:', score) return score def calc_discrete_entropy_2(agent_stats, skill_headers=None, verbose=False, pop=None, punish_youth=True): agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) agent_skills_0 = agent_skills= np.vstack(agent_skills) lifespans = np.hstack(lifespans) n_agents = lifespans.shape[0] if n_agents == 1: return -np.float('inf') n_skills = agent_skills.shape[1] if verbose: print('skills') print(agent_skills_0.transpose()) print('lifespans') print(lifespans) agent_skills = np.where(agent_skills == 0, 0.0000001, agent_skills) if punish_youth: # Below is a v funky way of punishing by lifespan # weights = sigmoid_lifespan(lifespans) # # contract population toward mean according to lifespan # # mean experience level for each agent # mean_skill = agent_skills.mean(axis=1) # # mean skill vector of an agent # mean_agent = agent_skills.mean(axis=0) # assert mean_skill.shape[0] == n_agents # assert mean_agent.shape[0] == n_skills # mean_skills = np.repeat(mean_skill.reshape(mean_skill.shape[0], 1), n_skills, axis=1) # mean_agents = np.repeat(mean_agent.reshape(1, mean_agent.shape[0]), n_agents, axis=0) # agent_deltas = agent_skills - mean_agents # skill_deltas = agent_skills - mean_skills # a_skills_skills = mean_agents + (weights * agent_deltas.transpose()).transpose() # a_skills_agents = mean_skills + (weights * skill_deltas.transpose()).transpose() # div_agents = skbio.diversity.alpha_diversity('shannon', a_skills_agents).mean() # div_skills = skbio.diversity.alpha_diversity('shannon', a_skills_skills.transpose()).mean() # We'll just do the usual a_skills = contract_by_lifespan(agent_skills, lifespans) div_agents = skbio.diversity.alpha_diversity('shannon', a_skills).mean() div_skills = skbio.diversity.alpha_diversity('shannon', a_skills.transpose()).mean() # div_lifespans = skbio.diversity.alpha_diversity('shannon', lifespans) score = -(div_agents * div_skills)#/ div_lifespans#/ len(agent_skills)**2 score = score#* 100 #/ (n_agents * n_skills) if verbose: print('Score:', score) return score def calc_discrete_entropy(agent_stats, skill_headers=None, pop=None): agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) agent_skills_0 = np.vstack(agent_skills) agent_lifespans = np.hstack(lifespans) weights = sigmoid_lifespan(agent_lifespans) agent_skills = agent_skills_0.transpose() * weights agent_skills = agent_skills.transpose() BASE_VAL = 0.0001 # split between skill and agent entropy n_skills = len(agent_skills[0]) n_pop = len(agent_skills) agent_sums = [sum(skills) for skills in agent_skills] i = 0 # ensure that we will not be dividing by zero when computing probabilities for a in agent_sums: if a == 0: agent_sums[i] = BASE_VAL * n_skills i += 1 skill_sums = [0 for i in range(n_skills)] for i in range(n_skills): for a_skills in agent_skills: skill_sums[i] += a_skills[i] if skill_sums[i] == 0: skill_sums[i] = BASE_VAL * n_pop skill_ents = [] for i in range(n_skills): skill_ent = 0 for j in range(n_pop): a_skill = agent_skills[j][i] if a_skill == 0: a_skill = BASE_VAL p = a_skill / skill_sums[i] if p == 0: skill_ent += 0 else: skill_ent += p * np.log(p) skill_ent = skill_ent / (n_pop) skill_ents.append(skill_ent) agent_ents = [] for j in range(n_pop): agent_ent = 0 for i in range(n_skills): a_skill = agent_skills[j][i] if a_skill == 0: a_skill = BASE_VAL p = a_skill / agent_sums[j] if p == 0: agent_ent += 0 else: agent_ent += p * np.log(p) agent_ent = agent_ent / (n_skills) agent_ents.append(agent_ent) agent_score = np.mean(agent_ents) skill_score = np.mean(skill_ents) # score = (alpha * skill_score + (1 - alpha) * agent_score) score = -(skill_score * agent_score) score = score * 100#/ n_pop**2 print('agent skills:\n{}\n{}'.format(skill_headers, np.array(agent_skills_0.transpose()))) print('lifespans:\n{}'.format(lifespans)) # print('skill_ents:\n{}\nskill_mean:\n{}\nagent_ents:\n{}\nagent_mean:{}\nscore:\n{}\n'.format( # np.array(skill_ents), skill_score, np.array(agent_ents), agent_score, score)) print('score:\n{}'.format(score)) return score def calc_homogeneity_l2(agent_stats, skill_headers=None, verbose=False, pop=None, punish_youth=True): '''Use L2 distance to punish agents for having high mean pairwise distance. Optimal state is all agents at the same point in skill-space, with maximal lifespans.''' if 'skills' not in agent_stats: raise Exception('We should be including dead agents in this calculation, so we should get at least some skill ' 'stats back here') agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) assert len(agent_skills) == len(lifespans) if punish_youth: agent_skills = expand_by_lifespan(agent_skills, lifespans) n_agents = agent_skills.shape[0] a = agent_skills b = a.reshape(n_agents, 1, a.shape[1]) # https://stackoverflow.com/questions/43367001/how-to-calculate-euclidean-distance-between-pair-of-rows-of-a-numpy-array distances = np.sqrt(np.einsum('ijk, ijk->ij', a - b, a - b)) score = np.sum(distances) / n_agents ** 2 if verbose: # print(skill_headers) print('agent skills:\n{}'.format(a.transpose())) print('lifespans:\n{}'.format(lifespans)) print('score:\n{}\n'.format( score)) return -score def calc_diversity_l2(agent_stats, skill_headers=None, verbose=False, pop=None, punish_youth=False): if 'skills' not in agent_stats: return 0 agent_skills = get_pop_stats(agent_stats['skills'], pop) lifespans = get_pop_stats(agent_stats['lifespans'], pop) assert len(agent_skills) == len(lifespans) if punish_youth: agent_skills = contract_by_lifespan(agent_skills, lifespans) n_agents = agent_skills.shape[0] a = agent_skills b = a.reshape(n_agents, 1, a.shape[1]) # https://stackoverflow.com/questions/43367001/how-to-calculate-euclidean-distance-between-pair-of-rows-of-a-numpy-array distances = np.sqrt(np.einsum('ijk, ijk->ij', a-b, a-b)) score = np.sum(distances) / n_agents ** 2 if verbose: # print(skill_headers) print('agent skills:\n{}'.format(a.transpose())) print('lifespans:\n{}'.format(lifespans)) print('score:\n{}\n'.format( score)) return score DIV_CALCS = [(calc_diversity_l2, 'mean pairwise L2'), (calc_differential_entropy, 'differential entropy'), (calc_discrete_entropy_2, 'discrete entropy'), (calc_convex_hull, 'convex hull volume'), (sum_lifespans, 'lifespans')]
37.589912
225
0.687066
[ "MIT" ]
narendasan/neural-mmo
evolution/diversity.py
17,145
Python
""" The file contains the PPO class to train with. NOTE: All "ALG STEP"s are following the numbers from the original PPO pseudocode. It can be found here: https://spinningup.openai.com/en/latest/_images/math/e62a8971472597f4b014c2da064f636ffe365ba3.svg """ import gym import numpy as np import torch import torch.nn as nn from torch.optim import Adam #For continuous actions from torch.distributions import MultivariateNormal #For discrete action_space from torch.distributions import Categorical from network import FeedForwardActorNN, FeedForwardCriticNN import sys from cbf_clf_helper import clf_control, cbf_control #Integrating tensorboard from torch.utils.tensorboard import SummaryWriter writer = SummaryWriter() class PPO: """ This is the PPO class we will use as our model in main.py """ def __init__(self, env, **hyperparameters): """ Initializes the PPO model, including hyperparameters. Parameters: policy_class - the policy class to use for our actor/critic networks. env - the environment to train on. hyperparameters - all extra arguments passed into PPO that should be hyperparameters. Returns: None """ # Make sure the environment is compatible with our code assert(type(env.observation_space) == gym.spaces.Box) # Makeassert(type(env.action_space) == gym.spaces.Box) # Initialize hyperparameters for training with PPO self._init_hyperparameters(hyperparameters) # Extract environment information self.env = env self.obs_dim = env.observation_space.shape[0] if self.discrete: self.act_dim = env.action_space.n else: self.act_dim = env.action_space.shape[0] #env.action_space.n #env.action_space.shape[0] # Initialize actor and critic networks self.actor = FeedForwardActorNN(self.obs_dim, self.act_dim,self.discrete) actor_model = 'ppo_actorKinematicBicycleGymLane.pth' policy = FeedForwardActorNN(5, 2,False) policy.load_state_dict(torch.load(actor_model)) actor_model = policy #print(f'model =========== {self.actor}') # ALG STEP 1 self.critic = FeedForwardCriticNN(self.obs_dim, 1) #print(f'critic =========== {self.critic}') # Initialize optimizers for actor and critic self.actor_optim = Adam(self.actor.parameters(), lr=self.lr) self.critic_optim = Adam(self.critic.parameters(), lr=self.lr) # Initialize the covariance matrix used to query the actor for actions self.cov_var = torch.full(size=(self.act_dim,), fill_value=0.05) self.cov_mat = torch.diag(self.cov_var) self.obs_count = 0 self.index_count = 0 # This logger will help us with printing out summaries of each iteration self.logger = { 't_so_far': 0, # timesteps so far 'i_so_far': 0, # iterations so far 'batch_lens': [], # episodic lengths in batch 'batch_rews': [], # episodic returns in batch 'batch_infractions': [], # Episodic returns in a neural network 'actor_losses': [], # losses of actor network in current iteration 'actor_network' : 0, # Actor network } def learn(self, env_name,failure_observations,subpolicy): """ Train the actor and critic networks. Here is where the main PPO algorithm resides. Parameters: total_timesteps - the total number of timesteps to train for Return: None """ print(f"Learning... Running {self.max_timesteps_per_episode} timesteps per episode, ", end='') print(f"{self.timesteps_per_batch} timesteps per batch for a total of {self.training_step} iterations") t_so_far = 0 # Timesteps simulated so far i_so_far = 0 # Iterations ran so far while i_so_far < self.training_step: # ALG STEP 2 # Autobots, roll out (just kidding, we're collecting our batch simulations here) batch_obs, batch_acts, batch_log_probs, batch_rtgs, batch_lens = self.rollout(subpolicy,failure_observations) # ALG STEP 3 # Calculate how many timesteps we collected this batch t_so_far += np.sum(batch_lens) # Increment the number of iterations i_so_far += 1 # Logging timesteps so far and iterations so far self.logger['t_so_far'] = t_so_far self.logger['i_so_far'] = i_so_far # Calculate advantage at k-th iteration V, _ = self.evaluate(batch_obs, batch_acts) A_k = batch_rtgs - V.detach() # ALG STEP 5 # One of the only tricks I use that isn't in the pseudocode. Normalizing advantages # isn't theoretically necessary, but in practice it decreases the variance of # our advantages and makes convergence much more stable and faster. I added this because # solving some environments was too unstable without it. A_k = (A_k - A_k.mean()) / (A_k.std() + 1e-10) # This is the loop where we update our network for some n epochs for _ in range(self.n_updates_per_iteration): # ALG STEP 6 & 7 # Calculate V_phi and pi_theta(a_t | s_t) V, curr_log_probs = self.evaluate(batch_obs, batch_acts) # Calculate the ratio pi_theta(a_t | s_t) / pi_theta_k(a_t | s_t) # NOTE: we just subtract the logs, which is the same as # dividing the values and then canceling the log with e^log. # For why we use log probabilities instead of actual probabilities, # here's a great explanation: # https://cs.stackexchange.com/questions/70518/why-do-we-use-the-log-in-gradient-based-reinforcement-algorithms # TL;DR makes gradient ascent easier behind the scenes. ratios = torch.exp(curr_log_probs - batch_log_probs) # Calculate surrogate losses. #print(f'A_k======================={A_k}') surr1 = ratios * A_k #print(f'surr1======================={surr1}') surr2 = torch.clamp(ratios, 1 - self.clip, 1 + self.clip) * A_k #print(f'surr2======================={surr2}') # Calculate actor and critic losses. # NOTE: we take the negative min of the surrogate losses because we're trying to maximize # the performance function, but Adam minimizes the loss. So minimizing the negative # performance function maximizes it. actor_loss = (-torch.min(surr1, surr2)).mean() #print(f'actor_loss======================={actor_loss}') critic_loss = nn.MSELoss()(V, batch_rtgs) # Calculate gradients and perform backward propagation for actor network self.actor_optim.zero_grad() actor_loss.backward(retain_graph=True) self.actor_optim.step() # Calculate gradients and perform backward propagation for critic network self.critic_optim.zero_grad() critic_loss.backward() self.critic_optim.step() # Log actor loss self.logger['actor_losses'].append(actor_loss.detach()) self.logger['actor_network'] = self.actor # Print a summary of our training so far self._log_summary() # Save our model if it's time if i_so_far % self.save_freq == 0: if subpolicy: torch.save(self.actor.state_dict(), './ppo_actor_subpolicy'+env_name+'.pth') torch.save(self.critic.state_dict(), './ppo_critic_subpolicy'+env_name+'.pth') else: torch.save(self.actor.state_dict(), './ppo_actor'+env_name+'.pth') torch.save(self.critic.state_dict(), './ppo_critic'+env_name+'.pth') def rollout(self,subpolicy,failure_observations): """ This is where we collect the batch of data from simulation. Since this is an on-policy algorithm, we'll need to collect a fresh batch of data each time we iterate the actor/critic networks. Parameters: None Return: batch_obs - the observations collected this batch. Shape: (number of timesteps, dimension of observation) batch_acts - the actions collected this batch. Shape: (number of timesteps, dimension of action) batch_log_probs - the log probabilities of each action taken this batch. Shape: (number of timesteps) batch_rtgs - the Rewards-To-Go of each timestep in this batch. Shape: (number of timesteps) batch_lens - the lengths of each episode this batch. Shape: (number of episodes) """ # Batch data. For more details, check function header. batch_obs = [] batch_acts = [] batch_log_probs = [] batch_rews = [] batch_rtgs = [] batch_lens = [] batch_infractions = [] # Episodic data. Keeps track of rewards per episode, will get cleared # upon each new episode ep_rews = [] t = 0 # Keeps track of how many timesteps we've run so far this batch # Keep simulating until we've run more than or equal to specified timesteps per batch while t < self.timesteps_per_batch: act_list = [] ep_rews = [] # rewards collected per episode # Reset the environment. sNote that obs is short for observation. obs = self.env.reset() #print(f'obs reset ============= {obs}') done = False count_infractions = 0 count_infractions_acc = 0 count_infractions_steer = 0 # Run an episode for a maximum of max_timesteps_per_episode timesteps for ep_t in range(self.max_timesteps_per_episode): a_predicted_clf = clf_control(self.env.v_ego) delta, target_id, crosstrack_error = self.env.car.tracker.stanley_control(self.env.x_ego, self.env.y_ego, self.env.yaw_ego, self.env.v_ego, self.env.delta_ego) # If render is specified, render the environment if self.render: self.env.render() t += 1 # Increment timesteps ran this batch so far # Track observations in this batch batch_obs.append(obs) # Calculate action and make a step in the env. # Note that rew is short for reward. if self.discrete: action, log_prob = self.get_action_discrete(obs) else: action, log_prob = self.get_action(obs) #self.get_action_discrete(obs) #print(f'action chosen =============== {action}') if(abs(round(float(action[0]),1))<abs(round(float(a_predicted_clf),1))): count_infractions_acc = count_infractions_acc+1 if(abs(round(float(action[1]),1)) < abs(round(float(delta),1))-0.2): #print(f'After rounding =============== {round(float(action_net[1]),1)} ====== {round(float(action[1]),1)}') count_infractions_steer = count_infractions_steer+1 obs, rew, done, info = self.env.step(action) count_infractions = count_infractions_acc+count_infractions_steer # Track recent reward, action, and action log probability ep_rews.append(rew) batch_acts.append(action) batch_log_probs.append(log_prob) act_list.append(info) # If the environment tells us the episode is terminated, break if done: break # Track episodic lengths and rewards #self.env.render(act_list) batch_lens.append(ep_t + 1) batch_rews.append(ep_rews) batch_infractions.append(count_infractions) # Reshape data as tensors in the shape specified in function description, before returning batch_obs = torch.tensor(batch_obs, dtype=torch.float) #print(f'batch_acts =============== {batch_acts}') #For discrete state space if self.discrete: batch_acts = torch.tensor(batch_acts, dtype=torch.long).view(-1,) else: batch_acts = torch.tensor(batch_acts, dtype=torch.float) #torch.tensor(batch_acts, dtype=torch.long).view(-1,) #print(f'batch_acts =============== {batch_acts}') batch_log_probs = torch.tensor(batch_log_probs, dtype=torch.float) batch_rtgs = self.compute_rtgs(batch_rews) # ALG STEP 4 # Log the episodic returns and episodic lengths in this batch. self.logger['batch_rews'] = batch_rews self.logger['batch_lens'] = batch_lens self.logger['batch_infractions'] = batch_infractions return batch_obs, batch_acts, batch_log_probs, batch_rtgs, batch_lens def compute_rtgs(self, batch_rews): """ Compute the Reward-To-Go of each timestep in a batch given the rewards. Parameters: batch_rews - the rewards in a batch, Shape: (number of episodes, number of timesteps per episode) Return: batch_rtgs - the rewards to go, Shape: (number of timesteps in batch) """ # The rewards-to-go (rtg) per episode per batch to return. # The shape will be (num timesteps per episode) batch_rtgs = [] # Iterate through each episode for ep_rews in reversed(batch_rews): discounted_reward = 0 # The discounted reward so far # Iterate through all rewards in the episode. We go backwards for smoother calculation of each # discounted return (think about why it would be harder starting from the beginning) for rew in reversed(ep_rews): discounted_reward = rew + discounted_reward * self.gamma batch_rtgs.insert(0, discounted_reward) # Convert the rewards-to-go into a tensor batch_rtgs = torch.tensor(batch_rtgs, dtype=torch.float) return batch_rtgs # Probability sampling for discrete actions def get_action_discrete(self, obs): #print(f'obs ================== {obs}') mean = self.actor(obs) #print(f'mean ================== {mean}') dist = Categorical(mean) #print(f'dist ================== {dist}') action = dist.sample() log_prob = dist.log_prob(action) #print(f'action ====== {action} ========= {log_prob}') return action.detach().numpy().item(), log_prob.detach().item() def get_action(self, obs): """ Queries an action from the actor network, should be called from rollout. Parameters: obs - the observation at the current timestep Return: action - the action to take, as a numpy array log_prob - the log probability of the selected action in the distribution """ # Query the actor network for a mean action mean = self.actor(obs) # Create a distribution with the mean action and std from the covariance matrix above. # For more information on how this distribution works, check out Andrew Ng's lecture on it: # https://www.youtube.com/watch?v=JjB58InuTqM dist = MultivariateNormal(mean, self.cov_mat) # Sample an action from the distribution action = dist.sample() # Calculate the log probability for that action log_prob = dist.log_prob(action) # Return the sampled action and the log probability of that action in our distribution return action.detach().numpy(), log_prob.detach() def evaluate(self, batch_obs, batch_acts): """ Estimate the values of each observation, and the log probs of each action in the most recent batch with the most recent iteration of the actor network. Should be called from learn. Parameters: batch_obs - the observations from the most recently collected batch as a tensor. Shape: (number of timesteps in batch, dimension of observation) batch_acts - the actions from the most recently collected batch as a tensor. Shape: (number of timesteps in batch, dimension of action) Return: V - the predicted values of batch_obs log_probs - the log probabilities of the actions taken in batch_acts given batch_obs """ # Query critic network for a value V for each batch_obs. Shape of V should be same as batch_rtgs V = self.critic(batch_obs).squeeze() # Calculate the log probabilities of batch actions using most recent actor network. # This segment of code is similar to that in get_action() mean = self.actor(batch_obs) if self.discrete: dist = Categorical(mean) else: dist = MultivariateNormal(mean, self.cov_mat) #For discrete actions #dist = Categorical(mean) log_probs = dist.log_prob(batch_acts) # Return the value vector V of each observation in the batch # and log probabilities log_probs of each action in the batch return V, log_probs def _init_hyperparameters(self, hyperparameters): """ Initialize default and custom values for hyperparameters Parameters: hyperparameters - the extra arguments included when creating the PPO model, should only include hyperparameters defined below with custom values. Return: None """ # Initialize default values for hyperparameters # Algorithm hyperparameters self.timesteps_per_batch = 4800 # Number of timesteps to run per batch self.max_timesteps_per_episode = 1600 # Max number of timesteps per episode self.n_updates_per_iteration = 5 # Number of times to update actor/critic per iteration self.lr = 0.005 # Learning rate of actor optimizer self.gamma = 0.95 # Discount factor to be applied when calculating Rewards-To-Go self.clip = 0.2 # Recommended 0.2, helps define the threshold to clip the ratio during SGA # Miscellaneous parameters self.render = False # If we should render during rollout self.save_freq = 10 # How often we save in number of iterations self.seed = None # Sets the seed of our program, used for reproducibility of results self.discrete = False # Sets the type of environment to discrete or continuous self.training_step = 200 # Sets the number of trainig step # Change any default values to custom values for specified hyperparameters for param, val in hyperparameters.items(): exec('self.' + param + ' = ' + str(val)) # Sets the seed if specified if self.seed != None: # Check if our seed is valid first assert(type(self.seed) == int) # Set the seed torch.manual_seed(self.seed) print(f"Successfully set seed to {self.seed}") def _log_summary(self): """ Print to stdout what we've logged so far in the most recent batch. Parameters: None Return: None """ # Calculate logging values. I use a few python shortcuts to calculate each value # without explaining since it's not too important to PPO; feel free to look it over, # and if you have any questions you can email me (look at bottom of README) t_so_far = self.logger['t_so_far'] i_so_far = self.logger['i_so_far'] avg_ep_lens = np.mean(self.logger['batch_lens']) avg_ep_rews = np.mean([np.sum(ep_rews) for ep_rews in self.logger['batch_rews']]) avg_actor_loss = np.mean([losses.float().mean() for losses in self.logger['actor_losses']]) avg_ep_infractions = np.mean([np.sum(ep_inf) for ep_inf in self.logger['batch_infractions']]) actor_model = self.logger['actor_network'] # Round decimal places for more aesthetic logging messages avg_ep_lens = str(round(avg_ep_lens, 2)) avg_ep_rews = str(round(avg_ep_rews, 2)) avg_ep_infractions = str(round(avg_ep_infractions, 2)) avg_actor_loss = str(round(avg_actor_loss, 5)) writer.add_scalar("Average Episodic Return", int(float(avg_ep_rews)), t_so_far) writer.add_scalar("Average actor Loss", int(float(avg_actor_loss)), t_so_far) writer.add_scalar("Average Infractions", int(float(avg_ep_infractions)), t_so_far) # Tracking the weight of the network for name, param in actor_model.named_parameters(): if 'weight' in name: writer.add_histogram(name, param.detach().numpy(), t_so_far) # Print logging statements print(flush=True) print(f"-------------------- Iteration #{i_so_far} --------------------", flush=True) print(f"Average Episodic Length: {avg_ep_lens}", flush=True) print(f"Average Episodic Return: {avg_ep_rews}", flush=True) print(f"Average Episodic Infractions : {avg_ep_infractions}", flush=True) print(f"Average Loss: {avg_actor_loss}", flush=True) print(f"Timesteps So Far: {t_so_far}", flush=True) print(f"------------------------------------------------------", flush=True) print(flush=True) # Reset batch-specific logging data self.logger['batch_lens'] = [] self.logger['batch_rews'] = [] self.logger['actor_losses'] = [] def test(env, actor_model, is_discrete): """ Tests the model. Parameters: env - the environment to test the policy on actor_model - the actor model to load in Return: None """ print(f"Testing {actor_model}", flush=True) # If the actor model is not specified, then exit if actor_model == '': print(f"Didn't specify model file. Exiting.", flush=True) sys.exit(0) # Extract out dimensions of observation and action spaces obs_dim = env.observation_space.shape[0] if is_discrete: act_dim = env.action_space.n else: act_dim = env.action_space.shape[0] #env.action_space.n #env.action_space.shape[0] # Build our policy the same way we build our actor model in PPO policy = FeedForwardActorNN(obs_dim, act_dim,is_discrete) # Load in the actor model saved by the PPO algorithm policy.load_state_dict(torch.load(actor_model)) # Evaluate our policy with a separate module, eval_policy, to demonstrate # that once we are done training the model/policy with ppo.py, we no longer need # ppo.py since it only contains the training algorithm. The model/policy itself exists # independently as a binary file that can be loaded in with torch. eval_policy(policy=policy, env=env, render=True, is_discrete=is_discrete)
40.42344
164
0.681444
[ "MIT" ]
britig/S2RL-Policies
ppoPolicyTraining.py
21,384
Python
import os from typing import Union, Tuple from torchtext._internal.module_utils import is_module_available from torchtext.data.datasets_utils import ( _wrap_split_argument, _create_dataset_directory, ) if is_module_available("torchdata"): from torchdata.datapipes.iter import FileOpener, GDriveReader, IterableWrapper URL = "https://drive.google.com/uc?export=download&id=0Bz8a_Dbh9QhbaW12WVVZS2drcnM" MD5 = "fe39f8b653cada45afd5792e0f0e8f9b" NUM_LINES = { "train": 3600000, "test": 400000, } _PATH = "amazon_review_polarity_csv.tar.gz" _EXTRACTED_FILES = { "train": os.path.join("amazon_review_polarity_csv", "train.csv"), "test": os.path.join("amazon_review_polarity_csv", "test.csv"), } DATASET_NAME = "AmazonReviewPolarity" @_create_dataset_directory(dataset_name=DATASET_NAME) @_wrap_split_argument(("train", "test")) def AmazonReviewPolarity(root: str, split: Union[Tuple[str], str]): """AmazonReviewPolarity Dataset For additional details refer to https://arxiv.org/abs/1509.01626 Number of lines per split: - train: 3600000 - test: 400000 Args: root: Directory where the datasets are saved. Default: os.path.expanduser('~/.torchtext/cache') split: split or splits to be returned. Can be a string or tuple of strings. Default: (`train`, `test`) :returns: DataPipe that yields tuple of label (1 to 2) and text containing the review title and text :rtype: (int, str) """ # TODO Remove this after removing conditional dependency if not is_module_available("torchdata"): raise ModuleNotFoundError( "Package `torchdata` not found. Please install following instructions at `https://github.com/pytorch/data`" ) url_dp = IterableWrapper([URL]) cache_compressed_dp = url_dp.on_disk_cache( filepath_fn=lambda x: os.path.join(root, _PATH), hash_dict={os.path.join(root, _PATH): MD5}, hash_type="md5", ) cache_compressed_dp = GDriveReader(cache_compressed_dp).end_caching(mode="wb", same_filepath_fn=True) cache_decompressed_dp = cache_compressed_dp.on_disk_cache( filepath_fn=lambda x: os.path.join(root, _EXTRACTED_FILES[split]) ) cache_decompressed_dp = ( FileOpener(cache_decompressed_dp, mode="b").read_from_tar().filter(lambda x: _EXTRACTED_FILES[split] in x[0]) ) cache_decompressed_dp = cache_decompressed_dp.end_caching(mode="wb", same_filepath_fn=True) data_dp = FileOpener(cache_decompressed_dp, encoding="utf-8") return data_dp.parse_csv().map(fn=lambda t: (int(t[0]), " ".join(t[1:])))
34.486842
119
0.720336
[ "BSD-3-Clause" ]
abhinavarora/text
torchtext/datasets/amazonreviewpolarity.py
2,621
Python
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) import os import catkin_pkg.package catkin_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) catkin_package = catkin_pkg.package.parse_package(os.path.join(catkin_dir, catkin_pkg.package.PACKAGE_MANIFEST_FILENAME)) # -- Project information ----------------------------------------------------- project = 'SMACHA ROS' copyright = '2019, ReconCell' author = 'Barry Ridge' # The short X.Y version # version = '' version = catkin_package.version # The full version, including alpha/beta/rc tags # release = '0.0.1' release = catkin_package.version # -- General configuration --------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinxcontrib.programoutput', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] # source_suffix = '.rst' source_parsers = { '.md': 'recommonmark.parser.CommonMarkParser', } # The master toctree document. master_doc = 'index' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = None # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # # html_theme = 'alabaster' html_theme = 'sphinx_rtd_theme' html_logo = "_static/logo.png" html_favicon = "_static/favicon.ico" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # # html_theme_options = {} html_theme_options = { 'canonical_url': 'https://reconcell.gitlab.io/smacha/smacha_ros/' # 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard # 'logo_only': False, # 'display_version': True, # 'prev_next_buttons_location': 'bottom', # 'style_external_links': False, # 'vcs_pageview_mode': '', # 'style_nav_header_background': 'white', # # Toc options # 'collapse_navigation': True, # 'sticky_navigation': True, # 'navigation_depth': 4, # 'includehidden': True, # 'titles_only': False } # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Custom sidebar templates, must be a dictionary that maps document names # to template names. # # The default sidebars (for documents that don't match any pattern) are # defined by theme itself. Builtin themes are using these templates by # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', # 'searchbox.html']``. # # html_sidebars = {} # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. htmlhelp_basename = 'smacha_rosdoc' # -- Options for LaTeX output ------------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'smacha_ros.tex', 'smacha\\_ros package API', 'Barry Ridge', 'manual'), ] # -- Options for manual page output ------------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'smacha_ros', 'smacha_ros package API', [author], 1) ] # -- Options for Texinfo output ---------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'smacha_ros', 'smacha_ros package API', author, 'smacha_ros', 'SMACHA is a meta-scripting, templating, and code generation engine for rapid prototyping of ROS SMACH state machines.', 'Miscellaneous'), ] # -- Options for Epub output ------------------------------------------------- # Bibliographic Dublin Core info. epub_title = project # The unique identifier of the text. This can be a ISBN number # or the project homepage. # # epub_identifier = '' # A unique identification for the text. # # epub_uid = '' # A list of files that should not be packed into the epub file. epub_exclude_files = ['search.html'] # -- Extension configuration ------------------------------------------------- # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'https://docs.python.org/': None} # -- Options for todo extension ---------------------------------------------- # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True
30.753304
147
0.655064
[ "BSD-3-Clause" ]
ReconCell/smacha
smacha_ros/doc/conf.py
6,981
Python
# qubit number=4 # total number=32 import cirq import qiskit from qiskit.providers.aer import QasmSimulator from qiskit.test.mock import FakeVigo from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from math import log2 import numpy as np import networkx as nx def bitwise_xor(s: str, t: str) -> str: length = len(s) res = [] for i in range(length): res.append(str(int(s[i]) ^ int(t[i]))) return ''.join(res[::-1]) def bitwise_dot(s: str, t: str) -> str: length = len(s) res = 0 for i in range(length): res += int(s[i]) * int(t[i]) return str(res % 2) def build_oracle(n: int, f) -> QuantumCircuit: # implement the oracle O_f # NOTE: use multi_control_toffoli_gate ('noancilla' mode) # https://qiskit.org/documentation/_modules/qiskit/aqua/circuits/gates/multi_control_toffoli_gate.html # https://quantumcomputing.stackexchange.com/questions/3943/how-do-you-implement-the-toffoli-gate-using-only-single-qubit-and-cnot-gates # https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate controls = QuantumRegister(n, "ofc") target = QuantumRegister(1, "oft") oracle = QuantumCircuit(controls, target, name="Of") for i in range(2 ** n): rep = np.binary_repr(i, n) if f(rep) == "1": for j in range(n): if rep[j] == "0": oracle.x(controls[j]) oracle.mct(controls, target[0], None, mode='noancilla') for j in range(n): if rep[j] == "0": oracle.x(controls[j]) # oracle.barrier() return oracle def make_circuit(n:int,f) -> QuantumCircuit: # circuit begin input_qubit = QuantumRegister(n,"qc") classical = ClassicalRegister(n, "qm") prog = QuantumCircuit(input_qubit, classical) prog.h(input_qubit[3]) # number=16 prog.cz(input_qubit[0],input_qubit[3]) # number=17 prog.h(input_qubit[3]) # number=18 prog.x(input_qubit[3]) # number=14 prog.cx(input_qubit[0],input_qubit[3]) # number=15 prog.h(input_qubit[1]) # number=2 prog.h(input_qubit[2]) # number=3 prog.h(input_qubit[3]) # number=4 prog.y(input_qubit[3]) # number=12 prog.cx(input_qubit[2],input_qubit[3]) # number=22 prog.h(input_qubit[0]) # number=5 oracle = build_oracle(n-1, f) prog.append(oracle.to_gate(),[input_qubit[i] for i in range(n-1)]+[input_qubit[n-1]]) prog.h(input_qubit[1]) # number=6 prog.h(input_qubit[2]) # number=24 prog.cz(input_qubit[3],input_qubit[2]) # number=25 prog.h(input_qubit[2]) # number=26 prog.h(input_qubit[2]) # number=7 prog.h(input_qubit[3]) # number=8 prog.x(input_qubit[2]) # number=23 prog.h(input_qubit[0]) # number=9 prog.y(input_qubit[2]) # number=10 prog.y(input_qubit[2]) # number=11 prog.x(input_qubit[1]) # number=20 prog.cx(input_qubit[0],input_qubit[1]) # number=29 prog.x(input_qubit[1]) # number=30 prog.cx(input_qubit[0],input_qubit[1]) # number=31 prog.x(input_qubit[3]) # number=27 prog.x(input_qubit[3]) # number=28 # circuit end for i in range(n): prog.measure(input_qubit[i], classical[i]) return prog if __name__ == '__main__': a = "111" b = "0" f = lambda rep: bitwise_xor(bitwise_dot(a, rep), b) prog = make_circuit(4,f) backend = FakeVigo() sample_shot =8000 info = execute(prog, backend=backend, shots=sample_shot).result().get_counts() backend = FakeVigo() circuit1 = transpile(prog,backend,optimization_level=2) writefile = open("../data/startQiskit_noisy1996.csv","w") print(info,file=writefile) print("results end", file=writefile) print(circuit1.__len__(),file=writefile) print(circuit1,file=writefile) writefile.close()
33.871795
140
0.651527
[ "BSD-3-Clause" ]
UCLA-SEAL/QDiff
benchmark/startQiskit_noisy1996.py
3,963
Python
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from .data import DataIngestion __all__ = ['DataIngestion']
23.571429
63
0.787879
[ "BSD-3-Clause" ]
4QuantOSS/OpenDIGITS
plugins/data/bAbI/digitsDataPluginBAbI/__init__.py
165
Python
""" Methods for assessing treatment of finite-precision issues """ import os import sys import time import multiprocessing as mp import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.markers as mrk import plotter as ptr import rnn_fxpts as rfx import fxpt_experiments as fe import pickle as pkl def get_relative_errors(test_data_id): """ Compute and save the relative errors of every point found on every network in a testing set. Relative error is defined in (Katz and Reggia 2017). test_data_id should be as in fxpt_experiments.generate_test_data (without file extension). """ network_sizes, num_samples, _ = fe.load_test_data('%s.npz'%test_data_id) for alg in ['traverse','baseline']: for (N, S) in zip(network_sizes, num_samples): for samp in range(S): print('%s, alg %s, N %d,samp %d'%(test_data_id,alg,N,samp)) npz = np.load('results/%s_%s_N_%d_s_%d.npz'%(alg,test_data_id,N,samp)) W = npz['W'] fxV = npz['fxV'] fxV, converged = rfx.refine_fxpts_capped(W, fxV) margin = rfx.estimate_forward_error(W, fxV) f = np.tanh(W.dot(fxV))-fxV re = np.fabs(f/margin) re_fx, re_un = re[:,converged].max(axis=0), re[:,~converged].max(axis=0) re_fx = re_fx[re_fx > 0] f_fx, f_un = np.fabs(f[:,converged]).max(axis=0), np.fabs(f[:,~converged]).max(axis=0) f_fx = f_fx[f_fx > 0] re_npz = {} re_npz['f_fx'] = f_fx re_npz['f_un'] = f_un re_npz['re_fx'] = re_fx re_npz['re_un'] = re_un fe.save_npz_file('results/%s_re_%s_N_%d_s_%d.npz'%(alg,test_data_id,N,samp), **re_npz) def show_traverse_re_fig(test_data_ids, Ns, samp_range): """ Plot relative errors from points found by fiber traversal. test_data_ids and Ns should be length-2 lists. Subplots in the first column will show errors networks of size Ns[0] from test_data_ids[0]. Similarly the second column draws from Ns[1], test_data_ids[1]. Each network sample within samp_range is shown on a separate row. """ log = True mpl.rcParams['mathtext.default'] = 'regular' sp = 1 for samp in samp_range: for (test_data_id,N) in zip(test_data_ids, Ns): print('samp %d, N %d'%(samp,N)) npz = np.load('results/traverse_re_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) m_fx, m_un = npz['re_fx'], npz['re_un'] ax = plt.subplot(len(samp_range),len(Ns),sp) sp += 1 if m_un.shape[0] > 0: plt.hist(np.log2(m_un),bins=30,log=log,facecolor='k') plt.hist(np.log2(m_fx),bins=10,log=log,facecolor='w') lo = 10*(int(np.log2(m_fx).min()/10)-1) if m_un.shape[0] > 0: hi = 10*(int(np.log2(m_un).max()/10)+1) else: hi = 0 plt.xticks(range(-10,1,2),['']+['$2^{%d}$'%yl for yl in range(-8,1,2)]) if N == Ns[0]: plt.ylabel('# of points') if samp == samp_range[0]: ax.set_title('N = %d'%N) if samp == samp_range[-1]: plt.xlabel('Fiber Relative Error') plt.show() def baseline_re_single_analysis(test_data_id, N, samp, cap=10): """ Analyze edge cases of relative errors on a single network Uses the samp^{th} sample network of size N in test data test_data_id. Relative errors in the range (0, 2^{cap}) are considered edge cases. Returns the number of edge cases divided by the difference |T-B| - |B-T| as a percent. T and B are as defined in (Katz and Reggia 2017). """ npz = fe.load_npz_file('results/baseline_re_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) res = fe.load_pkl_file('results/TvB_%s_N_%d_s_%d.pkl'%(test_data_id, N, samp)) re_un = npz['re_un'] percent = 100.*(re_un < 2**cap).sum()/np.array(res['T-B']-res['B-T']) print('N=%d, samp %d: B-T = %d, T-B = %d, %d (%f%%) possibly unique slow RE(B) < 2**%d'%(N, samp, res['B-T'], res['T-B'],(re_un < 2**cap).sum(), percent, cap)) return percent def baseline_re_batch_analysis(test_data_id, Ns, cap=10): """ Runs baseline_re_single_analysis on all networks in test_data_id of size N. cap is as in baseline_re_single_analysis. returns numpy.array percents, where percents[i] is as in baseline_re_single_analysis for the i^{th} sample network. """ percents = [] network_sizes, num_samples, _ = fe.load_test_data('%s.npz'%test_data_id) for (N, S) in zip(network_sizes, num_samples): if N not in Ns: continue for samp in range(S): percents.append(baseline_re_single_analysis(test_data_id,N,samp,cap=cap)) percents = np.array(percents) print('mean %%: %f%%'%percents.mean()) def show_baseline_re_fig(test_data_ids, Ns, samp_range): """ Plot relative errors from points found by the baseline solver. test_data_ids and Ns should be length-2 lists. Subplots in the first column will show errors networks of size Ns[0] from test_data_ids[0]. Similarly the second column draws from Ns[1], test_data_ids[1]. Each network sample within samp_range is shown on a separate row. """ log = True mpl.rcParams['mathtext.default'] = 'regular' sp = 1 for samp in samp_range: for (test_data_id,N) in zip(test_data_ids, Ns): print('samp %d, N %d'%(samp,N)) npz = np.load('results/baseline_re_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) m_fx, m_un = npz['re_fx'], npz['re_un'] ax = plt.subplot(len(samp_range),len(Ns),sp) sp += 1 if m_un.shape[0] > 0: plt.hist(np.log2(m_un),bins=30,log=log,facecolor='k') plt.hist(np.log2(m_fx),bins=10,log=log,facecolor='w') lo, hi = -20,50 plt.xticks(range(lo,hi+1,10),[''] + ['$2^{%d}$'%yl for yl in range(lo+10,hi+1,10)]) if N == Ns[0]: plt.ylabel('# of points') if samp == samp_range[0]: ax.set_title('N = %d'%N) if samp == samp_range[-1]: plt.xlabel('Baseline Relative Error') baseline_re_single_analysis(test_data_id, N, samp) plt.show() def get_baseline_rd(test_data_id,N,samp,cap,logfilename=os.devnull): """ Compute and save relative distances between pairs of points found by the baseline solver. Relative distance is defined in (Katz and Reggia 2017). Computes for the samp^{th} sample network of size N in test_data_id. test_data_id should be as in fxpt_experiments.generate_test_data (without file extension). Only pairs within a random subset of points of size cap are inspected. logfilename is a file name at which progress updates are written. """ logfile = open(logfilename,'w') logfile.write('Running baseline rd (%s,%d,%d)...\n'%(test_data_id,N,samp)) npz = fe.load_npz_file('results/baseline_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) fxV = npz['fxV_converged'] fxV_unique = npz['fxV_unique'] W = npz['W'] if cap is not None and fxV.shape[1] > cap: logfile.write('capping...\n') perm = np.random.permutation(fxV.shape[1]) fxV = fxV[:,perm[:cap]] in_RR, out_RR = [],[] for j in range(fxV_unique.shape[1]): logfile.write('duping %d of %d...\n'%(j,fxV_unique.shape[1])) dups, RR, R = rfx.identical_fixed_points(W, fxV, fxV_unique[:,[j]]) in_RR.append(RR[dups]) out_RR.append(RR[~dups]) in_RR, out_RR = np.concatenate(in_RR), np.concatenate(out_RR) npz["in_RR"], npz["out_RR"] = in_RR, out_RR fe.save_npz_file('results/baseline_rd_%s_N_%d_s_%d.npz'%(test_data_id,N,samp), **npz) logfile.write('Done.\n') logfile.close() print('Done %s %d %d'%(test_data_id,N,samp)) def pool_get_baseline_rd(args): """ Wrapper function passed to multiprocessing.Pool """ get_baseline_rd(*args) def run_baseline_rd(test_data_id, Ns, num_procs): """ Run get_baseline_rd on all networks in test_data_id whose size is in the list Ns. Multiprocessing is used to run on multiple networks in parallel. num_procs is the number of processors to use. """ cpu_count = mp.cpu_count() print('%d cpus, using %d'%(cpu_count, num_procs)) pool_args = [] network_sizes, num_samples, _ = fe.load_test_data('%s.npz'%test_data_id) for (N, S) in zip(network_sizes, num_samples): if N not in Ns: continue cap = 20000 for s in range(S): logfilename = 'logs/baseline_rd_%s_N_%d_s_%d.log'%(test_data_id,N,s) pool_args.append((test_data_id,N,s,cap,logfilename)) start_time = time.time() test_fun = pool_get_baseline_rd if num_procs < 1: # don't multiprocess for args in pool_args: test_fun(args) else: pool = mp.Pool(processes=num_procs) pool.map(test_fun, pool_args) pool.close() pool.join() print('total time: %f'%(time.time()-start_time)) def get_traverse_rd(test_data_id,N,samp,cap,logfilename=os.devnull): """ Compute and save relative distances between pairs of points found by the baseline solver. Relative distance is defined in (Katz and Reggia 2017). Computes for the samp^{th} sample network of size N in test_data_id. test_data_id should be as in fxpt_experiments.generate_test_data (without file extension). Only pairs within a random subset of points of size cap are inspected. logfilename is a file name at which progress updates are written. """ logfile = open(logfilename,'w') logfile.write('Running traverse rd (%s,%d,%d)...\n'%(test_data_id,N,samp)) npz = fe.load_npz_file('results/traverse_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) fxV = npz['fxV_converged'] fxV_unique = npz['fxV_unique'] W = npz['W'] if cap is not None and fxV.shape[1] > cap: logfile.write('capping...\n') perm = np.random.permutation(fxV.shape[1]) fxV = fxV[:,perm[:cap]] in_RR, out_RR = [],[] for j in range(fxV_unique.shape[1]): logfile.write('duping %d of %d...\n'%(j,fxV_unique.shape[1])) dups, RR, R = rfx.identical_fixed_points(W, fxV, fxV_unique[:,[j]]) in_RR.append(RR[dups]) out_RR.append(RR[~dups]) in_RR, out_RR = np.concatenate(in_RR), np.concatenate(out_RR) npz["in_RR"], npz["out_RR"] = in_RR, out_RR fe.save_npz_file('results/traverse_rd_%s_N_%d_s_%d.npz'%(test_data_id,N,samp), **npz) logfile.write('Done.\n') logfile.close() print('Done %s %d %d'%(test_data_id,N,samp)) def pool_get_traverse_rd(args): """ Wrapper function passed to multiprocessing.Pool """ get_traverse_rd(*args) def run_traverse_rd(test_data_id, Ns, num_procs): """ Run get_traverse_rd on all networks in test_data_id whose size is in the list Ns. Multiprocessing is used to run on multiple networks in parallel. num_procs is the number of processors to use. """ cpu_count = mp.cpu_count() print('%d cpus, using %d'%(cpu_count, num_procs)) pool_args = [] network_sizes, num_samples, _ = fe.load_test_data('%s.npz'%test_data_id) for (N,S) in zip(network_sizes, num_samples): if N not in Ns: continue cap = 20000 for s in range(S): logfilename = 'logs/traverse_rd_%s_N_%d_s_%d.log'%(test_data_id,N,s) pool_args.append((test_data_id,N,s,cap,logfilename)) start_time = time.time() test_fun = pool_get_traverse_rd if num_procs < 1: # don't multiprocess for args in pool_args: test_fun(args) else: pool = mp.Pool(processes=num_procs) pool.map(test_fun, pool_args) pool.close() pool.join() print('total time: %f'%(time.time()-start_time)) def get_simple_rd(test_data_id,N,samp,cap,logfilename=os.devnull): """ Use simple unique test: if max absolute coordinate-wise difference < 2**-32 Compute and save distances between pairs of points found by both solvers. Computes for the samp^{th} sample network of size N in test_data_id. test_data_id should be as in fxpt_experiments.generate_test_data (without file extension). Only pairs within a random subset of points of size cap are inspected. Saves pair-wise distance distribution in histogram with one bucket per integer power of 2 logfilename is a file name at which progress updates are written. """ logfile = open(logfilename,'w') rfx.hardwrite(logfile,'Running simple rd (%s,%d,%d)...\n'%(test_data_id,N,samp)) buckets = {} bins = np.arange(-1025,3) for method_key in ['traverse','baseline']: npz = fe.load_npz_file('results/%s_%s_N_%d_s_%d.npz'%(method_key,test_data_id,N,samp)) fxV = npz['fxV_converged'] buckets[method_key] = np.zeros(len(bins)-1) if cap is not None and fxV.shape[1] > cap: rfx.hardwrite(logfile,'capping...\n') perm = np.random.permutation(fxV.shape[1]) fxV = fxV[:,perm[:cap]] for j in range(fxV.shape[1]): rfx.hardwrite(logfile,'disting %d of %d...\n'%(j,fxV.shape[1])) dists = np.fabs(fxV-fxV[:,[j]]).max(axis=0) dists[dists == 0] = 2.0**bins[0] logdists = np.log2(dists) logdists[logdists < bins[0]] = bins[0] logdists[logdists > bins[-1]] = bins[-1] hist,_ = np.histogram(logdists,bins=bins) buckets[method_key] += hist npz = {'bins':bins,'traverse_buckets':buckets['traverse'],'baseline_buckets':buckets['baseline']} fe.save_npz_file('results/simple_rd_%s_N_%d_s_%d.npz'%(test_data_id,N,samp), **npz) rfx.hardwrite(logfile,'Done.\n') logfile.close() print('Done %s %d %d'%(test_data_id,N,samp)) def pool_get_simple_rd(args): """ Wrapper function passed to multiprocessing.Pool """ get_simple_rd(*args) def run_simple_rd(test_data_id, Ns, num_procs): """ Run get_simple_rd on all networks in test_data_id whose size is in the list Ns. Multiprocessing is used to run on multiple networks in parallel. num_procs is the number of processors to use. """ cpu_count = mp.cpu_count() print('%d cpus, using %d'%(cpu_count, num_procs)) pool_args = [] network_sizes, num_samples, _ = fe.load_test_data('%s.npz'%test_data_id) for (N,S) in zip(network_sizes, num_samples): if N not in Ns: continue cap = 1000 for s in range(S): logfilename = 'logs/simple_rd_%s_N_%d_s_%d.log'%(test_data_id,N,s) pool_args.append((test_data_id,N,s,cap,logfilename)) start_time = time.time() test_fun = pool_get_simple_rd if num_procs < 1: # don't multiprocess for args in pool_args: test_fun(args) else: pool = mp.Pool(processes=num_procs) pool.map(test_fun, pool_args) pool.close() pool.join() print('total time: %f'%(time.time()-start_time)) def show_traverse_rd_fig(test_data_ids, Ns, samp_range): """ Plot relative distances from points found by fiber traversal. test_ids, Ns, and samp_range should be as in show_traverse_re_fig. """ log = True mpl.rcParams['mathtext.default'] = 'regular' sp = 1 for samp in samp_range: for (test_data_id,N) in zip(test_data_ids, Ns): print('samp %d, N %d'%(samp,N)) npz = np.load('results/traverse_rd_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) in_rr, out_rr = npz['in_RR'], npz['out_RR'] if (in_rr > 0).any(): in_rr[in_rr == 0] = in_rr[in_rr > 0].min() else: in_rr[in_rr == 0] = 2**(-30) ax = plt.subplot(len(samp_range),len(Ns),sp) sp += 1 if out_rr.shape[0] > 0: plt.hist(np.log2(out_rr),bins=30,log=log,facecolor='k') plt.hist(np.log2(in_rr),bins=10,log=log,facecolor='w') if N == Ns[0]: plt.ylabel('# of pairs') if samp == samp_range[0]: ax.set_title('N = %d'%N) if samp == samp_range[-1]: plt.xlabel('Fiber Relative Distance') plt.xlim([-30,50]) plt.xticks(range(-30,51,10),['']+['$2^{%d}$'%xl for xl in range(-20,51,10)]) plt.show() def show_baseline_rd_fig(test_data_ids, Ns, samp_range): """ Plot relative distances from points found by the baseline solver. test_ids, Ns, and samp_range should be as in show_baseline_re_fig. """ log = True mpl.rcParams['mathtext.default'] = 'regular' sp = 1 for samp in samp_range: for (test_data_id,N) in zip(test_data_ids, Ns): print('samp %d, N %d'%(samp,N)) npz = np.load('results/baseline_rd_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) in_rr, out_rr = npz['in_RR'], npz['out_RR'] if (in_rr > 0).any(): in_rr[in_rr == 0] = in_rr[in_rr > 0].min() else: in_rr[in_rr == 0] = 2**(-30) ax = plt.subplot(len(samp_range),len(Ns),sp) sp += 1 if np.isinf(out_rr).any(): if np.isinf(out_rr).all(): out_rr[:] = 4*in_rr.max() else: out_rr[np.isinf(out_rr)] = 4*out_rr[~np.isinf(out_rr)].max() print('out_rr:') print(out_rr.shape) print((out_rr==0).sum()) print(np.isinf(in_rr).sum()) print(np.isinf(out_rr).sum()) print(np.isnan(out_rr).sum()) if out_rr.shape[0] > 0: plt.hist(np.log2(out_rr),bins=30,log=log,facecolor='k') # if out_rr.shape[0] > 0: plt.hist(out_rr,bins=30,facecolor='k') plt.hist(np.log2(in_rr),bins=10,log=log,facecolor='w') # plt.hist(in_rr,bins=10,facecolor='w') if N == Ns[0]: plt.ylabel('# of pairs') if samp == samp_range[0]: ax.set_title('N = %d'%N) if samp == samp_range[-1]: plt.xlabel('Baseline Relative Distance') plt.xlim([-30,50]) plt.xticks(range(-30,51,10),['']+['$2^{%d}$'%xl for xl in range(-20,51,10)]) plt.show() def show_simple_rd_all_fig(test_data_ids, Ns, samp_range): """ Plot relative distances from points found by fiber traversal or baseline. test_ids, Ns, and samp_range should be as in show_traverse_re_fig. """ log = True mpl.rcParams['mathtext.default'] = 'regular' mpl.rcParams['pdf.fonttype'] = 42 mpl.rcParams['ps.fonttype'] = 42 buckets = None bins = None for samp in samp_range: for (test_data_id,N) in zip(test_data_ids, Ns): print('samp %d, N %d'%(samp,N)) npz = np.load('results/simple_rd_%s_N_%d_s_%d.npz'%(test_data_id,N,samp)) if buckets is None: buckets = np.zeros(npz['traverse_buckets'].shape) bins = npz['bins'] buckets += npz['traverse_buckets'] buckets += npz['baseline_buckets'] plt.figure(figsize=(8,2.4)) # plt.hist(buckets,bins=bins,log=log) if log: buckets[buckets > 0] = np.log2(buckets[buckets > 0]) plt.bar(left=bins[:-1],height=buckets,width=bins[1:]-bins[:-1],facecolor='none') plt.ylabel('# of pairs') plt.xlabel('$max_i|v_i^{(1)}-v_i^{(2)}|$') #'Max Coordinate-wise Distance') xmin_idx = int(((bins[:-1] > -1000) & (buckets > 0)).argmax()) xstep = int(np.ceil((bins[-1]-bins[xmin_idx])/10)) plt.xticks(bins[xmin_idx::xstep],['$2^{%d}$'%xl for xl in bins[xmin_idx::xstep]]) plt.xlim([bins[xmin_idx]-xstep,bins[-1]+xstep]) if log: ymax = np.ceil(buckets.max())+1 ystep = np.ceil(ymax/5) plt.yticks(np.arange(0,ymax+ystep,ystep),['$2^{%d}$'%yl for yl in np.arange(0,ymax+ystep,ystep)]) plt.ylim([0,ymax+1]) plt.tight_layout() plt.show()
44.088496
163
0.616118
[ "MIT" ]
garrettkatz/rnn-fxpts
roundoff.py
19,928
Python
import pytest from selenium import webdriver from model.application import Application def pytest_addoption(parser): parser.addoption("--browser", action="store", default="firefox", help="browser type") parser.addoption("--base_url", action="store", default="http://localhost:9080/php4dvd/", help="base URL") @pytest.fixture(scope="session") def browser_type(request): return request.config.getoption("--browser") @pytest.fixture(scope="session") def base_url(request): return request.config.getoption("--base_url") @pytest.fixture(scope="session") def app(request, browser_type, base_url): if browser_type == "firefox": driver = webdriver.Firefox() elif browser_type == "chrome": driver = webdriver.Chrome() elif browser_type == "ie": driver = webdriver.Ie() #driver.implicitly_wait(30) request.addfinalizer(driver.quit) #close brawser return Application(driver, base_url)
30.548387
109
0.711721
[ "Apache-2.0" ]
sargm/selenium-py-traning-barancev
php4dvd/conftest.py
947
Python
# name : Shoby Gnanasekaran # net id: shoby from dungeonchar import DungeonCharacter from healable import Healable from hero import Hero class Priestess(Hero, Healable): """ Priestess is a hero with it own statistics. The basic behaviour is same as the hero. Special ability is to heal everytime after taking damage """ def __init__(self, name, model, **kwargs): super().__init__(name = name, model = model, **kwargs) super(DungeonCharacter, self).__init__(**kwargs) def take_damage(self, dmg, source): """ after taking damage, if the priestess is not dead, it heals itself""" hp_before_attack = self.hp super().take_damage(dmg, source) if self._is_alive and hp_before_attack > self.hp and source != "pit": heal_message = self.heal_itself() self.model.announce(f"{self.name}: {heal_message}")
35.52
92
0.679054
[ "MIT" ]
nvanbaak/dungeon-adventure-2
priestess.py
888
Python
from django.contrib import admin from claims import models # Register your models here. admin.site.register(models.AddressCountry) admin.site.register(models.AddressRegion) admin.site.register(models.AddressCity) admin.site.register(models.ProjectStatus)
28.444444
42
0.839844
[ "Apache-2.0" ]
joinrpg/joinrpg
claims/admin.py
256
Python
api_key = '' seceret_key = '' passphrase = ''
11.5
16
0.608696
[ "Apache-2.0" ]
dy618i5ECC/cryptoquant
cryptoquant/api/okex/config.py
46
Python
#!/usr/bin/env python # Copyright (c) 2021 IBM Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import sys import argparse import rosbag def main(): parser = argparse.ArgumentParser() parser.add_argument("-i","--input_bag", required=True) args = parser.parse_args() input_bag = args.input_bag topic_size_dict = {} for topic, msg, time in rosbag.Bag(input_bag, 'r').read_messages(raw=True): topic_size_dict[topic] = topic_size_dict.get(topic, 0) + len(msg[1]) topic_size = list(topic_size_dict.items()) topic_size.sort(key=lambda x: x[1]) print("topic", "size [GB]") for topic, size in topic_size: size_gb = size/(1024.0**3) print(topic, size_gb) if __name__ == "__main__": main()
37.847826
80
0.746123
[ "MIT" ]
CMU-cabot/cabot
mf_localization_mapping/script/check_topic_size.py
1,741
Python
import pymysql class SQLHold(): def __init__(self, host: str, user: str, password: str, database: str, port=3306): self.db = pymysql.connect(host=host, user=user, port=port, database=database, password=password) self.cursor = self.db.cursor() def execute_command(self, command: str): self.cursor.execute(command) self.cursor.connection.commit() def fetchall(self): result = self.cursor.fetchall() return result def close(self): self.cursor.close() self.db.close()
27.45
104
0.642987
[ "MIT" ]
kalenforn/video-context-analyze
Server/videoProcessServer/mysqlTools.py
549
Python