code
stringlengths
1
199k
import re from StringIO import StringIO from trac import util from trac.core import * from trac.db import get_column_names from trac.perm import IPermissionRequestor from trac.util import sorted from trac.util.datefmt import format_date, format_time, format_datetime, \ http_date from trac...
""" ======================== taoui_telescope.models ======================== Required by Django Apps, but nothing required here. """
from django.core.management.base import BaseCommand, CommandError from bierapp.accounts.models import Site class Command(BaseCommand): help = 'Verify sites to have members and/or admin' def handle(self, *args, **options): sites = Site.objects.select_related().all() for site in sites: ...
from os import environ from subprocess import run from . import WallpaperProvider as _WProv class SwayProvider(_WProv): def change_wallpaper(path: str): run(["swaymsg", f"output * background {path} fill"], check=True) def is_compatible() -> bool: return "sway" in environ.get("DESKTOP_SESSION", d...
try: import sys, os import errno import signal configdir = '../' testdir = os.path.dirname(__file__) sys.path.insert(0, os.path.dirname(__file__)) sys.path.insert(0, os.path.abspath(os.path.join(testdir, configdir))) import os.path from selenium import webdriver from selenium.web...
'''apport package hook for itelepathy-mission-control (c) 2011 Canonical Ltd. Author: Jamie Strandboge <jamie@ubuntu.com> ''' from apport.hookutils import * from os import path import re def add_info(report): attach_conffiles(report, 'telepathy-mission-control-5') attach_related_packages(report, ['apparmor', 'l...
DOCUMENTATION = ''' --- module: azure_affinity_group short_description: create or delete an affinity group description: - Creates or deletes affinity groups. This module has a dependency on python-azure >= 0.7.1 version_added: "1.9" options: name: description: - name of the affinity group required:...
from django.conf import settings from django.contrib.contenttypes.models import ContentType from lino.utils.instantiator import Instantiator from lino.core.dbutils import resolve_model def objects(): if settings.SITE.user_model: tft = Instantiator('system.TextFieldTemplate',"name description text").build ...
''' PDDL Merge and Translator - Post Processing Module Author: Dr. Patricia Riddle @ 2013 Contact: pat@cs.auckland.ac.nz Translates PDDL files using an automated planner in order to improve performance This module contain functions used in the post processing of the planner output file after reformulation ------- Copyr...
class Flick: pass
from abjad.tools.abctools import ContextManager class NullContextManager(ContextManager): r'''A context manager that does nothing. ''' ### CLASS VARIABLES ### __documentation_section__ = 'Context managers' ### INITIALIZER ### def __init__(self): pass ### SPECIAL METHODS ### def _...
from . import http class Plugin: def load(self, dependencies): api = dependencies['api'] args = (dependencies['group_service'],) api.add_resource( http.Group, '/groups/<uuid:group_uuid>', resource_class_args=args ) api.add_resource(http.Groups, '/groups', resource...
import PDALib import myPDALib import myPyLib import time import sys import signal LeftBumperDIO=18 RightBumperDIO=17 RearBumperDIO=16 NONE = 0 LEFT = 1 RIGHT = 2 REAR = 4 FRONT = 3 LEFTREAR = 5 RIGHTREAR= 6 ALL = 7 UNKNOWN = 8 bumperStrings=["NONE", "LEFT", "RIGHT", "FRONT", "REAR", ...
import mongoengine as models class Admin(models.Document): name = models.StringField(require=True) password = models.StringField(require=True) group_id = models.StringField(require=True) class Group(models.Document): name = models.StringField(require=True) perm_list = models.StringField() class Perm...
""" eXosip2 event API see: http://www.antisip.com/doc/exosip2/group__eXosip2__event.html """ from __future__ import absolute_import, unicode_literals from ctypes import POINTER, Structure, c_uint, c_int, c_void_p, c_char from . import globs from .utils import ExosipFunc EXOSIP_REGISTRATION_SUCCESS = 0 EXOSIP_REGISTRATI...
__license__ = ''' License (GPL-3.0) : This file is part of PPQT Version 2. PPQT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later v...
from ..base import Base from ..const import API_PATH class Chain(Base): def __init__(self, symbol, expiration, greeks=bool): """Create an instance of the ``Chain`` class. :param symbol: The symbol for the options chain. By default, this is passed from the parent ``Company`` class. :param exp...
import re import os import urllib import zipfile import FileGenerator import hashlib import json from xml.sax.saxutils import quoteattr import CustomRegEx BASEADDRESS = 32000 INFOLABELS_KEYS = [ 'genre', # string (Comedy) 'year', # integer (2009) ...
from setuptools import setup setup(name='engfordev', version='1.0', description='OpenShift Python-2.7 Community Cartridge based application', author='Sean Moon', author_email='daeseonmoon@gmail.com', url='http://www.python.org/sigs/distutils-sig/', # Uncomment one or more lines below in the ins...
from django.core.management.base import BaseCommand from django.contrib.auth.models import User class Command(BaseCommand): def handle(self, *args, **options): """ Converts all user.is_staff to user.is_superuser if user.is_active """ # command to run: python manage.py admin_converter...
""" Author: Brandon Denning Purpose: Serves as base class for most other AWS classes - automatically tries to switch role into account using the parameters given at creation and generates an AWS Session Object Date: 11 Dec 2017 Version: 1.0 """ from .AWSExceptions import InvalidAccountNumber import logging imp...
import json import os import os.path import stat import time import datetime import subprocess from unittest import TestCase from ecl.util.test import TestAreaContext from res.job_queue import JobManager class JobManagerTestRuntimeKW(TestCase): def test1(self): with TestAreaContext("job_manager_runtime_int_kw...
'''File: diffev.py an implementation of the differential evolution algoithm for fitting. Programmed by: Matts Bjorck Last changed: 2008 11 23 ''' from numpy import * import thread import time import random as random_mod import sys, os, pickle __parallel_loaded__ = False _cpu_count = 1 try: import multiprocessing as...
""" action.py - adds the "export as csv" option to the admin interface """ import csv from django.core.exceptions import PermissionDenied from django.http import HttpResponse def export_as_csv(modeladmin, request, queryset): """ Generic csv export admin action. """ if not request.user.is_staff: ...
import coreUtils import socket import os def HelperBanner(): coreUtils.clearScreen() print "********************************************************************************************" print "* *" print "* ...
''' to run this program, do something like this: ./runYarn.bash 'subject3' kmeans_subject.py 2>logs/kmeans_subject3.log where you have to specify subject number inside the program. I know this needs improving, but its working for now. I will fix it once we have all data. ''' from pyspark import SparkContext import os,i...
from django.contrib import admin from fishing.models import Water from fishing.models import Fish from fishing.models import FederalState from fishing.models import Catch from fishing.models import Account from fishing.models import Comment admin.site.register(Water) admin.site.register(Fish) admin.site.register(Federa...
import UserList, sys class TokenHandler: def begin(self): """Called before any other callbacks""" pass def add_token(self, name, pos, text): """Called for each token; state name, character position, token text""" pass def error(self, errmsg, pos, text): """Called when...
"""This script solves the Project Euler problem "Prime summations". The problem is: What is the first value which can be written as the sum of primes in over five thousand different ways? """ from __future__ import division import argparse import math import re def main(args): """Prime summations""" n = 0 n...
import shelve from decorators import publicMethod from mpd import MPDClient, ConnectionError class SwitchClass(): state = None def __init__(self, initial_data={}, **kwargs): initial_data.update(kwargs) for k,v in initial_data.items(): setattr(self, k, v) self.state = self.loa...
from django.http import JsonResponse#, HttpResponse, Http404 from django.shortcuts import render from scipy.misc import imread, imresize#, imsave from keras.models import load_model from io import BytesIO import numpy as np import base64 import cv2 import re def page(request): if request.POST: model = load_model('/p...
from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render, redirect from django.views import generic from .models import * def load_table(request): if request.POST: table_name ...
""" Copyright (C) 2013 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals from contextlib import closing from traceback import format_exc from zato.common import BATCH_DEFAULTS, INVOC...
""" Models used in the rankings """ from django.db import models from django.db.models import Q from django.forms import ValidationError from rankings import fields class PlayerManager(models.Manager): """ Model manager for Player. """ def active_players(self): """ Returns all active pla...
"""Analysis of the Ramachandran datasets. """ import tarfile import json from itertools import izip_longest as zip_longest import numpy as np import matplotlib import matplotlib.pyplot as plt from scipy import ndimage figsize = (7, 1.5) # size of each subplot in inches title_fontsize = 9 # size of the font for subplo...
"""HITAP Tazminat Guncelle Hitap'a personelin Tazminat bilgilerinin guncellemesini yapar. """ from ulakbus.services.personel.hitap.hitap_service import ZatoHitapService class HizmetTazminatGuncelle(ZatoHitapService): """ HITAP Guncelleme servisinden kalıtılmış Hizmet Tazminat Bilgi Guncelleme servisi """ ...
from mediarover.config import ConfigObj from mediarover.constant import CONFIG_OBJECT, WATCHED_SERIES_LIST from mediarover.error import * from mediarover.factory import EpisodeFactory, ItemFactory, SourceFactory from mediarover.episode.multi import MultiEpisode from mediarover.episode.single import SingleEpisode from m...
from sys import platform as _platform if _platform == "linux" or _platform == "linux2": #linux... from .linux import MouseManager elif _platform == "darwin": #mac... from .mac import MouseManager elif _platform == "win32": #window... from .windows import MouseManager
from ert_gui.models import ErtConnector from ert_gui.models.mixins import PathModelMixin class RshCommand(ErtConnector, PathModelMixin): def pathIsRequired(self): return True def pathMustBeADirectory(self): return False def pathMustBeAFile(self): return True def pathMustBeExecuta...
from django.views.generic import CreateView, DetailView, ListView from django.core.urlresolvers import reverse_lazy from .forms import StoryForm from .models import Story class CreateStoryView(CreateView): form_class = StoryForm model = Story success_url = reverse_lazy('stories:story_create_success') class ...
__version__ = '11.0.0'
from django.test import TestCase from lib import terms, constants import random class TermsTestCase(TestCase): def test_term_regex_works_in_common_case(self): term_data = terms.term_regex.match('16W') self.assertTrue(term_data and term_data.group('year') == '16' and term_data...
import mvc mvc.Main()
import hashlib import zlib class BlobInfo: def __init__(self, size, md5=None, sha1=None, crc32=None): self.size = size self.sha1 = sha1 self.md5 = md5 self.crc32 = crc32 def __eq__(self, other): if other is None: return False sha1_ok = ((self.sha1 is n...
""" Example RLFL Line Of Sight LOS method: rlfl.los( map, point 1, point 2, ) return True or False Cells need to be marked rlfl.CELL_OPEN and rlfl.CELL_SEEN to not block LOS """ import sys if sys.version_info[0] < 3: sys.exit("This example works with python3 only....
from PyQt5.QtCore import QThread, QObject from PyQt5.QtGui import QTextCursor, QIcon from AlphaHooks.widgets.console.interpreters import PythonInterpreter class PythonDisplay(QObject): def __init__(self, ui, config, parent=None, **kwargs): """ Loads python configurations for console_log. A new threa...
import time,random import threading,Queue q = Queue.Queue() class Produce(threading.Thread): def run(self): while True: num = random.randint(1,10000) q.put(num) print self.getName,"Produce put :" ,num time.sleep(1) class Couster(threading.Thread): def run...
print ("test")
"""Module representation for code browser $Id: __init__.py 29143 2005-02-14 22:43:16Z srichter $ """ __docformat__ = 'restructuredtext' import os import types import zope from zope.interface import implements from zope.interface.interface import InterfaceClass from zope.location.interfaces import ILocation from zope.lo...
import logging as l l.basicConfig(filename='mylogs.txt',filemode='a', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=l.DEBUG, datefmt='%c') l.debug("This is an debug message") l.info("This is an information message") l.warning("This is an warning message") l.error("This is ...
from flask import Blueprint from flask import render_template, redirect, url_for, jsonify from config.databases import mongo1, mongo2, mongo3, remoteDB1, secure_graph1 from flask.ext.pymongo import ObjectId from py2neo import Node, Relationship import json from bson import json_util users = Blueprint('users', __name__)...
from core import httptools from core import scrapertools from lib import jsunpack from platformcode import logger def test_video_exists(page_url): logger.info("(page_url='%s')" % page_url) data = httptools.downloadpage(page_url) if "Object not found" in data.data or "longer exists on our servers" in data.da...
from __future__ import print_function import os import numpy as np try: import vtk from vtk.util.numpy_support import vtk_to_numpy except BaseException: pass def calculate_vtk_max_pointwise_difference(file1, file2, tol=1e-6): arrays = [0] * 2 reader = vtk.vtkStructuredPointsReader() for i, fname...
import os import errno import logging.config import outspline.components.main from configuration import config, _USER_FOLDER_PERMISSIONS log = None class LevelFilter(object): def __init__(self, levels, inverse): self.levels = levels self.inverse = inverse def filter(self, record): return...
from pprint import pprint import numpy class BidLog(object): def __init__(self): self.distances = dict() def note_bid(self, job_id, bid): if job_id in self.distances: if self.distances[job_id] > bid: self.distances[job_id] = bid else: self.distance...
import json import logging from typing import List, Optional from golem.core.responses.buttons import Button, LinkButton, PayloadButton from golem.core.responses.quick_reply import QuickReply, LocationQuickReply from golem.core.responses.responses import * from golem.core.responses.templates import ListTemplate class T...
import logging from django.db import models logger = logging.getLogger(__name__)
from __future__ import division import numpy as np import matplotlib.pyplot as plt from InterferenceCorrection import GetCorrectedHiRes,CorrectionInfo from OffsetCorrection import CorrectAndInteprolateZsnsr import copy class TouchoffInfo: def __init__(self,LoadingRate,LoadTime,TriggerIdx,SurfaceIdx,SurfaceTime, ...
import os import unittest import tempfile from errbot.plugin_manager import check_dependencies, CORE_PLUGINS from errbot.utils import find_roots, find_roots_with_extra def touch(name): with open(name, 'a'): os.utime(name, None) class TestPluginManagement(unittest.TestCase): def test_check_dependencies(s...
''' This module contains some common routines for plotting ''' import matplotlib.pyplot as plt import numpy as np def add_subplot_axes(ax, rect, axisbg='w'): fig = plt.gcf() box = ax.get_position() width = box.width height = box.height inax_position = ax.transAxes.transform(rect[0:2]) transFigur...
from bin import loginOps
import numpy as np import cv2 def doColorClassification(givenSColor, givenCColor, optionalArgs): print "Python Color Classification (this is the Python)" if len(givenSColor) != 3: print "WARNING: SColor wasn't a 3-element list!!!" if len(givenCColor) != 3: print "WARNING: CColor wasn't a 3-element list!!!" retu...
import os,sys import lofar.parameterset from lofarpipe.support.data_map import DataMap sasid=sys.argv[1]; parsetfile='L'+sasid+'.parset' outputfile='L'+sasid+'.map' ps=lofar.parameterset.parameterset(parsetfile) dps = ps.makeSubset(ps.fullModuleName('DataProducts') + '.') output_data = DataMap([ tuple(os.pa...
"""Websocket server for iotile supervisor.""" import uuid import logging import functools import asyncio from iotile.core.utilities import SharedLoop from iotile_transport_socket_lib.generic import AsyncSocketServer from iotile_transport_websocket.websocket_implementation import WebsocketServerImplementation from .serv...
from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' --- module: apt short_description: Manages apt-packages description: - Manages I(apt) packages (such as for Debian/Ubuntu). version_added: "0.0.2" options: name: description: - A list of package names...
""" The Matcher service provides an XMLRPC interface for matching jobs to pilots It uses a Matcher and a Limiter object that encapsulated the matching logic. It connects to JobDB, TaskQueueDB, and PilotAgentsDB. """ __RCSID__ = "$Id$" from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.Utilities.ThreadSche...
from __future__ import print_function program = "get_cazy_fams" version = "0.1.0" author = "Darcy Jones" date = "1 October 2015" email = "darcy.ab.jones@gmail.com" short_blurb = ( '' ) license = ( '{program}-{version}\n' '{short_blurb}\n\n' 'Copyright (C) {date}, {author}' '\n\n' 'This progr...
from __future__ import division from ethereum.utils import denoms from customizer import Customizer class SubtaskDetailsDialogCustomizer(Customizer): def __init__(self, gui, logic, subtask_state): self.subtask_state = subtask_state Customizer.__init__(self, gui, logic) self.update_view(self....
""" Color : Function : RPI pin (SPI0) : Smartscope Yellow : SS : 24 : D0 NOTE: RPI SPI0-CS1 is RPI Pin 26 White : SCK : 23 : D1 Blue : MISO : 21 : D3 Orange : MOSI : 19 : D2 """ import spidev from struct import pack,unpack from time import...
import math import pygrace import pygame,os,time,sys import numpy as np def xmgrace(): global pg try: import pygrace except: print 'damn' return pg = pygrace.grace() pg.xlabel('V -->>') pg.ylabel('I -->') pg.title('Current') ev=1.6e-19 k=1#8.617e-5 delta=0.00001 T=0.5/11605.0 #temperature in eV 1ev=1160...
""" Copyright (C) 2017 Charles Schaff, David Yunis, Ayan Chakrabarti, Matthew R. Walter. See LICENSE.txt for details. """ import models.inf as md import models.trainable_beacon as smod import models.prop1 as pmod md.smod = smod md.pmod = pmod md.nGroup = 6 MAPFILE = '../maps/map1.txt' KEEPLAST = 1 KEEPEVERY= 1e6 SAVE_...
from definitions import * from pyopus.design.yt import YieldTargeting from pyopus.evaluator.aggregate import formatParameters from pyopus.parallel.mpi import MPI from pyopus.parallel.cooperative import cOS if __name__=='__main__': # Add 'wcd' module to all analyses (we have no corners) for name,an in analyses.iterite...
from django import forms class PollVoteForm(forms.Form): vote = forms.ChoiceField(widget=forms.RadioSelect()) def __init__(self, poll): forms.Form.__init__(self) self.fields['vote'].choices = [(c.id, c.choice) for c in poll.choice_set.all()]
from time import sleep from ulakbus.models import BAPProje from ulakbus.models import User from ulakbus.models import Okutman from ulakbus.models import Personel from zengine.lib.test_utils import BaseTestCase class TestCase(BaseTestCase): def lane_change_massage_kontrol(self, resp): assert resp.json['msgbo...
from django.conf.urls import url from avatar import views app_name = 'avatar' urlpatterns = [ url(r'^add/$', views.add, name='avatar_add'), url(r'^render_primary/(?P<contact>[\w\d\@\.\-_]{3,30})/(?P<size>[\d]+)/$', views.render_primary, name='avatar_render_primary'), url(r'^list/(?P<codename>[\+\w\@...
from elections.tests import VotaInteligenteTestCase as TestCase from popolo.models import Person, ContactDetail from elections.models import Candidate, Election, QuestionCategory, PersonalData from candidator.models import Category, Position, TakenPosition from django.template.loader import get_template from django.tem...
import sys,os,pygame from gettext import gettext as _ global GAME_DIR # Hago GAME_DIR global para las funciones del modulo GAME_DIR = os.path.abspath(os.path.dirname(sys.argv[0])) def Comprobar_Versiones(): if ( sys.__dict__.has_key("version_info" ) ): (major, minor, micro, releaselevel, serial) = sys.versi...
import os import sys import unittest sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..')) from resources.lib import api class APIITTests(unittest.TestCase): def test_get_topics(self): items = api.get_topics() self.assertTrue(len(items) > 10) # currently 11 def test_get_sub_topic...
import concurrent.futures import os import shlex import shutil import subprocess from typing import Dict, Iterator, List, Optional, Sequence, Tuple, Union from . import global_data from .collect import lines_for_path from .diff_speedup import changed_center left_lines: Tuple[str, ...] = () right_lines: Tuple[str, ...] ...
import GangaCore.Core.exceptions import os def get_user_platform(env=os.environ): ''' Doesn't appear to be used within Ganga! This will likely still extract the code as in the CMT package using env['CMTCONFIG'] ''' raise NotImplementedError def update_project_path(user_release_area, env=os.environ):...
from .generator import Generator, DictionaryError, SampleError __author__ = "Luca De Vitis <luca@monkeython.com>" __version__ = '1.0.2' __copyright__ = "2011, %s " % __author__ __license__ = """ Copyright (C) %s This program is free software: you can redistribute it and/or modify it under the terms of th...
''' cmdipc — System V and POSIX IPC from the command line Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or...
"""Subscript extension for Markdown. To subscript something, place a tilde symbol, '~', before and after the text that you would like in subscript: C~6~H~12~O~6~ The numbers in this example will be subscripted. See below for more: Examples: >>> import markdown >>> md = markdown.Markdown(extensions=['subscript']) >>> ...
from __future__ import print_function import numpy as np import sys import cv2 from cv import CV_CAP_PROP_FRAME_COUNT, CV_CAP_PROP_FPS if len (sys.argv) > 1: fileName=sys.argv[1] else: print("Usage : %s nom de fichier vidéo" %sys.argv[0]) fileName="IR001.avi" vidFile = cv2.VideoCapture( fileName ) face_cascade = ...
from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(579, 671) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) ...
""" MoveSafely2.mfx Move Safely 2 Object - David Clark (Alien) (http://www.clickteam.com) Allow multiple objects to move 'safely' from one point to another taking 'in-between steps' rather than jumping, allowing you to test for collisions. Ported to Python by Mathias Kaerlev """ from mmfparser.player.extensions.common ...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Album', fields=[ ('id', ...
"""Script that uses the `polar2grid` toolbox of modules to take VIIRS hdf5 (.h5) files and create a properly scaled AWIPS compatible NetCDF file. :author: David Hoese (davidh) :contact: david.hoese@ssec.wisc.edu :organization: Space Science and Engineering Center (SSEC) :copyright: Copyright (c) 2013 Univ...
""" Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. (Hint: remember to use the user input lessons from the very first exercise) Extras: Keep the game going until the user types “exit” Keep tr...
from mock import patch from nose.tools import * import pandas as pd import philharmonic def test_explore_ga_weights(): philharmonic._setup('philharmonic.settings.ga_explore') from philharmonic import conf conf.parameter_space = 'GAWeights' from philharmonic.explorer import explore # TODO: convert to...
import sys import argparse import nltk import features import stanford import util_run_experiment from util_run_experiment import output_one_best from util_run_experiment import output_five_best from util_run_experiment import all_target_languages from util_run_experiment import all_words from util_run_experiment impor...
""" Python interface to contents of doxygen xml documentation. Example use: See the contents of the example folder for the C++ and doxygen-generated xml used in this example. >>> # Parse the doxygen docs. >>> import os >>> this_dir = os.path.dirname(globals()['__file__']) >>> xml_path = this_dir + "/example/xml/" >>> d...
import logging from golem.task.localcomputer import LocalComputer from golem.task.taskcomputer import PyTestTaskThread logger = logging.getLogger("golem.task") class TaskTester(LocalComputer): TESTER_WARNING = "Task not tested properly" TESTER_SUCCESS = "Test task computation success!" def __init__(self, ta...
min_temperature = 0 max_temperature = 300 step = 20 print('Fahrenheit\tCelsius') for fahrenheit in range(min_temperature, max_temperature + step, step): celsius = 5 * (fahrenheit - 32) / 9 # {:10d}: fahrenheit as a decimal number in a field of width 10 # {:7.1f}: celsius as a floating point number in a fie...
from subprocess import * import sys class bcolor: HEADER = '\033[95m' OKBLUE = '\033[94m' OK = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' END = '\033[0m' def disable(self): self.HEADER = '' self.OKBLUE = '' self.OK = '' self.WARNING = '' self.FA...
import re from figures import Figure, Pawn, Rook, Knight, Bishop, King, Queen from constants import ALL_BOARD_POSITIONS class Board: def __init__(self): self._board = [[Rook('Black'), Knight('Black'), Bishop('Black'), Queen('Black'), King('Black'), Bishop('Bla...
from __future__ import unicode_literals import json import datetime from flask_bouncer import MANAGE, CREATE, EDIT, DELETE, READ from compair.authorization import allow from flask_login import login_user, logout_user from werkzeug.exceptions import Unauthorized from data.fixtures import DefaultFixture, UserFactory, Ass...
import getopt import sys import os import logging from ConfigParser import * class Config(): def __init__(self): self.debug = 0 self.background = 0 self.output_filename = "/dev/null" self.hostname = "127.0.0.1" self.port = 4001 self.username = "admin" self.password = ...
class Image: def __init__(self): return def Image(self): return class RealImage(Image): def __init__(self, filename): Image.__init__(self) self.filename = filename self.loadFromDisk() def display(self): print("Displaying " + self.filename) def loadFrom...
import unittest import ossie.utils.testing import os from omniORB import any class ComponentTests(ossie.utils.testing.ScaComponentTestCase): """Test for all component implementations in head_ii""" def testScaBasicBehavior(self): ####################################################################### ...