src
stringlengths
721
1.04M
#!/usr/bin/env python import rospy, os, signal, subprocess from std_msgs.msg import String from std_msgs.msg import Bool def state_callback(data): if data.data == "Shutdown": rospy.signal_shutdown(shutdown_hook()) def mapping_callback(data): global mapping mapping = data.data def shutdown_hoo...
from django.core import mail from django.test import TestCase from django.core.cache import cache from rest_framework.test import APIClient, APITestCase from contact.models import Description, Message from user.models import User from stats.models import Hit from user.tests import create_test_users, login from phi...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
#-*- coding: utf-8 -*- ########################################################################### ## ## ## Copyrights Etienne Chové <chove@crans.org> 2010 ## ## ...
""" This module provides general net utility functions. """ import os import re import sys import shutil from unicodedata import normalize from email.parser import FeedParser from urllib.parse import urljoin, urlparse from urllib.request import urlopen from sunpy.util import replacement_filename __all__ = ['slugify',...
from eventregistry import EventRegistry from eventregistry import QueryEvents from eventregistry import RequestEventsInfo class EventRegistry2(EventRegistry): """ Wrapper around EventRegistry API """ @classmethod def initialize(cls, key): cls.key = key def __init__(self): sup...
from includes import xmltodic import re import xml.etree.ElementTree as ET # INI XML paths XML_INFO = '/plugins/plugin[name={0}]/info' XML_PLUGIN_FILE = '/plugins/file' XML_PLUGIN_FILE_TYPE = '/plugins/file_type' # INI XML PATHS XML_INI_KEY = '/plugins/plugin[name={0}]/key' XML_INI_SECTION = '/plugins/plugin[name={0...
# pylint: disable=invalid-unary-operand-type from collections import OrderedDict from copy import deepcopy from datetime import datetime, timedelta import json import logging from multiprocessing import Pool from dateutil.parser import parse as dparse from flask import escape, Markup from flask_appbuilder import Model...
#!/usr/bin/python2.7 # Copyright 2010 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
# orm/persistence.py # Copyright (C) 2005-2015 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """private module containing functions used to emit INSERT, UPDATE and DELETE sta...
#!/usr/bin/env python2 import json import os import os.path from datetime import datetime from artifactor.plugins.post_result import test_report from cfme.utils import read_env from cfme.utils.path import project_path from cfme.utils.trackerbot import post_jenkins_result job_name = os.environ['JOB_NAME'] number = int...
# coding: utf8 # mecabcsv.py # 11/9/2013 jichi # # See: # http://tseiya.hatenablog.com/entry/2012/09/19/191114 # http://yukihir0.hatenablog.jp/entry/20110201/1296565687 # http://mecab.googlecode.com/svn/trunk/mecab/doc/dic.html # http://mecab.googlecode.com/svn/trunk/mecab/doc/dic-detail.html # # Example csv: # ユーザ設定,,...
import sqlite3 import urllib from urllib.request import urlopen from bs4 import BeautifulSoup from phyllo.phyllo_logger import logger def getBooks(soup): siteURL = 'http://www.thelatinlibrary.com' textsURL = [] # get links to books in the collection for a in soup.find_all('a', href=True): ...
# Reuben Thorpe (2016), codeEval [String Search v1.0] from sys import argv def check(string, second): # Checks if second is in string, with regular expression "*" if "*" not in second: # Standard search return(compare(string, second)) else: # Found regex or escaped "*" char ...
# -*- coding:utf-8 -*- # coding=<utf8> import sqlite3 from user_settings.settings import sqlite_file class BDConnector(): """ Класс для подключения к БД sqlite, Если получает аргумент 'd', то работает в режиме отладки при записи, то есть, ничего в файл не записывается, а выводится в stdout """ de...
import functools from django.core.cache import caches from .settings import api_settings class cache(object): """ Cache decorator that memoizes the return value of a method for some time. Increment the cache_version everytime your method's implementation changes in such a way that it returns values th...
import serial import crcmod.predefined import logging # Reads DSMR4.0 P1 port class InvalidTelegram(Exception): pass class BadChecksum(InvalidTelegram): pass _tst = lambda x: (2000+int(x[0:2]), int(x[2:4]), int(x[4:6]), int(x[6:...
# Builds the README.md # Looks for areas between two markers of the form # [//]: # "filename(#hash)?" # and replaces the text of those areas by the referenced text. import codecs import logging import re logging.basicConfig(level=20) # info f = codecs.open("README.md", "r", "utf-8") readme = f.read() f.close() d...
# -*- coding: utf-8 -*- from wechatpy import replies from wechatpy.fields import IntegerField REPLY_TYPES = {} def register_reply(reply_type): def register(cls): REPLY_TYPES[reply_type] = cls return cls return register @register_reply('text') class TextReply(replies.TextReply): agent...
from twisted.words.xish import domish from gabbletest import exec_test, make_presence from servicetest import EventPattern, assertEquals import ns import constants as cs def test(q, bus, conn, stream, should_decloak=False): event = q.expect('stream-iq', query_ns=ns.ROSTER) event.stanza['type'] = 'result' ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'designer/dconf.ui' # # Created: Sun Mar 30 10:19:28 2014 # by: PyQt4 UI code generator 4.10.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except...
#!/usr/bin/env python3 # # Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
###################################################### # _untuned_modeling.py # author: Gert Jacobusse, gert.jacobusse@rogatio.nl # licence: FreeBSD """ Copyright (c) 2015, Gert Jacobusse All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that...
#!/usr/bin/python ## lists contents of an IPS patch ## stole the processing from meunierd's python-ips ## License: MIT - https://opensource.org/licenses/MIT from os.path import getsize,isfile import struct from sys import argv def print_usage_and_exit(): print "Usage: {script} [IPS patch file]".format(script=argv...
# This is a component of LinuxCNC # Copyright 2013 Chris Morley <chrisinnanaimo@hotmail.com> # # 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 2 of the License, or # (...
#!/usr/bin/env python #-*- encoding:utf-8 -*- from bottle import route, mako_template as template, redirect, request, response, get, post from bottle import static_file, view #为了不经过controller直接返回诸如html,css等静态文件引入 from model.documents import * from setting import * DATE_FORMAT = '%Y-%m-%d %H:%M:%S' # 入库格式化时间 @post('/...
from django.utils import six from django.conf import settings import os from optparse import make_option from django.core.management.base import NoArgsCommand from leonardo.module.web.models import Widget, WidgetContentTheme, WidgetBaseTheme from ._utils import get_or_create_template "widget.verbose_name - template...
#!/usr/bin/python import Adafruit_BBIO.ADC as ADC import time import datetime import numpy as np ADC.setup() # Based on observation of high and low raw readings X 3.6 V. Then took the average of each. zeroOffsetX = 1.595 zeroOffsetY = 1.614 zeroOffsetZ = 1.672 #The sensitivity or conversion factor is the average fo...
from enigma import eEPGCache from Components.Converter.Converter import Converter from Components.Element import cached from Components.Converter.genre import getGenreStringSub from Components.config import config from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN from time import localtime, mktime, str...
from __future__ import absolute_import try: import mock except ImportError: from unittest import mock import pytest from catpy.client import CatmaidClient from catpy.applications.base import CatmaidClientApplication PROJECT_ID = 10 BASE_URL = "http://not-catmaid.org" @pytest.fixture def catmaid_mock(): ...
# -*- coding: utf-8 -*- # # MorseCode documentation build configuration file, created by # sphinx-quickstart on Tue Nov 26 16:14:19 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
### Copyright (C) 2002-2005 Stephen Kennedy <stevek@gnome.org> ### Redistribution and use in source and binary forms, with or without ### modification, are permitted provided that the following conditions ### are met: ### ### 1. Redistributions of source code must retain the above copyright ### notice, this list o...
#!/bin/env python # -*- coding: utf-8 -*- """ This class is menat to read step configurations for the different parameters related to the satelite. the syntax of the step parameters should be like this [Parameter Name] Start Value = float / int Step = float / int End Value = float / int ... ... ... This configuratio...
# This file is part of Fail2Ban. # # Fail2Ban 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 2 of the License, or # (at your option) any later version. # # Fail2Ban is distributed in the hope t...
import tokenize from tokenize import Token if '.' in str(1.0): from boot import * #EOF,ADD,SUB,MUL,DIV,POW,AND,OR,CMP,GET,SET,NUMBER,STRING,GGET,GSET,MOVE,DEF,PASS,JUMP,CALL,RETURN,IF,DEBUG,EQ,LE,LT,DICT,LIST,NONE,LEN,POS,PARAMS,IGET,FILE,NAME,NE,HAS,RAISE,SETJMP,MOD,LSH,RSH,ITER,DEL,REGS = 0,1,2,3,4,5,6,7,8,9,10,...
import crypt import random import time from django.db import transaction from sso.services import BaseDBService from django.conf import settings class MiningBuddyService(BaseDBService): """ Mining Buddy Class, allows registration and sign-in """ settings = { 'require_user': False, 'r...
#! /bin/usr/env python # D.J. Bennett # 07/11/2014 """ pglt setup tools """ # PACKAGES import argparse import sys import os import re import pickle import csv import logging import platform from datetime import datetime from reseter_tools import Reseter from special_tools import clean from special_tools import stats f...
#! /usr/bin/env python3 """setup.py - Setuptools tasks and config for cupage.""" # Copyright © 2009-2014 James Rowe <jnrowe@gmail.com> # # SPDX-License-Identifier: GPL-3.0-or-later # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publish...
import json from django.views.decorators.cache import never_cache from django.http import HttpResponse, Http404 from opencontext_py.libs.rootpath import RootPath from django.template import RequestContext, loader from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.cache import cache...
# 001_cleaner.py ##################################################################### ################################## # Import des modules et ajout du path de travail pour import relatif import sys sys.path.insert(0 , 'D:/Projets/shade_django/apis/') from voca import AddLog , StringFormatter , OutFileCreate...
import os from distutils.core import setup import sidewalk setup( name='sidewalk', version=sidewalk.__version__, url= 'http://www.blakerohde.com/projects/sidewalk', author='Blake Rohde', author_email='blake@blakerohde.com', description='The Simple Activity Aggregator.', long_description=open('README.rst').rea...
""" Usage: python yugisync.py pull|push Backs up everything needed to restore your current game options, deck and card list to a git repository. If the repository is uploaded to a service like GitHub.com, this will also upload the changes there. Example: python yugisync.py push on your own laptop and then python...
from .utils import DslBase, _make_dsl_class from .function import SF, ScoreFunction __all__ = [ 'Q', 'Bool', 'Boosting', 'Common', 'ConstantScore', 'DisMax', 'Filtered', 'FunctionScore', 'Fuzzy', 'FuzzyLikeThis', 'FuzzyLikeThisField', 'GeoShape', 'HasChild', 'HasParent', 'Ids', 'Indices', 'Match', 'MatchAl...
from django.test import TestCase from pizzaplace.models import PizzaPlace from pizzaplace.presenter.pizza_place_presenter import PizzaPlacePresenter from pizzaplace.services.parsed_yelp_response import ParsedYelpResponse class TestPizzaPlacePresenter(TestCase): def setUp(self): self.pizza_place = PizzaPlace(...
''' Created on Jul 30, 2015 @author: Mikhail ''' import unittest import re from json_file_generator import MyOwnJSONProcessing as json_processing from json_file_generator import __version__ as json_file_generator_version from unittest.case import skip, skipIf class GenerateAndLoadJSONTestUpdateFour(unittest.TestCase)...
""" OpenVZ containers ================= """ from __future__ import with_statement from fabric.api import * def create(ctid, ostemplate=None, config=None, private=None, root=None, ipadd=None, hostname=None, **kwargs): """ Create an OpenVZ container. """ return _vzctl('create', ctid, ostempl...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import datetime import json from pyramid.config import Configurator from pyramid.view import view_config from waitress import serve import sqlalchemy as sa from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_ba...
# -*- coding:utf-8 -*- import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib vm = test_lib.lib_get_specific_stub('e2e_mini/vm', 'vm') vm_ops = None vm_name = 'vm-' + vm.get_time_postfix() def test(): global vm_ops vm_ops = vm.VM() vm_ops.create_vm(name=vm_name) ...
""" :class:`GeocoderDotUS` geocoder. """ import csv from base64 import b64encode from geopy.compat import urlencode, py3k, Request from geopy.geocoders.base import ( Geocoder, DEFAULT_FORMAT_STRING, DEFAULT_TIMEOUT, ) from geopy.location import Location from geopy.exc import ConfigurationError from geopy.u...
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- """ BitBake 'msg' implementation Message handling infrastructure for bitbake """ # Copyright (C) 2006 Richard Purdie # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU...
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
import logging import argparse log = logging.getLogger(__name__) def get_cmd(prj): return "info" def get_call(prj): return info_cmd def get_parser(prj): parser = argparse.ArgumentParser("info", description=""" Prints informations regarding the active project. """) return parser def info_cmd(args): info(ar...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import ldap from ldap.filter import filter_format from django.conf import settings from django.contrib.auth.models impor...
import numpy as np from matplotlib import rcParams import scipy.stats as scst # TODO get rid of these and we won't need matplotlib in the setup, only for examples rcParams['font.size'] = 14 rcParams['legend.fontsize'] = 10 rcParams['savefig.dpi'] = 300 rcParams['legend.loc'] = 'upper right' rcParams['image.cmap'] = 'ho...
#!/usr/bin/env python import unittest from day22 import Node, make_nodes, viable_nodes class TestMakingNodes(unittest.TestCase): def test_makes_nodes_from_input(self): df = """ /dev/grid/node-x0-y0 87T 71T 16T 81% /dev/grid/node-x0-y1 93T 72T 21T 77% /dev/gr...
import sqlite3 import os try: import json except ImportError: import simplejson as json import sys import xml.sax import binascii from vincenty import vincenty from struct import pack, unpack from rtree import Rtree def cons(ary): for i in range(len(ary)-1): yield (ary[i], ary[i+1]) def pack_coord...
# Copyright 2014 Mellanox Technologies, Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
import nil.string, nil.thread, utility, craw, packets, time, configuration, threading class bncs_packet_handler_class: def __init__(self): self.lock = threading.Lock() self.whois_name_queue = [] self.whois_handler_queue = [] self.account_map = {} self.entering_game = False self.has_thread = False def ...
from collections import OrderedDict class DummyProxy(dict): def make_key(self, path, headers=None): key = path if headers is not None: key += str(frozenset(sorted(headers.items()))) return key def cache(self, request, value): headers = {k[5:].replace("_", "-").low...
#!/usr/bin/python import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email import Encoders class GMail(object): """Compose and Send via GMail""" def __init__(self, email_address, password): super(GMail, self).__init__() ...
# coding=utf-8 __author__ = 'DongMin Kim' from opencog.type_constructors import * # Choose atoms which are connected to specific atom. def get_incoming_nodes(a, target): ret = [] xget_target_link = a.xget_atoms_by_target_atom(types.Link, target) for link in xget_target_link: xget_target_link_no...
# Copyright 2017 reinforce.io. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
# ============================================================================= # Copyright [2013] [Kevin Carter] # License Information : # This software has no warranty, it is provided 'as is'. It is your # responsibility to validate the behavior of the routines and its accuracy # using the code provided. Consult the ...
# this is an implementation of the method described in # # Neural Algorithm of Artistic Style. Gatys, Ecker, Bethge 2015 http://arxiv.org/pdf/1508.06576.pdf # # this code is meant as an executable sketch showing the kinds of computation that need to be done. # running the code makes the most sense in an interactive ...
import os,sys import unittest import ConfigParser TEST_DIR = os.path.dirname(os.path.abspath(__file__)) INSTALL_DIR = os.path.abspath(os.path.join(TEST_DIR,"..")) sys.path.append(os.path.join(INSTALL_DIR)) import json from layman.layed import LayEd from layman.layed import GsRest class LayEdTestCase(unittest.TestCas...
""" 基本面 """ import logging import datetime import numpy as np import pandas as pd import tushare as ts from stock.website import get_balance_sheet, get_profit_statement from stock.website import get_bdi_index from stock.website import get_shibor as _get_shibor from stock.technical import get_k_data logger = logging....
import doctest import unittest # doctests # unit tests... from dualauth import * #----------------------------------------------------------------------- def addModuleToSuite(ste, mod): """ Side effect on suite, returned also """ ste.addTests(unittest.TestLoader().loadTestsFromModule(mod)) retur...
#!/usr/bin/env python3 # -*- python -*- #BEGIN_LEGAL # #Copyright (c) 2019 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2010 OpenStack LLC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
import numpy as np import cv2 cap = cv2.VideoCapture(0) # take first frame of the video ret,frame = cap.read() # setup initial location of window r,h,c,w = 250,90,400,125 # simply hardcoded the values track_window = (c,r,w,h) # set up the ROI for tracking roi = frame[r:r+h, c:c+w] hsv_roi = cv2.cvtColor(roi, cv2....
import numpy as np #labels for summary plots d_label = np.array(["You", "Your gender", "Your age group", "Your race / ethnicity", "Your location"]) #US statistics gender_number = {} gender_number["Male"] = 155651602 gender_number["Female"] = 160477237 race_number = {} race_number["Native"] = 1942876.0 race_number[...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import pygame, sys from pygame.locals import * class Platform(pygame.sprite.Sprite): def __init__(self, loc, *groups): super(Platform, self).__init__(*groups) self.start = loc self.image = pygame.image.load('images/platform.png').convert_alpha() self.rect = self.image.get_rect() ...
#! /usr/bin/env python PKG='deedee_driver' import sys import unittest from mock import Mock from deedee_driver.motors_driver_lib import * class TestMotorsDriver(unittest.TestCase): def setUp(self): robot_name = "test_bot" config = {"max_wheel_speed": 0.55} serial_socket = Mock() ...
import shlex import subprocess from subprocess import PIPE import six from threading import Lock try: from insights.contrib import magic except Exception: magic_loaded = False else: # RHEL 6 does not have MAGIC_MIME_TYPE defined, but passing in the value # found in RHEL 7 (16, base 10), seems to work. ...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# -*- coding: utf-8 -*- import re from random import randrange from urllib import unquote from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" __version__ ...
# -*- coding: utf-8 -*- from kivy.uix.widget import Widget from kivy.clock import Clock from kivy.graphics import Color, Callback, Rotate, PushMatrix, PopMatrix, Translate, Quad from kivy.graphics.opengl import glBlendFunc, GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL...
# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import codecs import logging import portage from portage import os from portage import _encodings from portage import _unicode_encode from _emerge.AsynchronousTask import AsynchronousTask from _emerge.unmerge imp...
from datatypes import values from util import compact from db.models import Block max_target = compact.bits_to_target(values.HIGHEST_TARGET_BITS) target_timespan = 60 * 60 * 24 * 7 * 2 # We want 2016 blocks to take 2 weeks. retarget_interval = 2016 # Blocks def validate_block(block, prev_block): """Validate a new...
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Flag.words' db.add_column('contact_flag', 'words', self.gf('django.db.models.fields.CharFi...
import datetime from django.db import models #from django_hstore import hstore from jsonfield import JSONField from pug.nlp.db import representation # FIXME: simplify circular import/dependencies with miner app #from pug.dj.miner import explore from model_mixin import DateMixin class Connection(models.Model): ...
from django.conf.urls import url from .views import (question_list, question_detail, question_ask, question_update, category_list, category, answer_update, question_delete, ...
"""Command line Conway's Game of Life.""" # Rules: # 1. Live cell with less than two neighbors dies. # 2. Live cell with two or three neighbors lives on. # 3. Live cell with more than three live neighbors dies. # 4. Dead cell with exactly three live neighbors becomes a live cell. from time import sleep from random im...
import unittest from .sudoku import * from copy import deepcopy SUDOKU_SAMPLE = [ [2, 0, 0, 0, 0, 0, 0, 6, 0], [0, 0, 0, 0, 7, 5, 0, 3, 0], [0, 4, 8, 0, 9, 0, 1, 0, 0], [0, 0, 0, 3, 0, 0, 0, 0, 0], [3, 0, 0, 0, 1, 0, 0, 0, 9], [0, 0, 0, 0, 0, 8, 0...
#!/usr/bin/env python3 from .image import Image from .streamtools import MAT_WIDTH, MAT_HEIGHT from time import sleep from .rainbow import msg R = 'right' L = 'left' U = 'up' D = 'down' RU = 'right_up' LU = 'left_up' RD = 'right_down' LD = 'left_down' F = 'fluid' S = 'stop' class Slide: """ Slide is used to ...
############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2015 FactorLibre (http://www.factorlibre.com) # Hugo Santos <hugo.santos@factorlibre.com> # # This program is free software: you can redistribute it and/o...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # FreeType high-level python API - Copyright 2011 Nicolas P. Rougier # Distributed under the terms of the new BSD license. # # ---------------------------------------------------------------...
__author__ = 'kevinschoon@gmail.com' import subprocess import uuid import os import time import jinja2 from haproxy.models import GlobalSection, DefaultsSection, StatsSection from haproxy.exceptions import BadConfiguration, HaProxyProcessException class HAProxyConfig: """ HAProxyConfig represents an HAProxy...
# -*- coding: utf-8 -*- # # Installationsleitfaden documentation build configuration file, created by # sphinx-quickstart on Sat Nov 7 15:29:20 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenera...
#!/usr/bin/env python # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' from collections import OrderedDict from calibre.ebooks.docx.block_styles imp...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import re PHYSICAL_SIDES = ["top", "left", "bottom", "right"] LOGICAL_SIDES = ["block-start", "block-end", "inline-star...
# Copyright 2016 Quora, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
import numpy, h5py, pylab from PnSC_h5io import * from matplotlib.ticker import FuncFormatter def myexpformat(x, pos): for ndigs in range(5): lab=(('%.'+'%d' %ndigs+'e') %x).replace('e+0','e').replace('e+','e').replace('e0','').replace('e-0','e-') if eval(lab)==x: return lab return...
from django.conf import settings from django.db import models from django.db.models.signals import post_delete, post_save from django.dispatch import receiver from django.template.defaultfilters import slugify class Post(models.Model): author = models.ForeignKey(settings.AUTH_USER_MODEL) date = models.DateTim...
#!/usr/bin/env python2 from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand import debbindiff class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] def initialize_options(self): TestCommand.initialize_options(s...
#------------------------------------------------------------------------------- # Copyright (c) 2012 Gael Honorez. # All rights reserved. This program and the accompanying materials # are made available under the terms of the GNU Public License v3.0 # which accompanies this distribution, and is available at # http://w...
from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext as _ import random def get_random_value(start=100, end=100000): def get_random(): return random.randint(start, end) * 0.01 return get_random class Trader(models.Model): name = model...