This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cmd | |
| from pprint import pprint | |
| class Calculator(cmd.Cmd): | |
| def get_floats(self, line, number = None): | |
| ''' get number of floats from line | |
| if number is None, don't worry about the number returned | |
| if cannot float anything in the line it prints help and raises |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import datetime | |
| import os | |
| import csv | |
| import re | |
| import logging | |
| from pprint import pprint | |
| from collections import namedtuple, defaultdict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| import json | |
| import time | |
| from pprint import pprint | |
| from collections import defaultdict, namedtuple | |
| from itertools import product | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # comments added, but not tested, so there are probably typos and other things | |
| # that need to be worked out | |
| import sqlite3 | |
| # consider using json for this sort of thing. sqlite3 is terrific for random | |
| # selects, but if you are going to be loading it all up anyway, no reason not to | |
| # have the easier editing of json | |
| quit_game = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import shuffle | |
| from collections import namedtuple | |
| Card = namedtuple('Card',['value','suit']) | |
| test = Card(5,'spades') | |
| print('look how namedtuples make things easier: {}'.format(test)) | |
| print('now that test is a card we can access its attributes cleanly: {} of {}'. | |
| format(test.value, test.suit)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import collections | |
| import logging | |
| from pprint import pprint | |
| SAVEFILE = 't1' | |
| class Board(object): | |
| template = ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Date: | |
| def __init__(self, new_month, new_day, new_year): | |
| """The constructor for objects of type Date.""" | |
| self.month = new_month | |
| self.day = new_day | |
| self.year = new_year | |
| def __str__(self): | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from jira.client import JIRA | |
| from datetime import datetime, date, timedelta | |
| from BusinessHours import BusinessHours | |
| import sys | |
| global jira | |
| global jiraURL | |
| global jiraUser | |
| global jiraPass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| from collections import defaultdict | |
| #from statistics import median | |
| import time | |
| def median(iterable): | |
| return sorted(iterable)[len(iterable)//2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| from collections import defaultdict, deque | |
| from pprint import pprint | |
| class Edge(object): | |
| ''' | |
| Edge class, used to keep track of links between nodes. | |
| two adjacent noes chare a single Edge instance, that describes their | |
| relationship |