code
stringlengths
1
199k
""" This file exports all NetworkInspectors. """ import os import glob import nupic from nupic.analysis.inspectors.network.NetworkInspector import * files = [os.path.splitext(os.path.split(x)[1])[0] for x in glob.glob(os.path.join(os.path.split(__file__)[0], '*.py'))] files.remove('__init__') files.remove(...
import logging import log import yaml import inspect import sys import os.path import copy from Cheetah.Template import Template wfrog_version = "0.8.2.99-git" class Configurer(object): default_filename = None module_map = None log_configurer = log.LogConfigurer() logger = logging.getLogger('config') ...
"""Multidict implementation. HTTP Headers and URL query string require specific data structure: multidict. It behaves mostly like a dict but it can have several values for the same key. """ import os __all__ = ('MultiDictProxy', 'CIMultiDictProxy', 'MultiDict', 'CIMultiDict', 'upstr', 'istr') __version__ = '...
""" DIRAC FileCatalog mix-in class to manage directory metadata """ import six import os from DIRAC import S_OK, S_ERROR from DIRAC.Core.Utilities.Time import queryTime class DirectoryMetadata(object): def __init__(self, database=None): self.db = database def setDatabase(self, database): self.db...
import re from BitTorrent import BTFailure allowed_path_re = re.compile(r'^[^/\\.~][^/\\]*$') ints = (long, int) def check_info(info, check_paths=True): if type(info) != dict: raise BTFailure, 'bad metainfo - not a dictionary' pieces = info.get('pieces') if type(pieces) != str or len(pieces) % 20 !=...
from __future__ import absolute_import from .MockPrinter import MockPrinter import mock from random import random class M201_Tests(MockPrinter): def setUp(self): self.printer.path_planner.native_planner.setAcceleration = mock.Mock() self.printer.axis_config = self.printer.AXIS_CONFIG_XY self.printer.speed...
import logging from ..Tools.StringTools import join_list, join_dict from .NgSpice.Shared import NgSpiceShared from .Server import SpiceServer _module_logger = logging.getLogger(__name__) class CircuitSimulation: """Define and generate the spice instruction to perform a circuit simulation. .. warning:: In some c...
import time import datetime import sqlite3 import sickbeard from sickbeard import db from sickbeard import logger from sickbeard.common import Quality from sickbeard import helpers, exceptions, show_name_helpers, scene_exceptions from sickbeard import name_cache from sickbeard.exceptions import ex import xml.dom.minido...
from DIRAC import S_ERROR, S_OK, gLogger from DIRAC.DataManagementSystem.private.FTSAbstractPlacement import FTSAbstractPlacement, FTSRoute from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getFTS3Servers from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus import random class FTS3Pl...
"""Isolate Python 2.6 and 2.7 version-specific semantic actions here. """ from uncompyle6.semantics.consts import TABLE_DIRECT def customize_for_version26_27(self, version): ######################################## # Python 2.6+ # except <condition> as <var> # vs. older: # except <condition> ,...
import sys,re import json from jsonpath_rw import jsonpath, parse # pip2/pip3 install jsonpath_rw from lxml import etree import platform sysstr = platform.system() ### 判断操作系统类型 Windows Linux . 本脚本函数入口, 统一以 LINUX 为准, 其后在函数内进行转换 jsondoc=None def jsonnode(jsonstr,jsonpath): if jsonpath[0:5]=="JSON.": ## ...
import json import pytest from plugins.fishbans import fishbans, bancount from cloudbot import http test_user = "notch" test_api = """ {"success":true,"stats":{"username":"notch","uuid":"069a79f444e94726a5befca90e38aaf5","totalbans":11,"service":{"mcbans":0,"mcbouncer":11,"mcblockit":0,"minebans":0,"glizer":0}}} """ te...
import random from copy import copy from cnfgen.formula.cnf import CNF def Shuffle(F, polarity_flips='shuffle', variables_permutation='shuffle', clauses_permutation='shuffle'): """Reshuffle the given formula F Returns a formula logically equivalent to `F` with the followi...
import requests from requests.auth import HTTPBasicAuth import json from xml.dom import minidom import socket import struct import time class MockResponse(object): def __init__(self, status_code): self.status_code = status_code class Bravia(object): def __init__(self, hostname = None, ip_addr = None, ma...
import re import sigrokdecode as srd ann_cmdbit, ann_databit, ann_cmd, ann_data, ann_warning = range(5) class Decoder(srd.Decoder): api_version = 3 id = 'sda2506' name = 'SDA2506' longname = 'Siemens SDA 2506-5' desc = 'Serial nonvolatile 1-Kbit EEPROM.' license = 'gplv2+' inputs = ['logic']...
from setuptools import setup setup(name='edith', version='0.1.0a1', description='Edit-distance implementation with edit-path retrieval', author='david weil (tenuki)', author_email='tenuki@gmail.com', url='https://github.com/tenuki/edith', py_modules=['edith'], license="GNU Gene...
from setuptools import setup, find_packages from fccsmap import __version__ test_requirements = [] with open('requirements-test.txt') as f: test_requirements = [r for r in f.read().splitlines()] setup( name='fccsmap', version=__version__, author='Joel Dubowy', license='GPLv3+', author_email='jdu...
from __future__ import with_statement import os import sys from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig _this_dir = os.path.dirname((os.path.abspath(__file__))) _parent_dir = os.path.join(_this_dir, '../') for _p in (_this_dir, _parent_dir): if _p...
"""Google Code file uploader script. """ __author__ = 'danderson@google.com (David Anderson)' import http.client import os.path import optparse import getpass import base64 import sys def get_svn_config_dir(): pass def get_svn_auth(project_name, config_dir): """Return (username, password) for project_name in config_...
import math def clamp(val, min, max): if val <= min: return min elif val >= max: return max return val def fixAngle(angle): while angle > 180.0: angle -= 360.0 while angle < -180.0: angle += 360.0 return angle def diffAngle(angle1, angle2): return fixAngle(ang...
import re, shlex import hangups from hangupsbot.utils import text_to_segments from hangupsbot.handlers import handler, StopEventHandling from hangupsbot.commands import command default_bot_alias = '/bot' def find_bot_alias(aliases_list, text): """Return True if text starts with bot alias""" command = text.split...
from __future__ import unicode_literals from statemachine import _Statemachine class Windows8_1StateMachine(_Statemachine): def __init__(self, params): _Statemachine.__init__(self, params) def _list_share(self): return super(Windows8_1StateMachine, self)._list_share() def _list_running(self)...
import sys import urllib2, urllib, json from datetime import datetime, timedelta from lib import nwmodule trans_header = """<MaltegoMessage> <MaltegoTransformResponseMessage> <Entities>""" nwmodule.nw_http_auth() risk_name = sys.argv[1] fields = sys.argv[2].split('#') date_t = datetime.today() tdelta = timedelta(da...
import pytest from learn.models import Task, ProblemSet, Domain from learn.models import Student, TaskSession, Skill from learn.mastery import has_mastered, get_level from learn.mastery import get_first_unsolved_mission from learn.mastery import get_first_unsolved_phase from learn.mastery import get_current_mission_pha...
import os import json from flask import Flask, abort, jsonify, request, g, url_for from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.httpauth import HTTPBasicAuth from passlib.apps import custom_app_context as pwd_context from itsdangerous import (TimedJSONWebSignatureSerializer as Se...
from collections import defaultdict from xml.dom.minidom import parseString from textwrap import fill from os.path import dirname as os_dirname from os.path import join as os_join import dbm import sys import re import Sword from .utils import * data_path = os_join(os_dirname(__file__), 'data') def book_gen(): """ ...
import sys import os sys.path.append(os.path.join(sys.path[0], '..', 'config')) import featuredefs if len(sys.argv) != 2: print("Usage: %s FILE" % sys.argv[0]) exit(2) fdefs = featuredefs.defs(sys.argv[1])
from pycddb.dataset import Dataset from lingpy import Wordlist, csv2list from lingpy.compare.partial import _get_slices def prepare(ds): errs = 0 wl = Wordlist(ds.raw('bds.tsv')) W = {} for k in wl: value = wl[k, 'value'] tokens = wl[k, 'tokens'] doc = wl[k, 'doculect'] i...
import re def analyzeLine(txtlines): outline = [] lcnt = -1 for line in txtlines: lcnt += 1 typ = None itmText = None spc = (len(line) -len(line.lstrip()))*' ' tls = line.lstrip() if tls.lower().startswith('<body'): itmText = '<BODY>' t...
import opiniongame.config as og_cfg import opiniongame.IO as og_io import opiniongame.coupling as og_coupling import opiniongame.state as og_state import opiniongame.opinions as og_opinions import opiniongame.adjacency as og_adj import opiniongame.selection as og_select import opiniongame.potentials as og_pot import op...
import sys, os sys.path.insert(0, os.path.abspath('../')) import pyrotrfid extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] templates_path = ['templates'] source_suffix = '.rs...
"""AGI script that renders speech to text using Google Cloud Speech API using the REST API.""" from __future__ import print_function db_update = ("UPDATE `{0}` SET `{1}` = '{2}' WHERE id = {3}") db_int = ("UPDATE `{0}` SET `{1}` = `{1}` + {2} WHERE id = {3}") data = { 'table': 'tableName', 'field': 'billsec', 'value' ...
'''Dependencies: The ``scoretools`` package should not import ``instrumenttools`` at top level. ''' from abjad.tools import systemtools systemtools.ImportManager.import_structured_package( __path__[0], globals(), ) _documentation_section = 'core'
""" MRBPR Runner """ from os import path from argparse import ArgumentParser import shlex import subprocess import multiprocessing import logging from run_rec_functions import read_experiment_atts from mrbpr.mrbpr_runner import create_meta_file, run logging.basicConfig(format='%(asctime)s : %(levelname)s : %(name)s : %...
""" Written by: True Demon The non-racist Kali repository grabber for all operating systems. Git Kali uses Offensive Security's package repositories and their generous catalog of extremely handy penetration testing tools. This project is possible because of Offensive Security actually sticking to good practices and kee...
""" """ __version__ = "$Id$" import trace from trace_example.recurse import recurse tracer = trace.Trace(count=True, trace=False, outfile='trace_report.dat') tracer.runfunc(recurse, 2) report_tracer = trace.Trace(count=False, trace=False, infile='trace_report.dat') results = tracer.results() results.write_results(summa...
import os DEBUG = True if os.environ.get('DJANGO_DEBUG', None) == '1' else False TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS import dj_database_url DATABASES = {'default': dj_database_url.config()} TIME_ZONE = 'UTC' LANGUAGE_CODE = 'en-us' SITE_ID = 1 USE_I18N = ...
import argparse import pathlib import numpy as np def waterfall(input_filename, output_filename): fs = 200 nfft = 8192 w = np.blackman(nfft) x = np.fromfile(input_filename, 'int16') x = (x[::2] + 1j*x[1::2])/2**15 freq_span = 5 nbins = round(freq_span / fs * nfft) # In these recordings t...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('contests', '0001_initial'), ] operations = [ migrations.CreateModel( name='SuspendedProblem', fields=[ ('id', mod...
import time import threading def play(name,count): for i in range(1,count): print('%s %d in %d' %(name, i, count)) time.sleep(1) return if __name__=='__main__': t1=threading.Thread(target=play, args=('t1',10)) # 设置为守护线程 t1.setDaemon(True) t1.start() print("main") # 等待子线程结...
import os SITEURL = 'http://$DOMAIN' OGC_SERVER['default']['LOCATION'] = os.path.join(GEOSERVER_URL, 'geoserver/') OGC_SERVER['default']['PUBLIC_LOCATION'] = os.path.join(SITEURL, 'geoserver/') """ SITE_DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(PROJECT_R...
""" WSGI config for model_advanced project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SE...
__license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import os, subprocess, hashlib, shutil, glob, stat, sys, time from subprocess import check_call from tempfile import NamedTemporaryFile, mkdtemp from zipfile import ZipFile if __name__ == '__main__'...
import sys, os.path dirfichero = os.path.realpath(os.path.dirname(__file__)) if os.path.realpath(os.path.curdir) == dirfichero: os.chdir("..") if ("utils" in os.listdir(os.path.curdir) and os.path.abspath(os.path.curdir) not in sys.path): sys.path.insert(0, ".") from utils.googlemaps import GoogleMaps, Goog...
import numpy as np import pandas as pd from scipy.integrate import quad from scipy import stats import astropy.constants as const import astropy.units as u from astropy.coordinates import SkyCoord import subprocess as sp import os, re import time AU = const.au.cgs.value RSUN = const.R_sun.cgs.value REARTH = const.R_ear...
""" /* * Custom handlers for the BBB * */ """ import Adafruit_BBIO.GPIO as GPIO GPIO.setup("P9_12", GPIO.OUT) def alexaHandler(client, userdata, message): print "Received payload: " + str(message.payload.decode()) # Assume only 1 and 0 are send here. if message.payload == "1": GPIO.output("P9_12"...
import skapp from optparse import OptionParser import sys parser = OptionParser( usage = "%prog [options]", description = """A simple snake game.Suggest that resize your terminal window at a property size befor playing!""", epilog = "rapidhere@gmail.com", version = "0.1" ) parser.add_option( "","--k...
from __future__ import absolute_import import re try: import regex _regex_available = True except ImportError: _regex_available = False import phonenumbers from six.moves import zip from language_utilities.constant import ENGLISH_LANG from ner_v2.detectors.base_detector import BaseDetector from ner_v2.detec...
import sys, os from gevent import select, monkey, spawn, Greenlet, GreenletExit, sleep, socket from base64 import b64encode from hashlib import md5 from struct import pack, unpack from zlib import adler32 from Proto import Proto from Index import Index from Config import * class Client(Proto): def __init__(self, vp...
import shesha.config as conf simul_name = "bench_scao_sh_16x16_8pix" layout = "layoutDeFab_SH" p_loop = conf.Param_loop() p_loop.set_niter(1000) p_loop.set_ittime(0.002) # =1/500 p_geom = conf.Param_geom() p_geom.set_zenithangle(0.) p_tel = conf.Param_tel() p_tel.set_diam(4.0) p_tel.set_cobs(0.2) p_atmos = conf.Param_...
import math import random import pygame from pygame.locals import * pygame.init() pygame.mixer.init() width, height = 800, 600 screen = pygame.display.set_mode((width, height)) keys = [False, False, False, False] player = [100, 520] invaders = [] bullets = [] bombs = [] rockets = [] rocketpieces = [] bgimg = pygame.ima...
""" Configuration and utilities for all the X509 unit tests """ import os import sys from datetime import datetime from pytest import fixture CERTDIR = os.path.join(os.path.dirname(__file__), "certs") HOSTCERT = os.path.join(CERTDIR, "host/hostcert.pem") HOSTKEY = os.path.join(CERTDIR, "host/hostkey.pem") USERCERT = os...
""" Base tools for administrable options """ from sqlalchemy import ( Column, Integer, String, Boolean, ForeignKey, ) from sqlalchemy.util import classproperty from sqlalchemy.sql.expression import func from autonomie_base.utils.ascii import camel_case_to_name from autonomie_base.models.base import ...
import json from mflow_nodes.processors.base import BaseProcessor from mflow_nodes.stream_node import get_processor_function, get_receiver_function from mflow_nodes.node_manager import NodeManager def setup_file_writing_receiver(connect_address, output_filename): """ Setup a node that writis the message headers...
"""Tool to initialize Thrustmaster racing wheels.""" import argparse import time import tmdrv_devices import usb1 from importlib import import_module from os import path from subprocess import check_call, CalledProcessError device_list = ['thrustmaster_t500rs', 'thrustmaster_tmx', 'thrustmaster_tx', 'thrustmaster_tsxw'...
from time import time from gi.repository import GLib, GObject from pychess.Utils.const import WHITE, BLACK from pychess.System.Log import log class TimeModel(GObject.GObject): __gsignals__ = { "player_changed": (GObject.SignalFlags.RUN_FIRST, None, ()), "time_changed": (GObject.SignalFlags.RUN_FIRST...
__author__ = 'ogaidukov' import os.path import argparse import tornado.ioloop import tornado.httpserver import tornado.web from commonlib import configparser, logmaker from rotabanner.lib import route import redis import pygeoip config = None logger = None args = None redisdb = None geoip = None def init_application():...
from collections import defaultdict from math import log2 as log from gui.transcriptions import STANDARD_SYMBOLS from imports import (QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QRadioButton, QButtonGroup, QPushButton, QStackedWidget, QWidget, QComboBox, QMessageBox, QLabel, QLineEdit, QTableWidge...
""" The utility Author: lipixun Created Time : 日 2/12 14:14:50 2017 File Name: utils.py Description: """ from spec import DataPath try: import simplejson as json except ImportError: import json import nltk nltk.data.path = [ DataPath ]
""" WSGI config for antibiobank project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "antibiobank.settings") from django.co...
import traceback import json from ansible.module_utils._text import to_text, to_native from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import env_fallback from ansible.module_utils.connection import Connection, ConnectionError from ansible.module_utils.network.common.netconf import ...
import sqlite3 import os, sys, time, datetime, random, string import urllib.request, urllib.error import configparser from flask import Flask, request, session, redirect from flask import render_template, g, flash, url_for from contextlib import closing from .modules import Pagi from pxeat import app from config import...
import pigpio import time class LeftEncoder: def __init__(self, pin=24): self.pi = pigpio.pi() self.pin = pin self.pi.set_mode(pin, pigpio.INPUT) self.pi.set_pull_up_down(pin, pigpio.PUD_UP) cb1 = self.pi.callback(pin, pigpio.EITHER_EDGE, self.cbf) self.tick = 0 d...
n = int(input()) def sum_kv_cifr(x): su = 0 for i in str(x): su += int(i)*int(i) return su maxi_power = 0 for i in range(1, n//2+1): print('______',i) for k in range(n//i, 0, -1): power = sum_kv_cifr(i * k) print('_', k, power) if power > maxi_power: maxi_...
import unittest from .Weather_analyzer import is_not_number class BtcPriceTestCase(unittest.TestCase): def test_checking_of_input_in_form(self): input = 46 answer = is_not_number(input) # The bitcoin returned changes over time! self.assertEqual(answer, False)
import argparse import math import re def convertTable(gro_in_file, esp_out_file, sigma=1.0, epsilon=1.0, c6=1.0, c12=1.0): """Convert GROMACS tabulated file into ESPResSo++ tabulated file (new file is created). First column of input file can be either distance or angle. For non-bonded files, c6 and c12 can...
import csv, random def askName(): # askName function returns the name of the student print("Welcome to the Super Python Quiz!") yourName = input("What is your name? ") print ("Hello",str(yourName)) return yourName def getQuestions(): ...
""" WSGI config for mng_files project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ """ import os import sys path = os.path.abspath(__file__+'/../..') if path not in sys.path: sys.path...
""" Test sickbeard.helpers Methods: fixGlob indentXML remove_non_release_groups isMediaFile isRarFile isBeingWritten remove_file_failed makeDir searchIndexerForShowID listMediaFiles copyFile moveFile link hardlinkFile symlink moveAndSymlinkFile make_di...
''' Decomposition ------------- The core of sector decomposition. This module implements the actual decomposition routines. Common ~~~~~~ This module collects routines that are used by multiple decompition modules. .. autoclass:: pySecDec.decomposition.Sector .. autofunction:: pySecDec.decomposition.squash_symmetry_red...
from robottelo.constants import FILTER, FOREMAN_PROVIDERS from nailgun import entities from robottelo.ui.base import Base, UINoSuchElementError, UIError from robottelo.ui.locators import common_locators, locators, tab_locators from robottelo.ui.navigator import Navigator class ResourceProfileFormBase(object): """Ba...
from world import NORTH,SOUTH,EAST,WEST from utils import trace_error import re,gettext try: #print "current _", _ old_ = _ except Exception,info: print >> sys.stderr, "in gvrparser locale switch:\n",info _ = gettext.gettext KEYWORDS = ( _('ROBOT'), _('WALL'), _('BEEPERS'), _...
from aquarius.objects.Book import Book class GetBookByTitleAndAuthor(object): def __init__(self, connection): self.__connection = connection def execute(self, book): b = Book() sql = "SELECT Id, Title, Author FROM Book WHERE Title=? AND Author=?" r = list(self.__connection.execut...
from django.contrib import admin from comments.models import Comment admin.site.register(Comment)
""" Created on Tue Dec 08 13:25:40 2015 @author: J. Alejandro Cardona """ from Board import * import pygame UP, LEFT, DOWN, RIGHT = 1, 2, 3, 4 juego = Board() _2 = pygame.image.load("2.jpg"); _2re = _2.get_rect() _4 = pygame.image.load("4.jpg"); _4re = _4.get_rect() _8 = pygame.image.load("8.jpg"); _8re = _8.get_rect()...
from __future__ import division import numpy as np import argparse import matplotlib.pyplot as plt from matplotlib.colors import colorConverter from mpl_toolkits.axes_grid1 import ImageGrid import matplotlib.cm as cm from amitgroup.stats import bernoullimm def main(args): means = np.load('%s_means.npy' % args.save_...
import os from django import template from django.conf import settings from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag() def custom_css(): theme_path = os.path.join( settings.MEDIA_ROOT, "overrides.css" ) if os.path.exists(theme_path): ...
""" Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb. The bomb kills all the enemies in the same row and column from the planted point until it hits the wall since the wall is too strong to be destroyed. Note that you ca...
from distutils.core import setup setup( name='libtorrent', version='1.0.9', packages=['libtorrent',], data_files=[('Lib', ['libtorrent/libtorrent.pyd']),], )
from pyFTS.common import FuzzySet, Membership import numpy as np from scipy.spatial import KDTree import matplotlib.pylab as plt import logging class Partitioner(object): """ Universe of Discourse partitioner. Split data on several fuzzy sets """ def __init__(self, **kwargs): """ Univers...
''' command_line.py Utility functions for reading command line arguments. Author: Martin Norbury Novemeber 2013 ''' import inspect import argparse def command_line(fn): ''' A decorator for functions intented to be run from the command line. This decorator introspects the method signature of the wrap...
from django.http import HttpResponseRedirect, JsonResponse from django.views.generic import CreateView, UpdateView from django.contrib.messages.views import SuccessMessageMixin from .models import HistoriaClinica, Patologia from .forms import HistoriaClinicaForms from apps.afiliados.models import Titular, Adherente fro...
import dns.resolver domain = raw_input ('Please input an domain: ') #输入域名地址 MX = dns.resolver.query(domain , "MX") #指定查询类型为A记录 for i in MX: # 遍历回应结果,输出MX记录的preference及exchanger信息 print 'MX preference =', i.preference, 'mail exchanger =', i.exchange if __name__ == "__main__": pass
from openerp import models, fields, api, _ from openerp.exceptions import ValidationError class ProductProduct(models.Model): _inherit = 'product.product' # Link rental service -> rented HW product rented_product_id = fields.Many2one( 'product.product', string='Related Rented Product', domai...
Version = "0.2.0" Description = "LOTRO/DDO Launcher" Author = "Alan Jackson" Email = "ajackson@bcs.org.uk" WebSite = "http://www.lotrolinux.com" LongDescription = "Lord of the Rings Online and Dungeons & Dragons Online\nLauncher for Linux & Mac OS X" Copyright=" (C) 2009-2010 AJackson" CLIReference = "Based on CLI l...
n=int(input('Enter any number: ')) if n%2!=0: n=n+1 for i in range(n): for j in range(n): if (i==int(n/2)) or j==int(n/2) or ((i==0)and (j>=int(n/2))) or ((j==0)and (i<=int(n/2))) or ((j==n-1)and (i>=int(n/2))) or ((i==n-1)and (j<=int(n/2))): print('*',end='') else: print...
import numpy, cairo, math from scipy import ndimage from .object3d import Object3d from .point3d import Point3d from .polygon3d import Polygon3d from .draw_utils import * from .colors import hsv_to_rgb, rgb_to_hsv def surface2array(surface): data = surface.get_data() if not data: return None rgb_arr...
import os.path import six from unittest import skipIf, skip import time import itertools from numpy import linspace from ecl.util.util import IntVector from ecl import EclDataType, EclUnitTypeEnum from ecl.eclfile import EclKW, EclFile from ecl.grid import EclGrid from ecl.grid import EclGridGenerator as GridGen from e...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('scoping', '0128_auto_20170808_0954')...
''' Created on Mar 20, 2011 @author: frederikns ''' from model.flyweight import Flyweight from collections import namedtuple from model.static.database import database from model.dynamic.inventory.item import Item class SchematicTypeMap(Flyweight): def __init__(self,schematic_id): #prevents reinitializing ...
import sys,time import simplejson as json from stompy.simple import Client import ConfigParser config = ConfigParser.ConfigParser() devel_config = ConfigParser.ConfigParser() config.read('/opt/ucall/etc/config.ini') devel_config.read('/opt/ucall/etc/devel_config.ini') stomp_host = config.get('STOMP', 'host') stomp_user...
import re import os import pytz from PIL import Image from dateutil.parser import parse from datetime import datetime from decimal import Decimal from django.template import Library from django.conf import settings from django.template.defaultfilters import stringfilter from django.utils import formats from django.util...
import unittest as ut import importlib_wrapper tutorial, skipIfMissingFeatures = importlib_wrapper.configure_and_import( "@TUTORIALS_DIR@/04-lattice_boltzmann/04-lattice_boltzmann_part2.py", gpu=True, loops=400) @skipIfMissingFeatures class Tutorial(ut.TestCase): system = tutorial.system if __name__ == "__m...
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ProxyServe.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
from __future__ import division from math import sqrt, pi import unittest from sapphire import clusters class SimpleClusterTest(unittest.TestCase): def setUp(self): self.cluster = clusters.SimpleCluster(size=100) def test_station_positions_and_angles(self): a = sqrt(100 ** 2 - 50 ** 2) e...
from math import * def f(e, x): return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')'))) def solve(e, a, b): N = 1999 t = f(e, a) + f(e, b) for i in range(1, 2*N): if i % 2 == 0: t += 2*f(e, a + (b-a)*i/2/N) else: t += 4*f(e, a + (b-a)*i/2/N) return (b-a)*t/6/N def main(): ## with open('inpu...
"""Utility functions""" import os import difflib def get_diff(str1, str2): """Returns git-diff-like diff between two strings""" expected = str1.splitlines(1) actual = str2.splitlines(1) diff = difflib.unified_diff(expected, actual, lineterm=-0, n=0) return ''.join(diff) def ensure_directory(path): ...
from openerp.osv import fields, osv from openerp.tools.translate import _ from . import api class stock_packages(osv.osv): _inherit = "stock.packages" def cancel_postage(self, cr, uid, ids, context=None): for package in self.browse(cr, uid, ids, context=context): if package.shipping_company_...
from nbxmpp.namespaces import Namespace from nbxmpp.protocol import NodeProcessed from nbxmpp.structs import StanzaHandler from nbxmpp.task import iq_request_task from nbxmpp.errors import MalformedStanzaError from nbxmpp.modules.base import BaseModule from nbxmpp.modules.util import raise_if_error from nbxmpp.modules....
import os import json import platform from collections import defaultdict from anaconda_go.lib import go from anaconda_go.lib.plugin import typing cachepath = { 'linux': os.path.join('~', '.local', 'share', 'anaconda', 'cache'), 'darwin': os.path.join('~', 'Library', 'Cache', 'anaconda'), 'windows': os.path...