content stringlengths 4 20k |
|---|
#!/bin/env python
"""
The MIT License
Copyright (c) 2010 The Chicago Tribune & Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... |
'''
Includes complex class definitions, functions, etc that will be
used by simulated IDL components.
There are several intended purposes of this module and the
first is to place code relating to complex simulations outside
of the domain of the ACS CDB. In doing so, code checking tools
can be used to analyze the d... |
"""
SQLAlchemy adapter module.
@see: U{SQLAlchemy homepage<http://www.sqlalchemy.org>}
@since: 0.4
"""
from sqlalchemy import orm, __version__
try:
from sqlalchemy.orm import class_mapper
except ImportError:
from sqlalchemy.orm.util import class_mapper
import pyamf
UnmappedInstanceError = None
try:
c... |
"""Tests the capability for registered students to invite others."""
__author__ = 'John Orr (<EMAIL>)'
import urlparse
from common import crypto
from models import courses
from models import models
from models import transforms
from modules.invitation import invitation
from modules.notifications import notification... |
'''sashwindow_tools.py - custom painting of sashwindows
This module takes over painting the sash window to make it a little more obvious
CellProfiler is distributed under the GNU General Public License.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyr... |
import proto # type: ignore
from google.ads.googleads.v7.resources.types import user_list
from google.protobuf import field_mask_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
__protobuf__ = proto.module(
package='google.ads.googleads.v7.services',
marshal='google.ads.googleads.v7',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import django
import sys
import unittest
from inspect import getfile
from os.path import dirname
from rainbowtests import colors
class ColorfulOut:
"""Wrapper around sys.sdout to make it's output colorful"""
def write(self, arg, **kwargs):
return sys.s... |
import subprocess
import os
import sys
import logging
import time
import settings
import re
import uuid
import requests_unixsocket
import requests
from threading import Thread
from threading import Event
# We use an integer for time and record microseconds.
SECONDSTOMICROSECONDS = 1000000
def all_subclasses(obj):
... |
"""Module to handle interactions with Windows Firmware Passwords."""
from cauliflowervest.server import permissions
from cauliflowervest.server.handlers import firmware_handler
from cauliflowervest.server.models import firmware as firmware_model
class WindowsFirmwarePassword(firmware_handler.FirmwarePasswordHandler)... |
import mock
import cms.api
from cms.models import Page
from django.core.exceptions import ImproperlyConfigured
from django.test import RequestFactory, TestCase
from shop.models.defaults.mapping import ProductPage
from shop.rest.filters import RecursiveCMSPagesFilterBackend
from myshop.models import Product
from mysho... |
#!/usr/env/python2
"""
Implements multi-threaded job handler that solves a classic network problem:
When processing a network job, often there will be data transferred but at such a slow
rate that the connection is in fact "hung". In this case, the thread should be considered
as "dead", and another thread ... |
from rest_framework import serializers
from apps.plea.models import (
AuditEvent,
Case,
CaseOffenceFilter,
Offence,
UsageStats,
)
from apps.result.models import Result, ResultOffence, ResultOffenceData
from apps.plea.standardisers import standardise_urn
from apps.plea.validators import is_valid_urn... |
from toee import *
import race_defs
###################################################
print "Registering race: Wild Elf"
raceEnum = race_elf + (4 << 5)
raceSpec = race_defs.RaceSpec()
raceSpec.hit_dice = dice_new("0d0")
raceSpec.level_modifier = 0
raceSpec.help_topic = "TAG_WILD_ELF"
raceSpec.flags ... |
import mock
from rally.plugins.openstack.context.nova import keypairs
from tests.unit import test
CTX = "rally.plugins.openstack.context.nova"
class KeyPairContextTestCase(test.TestCase):
def setUp(self):
super(KeyPairContextTestCase, self).setUp()
self.users = 2
task = {"uuid": "foo_t... |
#------------------------------------------------------------------------------
#-- FRIKI: Freecad, RobotIcs and KInematics
#------------------------------------------------------------------------------
#-- (C) Juan Gonzalez-Gomez (Obijuan) March - 2015
#--------------------------------------------------------------... |
from __future__ import division, print_function, absolute_import
from itertools import product
from numpy.testing import assert_allclose
import pytest
from scipy import special
from scipy.special import cython_special
int_points = [-10, -1, 1, 10]
real_points = [-10.0, -1.0, 1.0, 10.0]
complex_points = [complex(*t... |
class Group(object):
"""Group inside the Board."""
def __init__(self, board, row, col):
self.points = set()
self.color = board.state[row][col]
self.is_surrounded = self.color is not None
to_handle = set()
to_handle.add((row, col))
while to_handle:
r... |
import numpy as np
import param
from ..core import util
from ..core import Dimension, Dataset, Element2D
from ..core.data import GridInterface
from .geom import Points, VectorField # noqa: backward compatible import
from .stats import BoxWhisker # noqa: backward compatible import
class Chart(Dataset, Elemen... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("pinboard", "0012_account_is_active"),
]
operations... |
from msrest.serialization import Model
class Usage(Model):
"""The usage data for a usage request.
Variables are only populated by the server, and will be ignored when
sending a request.
:param unit: The unit of the metric. Possible values include: 'Count',
'Bytes', 'Seconds', 'Percent', 'CountP... |
"""
Exception related utilities.
"""
import contextlib
import logging
import sys
import traceback
from hotzenplotz.openstack.common.gettextutils import _
@contextlib.contextmanager
def save_and_reraise_exception():
"""Save current exception, run some code and then re-raise.
In some cases the exception cont... |
#main: ../run.py
"""Copyright (c) 2015 Nash
http://slackingsource.wordpress.com/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use... |
#!/usr/bin/env python
import os
import importlib
import shutil
import sys
from wsgiref.simple_server import make_server
from ngo.backends import NgoTemplate
def runserver(ip='127.0.0.1', port='8000'):
"""開発用サーバーを起動する"""
from ngo.wsgi import get_wsgi_application
application = get_wsgi_application()
wit... |
from ..exceptions import InvalidChoiceError
from .base import MarathonObject
class MarathonContainer(MarathonObject):
"""Marathon health check.
See https://mesosphere.github.io/marathon/docs/native-docker.html
:param docker: docker field (e.g., {"image": "mygroup/myimage"})'
:type docker: :class:`ma... |
"""
Manage figures for pyplot interface.
"""
import sys, gc
import atexit
import traceback
def error_msg(msg):
print >>sys.stderr, msg
class Gcf(object):
"""
Manage a set of integer-numbered figures.
This class is never instantiated; it consists of two class
attributes (a list and a dictionary... |
'''
* Copyright (C) 2015 Touch Vectron
*
* Author: Cornel Punga
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it wil... |
extensions = [
'oslosphinx',
'reno.sphinxext',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
proj... |
import os
current_dir = os.path.dirname(os.path.abspath(__file__)) + "/"
def index(songData):
return open(current_dir + "static/html/index.html").read()
def tv(songData):
return open(current_dir + "static/html/tv.html").read()
def mobile(songData):
returnData = open(current_dir + "static/html/mobile.html").read(... |
import math
from urllib.request import urlretrieve
import torch
from PIL import Image
from tqdm import tqdm
class Warp(object):
def __init__(self, size, interpolation=Image.BILINEAR):
self.size = int(size)
self.interpolation = interpolation
def __call__(self, img):
return img.resize(... |
"""
Compile CoreML Models
=====================
**Author**: `Joshua Z. Zhang <https://zhreshold.github.io/>`_
This article is an introductory tutorial to deploy CoreML models with NNVM.
For us to begin with, coremltools module is required to be installed.
A quick solution is to install via pip
.. code-block:: bash
... |
from __future__ import print_function, unicode_literals
import os
import sys
import shutil
import zipfile
import datetime
import tempfile
import json as json
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from contextlib import closing
import requests
import numpy as np
from ... |
from mock import patch
# 3p
from nose.plugins.attrib import attr
# project
from tests.core.test_wmi import TestCommonWMI
from tests.checks.common import AgentCheckTest
def to_time(wmi_ts):
"Just return any time struct"
return (2100, 12, 24, 11, 30, 47, 0, 0)
def from_time(year=0, month=0, day=0, hours=0, m... |
from openerp import fields, models, api
class AccountInvoice(models.Model):
# Private attributes
_inherit = "account.invoice"
# Default methods
# @api.model
# def _get_partner_bank(self):
# inv_type = self._context.get('type', 'out_invoice')
# partner_bank = self.env['ir.... |
# %%
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
# %%
sns.set(color_codes=True)
tips = sns.load_dataset('tips')
tips.columns
tips.dtypes
tips.shape
# %%
# regplot
sns.regplot(x='total_bill', y='tip', data=tips)
# %%
# lmplot
sns.lmplot(x='total_bill', y='tip', data=tips)
# %%
sns.lmplo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... |
from setuptools import setup, find_packages
from setuptools.command.sdist import sdist
from subprocess import check_call
import os
from hs_build_tools.setup import get_version_and_add_release_cmd
class MySdistCommand(sdist):
def run(self):
npm = 'npm'
if os.name == 'nt':
npm = 'npm.cmd... |
from inspect import getargspec
from itertools import takewhile
from types import FunctionType
from pygame.time import get_ticks
from diamond import event
from diamond.helper.weak_ref import Wrapper
from diamond.helper.ordered_set import OrderedSet
# from diamond.decorators import dump_args
class OnetimeTick(list):
... |
"""CSS selector structure items."""
import copyreg
from collections.abc import Hashable, Mapping
__all__ = (
'Selector',
'SelectorNull',
'SelectorTag',
'SelectorAttribute',
'SelectorContains',
'SelectorNth',
'SelectorLang',
'SelectorList',
'Namespaces',
'CustomSele... |
# -*- coding: utf-8 -*-
from module.plugins.internal.SimpleCrypter import SimpleCrypter
from module.plugins.internal.misc import json
class GooGl(SimpleCrypter):
__name__ = "GooGl"
__type__ = "crypter"
__version__ = "0.07"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?goo\.gl/... |
import gtk, gobject
class GtkCheckRadio(gtk.MenuItem):
# VBOX
"""
This class handles having an arbitrary number of check radio buttons, but have it act as
a real radio control.
We want to be able to have our elements notify us of an event ( by making GtkCheckRadio emit
a toggled signal )
"""
... |
from AdventureEngine.components.gamecomponent import GameComponent
class World(GameComponent):
def __init__(self):
GameComponent.__init__(self)
self.m_type = "world"
self.m_spaceDescription = None
self.m_landingDescription = None
self.m_name = None
self.m_music = None
self.m_tileList = []
c... |
## this program determines the highest number the user has entered.
# ask the user for input
number1=int(input("Please enter the first number: "))
number2=int(input("Please enter the second number: "))
number3=int(input("Please enter the third number: "))
# conditions
if (number1>number2) and (number1>number3):
p... |
from spack import *
class Voropp(MakefilePackage):
"""Voro++ is a open source software library for the computation of the
Voronoi diagram, a widely-used tessellation that has applications in many
scientific fields."""
homepage = "http://math.lbl.gov/voro++/about.html"
url = "http://math.lbl.... |
"""Resolves non-system C/C++ includes to their full paths to help Arduino."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import re
import sys
import six
def replace_includes(line, supplied_headers_list):
"""Updates any includes to r... |
#!/usr/bin/python
## Author: Hailey Bureau
## Latest edits: 28 May 2014
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from pylab import *
from matplotlib import rcParams
# FONTSIZE xx-small,x-small,small,medium,large,x-large,xx-large
fpropxxl=matp... |
import datetime
import http.client
import urllib.parse
import ssl
class sms(object):
def __init__(self, username, password, host='https://sms.stadel.dk/send.php', ssl_context=None):
"""Create a new SMS sender"""
self.srv = {
'username': username,
'password': password... |
"""
Wrapper for loading templates from the filesystem.
"""
import errno
import io
import warnings
from django.core.exceptions import SuspiciousFileOperation
from django.template import Origin, TemplateDoesNotExist
from django.utils._os import safe_join
from django.utils.deprecation import RemovedInDjango20... |
'''
Exercício 2 - (Difícil) Soma das hipotenusas
Escreva uma função soma_hipotenusas que receba como parâmetro um número inteiro positivo n
e devolva a soma de todos os inteiros entre 1 e n que são comprimento da hipotenusa de algum triângulo retângulo com catetos inteiros.
Dica1: um mesmo número pode ser hipotenusa ... |
from abc import abstractmethod, ABC
from io import BytesIO
from typing import TypeVar, Generic
T = TypeVar('T')
class TypeSerializer(ABC, Generic[T]):
"""
This interface describes the methods that are required for a data type to be handled by the
Flink runtime. Specifically, this interface contains the s... |
from Components.VariableText import VariableText
from enigma import eLabel, eEPGCache
from Components.config import config
from Renderer import Renderer
from time import localtime
class NextEvent(Renderer, VariableText):
def __init__(self):
Renderer.__init__(self)
VariableText.__init__(self)
self.epgcache = eEP... |
import os
import re
import logging
import shutil
from autotest.client import utils, test
from autotest.client.test_config import config_loader
from autotest.client.shared import error, software_manager
class dacapo(test.test):
"""
This autotest module runs the dacapo benchmark suite.
This benchmark sui... |
from m400lib import r40_str, wload
# ------------------------------------------------------------------------
class DDEntry:
# --------------------------------------------------------------------
def __init__(self, pos, data):
self.pos = pos
self.name = r40_str(data[0:2]).strip().lower()
... |
# coding=utf-8
from __future__ import unicode_literals
import logging
from collections import OrderedDict
import os
import time
from colorama import Fore, Style
import six
from six import python_2_unicode_compatible
from copy import deepcopy
from .util import pick, utf8print
log = logging.getLogger(__name__)
@python... |
# Lint as: python3
"""Utility functions to load a Resnet34 tf checkpoint into JAX-ssd model.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import REDACTED
from __future__ import print_function
from flax import optim
import jax.numpy as jnp
import tensorflow.compat.v1 as tf... |
import peel
import pymolecule
part_1 = pymolecule.Molecule()
part_1.fileio.load_pdb_into('helixPt1.pdb')
part_2 = pymolecule.Molecule()
part_2.fileio.load_pdb_into('helixPt2.pdb')
#peel_1.write_vmd_script_file('peel1.vmd'')
peel_1 = peel.peel(part_1, peel.defaultParams)
fmaps_1 = peel_1.create_feature_maps([25,55,-... |
from zeep import Client
from zeep.wsse.username import UsernameToken
from zeep.transports import Transport
from .models import NewOrder, OrderStatus
class AlfabankSoapClient(object):
def __init__(self, username, password, timeout=30,
endpoint='https://test.paymentgate.ru/testpayment/webservices... |
from parsec.api.protocol import OrganizationID, DeviceID
from parsec.backend.backend_events import BackendEvent
from parsec.backend.user import (
UserError,
UserNotFoundError,
UserAlreadyExistsError,
DeviceInvitation,
)
from parsec.backend.postgresql.handler import send_signal
from parsec.backend.postgr... |
import json
from typing import Dict, Optional
from ._abc import AbcCacheStore
from ..database import DatabaseMain
class GameAbbreviationsMixin(AbcCacheStore):
async def loadGameAbbreviations(self) -> Dict[str, str]:
gameAbbreviations: Dict[str, str]
db: DatabaseMain
async with DatabaseMai... |
from __future__ import unicode_literals
from setuptools import find_packages, setup
utils_requirements = ["requests", "requests-cache", "tqdm"]
EXTRA_REQUIREMENTS = {
"cli": ["click"] + utils_requirements,
"csv": ["unicodecsv"],
"detect": ["file-magic"],
"html": ["lxml"], # apt: libxslt-dev libxml2-d... |
import os
import sys
import gzip
import time
import numpy as np
import pickle as pkl
from sklearn.metrics import roc_auc_score
from models import MTR_subgrad as MTR
if len(sys.argv) != 7:
print('Usage: python', sys.argv[0],
'WORK_DIR DATASET C1 C2 C3 TRAIN_DEV(Y/N)')
sys.exit(0)
else:
work_... |
"""Certificates API
This is a Python API for generating certificates asynchronously.
Other Django apps should use the API functions defined in this module
rather than importing Django models directly.
"""
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from eventtracking ... |
class Stub(object):
"""
Simple stub class. This can be inserted in place of a function, i.e.
instance.somefunc = Stub
Then, when instance.somefunc(*args, **kwargs) is called, we can record this.
This is similar to python Mock functionality, however this works more nicely
for comparing retu... |
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
class RouteState(object):
def __init__(self, request):
self._prefixes = ()
# matched subdomain with aliases replaced by their main value
self.primary_subdomains = () # tuple to be sure it's readonly
self.... |
# -*- coding: utf-8 -*-
"""
This file is part of COS : Collecte d'Opinions lors de Soutenances
(Collect Opinions during defenSes).
Copyright: Copyright (C) 2016-2017
Contact: <EMAIL>
This file is part of COS : Collecte d'Opinions lors de Soutenances
(Collect Opinions during defenSes).
COS is free software: y... |
import os
import argparse
import subprocess
import re
import math
from lxml import etree
class Error(Exception):
def __init__(self, message):
self.message = message
class Encoder (object):
def __init__(self,
in_file=None,
in_srt=None,
out_file=None... |
"""
Functions to compute the COM and the ZMP
For now, the base link moves in translation only, no rotation allowed
"""
from openravepy import *
from numpy import *
def v2t(v):
T=eye(4)
T[0:3,3]=v
return T
##########################################################################
def ComputeJacobian... |
"""Reverse Port Forwarding class to provide webpagereplay to mobile devices."""
from selenium import webdriver
import os
import sys
# TODO(chris) this path will be subject to change as we put the ispy
# file system together.
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
... |
import unittest2
from google.appengine.ext import testbed
from consts.client_type import ClientType
from consts.notification_type import NotificationType
from notifications.ping import PingNotification
class TestBaseNotification(unittest2.TestCase):
def setUp(self):
self.testbed = testbed.Testbed()
... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
1. 控制台 I/O
input() 函数接受来自用户的输入,可选的字符串参数可以在控制台上打印。
实例中,输入的字符无法转换成整型时,将产生异常并被异常处理程序捕捉。
不输入任何参数,程序将直接跳出,且不会打印统计信息。
2. 重定向 I/O
重定向 I/O 不需要打印提示信息。
程序结束,以EOF 文件结尾字符作为标记。
3. 异常位置
异常集中放在程序末尾,以保证主要流程尽可能清晰。
$ python3 g_input_output.py
Type integers, each followed by Enter; or ... |
# python
# This file is generated by a program (mib2py). Any edits will be lost.
from pycopia.aid import Enum
import pycopia.SMI.Basetypes
Range = pycopia.SMI.Basetypes.Range
Ranges = pycopia.SMI.Basetypes.Ranges
from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, N... |
from datetime import datetime, timedelta
from bs4 import BeautifulSoup
from operator import attrgetter
import re
import requests
from statistics import pstdev, mean
from app import app, db
from app.models import Song, Album, Artist, Similar
from app.lastfm import LastFm
def update_song_similars(song, days=90):
#... |
"""TrailDB to TimeSeries
Todo: Consider direct processing trails here and bypass the traildb/sqlite.
"""
from collections import defaultdict
import datetime
import logging
import os
import subprocess
import tempfile
import time
import boto3
from botocore.exceptions import ClientError
import click
from concurrent.fut... |
# coding=utf-8
"""InaSAFE Wizard Step Aggregation Layer Canvas."""
from qgis.core import QgsProject
# noinspection PyPackageRequirements
from qgis.PyQt import QtCore, QtGui
# noinspection PyPackageRequirements
from qgis.PyQt.QtCore import pyqtSlot
# noinspection PyPackageRequirements
from qgis.PyQt.QtWidgets import QL... |
""" Module provides functionality for common gui related tasks. """
import sys
from thread import get_ident
from threading import Lock, Condition
from qt import QMimeSourceFactory, QCustomEvent, QObject, qApp, QEvent, \
QPixmap, QApplication, QLabel, \
QPoint, Qt, QFrame
fro... |
import json
from datetime import datetime
import pytz
from flask import Blueprint
from flask import make_response
from flask import request, url_for, flash, render_template
from flask.ext import login
from flask.ext.restplus import abort
from markupsafe import Markup
from werkzeug.utils import redirect
from app.helpe... |
# coding=utf-8
import requests
from emft.core.logging import make_logger
from emft.core.singleton import Singleton
from .gh_errors import AuthenticationError, GHSessionError, GithubAPIError, NotFoundError, \
RateLimitationError, RequestFailedError
from .gh_objects.gh_repo import GHRepo, GHRepoList
from .gh_objects... |
"""Common functions for various parts of gtkui to use."""
import os
import pygtk
pygtk.require('2.0')
import gtk
import logging
import deluge.component as component
import deluge.common
log = logging.getLogger(__name__)
def get_logo(size):
"""Returns a deluge logo pixbuf based on the size parameter."""
if ... |
from icc.cellula.indexer.interfaces import IIndexer
from zope.interface import implementer, Interface
from zope.component import getUtility
import subprocess as sp
from icc.contentstorage import intdigest, hexdigest
import os.path, os, signal
from icc.cellula.indexer.sphinxapi import *
from pkg_resources import resourc... |
from builtins import object
import logging
from nose.plugins.skip import SkipTest
from nose.tools import assert_equal, assert_false, assert_not_equal, assert_true
from indexer.conf import ENABLE_SQOOP
from indexer.indexers.rdbms import _get_api
from librdbms.server import dbms as rdbms
from useradmin.models import Us... |
"""tests for ConsoleAuth class."""
from pkaaw.console_auth import ConsoleAuth
import pkaaw.coach_and_student as pcs
from helper import ObjectTest
class ConsoleAuthTest(ObjectTest):
def setUp(self):
self.configure()
def test_get_request_tokens(self):
khan_auth = ConsoleAuth(self.APP_KEYS)
... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def get_sub_array_from_array(object_array, to_match):
'''
Finds and returns a sub array from an array of arrays.
to_match should be a unique idetifier of a sub array
'''
num_matched = 0
for... |
"""Handle TeX formatting for matplotlib output
"""
from __future__ import division
import os
from astropy import units
from astropy.units.format import (latex as ulatex, utils as uutils)
__author__ = "Duncan M. Macleod <<EMAIL>>"
USE_TEX = os.system('which pdflatex > %s 2>&1' % os.devnull) == 0
LATEX_CONTROL_CHAR... |
"""
Django settings for lmtt project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
import uuid
import httplib2
from django import http
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.utils.datastructures import SortedDict
from django.contrib import sessions
from mox import IsA
from thermal import api as t_api
from thermal import CATALOGUES
from openstac... |
"""
Slow Exit typeclass
Contribution - Griatch 2014
This is an example of an Exit-type that delays its traversal.This
simulates slow movement, common in many different types of games. The
contrib also contains two commands, CmdSetSpeed and CmdStop for changing
the movement speed and abort an ongoing traversal, respe... |
"""stations URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
#K
#
# o
# h
# l
# c
# vol
# increase
# amplitude
from formula.Direction import Direction
def ct(t):
if t > 1000000000000:
return t/1000;
return t;
class K():
def __init__(self, data=None, idx=-1):
if data:
self.Set(data);
else:
self.Set... |
# -*- coding: utf-8 -*-
__license__ = "GNU Affero General Public License, Ver.3"
__author__ = "Pablo Alvarez de Sotomayor Posadillo"
# This file is part of Kirinki.
#
# Kirinki is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the ... |
from enum import Enum
class Slot(Enum):
HEAD=0
SHOULDER_L=1
SHOULDER_R=2
TORSO=3
ARM_L=4
ARM_R=5
LEGS=6
FEET=7
WEAPON=8
class Stat:
def __init__(self, name, id):
self.m_ID = id
self.m_name = name
self.m_xp = 0
def GetRating(self):
x = 0
y = -1
while self.m_xp >= x:
... |
data = (
'Bu ', # 0x00
'Zhang ', # 0x01
'Luo ', # 0x02
'Jiang ', # 0x03
'Man ', # 0x04
'Yan ', # 0x05
'Ling ', # 0x06
'Ji ', # 0x07
'Piao ', # 0x08
'Gun ', # 0x09
'Han ', # 0x0a
'Di ', # 0x0b
'Su ', # 0x0c
'Lu ', # 0x0d
'She ', # 0x0e
'Shang ', # 0x0f
'Di... |
import sys
from paravistest import datadir, pictureext, get_picture_dir
from presentations import CreatePrsForFile, PrsTypeEnum
import pvserver as paravis
# Create presentations
myParavis = paravis.myParavis
# Directory for saving snapshots
picturedir = get_picture_dir("Vectors/A6")
file = datadir + "clo.med"
prin... |
# coding: utf-8
from openerp import models, api, _
from openerp.exceptions import UserError
class sale_order_line(models.Model):
_inherit = 'sale.order.line'
@api.multi
def _check_routing(self, product, warehouse):
""" skip stock verification if the route goes from vendor to customer
... |
import numpy as np
import os
import sys
"""
This script parses a Gaussian09 output file and .rwf file.
It saves the number of basis function, number of electrons, Fock matrix/Kohn-Sham matrix and overlap matrix in a new folder.
"""
def lower_triangle2full(elements, nbf):
matrix = np.zeros((nbf, nbf))
count1 = 0... |
import sys
import os
# Windows
if sys.platform.startswith("win"):
from .win32_monitor import Win32Monitor as Monitor
# Mac OS
elif sys.platform == "darwin":
from .darwin_monitor import DarwinMonitor as Monitor
# Linux/X11
elif os.environ.get("XDG_SESSION_TYPE") == "x11":
from .x11_monitor import X11Monit... |
from nose.tools import assert_raises
from endicia.breakers.ChangePassPhraseXmlBreaker import ChangePassPhraseXmlBreaker
from lxml.builder import E
from lxml import etree
def test_ChangePassPhraseXmlBreaker_parses_correctly():
"""The ChangePassPhraseXmlBreaker should parse the response correctly."""
def mock_respons... |
import logging
import typing
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QDialogButtonBox
from autokey.qtui import common as ui_common
from autokey import iomediator, model, configmanager as cm
from autokey.iomediator.key import Key
logger = ui_common.logger.getChild("Hotkey Settings Dialog") #... |
from __future__ import absolute_import
from django.conf import settings
from zerver.models import get_client, UserProfile
from zerver.lib.response import json_success
from zerver.lib.validator import check_dict
from zerver.decorator import authenticated_api_view, REQ, has_request_variables, to_non_negative_int, flexibl... |
# -*- coding: utf-8 -*-
import numpy as np
# import scipy.stats as ss
# import scipy as sp
import pickle
import os
def calcDailyMeanTempv2(file_path, path_out_dmt, path_out_t95, t95_pickle_file_name):
# Year, Month, Day, Weather State (you probably won’t use this), Rainfall (mm), Tmax (oC), Tmin (oC), Short wave s... |
import os
import threading
import time
from types import ListType
import unittest
import mock
# 3p
from nose.plugins.attrib import attr
# project
from aggregator import MetricsAggregator
import logging
LOG_INFO = {
'log_to_event_viewer': False,
'log_to_syslog': False,
'syslog_host': None,
'syslog_po... |
"""
Plots the instantaneous drag coefficient between 0 and 20 time-units of flow
simulation and compares with numerical results from
Koumoutsakos and Leonard (1995).
_References:_
* Koumoutsakos, P., & Leonard, A. (1995).
High-resolution simulations of the flow around an impulsively started
cylinder using vortex m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.