Exemplo n.º 1
0
class OutputWorkbook:
    CONTRACT_SHEET = u"合同"
    INVOICE_SHEET = u"箱单发票"
    DETAILS_SHEET = u"出仓明细"
    def __init__(self,template, **kwargs):
        self.template = template
        #self.dest = dest
        
        self.wb = load_workbook(template)
        
        self.contract = Contract(self.wb.get_sheet_by_name(self.CONTRACT_SHEET))
        self.invoice = Invoice(self.wb.get_sheet_by_name(self.INVOICE_SHEET))
        self.details = Details(self.wb.get_sheet_by_name(self.DETAILS_SHEET))
        
    def get_contract_sheet(self):
        return self.contract
    def get_invoice_sheet(self):
        return self.invoice
    def get_detail_sheet(self):
        return self.details
        
    def save(self,dest=None):
        if dest is None:
            dest = self.template
        
        self.contract.fix_borders()
        self.details.fix_borders()
        #save here
        self.contract.remove_empty_rows()
        self.invoice.remove_empty_rows()
        self.details.remove_empty_rows()
        
        self.wb.save(dest)
Exemplo n.º 2
0
    def test_find_contact_by_username(self):

        self.bb.save_details()
        test_details = Details("Naff", "12345678")
        test_details.save_details()
        found_details = Details.find_by_username("Naf")
        self.assertEqual(found_details.username, test_details.username)
Exemplo n.º 3
0
    def test_delete_details(self):

        self.bb.save_details()
        test_details = Details("Naf", "12345678")
        test_details.save_details()

        self.bb.delete_details()
        self.assertEqual(len(Details.details_list), 1)
Exemplo n.º 4
0
def details_items(data):
    from details import Details
    for each_stream in re.findall('<div class="stream-box\s*"(.*?)</div>',
                                  data, re.DOTALL):
        items.add_item(Details(html_unescape(each_stream)).item)
    for each_highlight in re.findall('<div class="highlight\s*(.*?)</div>',
                                     data, re.DOTALL):
        items.add_item(Details(html_unescape(each_highlight)).item)
    items.list_items()
Exemplo n.º 5
0
    def __init__(self, template, **kwargs):
        self.template = template
        #self.dest = dest

        self.wb = load_workbook(template)

        self.contract = Contract(self.wb.get_sheet_by_name(
            self.CONTRACT_SHEET))
        self.invoice = Invoice(self.wb.get_sheet_by_name(self.INVOICE_SHEET))
        self.details = Details(self.wb.get_sheet_by_name(self.DETAILS_SHEET))
Exemplo n.º 6
0
class TestDetails(unittest.TestCase):
    def setUp(self):

        self.bb = Details("Naff", "12345678")

    def test_init(self):

        self.assertEqual(self.bb.username, "Naff")
        self.assertEqual(self.bb.password, "12345678")

    def test_save_details(self):

        self.bb.save_details()
        self.assertEqual(len(Details.details_list), 1)

    def test_find_contact_by_username(self):

        self.bb.save_details()
        test_details = Details("Naff", "12345678")
        test_details.save_details()
        found_details = Details.find_by_username("Naf")
        self.assertEqual(found_details.username, test_details.username)

    def test_delete_details(self):

        self.bb.save_details()
        test_details = Details("Naf", "12345678")
        test_details.save_details()

        self.bb.delete_details()
        self.assertEqual(len(Details.details_list), 1)

    def test_display_all_details(self):

        self.assertEqual(Details.display_details(), Details.details_list)
Exemplo n.º 7
0
    def __init__(self, filename, **kwargs):
        self.filename = filename
        self.wb = load_workbook(filename)

        self.contract = Contract(self.wb.get_sheet_by_name(self.CONTRACT))
        self.invoice = Invoice(self.wb.get_sheet_by_name(self.INVOICE))
        self.details = Details(self.wb.get_sheet_by_name(self.DETAILS))
Exemplo n.º 8
0
 def __init__(self,template, **kwargs):
     self.template = template
     #self.dest = dest
     
     self.wb = load_workbook(template)
     
     self.contract = Contract(self.wb.get_sheet_by_name(self.CONTRACT_SHEET))
     self.invoice = Invoice(self.wb.get_sheet_by_name(self.INVOICE_SHEET))
     self.details = Details(self.wb.get_sheet_by_name(self.DETAILS_SHEET))
Exemplo n.º 9
0
    def get(self):
        # Instantiate the details class, contains the html.
        details = Details()

        # Instantiate the Lion subclass
        lion = Lion()
        # Assign information to attributes passed down from Lion's superclass Animal
        lion.name = 'Lion'
        lion.phylum = 'Chordata'
        lion.animal_class = 'Mammalia'
        lion.order = 'Carnivora'
        lion.family = 'Felidea'
        lion.genus = 'Panthera'
        lion.image = 'https://upload.wikimedia.org/wikipedia/commons/7/73/Lion_waiting_in_Namibia.jpg'
        lion.lifespan = '15'
        lion.habitat = 'Tropical'
        lion.geolocation = 'Sub-Saharan Africa'
        lion.sound = 'Rawr'

        # Instantiate the Kangaroo subclass
        kangaroo = Kangaroo()
        # Assign information to attributes passed down from Kangaroo's superclass Animal
        kangaroo.name = 'Kangaroo'
        kangaroo.phylum = 'Chordata'
        kangaroo.animal_class = 'Mammalia'
        kangaroo.order = 'Diprotodontia'
        kangaroo.family = 'Macropodidae'
        kangaroo.genus = 'Macropus'
        kangaroo.image = 'https://upload.wikimedia.org/wikipedia/commons/5/5d/RedRoo.JPG'
        kangaroo.lifespan = '15'
        kangaroo.habitat = 'Forest'
        kangaroo.geolocation = 'Southern Australia'
        kangaroo.sound = 'Tut-tut'

        # Instantiate the PatasMonkey subclass
        monkey = PatasMonkey()
        monkey.name = 'Patas Monkey'
        monkey.phylum = 'Chordata'
        monkey.animal_class = 'Mammalia'
        monkey.order = 'Primates'
        monkey.family = 'Cercopithecidae'
        monkey.genus = 'Erythrocebus'
        monkey.image = 'https://upload.wikimedia.org/wikipedia/commons/4/4a/Patas_Monkey_Jr.jpg'
        monkey.lifespan = '15'
        monkey.habitat = 'Grassland'
        monkey.geolocation = 'Ethiopia'
        monkey.sound = 'Ohh-ee'

        # Array to populate animal information
        animals = [lion, kangaroo, monkey]
        self.response.write(details.header + details.body + details.footer)
        if self.request.GET:
            animal = (int(self.request.GET['animal'])) - 1
            self.response.write(self.html(animals[animal]))
Exemplo n.º 10
0
class OutputWorkbook:
    CONTRACT_SHEET = u"合同"
    INVOICE_SHEET = u"箱单发票"
    DETAILS_SHEET = u"出仓明细"

    def __init__(self, template, **kwargs):
        self.template = template
        #self.dest = dest

        self.wb = load_workbook(template)

        self.contract = Contract(self.wb.get_sheet_by_name(
            self.CONTRACT_SHEET))
        self.invoice = Invoice(self.wb.get_sheet_by_name(self.INVOICE_SHEET))
        self.details = Details(self.wb.get_sheet_by_name(self.DETAILS_SHEET))

    def get_contract_sheet(self):
        return self.contract

    def get_invoice_sheet(self):
        return self.invoice

    def get_detail_sheet(self):
        return self.details

    def save(self, dest=None):
        if dest is None:
            dest = self.template

        self.contract.fix_borders()
        self.details.fix_borders()
        #save here
        self.contract.remove_empty_rows()
        self.invoice.remove_empty_rows()
        self.details.remove_empty_rows()

        self.wb.save(dest)
Exemplo n.º 11
0
def get_all_details():
    try:
        if request.method == "POST":
            jwt_token = request.headers["token"]
            driver_number = request.headers["number"]
            stat, tok = Authorize.verify_jwt(driver_number, jwt_token)
            if stat == 0:
                raise ValueError("Not authorized")

            logging.debug("incoming POST request: " + str(request.form))
            response = Details.get_all(driver_number)
            logging.debug("getalldetails returned:\n" + str(response))
            return response
    except RuntimeError as e:
        logging.critical("failure in v1/getalldetails with error: " + str(e))
        return default_error
Exemplo n.º 12
0
    def get_details(self) -> Details:
        """
        Gathering the details from the bot

        throws TokenIsInvalidException if the token is not set yet

        returns a Details object with the information's
        """

        if not self.token:
            logging.error(
                "Hey there, it's me, the logger, just want to say, your token isn't set yet!"
            )
            raise TokenIsInvalidException("There's no token")

        url = BASE_URL + "/details/test.php?token=" + self.token
        res = requests.get(url=url)
        data = res.json()

        logging.info("Successfully gathered details about your bot")

        return Details(data)
Exemplo n.º 13
0
def show_details(database_name,image_name):
	details = Details()
	res_list = details.get_details(database_name,image_name)
	return render_template('details.html',res_list=res_list)
Exemplo n.º 14
0
    def show_details(self):
        selected_item = self.listBox.curselection()
        person = self.listBox.get(selected_item)
        person_id = person.split(".")[0]

        details_page = Details(person_id)
Exemplo n.º 15
0
def display_account(sitename):

        return Details.display_account(sitename)
Exemplo n.º 16
0
def details_found(sitename):

    return Details.details_found(sitename)
Exemplo n.º 17
0
def create_details(sitename, username, password):

    new_bb = Details(sitename,username, password)
    return new_bb
Exemplo n.º 18
0
    def test_display_all_details(self):

        self.assertEqual(Details.display_details(), Details.details_list)
Exemplo n.º 19
0
def eight_char_password(Details):

	return Details.eight_char_password(Details)
Exemplo n.º 20
0
def verify_user(username, password):

	checking_user = Details.check_user(username, password)
	return checking_user
Exemplo n.º 21
0
def delete_details(Details):

    Details.del_details()
Exemplo n.º 22
0
 def click_continue(self):
     self.selenium.find_element(*self._continue_locator).click()
     from details import Details
     return Details(self.base_url, self.selenium)
Exemplo n.º 23
0
 def build(self):
     manager = ScreenManager()
     manager.add_widget(MyRoot(name='Login'))
     manager.add_widget(Accounts(name='Accounts'))
     manager.add_widget(Details(name='Details'))
     return manager
Exemplo n.º 24
0
    def setUp(self):

        self.bb = Details("Naff", "12345678")
Exemplo n.º 25
0
def runGame():
    pygame.init()
    settings = Settings()
    screen = pygame.display.set_mode(
        (settings.screenWidth, settings.screenHeight))
    pygame.display.set_caption("PacMan")
    mainMenu = Menu(screen, settings)
    play = Play(screen, settings)
    gameStats = GameStats()
    map = BuildMap(screen, settings)
    details = Details(screen, settings)
    blocks = Group()
    dots = Group()
    ghosts = []
    for i in range(4):
        new = Ghost(screen, settings)
        new.type = i
        new.x += 30 * i
        new.prep()
        ghosts.append(new)
    fruit = Fruit(screen, settings)
    powerPills = Group()
    player = Player(screen, settings)
    map.makeMap(blocks, dots, powerPills)
    pygame.mixer.init()

    while True:
        screen.fill((50, 20, 20))
        map.drawMap(blocks, dots, powerPills)

        details.blit()
        gf.checkEvents(player, gameStats, play)
        if gameStats.gameActive:
            if gameStats.pause == False:
                if player.movementRight or player.movementLeft or player.movementUp or player.movementDown:
                    pygame.mixer.music.load('sound/dotSound.mp3')
                    pygame.mixer.music.play(0, .052)
                player.update()
                player.blit()
                for i in range(4):
                    ghosts[i].update(gameStats)
                    ghosts[i].blit()
                    gf.checkScreenLimits(ghosts[i])
                gf.checkScreenLimits(player)
            details.prep(gameStats)
            fruit.blit(gameStats)
            gf.spawnFruit(gameStats, fruit)
            gf.ghostCollide(ghosts[0], blocks)
            gf.ghostCollide(ghosts[2], blocks)
            gf.fruitCollide(player, fruit, gameStats)
            gf.addDiff(ghosts[2], gameStats)
            gf.wallCollide(player, blocks)
            gf.dotCollide(player, dots, gameStats)
            gf.pillCollide(player, powerPills, gameStats)
            for ghost in ghosts:
                gf.playerGhostCollide(player, ghost, gameStats, mainMenu)
            gf.roundEnd(gameStats, player, ghosts, dots, powerPills, map)
        else:
            mainMenu.checkShowHS(gameStats.showHS)
            mainMenu.update()
            mainMenu.blit()
            play.blit()

        pygame.display.flip()
Exemplo n.º 26
0
from person import Person
from virus import Virus
from display import Display
from details import Details
from population import Population

import random

num_people_1d = 10

simul_details = Details(num_people_1d=num_people_1d, fig_size=(1, 1))
virus_strain1 = Virus()
pop = Population(details_instance=simul_details, virus_strain=virus_strain1)

number_people = num_people_1d**2 - 1
for i in range(number_people):
    pop.add_person()
pop.add_neighbors()
starting_person = random.randint(0, number_people - 1)
print('The starting person is %d' % starting_person)

pop.persons[starting_person].become_infected(virus_strain1)
current_infected = pop.get_infected_table()
current_dead = pop.get_dead_table()

simul_display = Display(details_instance=simul_details)
simul_display.create_plot()

total = 100
for iter in range(total):
    infected_people = pop.get_infected_count()
Exemplo n.º 27
0
def save_details(Details):
    '''
    Function to save credentials
    '''
    Details.save_details() 
Exemplo n.º 28
0
 def details(self, widget):
     Details(self.selected_combo_name)
Exemplo n.º 29
0
def eleven_char_password(Details):

    return Details.eleven_char_password(Details)