def stats(name, region): newReg = inv_regionMappings[region] print name, newReg obj = DataStore('43e873ea-c59b-4e3c-95dd-82ac46f093e2', name, newReg) print obj ID = obj.getPlayerID() print ID global var var = Interpreter(ID) o = var.getOverview() s = var.getSpecificMatchData([]) #print json.dumps(var.getOverview(), indent=4) #print var.getSpecificMatchData([1749310367, 1749340557]) return render_template('stats.html', playername=name, region=region, jsonData=o, matchData=s)
def setUp(self): super(GameNoInitTestCase, self).setUp() self._ds = DataStore(db_name='project200-unittest') self._user_generator = (User.new(None, 'user' + str(x), '*****@*****.**', 'pw', self._ds) for x in xrange(1, 999)) self._creator = self._user_generator.next()
def DisplayName(self): """ Retrieve the display name for the data backing this subplot. @rtype: string @return: A string representing the name of the file for the data backing this subplot. """ return DataStore.getData()[self.dataIndex].displayname
def Labels(self): """ Retrieve the column labels for the data backing this subplot. @rtype: list @return: A list of strings representing the column names for the data backing this subplot. """ return DataStore.getData()[self.dataIndex].labels
def getClustering(self): """ Retrieve the clustering specified for this subplot. @rtype: list @return: A list where each element indicates the cluster membership of the corresponding index in the original data """ return DataStore.getData()[self.dataIndex].clustering[self.clustIndex]
def getData(self): """ Retrieve the data backing this subplot. @rtype: numpy array @return: An array containing the original data backing this subplot. """ data = DataStore.getData() facs = data[self.dataIndex] return facs.data
def deleteAssociatedSubplots(self, ids): """ Delete any subplots associated with the specified data or clustering ids @type ids: tuple @param ids: A tuple containing either a data ID and a clustering ID or a data ID and None. """ all, figPlots = [ids[0]], {None: self.subplots} if ids[1] is None: DataStore.get(ids[0]).collectAllChildren(all) # add subplot lists from figures in the store for fID, fig in FigureStore.getFigures().items(): if fID != FigureStore.getSelectedIndex(): figPlots[fID] = fig.subplots # remove matching subplots from all figures for fID, plots in figPlots.items(): toDelete = [] for n, subplot in enumerate(plots): if subplot.dataIndex in all: if ids[1] is None: toDelete.append(n) else: if subplot.clustIndex == ids[1]: toDelete.append(n) # delete flagged subplots by creating a new list w/o the deleted indices plots = [plots[i] for i in range(len(plots)) if not (i in toDelete)] if fID is None: self.subplots = plots else: FigureStore.get(fID).subplots = plots self.renumberPlots(fID) self.draw()
def __init__(self, directory=None, filename=None): super(WriterCsv, self).__init__(directory, filename) self.initParams = DataStore.instance().query('INIT_PARAMS')
def __init__(self, root): """ Virtually private constructor. """ Starter.inst = self self.onInit(root) self.initStore = InitStore.instance() self.dataStore = DataStore.instance()
class Database(object): """An in-memory database similar to Redis that supports database transactions. """ # COMMANDS: The supported commands for this database COMMANDS = ['SET', 'GET', 'UNSET', 'NUMEQUALTO', 'BEGIN', 'ROLLBACK', 'COMMIT', 'END'] def __init__(self): self._store = DataStore() def execute(self, raw_cmd): """Parse and execute a raw string command. """ tokens = raw_cmd.strip().split() cmd = tokens[0] args = tokens[1:] if cmd.upper() not in Database.COMMANDS: raise LookupError("The inputted command is not supported.") # Get Database method associated with inputted command cmd_method = getattr(self, cmd.lower()) # Get the number of arguments of the method without "self" method_arg_count = cmd_method.__code__.co_argcount - 1 if len(args) != method_arg_count: raise TypeError("Wrong number of arguments for the command %s." % cmd) return cmd_method(*args) def set(self, name, value): """Command: SET [name] [value]""" self._store.set(name, value) def get(self, name): """Command: GET [name]""" value = self._store.get(name) return value if value else "NULL" def unset(self, name): """Command: UNSET [name]""" self._store.unset(name) def numequalto(self, value): """Command: NUMEQUALTO [value]""" return self._store.numequalto(value) def begin(self): """Command: BEGIN""" self._store.begin() def rollback(self): """Command: ROLLBACK""" if not self._store.in_transaction(): return "NO TRANSACTION" self._store.rollback() def commit(self): """Command: COMMIT""" if not self._store.in_transaction(): return "NO TRANSACTION" self._store.commit() def end(self): """Command: END""" sys.exit()
def __init__(self): self._store = DataStore()
class Database(object): """An in-memory database similar to Redis that supports database transactions. """ # COMMANDS: The supported commands for this database COMMANDS = [ 'SET', 'GET', 'UNSET', 'NUMEQUALTO', 'BEGIN', 'ROLLBACK', 'COMMIT', 'END' ] def __init__(self): self._store = DataStore() def execute(self, raw_cmd): """Parse and execute a raw string command. """ tokens = raw_cmd.strip().split() cmd = tokens[0] args = tokens[1:] if cmd.upper() not in Database.COMMANDS: raise LookupError("The inputted command is not supported.") # Get Database method associated with inputted command cmd_method = getattr(self, cmd.lower()) # Get the number of arguments of the method without "self" method_arg_count = cmd_method.__code__.co_argcount - 1 if len(args) != method_arg_count: raise TypeError("Wrong number of arguments for the command %s." % cmd) return cmd_method(*args) def set(self, name, value): """Command: SET [name] [value]""" self._store.set(name, value) def get(self, name): """Command: GET [name]""" value = self._store.get(name) return value if value else "NULL" def unset(self, name): """Command: UNSET [name]""" self._store.unset(name) def numequalto(self, value): """Command: NUMEQUALTO [value]""" return self._store.numequalto(value) def begin(self): """Command: BEGIN""" self._store.begin() def rollback(self): """Command: ROLLBACK""" if not self._store.in_transaction(): return "NO TRANSACTION" self._store.rollback() def commit(self): """Command: COMMIT""" if not self._store.in_transaction(): return "NO TRANSACTION" self._store.commit() def end(self): """Command: END""" sys.exit()