src stringlengths 721 1.04M |
|---|
import datetime
import json
import time
import sys
from pprint import pprint
import requests
from django.conf import settings
from django.utils import timezone
from django.db.models import Count
from django.core.exceptions import ImproperlyConfigured
from funfactory.urlresolvers import reverse
from airmozilla.main.... |
#!/bin/env python
"""
Module simtk.unit.quantity
Physical quantities with units, intended to produce similar functionality
to Boost.Units package in C++ (but with a runtime cost).
Uses similar API as Scientific.Physics.PhysicalQuantities
but different internals to satisfy our local requirements.
In particular, there i... |
import codecs
import numpy as np
from sklearn.feature_extraction import DictVectorizer
def gold_reader(bow_file, l_file, sim_idx, vector=u'latent'):
op = codecs.open
sims = []
vectors = []
labels = []
unicodes = []
last_hour = None
with op(bow_file, u'r', u'utf-8') as bf, op(l_file, u'r', u... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
# -*- coding: utf-8 -*-
"""
sphinxcontrib.embedly
~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2013-2014 by the contributors (see AUTHORS file)
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
import os
from docutils import nodes
from ... |
# Copyright (C) 2002, Thomas Hamelryck (thamelry@vub.ac.be)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Align on protein structure onto another using SVD alignment.
SVDSuperimposer finds the b... |
#
# Copyright (c) 2015 Juniper Networks, 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 required by a... |
import numpy as np
from scipy.special import jn, jvp, jn_zeros
from scipy.integrate import quad
import matlibplot.pyplot as plt
class TE(object):
def __init__(self,l,m,n,R,L):
self.l = l
self.m = m
self.n = n
k1 = jn_zeros(m,l)/R
k3 = n*np.pi/L
def E_r(self, r, th... |
#!/usr/bin/env python3
# @author: R. Gowers, S. Al-Izzi, T. Pollington, R. Hill & K. Briggs
# Boyd and Vandenberghe, Convex Optimization, exercise 4.57 page 207
import cvxpy as cvx
import numpy as np
'''
Input parameters
P: channel transition matrix P_ij(t) = P(output|input) at time t
n: size of input
m: size o... |
from distutils import sysconfig
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
import os
import site
import sys
import setuptools
from copy import deepcopy
assert sys.version_info >= (3, 5), (
"Please use Python version 3.5 or higher, "
"lower version... |
# 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... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import gdspy
import picwriter.toolkit as tk
class StripSlotConverter(tk.Component):
"""Strip-to-Slot Side Converter Cell class. Adiabatically transforms a strip to a slot waveguide mode,... |
#!/usr/bin/python3
"""trello2misc.py
Pulls your cards from Trello to your console or your local todo.txt-file.
Broadly speaking, one card corresponds to one entry. Boards correspond to
contexts, lists to priorities, and labels to projects. See the README.md and
trello2misc.ini files for more information.
Author: Andr... |
from __future__ import print_function
from time import time
import logging
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.datasets import fetch_lfw_people
from sklearn.metrics import classification_report
from sklearn.me... |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase, Client
from issues.models import *
urls = "/admin/issues/issue/ /issues/cr... |
from rest_framework import permissions
class IsAuthorOrReadOnly(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permission(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always al... |
# -*- coding: utf-8 -*-
#
# 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
#... |
"""All models are direct mappings to the WePay objects. By default only the
fields that correspond to the values returned from WePay lookup calls
(ex. `/account <https://www.wepay.com/developer/reference/account#lookup>`_) are
included in the models. All fields follow the rules outlined in `Storing Data
<https://www.we... |
from io import StringIO
import os
import pytest
import numpy as np
import tempfile
import ruamel.yaml as ruamel_yaml
from calliope.core.attrdict import AttrDict, _MISSING
from calliope.test.common.util import check_error_or_warning
class TestAttrDict:
@pytest.fixture
def regular_dict(self):
d = {'a'... |
import os
import unittest
import numpy as np
from sdi.binary import Dataset
class TestRead(unittest.TestCase):
""" Test basic reading of binary files
"""
def setUp(self):
self.test_dir = os.path.dirname(__file__)
def test_read(self):
""" Test that all test files can be read without... |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Monopoly odds". The problem
is: If, instead of using two 6-sided dice, two 4-sided dice are used, find the
six-digit modal string.
"""
import argparse
import random
def main(args):
"""Monopoly odds"""
# Constants
SQUARES = 40
CC... |
from helper import unittest, PillowTestCase, hopper
# Not running this test by default. No DOS against Travis CI.
from PIL import PyAccess
import time
def iterate_get(size, access):
(w, h) = size
for x in range(w):
for y in range(h):
access[(x, y)]
def iterate_set(size, access):
(... |
'''
Created on Apr 8, 2016
@author: clintpg
'''
import codecs
from os.path import join
from collections import defaultdict
data_dir = "D:\\data\\clda-data"
ds_name = "reuters-21578"
# loc_country_file_path = join(data_dir, "%s.countries" % ds_name)
md_file_path = join(data_dir, "%s.csv" % ds_name)
europe = "alba... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
from util import irc
from util.garbage import rainbow
from util.handler_utils import prehook, get_value, set_value, get_target, cmdhook, fetch_all
from qtbot3_common.types.message import Message
disconnection_ladder = {
1: "Connection reset by peer",
5: "Connection reset by beer",
10: "Connection reset by... |
# -*- 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... |
import unittest
import random
from change_money_dp_list import make_change
class TestMakechange(unittest.TestCase):
def test_makechange(self):
coin_value_list = [1, 5, 10, 21, 25]
for change in range(0, 101, 1):
random.shuffle(coin_value_list)
known_result = list()
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from random import choice
from string import digits
from odoo import models, fields, api, exceptions, _, SUPERUSER_ID
class HrEmployee(models.Model):
_inherit = "hr.employee"
_description = "Employee"
def... |
__author__ = 'Sergey Tomin'
from ocelot import *
def RFcavity(l, volt, lag, harmon):
rf = Cavity(l = l, volt=volt, id = id)
rf.lag = lag
rf.harmon = harmon
return rf
class MadObj:
name = ""
type = ""
params = ""
def parse_params(self):
self.dic_p = {}
for param in se... |
import sys
import threading
import psutil
if sys.platform.startswith('win32'):
from winpexpect import EOF, TIMEOUT
from winpexpect import winspawn as spawn
else:
from pexpect import EOF, TIMEOUT
from pexpect import spawn
class PlatformError(Exception):
def __init__(self, platform):
self.platform =... |
# -*- coding: utf-8 -*-
"""
HipparchiaServer: an interface to a database of Greek and Latin texts
Copyright: E Gunderson 2016-21
License: GNU GENERAL PUBLIC LICENSE 3
(see LICENSE in the top level directory of the distribution)
"""
import re
from typing import List
from server import hipparchia
fr... |
#!/usr/bin/env python
"""Bash completion for ase-db, ase-run, ase-build, ase-info and ase-gui.
Put this in your .bashrc::
complete -o default -C _ase_bash_complete.py ase-db ase-run \
ase-build ase-info ase-gui
"""
import os
import sys
from glob import glob
command, word, previous = sys.argv[1:]
line = ... |
"""
Provides functionality to interact with lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light/
"""
import logging
import os
import csv
import voluptuous as vol
from homeassistant.components import (
group, discovery, wemo, wink, isy994,... |
import re
# input
date = "2016-11-11"
output_file = date + "/links.txt"
write_output = open(output_file, "a")
# bbc
journal = "bbc"
for i in range(1, 4):
file = date + "/" + journal + "/" + journal + str(i) + ".html"
print(file)
with open(file, "r") as f:
for line in f:
# print(line)... |
#!/usr/bin/python
"""
(C) Copyright 2019-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import os
import random
import time
import threading
import re
from general_utils import run_command, DaosTestError
from ClusterShell.NodeSet import NodeSet
W_LOCK = threading.Lock()
class SlurmFaile... |
from pycp2k.inputsection import InputSection
class _each415(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... |
"""A binary to train eye using multiple GPU's with synchronous updates.
Just for experimence because I don't have the computer comparable wich GPU computing.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import re
import time
from dat... |
import os
from collections import namedtuple
from os.path import join
import numpy as np
from dependency.data_directory import DataDirectory
from gtd.chrono import verboserate
from gtd.ml.vocab import SimpleVocab, SimpleEmbeddings
from gtd.utils import random_seed, cached_property, ComparableMixin
from strongsup.tab... |
# Copyright 2014-2016 The Meson development team
# 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 agree... |
#
# Copyright 2013 Intel
# Copyright 2013 Isaku Yamahata <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# 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 m... |
#!/usr/bin/python
from PyQt4 import QtCore, QtGui
import glob
import os
import sys
import datetime
import re
import argparse
dirSelf = os.path.dirname(os.path.realpath(__file__))
sys.path.append(dirSelf.rstrip(os.sep).rstrip("guiBin").rstrip(os.sep) + os.sep + "lib")
import selectRadioBoxMod
sys.path.append(dirSelf... |
#Simulate queuing system G/G/1
#@Author: Nguyen Duc Viet
import random as rd
import numpy as np
import simpy
#Function for epirical data --------------------------------------------------------------------------------------------
data_wt = []
def arrival(env, number,counter,interval,time_service):
for i in range(... |
import web
from inginious.frontend.pages.api._api_page import APIError
from inginious.frontend.plugins.utils.superadmin_utils import SuperadminAPI
from ..utils import get_api_query_parameters
class RadarPlotAPI(SuperadminAPI):
def API_GET(self):
self.check_superadmin_rights()
input_dict = web.inp... |
# -*- coding: utf-8 -*-
# EditXT
# Copyright 2007-2016 Daniel Miller <millerdev@gmail.com>
#
# This file is part of EditXT, a programmer's text editor for Mac OS X,
# which can be found at http://editxt.org/.
#
# EditXT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publ... |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... |
##############################################################################
##
## This file is part of Sardana
##
## http://www.sardana-controls.org/
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
## Sardana is free software: you can redistribute it and/or modify
## it under the terms of the GN... |
import os
import re
import abc
import csv
import sys
import zipp
import email
import pathlib
import operator
import functools
import itertools
import posixpath
import collections
from ._compat import (
NullFinder,
PyPy_repr,
install,
Protocol,
)
from configparser import ConfigParser
from contextlib im... |
import erukar
from erukar.system.engine import EnvironmentProfile, OverlandSector, Sector, Region, Location, Chunk, EconomicProfile
def create():
barlen = Region()
barlen.name = "Greater Barlen Region"
barlen.description = "A fertile area, known best for its vast barley and wheat fields. The seat of this... |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2014 TrilioData, Inc
# Copyright (c) 2015 EMC Corporation
# 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
# ... |
# -*- coding: utf-8 -*-
import re
from pyload.plugin.Captcha import Captcha
class SolveMedia(Captcha):
__name = "SolveMedia"
__type = "captcha"
__version = "0.12"
__description = """SolveMedia captcha service plugin"""
__license = "GPLv3"
__authors = [("pyLoad Team", "admin@py... |
#(c) 2013-2014 by Authors
#This file is a part of Ragout program.
#Released under the BSD license (see LICENSE file)
"""
This module defines abstract SyntenyBackend class
"""
import logging
import os
from collections import namedtuple, defaultdict
import ragout.shared.config as config
logger = logging.getLogger()
... |
import numpy as np
import pprint
import matplotlib.pyplot as plt
from ResoFit.experiment import Experiment
import peakutils as pku
from ResoFit.simulation import Simulation
from scipy import signal
import scipy
folder = 'data/IPTS_20439/reso_data_20439'
sample_name = ['No Pb', '10mm Pb']
data_file = ['Ta.csv', 'Ta_Pb_... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
# Copyright 2013 anthony cantor
# This file is part of mozz.
#
# mozz 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 version.
#
# mozz is di... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 Jonathan Schultz
#
# 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
# (at your option) any lat... |
import threading
import select
import time
import utils
import global_var as g
from xlog import getLogger
xlog = getLogger("smart_router")
class PipeSocks(object):
def __init__(self, buf_size=16*1024):
self.buf_size = buf_size
self.sock_dict = {}
self.read_set = []
self.write_se... |
# -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2001-2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free S... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## Customize your APP title, subtitle and menus here
#########################################################################
response.logo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
#!/usr/bin/python2
# -*- coding=utf-8 -*-
#************************************************************************
# $Id: generatenoundict.py,v 0.7 2011/03/26 01:10:00 Taha Zerrouki $
#
# ------------
# Description:
# ------------
# Copyright (c) 2011, Arabtechies, Arabeyes Taha Zerrouki
#
# This file is the main fi... |
# -*- coding: utf-8 -*-
#################################################################################################
import json
import xbmc
import xbmcgui
import clientinfo
import downloadutils
import embydb_functions as embydb
import playbackutils as pbutils
import utils
#####################... |
import itertools
import collections
from sympy import S, Tuple, Matrix, prod
from sympy.tensor.array import ImmutableDenseNDimArray
from sympy.tensor.array.ndim_array import NDimArray
def _arrayfy(a):
if isinstance(a, NDimArray):
return a
if isinstance(a, (Matrix, list, tuple, Tuple)):
retu... |
def drop_privileges(uid_name='nobody', gid_name='nogroup'):
import grp, pwd, os, resource
if os.getuid() != 0: # not root. #yolo
return
running_uid = pwd.getpwnam(uid_name).pw_uid
running_gid = grp.getgrnam(gid_name).gr_gid
os.setgroups([])
os.setgid(running_gid)
os.setuid(running... |
import unittest
from MuseParse.classes.ObjectHierarchy.TreeClasses import BaseTree
class testTree(unittest.TestCase):
def setUp(self):
self.item = BaseTree.Tree()
def testAddNode(self):
elem = BaseTree.Node()
self.item.AddNode(elem)
self.assertEqual(elem, self.item.root)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
description: Provides a fluent interface for functional programming,
filtering sequences, and streams.
Examples:
>>> from utils3 import Chain
>>>
>>> x = Chain([['233', 'a', 'b'], ['4343', 'y', 'o'], ['44', 'p', 'k']])
>>>
>>> x
... |
#!/usr/bin/env python2
# transpiled with BefunCompile v1.3.0 (c) 2017
import sys
import zlib, base64
_g = ("AR+LCAAAAAAABADt2k1Lw0AQBuC/st20l4S4k020zVAWL5716CGkRS0LoriI7qk/3lk/oNraFooo8j6wgelMs5uZ5taYJSotY9TF48Pt4vpJnT3fLR5VmeKru8W9ak7U"
+ "H5cBAAAAAAAAAAAAAAAAAAAAAAAA/AO/+V88Z3cUxNViii5GFagtPLW55UDjsvM0TiFPf/Kcn84R... |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Bert Vermeulen <bert@biot.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 3 of the Lice... |
import argparse
import common
import cv2
from gabriel_protocol import gabriel_pb2
from gabriel_client.websocket_client import WebsocketClient
from gabriel_client.websocket_client import ProducerWrapper
from gabriel_client import push_source
DEFAULT_NUM_SOURCES = 1
ORG = (0, 120)
FONT_FACE = cv2.FONT_HERSHEY_PLAIN
FON... |
import itertools
import logging
from datetime import datetime, timedelta
from decimal import Decimal
from dateutil.relativedelta import relativedelta
from flask_wtf import FlaskForm
from werkzeug.datastructures import MultiDict
from wtforms import validators
from app.forms.date_form import get_dates_for_single_date_p... |
import unittest
from harvester.providers.esri import RESTHarvester
from harvester.util import chunk
from harvester.transform.esri import ESRIJSON
from tests import TEST_DIR
from tests.util import load_mock
import requests_mock
import os
@requests_mock.Mocker()
class TestESRIHarvesting(unittest.TestCase):
def setU... |
"""
This page is in the table of contents.
The Joris plugin makes the perimiter slowly increase in Z over the layer. This will make vases/cups without a z blob.
==Operation==
The default 'Activate Joris' checkbox is off. When it is on, the Joris plugin will do it's work.
==Settings==
===Layers From===
Default: 1
De... |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... |
#!/usr/bin/env python
import cgi, re, os, logging, string
import hmac, random
from datetime import datetime
import webapp2, jinja2
from google.appengine.ext import db
from google.appengine.api import memcache
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = ... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from typing import Tuple
from pants.backend.python.lint.docformatter.subsystem import Docformatter
from pants.backend.python.lint.python_fmt import Pytho... |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# 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 https://mozilla.org/MPL/2.0/.
"""Unit tests for ADMM."""
from __future__ ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#################################################################
# 10 de julio de 2006.
# Script temporal para ajustar los precios de LDV de algunas
# facturas antiguas DEBIDO A UN ERROR EN LAS MACROS EXCEL que
# usaban antes de la implantación de ginn. Para respetar la ... |
#! /usr/bin/env python
# Build ApBsInT extension modules (C++ code). Use '--workaround' option
# in order to build workaround code (this needs private part not contained
# in the public repo).
from distutils.core import setup
#from distutils.extension import Extension
from Cython.Distutils import build_ext
from Cytho... |
# Cumulus: Efficient Filesystem Backup to the Cloud
# Copyright (C) 2008-2009, 2012 The Cumulus Developers
# See the AUTHORS file for a list of contributors.
#
# 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 Softwar... |
import logging
from twisted.python import failure
from twisted.internet import error, defer
from twisted.internet.protocol import Protocol, ServerFactory
import json
from lbrynet.core.utils import is_valid_blobhash
log = logging.getLogger(__name__)
class ReflectorServer(Protocol):
def connectionMade(self):
... |
#!/usr/bin/env python
import numpy as np
import geostatsmodels.kriging as k
import random
def gridpath( xdim, ydim ):
'''
Input: (xdim) iterable describing the start, stop, and no. steps
(ydim) iterable describing the start, stop, and no. steps
Output: (path) path through the 2D grid, a list ... |
#******************************************************************************
# (C) 2018, Stefan Korner, Austria *
# *
# The Space Python Library is free software; you can redistribute it and/or *
... |
from .models import *
from .controller import *
from .utilities import *
# utilities
from .decompress import *
from .compress import *
class Scenario:
""" Scenario class """
def __init__(self, filename=None, ver=1.21):
"""create scenario with defaults values,
check default.txt for more i... |
import cStringIO
import random
import time
import urllib2
from datetime import datetime
class TileTimeStat:
def __init__(self, x, y, z, time_taken_ms, http_code, time_of_request):
self.x = x
self.y = y
self.z = z
self.time_taken_ms = time_taken_ms
self.http_code = http_code... |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetActivityWeeklyGoals
# Get a user's current weekly activity goals.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... |
#!/usr/bin/python3
# encoding=utf-8
#
# Copyright © 2017 Alexandre Detiste <alexandre@detiste.be>
#
# 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 (at your... |
"""
Django Extensions model fields
"""
from __future__ import unicode_literals
import uuid
from django.db.models import CharField
class UUIDVersionError(Exception):
pass
class UUIDField(CharField):
"""UUIDField
By default uses UUID version 1 (generate from host ID, sequence
number and current tim... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 24 19:49:39 2014
@author: brian
"""
import socket, time, re
class LifeBoard:
"""
Play the game of life
"""
def __init__(self, board):
"""
board - 2d array of the board where '*' is an alive cell and ' ' is a dead
cell
"""
self.board = b... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... |
import os
import signal
import tempfile
import docker
from docker.constants import IS_WINDOWS_PLATFORM
from docker.utils.socket import next_frame_size
from docker.utils.socket import read_exactly
import pytest
import six
from .base import BUSYBOX, BaseAPIIntegrationTest
from .. import helpers
from ..helpers import ... |
# -*- coding: utf-8; fill-column: 78 -*-
"""Class attribute-style declarative schema construction."""
from .base import Element
from .containers import Dict
import six
__all__ = 'Form',
class _MetaForm(type):
"""Allows fields to be specified as class attribute declarations.
Processes class declarations of t... |
from array import array
import datetime
from decimal import Decimal
import time
import sys
from .compat import PY2, buffer_type
if PY2:
from types import ClassType, InstanceType, NoneType
else:
# Use suitable aliases for now
ClassType = type
NoneType = type(None)
# This is may not be what we want i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
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
any later version.
This program is distributed... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Google 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 requi... |
from setuptools import setup, find_packages
from codecs import open
import os
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the README file
try:
import pypandoc
long_description = pypandoc.convert('README.md', format='md', to='rst')
except(IOError, ImportError):
with op... |
# -*- coding: utf-8 -*-
class Resumen(object):
#fecha = ''
saldo_anterior = ''
saldo = ''
fecha_saldo = ''
items = []
def __repr__(self):
return u"Resumen al {fecha}".format(fecha=self.fecha_saldo)
def __str__(self):
return u"Resumen()"
def to_dict(self):
res... |
#!/usr/bin/env python3
"""Module providing the AttributesMixIn class."""
class AttributesMixIn(object):
"""Mix-in, providing an attributes collection of variable type.
Collection type may be list, set or dict. Getters and setters are
polymorphic.
To return a node's inherited attributes, access
... |
# mean shift to find global modes
import numpy as np # original numpy
#import jax.numpy as jnp
#from jax import vmap
import numpy as np
from functools import partial
from scipy.stats import norm, uniform
import matplotlib.pyplot as plt
import os
figdir = "../figures"
def save_fig(fname): plt.savefig(os.path.join(figd... |
# Metarunlog, experiment management tool.
# Author: Tom Sercu
# Date: 2015-01-23
import datetime
import subprocess
def nowstring(sec=True, ms= False):
tstr = datetime.datetime.now().isoformat()
if not ms:
tstr = tstr.split('.')[0]
if not sec:
tstr = tstr.rsplit(':',1)[0]
return tstr
d... |
# Copyright 2014 The crabapple Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import datetime
from flask import render_template, redirect, request
from crabapple.objects import Commit, Deployment, DeploymentStatus
class ControllerDe... |
from django.conf.urls import patterns, url, include
from django.contrib import admin
from .views import (CollectionPageView, BrowsePageView, AboutPageView,
IndexPageView, DonationsPageView)
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^api/', include('ygo_api.urls')),
url(r'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.