Beispiel #1
0
    def __init__(self, lie_type, rank):
        self.lie_type = lie_type
        self.rank = rank
        self.label = self.lie_type + str(self.rank)

        self.rootsystem = rs.RootSystem(self)
        self.dim = self.rootsystem.nr_roots + self.rank

        self.weyl = wg.Weyl(self)
        self.parabolics = pa.Parabolics(self)
        self.constants = cs.Constants(self)
        nr = self.rootsystem.nr_roots
        self.var = vr.Variables(2 * nr, 2 * nr, 2 * self.rank)
        self.group = gr.Group(self)
        self.lie = la.LieAlgebra(self)
        self.ad_action = ad.AdAction(self)

        self.bruhat = br.Bruhat(self)
        self.deodhar = dr.Deodhar(self)
        if self.label == "a2":
            self.curtis = CurtisA2(self)
        if self.label == "b2":
            self.curtis = CurtisB2(self)
        if self.label == "g2":
            self.curtis = CurtisG2(self)
Beispiel #2
0
    def __init__(self):
        self.world = []
        self.constants = constants.Constants()
        self.ball = pygame.image.load(
            os.path.join(self.constants.assets_dir, "ball.gif"))

        for i in range(0, 2):
            b = Ball(self.ball, (1, 1))
            self.world.append(b)

        print("GameWorld: initialized")
class PointMoverCmd:
    '''
    The class that the user interacts with to set up the matrix dimensions,
    starting position of the pointer and the list of actions that the pointer
    will take.

    Attributes:
    -----------
    vi : object
        validate_input class object for ensuring user input is correct.

    cc : object
        constants class object to give user generic messages containing
        instructions.

    dim : list
        [x,y] defining shape of the matrix split from position

    pos : list
        [x,y] defining the starting position of the pointer split from matrix

    actions : list
        validated list of actions to be sent to sent to the data model for
        moving the pointer around.

    view_mod : object
        class object of the view_model that sets up the pointer and matrix

    results , message : list, str
        the result of the pointer's final position and corresponding message to
        be sent back to the user.


    Methods:
    --------

    None
    '''
    vi = validate_input.ValidateInput()
    cc = constants.Constants()

    cc.start_message()
    dim, pos = vi.split_input(
        vi.check_dimension_position(sys.stdin.readline().rstrip()))
    cc.action_list_message()
    actions = vi.contains_zero(vi.check_operation_list())
    view_mod = view_model.ViewModel(dim, pos)
    result, message = view_mod(actions)

    sys.stdout.write(message.format(result))
Beispiel #4
0
import logging
import os
import webapp2
# Import app modules
from configuration import const as conf
import constants
import httpServer
import linkKey
import proposal
import reason
import reasonVote
import requestForProposals
import text
import user

const = constants.Constants()
const.INITIAL_MAX_PROPOSALS = 10


class GetRequestData(webapp2.RequestHandler):
    def get(self, linkKeyStr):
        logging.debug('linkKeyStr=' + linkKeyStr)

        # Collect inputs
        cursor = self.request.get('cursor', None)
        cursor = Cursor(urlsafe=cursor) if cursor else None
        getReasons = (self.request.get('getReasons', 'true') == 'true')
        logging.debug('getReasons=' + str(getReasons))

        httpRequestId = os.environ.get(conf.REQUEST_LOG_ID)
        responseData = {'success': False, 'httpRequestId': httpRequestId}
client.on_connect = on_connect
client.on_disconnect = on_disconnect
client.on_message = on_message
print("Connecting to broker ", broker)

client.connect(broker)  #connect to broker
client.loop_start()  #start loop
###### END MQTT ######

_starting_time = datetime.datetime.now().timestamp() + 3600
my_ts = Timestamp.MyTimestamp(_starting_time)
print(my_ts.getFullTs())

my_db = mongodb.MyDB("bin_simulation", _starting_time)
my_const = c.Constants(my_db)
my_func = f.Functions(my_const, my_db)

###### START PROGRAM ######
bins = {}
littering = 0


def throwOut_trash(my_bins, the_bin, my_current, w_type, nearest=1):
    nearest += 1
    if ((my_current + my_bins[the_bin]['levels'][w_type]) <=
            my_bins[the_bin]['total_height']):
        my_bins[the_bin]['levels'][waste_type] += current
    else:
        print(my_bins[the_bin]["bin_id"], ": ", waste_type, "full")
        new_bin = my_func.calculateNeighbours(my_bins[key], nearest)
Beispiel #6
0
import os
import sys
import traceback

import discord
from discord.ext import commands

import constants
import database

initial_modules = ['modules.simple', 'modules.osu']

constants = constants.Constants()
database = database.Database(constants.DATABASE)
client = commands.Bot(command_prefix=constants.PREFIX)
client.database = database

if __name__ == '__main__':
    for module in initial_modules:
        try:
            client.load_extension(module)
            print("Loaded {}".format(module))
        except Exception as e:
            print("Failed to load module {}".format(module))
            traceback.print_exc()


def restart_program():
    """Restarts the current program.
    Note: this function does not return. Any cleanup action (like
    saving data) must be done before calling this function."""
Beispiel #7
0
 def __init__(self):
     self._constants = constants.Constants()