content string |
|---|
"""Radiance Plastic2 Material.
http://radsite.lbl.gov/radiance/refer/ray.html#Plastic2
"""
from materialbase import RadianceMaterial
# TODO(): Implement the class. It's currently creates this material as generic Radiance
# material
class Plastic2(RadianceMaterial):
"""Radiance Plastic2 Material.
Plastic2 is... |
# -*- coding: utf-8 -*-
'''
importer: timezones
~~~~~~~~~~~~~~~~~~~
this package provides utilities and predefined
dictionaries for dealing with timezones and
time offsets.
:author: Sam Gammon <<EMAIL>>
:license: This software follows the MIT (OSI-approved)
license for open ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 30 20:08:47 2016
@author: boldingd
"""
import SnnBase
import Stdp
import DopamineStdp
import random
class Cluster:
def __init__(self):
self.neurons = []
def add_neuron(self, neuron):
self.neurons.append(neuron)
def create_p... |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit
from django import forms
from django.utils.translation import ugettext_lazy as _
from profile.models import CustomField
class ReportGroupByForm(forms.Form):
def __init__(self, *args, **kwargs):
super(ReportGr... |
"""Summarises Haiku modules."""
import functools
import pprint
import types
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, TypeVar, Union
import dataclasses
from haiku._src import base
from haiku._src import data_structures
from haiku._src import module as module_lib
from haiku._src... |
"""
Serializers for Course Blocks related return objects.
"""
import six
from django.conf import settings
from rest_framework import serializers
from rest_framework.reverse import reverse
from lms.djangoapps.course_blocks.transformers.visibility import VisibilityTransformer
from .transformers.block_completion impor... |
from pathfinding import find_path
import sys
input_filename = sys.argv[1]
with open(input_filename) as f:
input = f.read()
class Node:
def __init__(self, line):
splitted = line.split()
self.size = int(splitted[1][:-1])
self.used = int(splitted[2][:-1])
self.avail = int(splitt... |
# coding=utf-8
import unittest
class Solution(unittest.TestCase):
"""9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string, not... |
#!/usr/bin/env python
# encoding: utf-8
from django.test.client import Client, RequestFactory
from yard.resources import MobileDrivenResource
from yard.api import Api
from yard import fields
from books.tests.base import BaseTestCase
from books.models import *
from books.resources import AuthorResource
import simplejso... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Everything related to user logics : latest_changes, profile, etc.
"""
from ludobox.content import get_content_index
from ludobox.utils import get_resource_slug
from datetime import datetime
def get_latest_changes(user=None, before_time=None):
"""
Return all ... |
import sys
t = int(sys.stdin.readline())
def path(f, n, m, sn, sm, gn, gm):
fr = []
visited = [[False for mix in range(m)] for nix in range(n)]
fr.append((sn, sm, 0))
while len(fr) > 0:
xn, xm, kk = fr.pop()
if xn == gn and xm == gm:
return kk
visited[xn][xm] = True... |
from imperialism_remake.server.models.technology_type import TechnologyType
from imperialism_remake.server.models.terrain_type import TerrainType
from imperialism_remake.server.models.turn_planned import TurnPlanned
from imperialism_remake.server.models.workforce_action import WorkforceAction
from imperialism_remake.se... |
#-*- coding: utf-8 -*-
"""
Utils related to the videos.
"""
import logging
from urlparse import urljoin
import requests
from django.conf import settings
from django.core.files.images import get_image_dimensions
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils.translation import ugettext ... |
import requests
from plugincon import bot_command, easy_bot_command, get_message_target, get_bot_nickname
from BeautifulSoup import BeautifulSoup
from requests import get
@easy_bot_command("webtitle")
def website_title(message, raw):
if raw:
return
if message["arguments"] < 2:
return ["Too little arguments!... |
#!/usr/bin/env python
# coding=utf-8
"""467. Superinteger
https://projecteuler.net/problem=467
An integer s is called a _superinteger_ of another integer n if the digits of
n form a subsequence of the digits of s.
For example, 2718281828 is a superinteger of 18828, while 314159 is not a
superinteger of 151.
Let p... |
source("../../shared/qtcreator.py")
import re
SpeedCrunchPath = ""
def buildConfigFromFancyToolButton(fancyToolButton):
beginOfBuildConfig = "<b>Build:</b> "
endOfBuildConfig = "<br/><b>Deploy:</b>"
toolTipText = str(fancyToolButton.toolTip)
beginIndex = toolTipText.find(beginOfBuildConfig) + len(begi... |
from telepot import Bot
from functools import wraps
from nimmy.utils import Map
from threading import Thread
class Bot(Bot):
def __init__(self, *args, **kwargs):
super(Bot, self).__init__(*args, **kwargs)
# holds script functions
self.scripts = []
self.script_lock = None
def... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from genericpath import isfile
import os
from os.path import join, basename, splitext, isdir, dirname
from action import View
import string
class Node(object):
def __init__(self, root, path):
splitetPath = string.split(path,"/")
self.path = os.path.se... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['deprecated'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.common.removed import removed_module
from ans... |
from django.db import models
from django.utils import timezone
from account.models import SignupCode
from kaleo.compat import get_user_model, AUTH_USER_MODEL
from kaleo.conf import settings
from kaleo.signals import invite_sent, joined_independently, invite_accepted
class NotEnoughInvitationsError(Exception):
p... |
import os
import unittest
import vtk, qt, ctk, slicer
import math
import sys
#
# AstroReprojectSelfTest
#
class AstroReprojectSelfTest:
def __init__(self, parent):
parent.title = "Astro Reproject SelfTest"
parent.categories = ["Testing.TestCases"]
parent.dependencies = ["AstroVolume"]
parent.contrib... |
#!/usr/bin/python
import sys
import traceback
import urllib
import vobject
from datetime import timedelta, tzinfo, datetime, date
from localtimezone import Local
### monkeypatch vobject.icalendar.stringToDateTime to handle bogus data more elegantly
vobject.icalendar.stringToDateTime_OLD = vobject.icalendar.stringToD... |
from django.conf import settings
from django.db.models.signals import class_prepared
from django.core.validators import MaxLengthValidator
# Patch up Permission.name
MAX_PERMISSION_NAME_LENGTH = getattr(settings, 'MAX_PERMISSION_NAME_LENGTH', 128)
MAX_USERNAME_LENGTH = getattr(settings, 'MAX_USERNAME_LENGTH', 255)
MAX... |
"""
convnetDB.py
Deep convolutional neural network "hashing" (via `keras` library)
"""
import os
os.environ['KERAS_BACKEND'] = 'theano'
import keras.backend as K
import sys
import numpy as np
from PIL import Image
from keras.models import Model
from keras.preprocessing import image
from keras.applications.... |
from WaveBlocksND import *
import numpy.linalg
import numpy.random
import time
import math
import sys
def print_coefficients(wp):
for node, coeff in zip(list(wp.get_basis_shapes(0).get_node_iterator()), wp.get_coefficients(0)):
if numpy.linalg.norm(coeff) > 1e-10:
print node, coeff
def run(D, ... |
#!/usr/bin/env python
"""
"""
from api import State, util
import random
class Bot:
__max_depth = -1
__randomize = True
def __init__(self, randomize=True, depth=12):
self.__randomize = randomize
self.__max_depth = depth
def get_move(self, state):
val, move = self.value(stat... |
from Simulation import *
class MyHouseSim(Simulation):
def __init__(self):
Simulation.__init__(self)
def setup(self):
Simulation.setup(self)
kitchen = Kitchen(self.home, "Kitchen")
cubbyRoom = Room(self.home, "Cubby Room")
diningRoom = Room(self.home, "Dining Room")
... |
"""Defines chart-wide shared test fixtures."""
import numpy as np
import pandas as pd
import pytest
from bokeh.sampledata.autompg import autompg
class TestData(object):
"""Contains properties with easy access to data used across tests."""
def __init__(self):
self.cat_list = ['a', 'c', 'a', 'b']
... |
#!/usr/bin/python
import subprocess
from subprocess import Popen, PIPE
import sys,re
def runTcpdump(pcapfile):
"""
runTcpdump(string) --> string
take a string pcap filname and returns the pcap string output of tcpdump.
e.g. runTcpdump('/localdisk/Clone/test.pcap')
readi... |
"""Check that there is enough disk space in predefined paths."""
import tempfile
from openshift_checks import OpenShiftCheck, OpenShiftCheckException
class DiskAvailability(OpenShiftCheck):
"""Check that recommended disk space is available before a first-time install."""
name = "disk_availability"
tags... |
"""
A subclass of `Trainer` specific to Question-Answering tasks
"""
from transformers import Trainer, is_torch_tpu_available
from transformers.trainer_utils import PredictionOutput
if is_torch_tpu_available():
import torch_xla.core.xla_model as xm
import torch_xla.debug.metrics as met
class QuestionAnswer... |
import os, os.path
import shutil
import time
from play.utils import *
COMMANDS = ['netbeansify', 'nb']
HELP = {
'netbeansify': 'Create all NetBeans configuration files'
}
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
play_env = kargs.get("en... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
other property
"""
import copy
from rebulk.remodule import re
from rebulk import Rebulk, Rule, RemoveMatch, POST_PROCESS, AppendMatch
from ..common import dash
from ..common import seps
from ..common.validators import seps_surround
from ...rules.common.formatters impo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
import mock
import sys
from django.core.files import File
from users.models import User
from documents.models import Document
from documents.models import process_document
from celery_test import create_doc
pytestmark = pytest.mark.django... |
from contextlib import suppress
from argparse import ArgumentError
from dataclasses import dataclass, field
from typing import *
import pytest
import simple_parsing
from simple_parsing import ArgumentParser, InconsistentArgumentError
from simple_parsing.helpers import list_field
from .testutils import *
def test_li... |
from __future__ import division
import csv
import numpy as np
from Context import Context
import math
import sklearn.preprocessing
class Data:
@staticmethod
def splitDataset(mmsi, tr_mmsi, vl_tmmsi):
test_index = Data.get_match_index(mmsi, tr_mmsi)
val_index = Data.get_match_index(mmsi, vl_tmmsi)
trai... |
from . import surface, field, analysis, wavelength, first_order_tools, draw
# Ray Class
class Lens(object):
surface_list = []
def __init__(self,lens_name='',creator=''):
self.lens_name = lens_name
self.creator = creator
self.field_angle_list = []
self.wavelength_list = []
self.EP_thickness = 0
self.EFL ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Utilities for CNN-like layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def max_pool(bottom, pooling_size, stride=[2, 2], name='max_pool'):
"""A max pooling layer.
... |
import os.path
import logging
import subprocess
import shutil
import json
from gii.core import *
##----------------------------------------------------------------##
def _getModulePath( path ):
import os.path
return os.path.dirname( __file__ ) + '/' + path
##-------------------------------------------------------... |
"""Script to analyze performance speedup when using multiple Edge TPUs.
Basically, this script times how long it costs to run certain amount of
inferences, `num_inferences`, with 1, 2, ..., (max # Edge TPU) Edge TPU.
It then reports the speedup one can get by using multiple Edge TPU
devices. Speedup is defined as:
... |
from datetime import datetime
import boto3
import argparse
import warnings
from ruamel.yaml.error import UnsafeLoaderWarning
warnings.simplefilter('ignore', UnsafeLoaderWarning)
import dateparser
from AwsElbLogUtil import LogFileList, LogFileDownloader, UTC
# these are here for the benefit of dateparser Russian dates.... |
# -----------------------------------------------------------------------------
# calc.py
#
# A simple calculator with variables.
# -----------------------------------------------------------------------------
tokens = (
'NAME','NUMBER',
'PLUS','MINUS','TIMES','DIVIDE','EQUALS',
'LPAREN','RPAREN',
)
#... |
import collections
import re
import peru.glob as glob
import shared
class GlobTest(shared.PeruTest):
def test_split_on_stars_interpreting_backslashes(self):
cases = [
('', ['']),
('*', ['', '']),
('abc', ['abc']),
('abc\\', ['abc\\']),
('abc\\n'... |
from datetime import datetime, timedelta
from django.contrib.auth.models import User, Group, AnonymousUser
from django.test import TestCase
from django.utils import timezone
from mock import patch
from astrobin.tests.generators import Generators
from astrobin_apps_users.services import UserService
from nested_comment... |
#!/usr/bin/env python3
"""
Multithreaded NMEA serial port logger that allows logging every N seconds,
even when GPS is giving data every second.
An example of using non-blocking threading for serial port reading.
Note: python will be switching back and forth, processing one thread at a time.
This is just fine for th... |
"""This example gets the current network that you can make requests against."""
__author__ = '<EMAIL> (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
#... |
# -*- coding: utf-8 -*-
# @Time : 2017/8/8 12:33
# @Author : play4fun
# @File : knn-find_nearest.py
# @Software: PyCharm
"""
knn-find_nearest.py:
http://www.bogotobogo.com/python/OpenCV_Python/python_opencv3_Machine_Learning_Classification_K-nearest_neighbors_k-NN.php
"""
import cv2
import numpy as np
import m... |
from msrest.serialization import Model
class StorageAccountUpdateParameters(Model):
"""The parameters that can be provided when updating the storage account
properties.
:param sku: Gets or sets the SKU name. Note that the SKU name cannot be
updated to Standard_ZRS or Premium_LRS, nor can accounts of... |
# -*- coding: utf- 8 -*-
from __future__ import absolute_import
from base64 import b64encode
import hmac
from hashlib import sha1
import json
import blinker
from flask import request
from werkzeug.exceptions import BadRequest
class MandrillWebhooks(object):
def __init__(self, app=None):
"""Init method.
... |
{
'name': 'Assets Management',
'version': '8.0.2.6.0',
'depends': ['account'],
'conflicts': ['account_asset'],
'author': "Rosen Vladimirov,OpenERP & Noviat,Odoo Community Association (OCA)",
'website': 'http://www.noviat.com',
'category': 'Accounting & Finance',
'sequence': 32,
'demo... |
from messagebird.base_list import BaseList
from messagebird.voice_transcription_data import VoiceTranscriptionData
class VoiceTranscriptionsList(BaseList):
def __init__(self):
super(VoiceTranscriptionsList, self).__init__(VoiceTranscriptionData)
self.perPage = None
self.currentPage = None
... |
# -*- coding: utf-8 -*-
import os, time
from .cross import pickle, md5hex
from funcy import wraps
from .conf import settings
from .utils import func_cache_key, cached_view_fab
from .redis import redis_client, handle_connection_failure
__all__ = ('cache', 'cached', 'cached_view', 'file_cache', 'CacheMiss', 'FileCach... |
"""Integration tests for TensorBoard.
These tests start up a full-fledged TensorBoard server.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import base64
import gzip
import json
import os
import shutil
import threading
import zlib
from six import By... |
# -*- coding: utf-8 -*-
import datetime
import sys
import os
import cakephp_theme
from sphinx.highlighting import lexers
from pygments.lexers.php import PhpLexer
sys.path.insert(0, os.path.abspath('.'))
# Pull in all the configuration options defined in the global config file..
from _config import *
################... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# Bu... |
"""Stores various configuration options and constants for Oppia."""
import os
import jinja2
# Code contributors, in alphabetical order.
CODE_CONTRIBUTORS = [
'Jeremy Emerson',
'Koji Ashida',
'Manas Tungare',
'Sean Lip',
'Stephanie Federwisch',
'Wilson Hong',
'Yana Malysheva',
]
# Idea con... |
"""Creates a 4D image and plots it
"""
import numpy as np
import hyperspy.api as hs
import matplotlib.pyplot as plt
# Create a 2D image stack with random data
im = hs.signals.Image(np.random.random((16, 16, 32, 32)))
# Define the axis properties
im.axes_manager.signal_axes[0].name = ''
im.axes_manager.signal_axes[0]... |
from oslo_log import log as logging
from nova.i18n import _LW
from nova.scheduler import filters
from nova.scheduler.filters import utils
LOG = logging.getLogger(__name__)
class BaseRamFilter(filters.BaseHostFilter):
def _get_ram_allocation_ratio(self, host_state, filter_properties):
raise NotImplement... |
import sys
import json
import logging
from redash.utils import JSONEncoder
from redash.query_runner import *
logger = logging.getLogger(__name__)
types_map = {
5: TYPE_BOOLEAN,
6: TYPE_INTEGER,
7: TYPE_FLOAT,
8: TYPE_STRING,
9: TYPE_STRING,
10: TYPE_DATE,
11: TYPE_DATETIME,
12: TYPE_D... |
# -*- coding: utf-8 -*-
# Authors: Y. Jia <<EMAIL>>
"""
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all
unique triplets in the array which gives the sum of zero.
https://leetcode.com/problems/3sum/description/
"""
class Solution(object):
def threeSum(self, nums... |
from Bio import Entrez
import numpy as np
### pull info from pubmed api
outDir = '/Users/hogstrom/Dropbox (MIT)/pubmed_scrp'
### efetch example
Entrez.efetch(id="57240072")
Entrez.email = "<EMAIL>"
handle = Entrez.efetch(db="nucleotide", id="57240072", rettype="gb", retmode="text")
### esummary example
handle = Entr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mr.S'
from bottle import request, FileUpload
from PIL import Image
import os
def is_ajax():
return True if request.headers.get('X-Requested-With') == 'XMLHttpRequest' else False
def image_thumbnail(image, width, height, position=('center', 'c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (<EMAIL>)
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, e... |
import optparse;
class OptionHandler:
""" Support for command line options.
"""
#### class member
# m_options -- option object (returned by optparse.parse_args)
# m_args -- arguments list (returned by optparse.parse_args)
# m_parser -- option parser
m_options = None;
m_... |
emw"""
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"""
class Solution:
# @return a list of lists of integer
def generateMatrix(self, n):
r... |
from spack import *
class RXde(RPackage):
"""Multi-level model for cross-study detection of differential gene
expression."""
homepage = "https://www.bioconductor.org/packages/XDE/"
git = "https://git.bioconductor.org/packages/XDE.git"
version('2.22.0', commit='25bcec965ae42a410dd285a9db9... |
"""Implementation of SQLAlchemy backend."""
import uuid
from sqlalchemy.sql.expression import asc
from sqlalchemy.sql.expression import literal_column
import nova.context
from nova.db.sqlalchemy import api as sqlalchemy_api
from nova import exception
from nova.openstack.common.db import exception as db_exc
from nova... |
"""
Default configuration file.
This settings should be redifined.
"""
DEBUG = False # bool. can be set by env var PYPEMAN_DEBUG (0|1|true|false) or pypeman cmd args
TESTING = False # bool. can be set by env var PYPEMAN_TESTING (0|1|true|false) pypeman cmd args
PROJECT_MODULE = "project" # name of module contain... |
"""Defines the command line method for running the Scale daily metrics process."""
from __future__ import unicode_literals
import datetime
import logging
import sys
from django.core.management.base import BaseCommand
import metrics.registry as registry
from util.retry import retry_database_query
logger = logging.g... |
from threading import Timer
from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QContextMenuEvent
from PyQt5.QtWidgets import QAction
from PyQt5.QtWidgets import QHeaderView
from PyQt5.QtWidgets import QMenu
from PyQt5.QtWidgets import QTreeView
class TransferTreeView(QTreeView):
def __init__(self, parent=No... |
"""Ganga Robot is a tool for running a user-defined list of actions within the
context of a Ganga session.
The Framework package contains the driver code, see Framework.Driver, and the
action interface, see Framework.Action, which should be implemented by any
action to be executed by the driver.
The Lib package conta... |
# ---------------------------------------------------------------
# Imports
# ---------------------------------------------------------------
import scipy
# ---------------------------------------------------------------
# Interface
# ---------------------------------------------------------------
def read_matrix()... |
# -*- coding: utf-8 -*-
from datetime import date, datetime
import pytest
import sqlalchemy as sa
from sqlalchemy_defaults import Column
@pytest.fixture
def User(Base, lazy_options):
class User(Base):
__tablename__ = 'user'
__lazy_options__ = lazy_options
id = Column(sa.Integer, primar... |
""" A module for reading agws.
"""
import os
from time import sleep
from tempfile import mktemp
from sys import stdout as sys_stdout
from sys import stderr as sys_stderr
from .io_base import AudioIO, io_wrapper
from .io_util import silence
# from .audiality import audiality as _agw
from .import_util import LazyImpo... |
from littleRunner import GameDirection, GameElement, GameInstruction, InstructionType
from littleRunner.GameObjects import MoveType
from littleRunner.GamePhysics import SimpleCrashDetection
import time
class MovingPlatform(object):
def __init__ (self, lr, obj, maxDistance, speed=220, startDirection=G... |
"""Test cltk.tag."""
import os
import shutil
import unittest
from cltk.corpus.utils.importer import CorpusImporter
from cltk.stem.latin.j_v import JVReplacer
from cltk.tag import ner
from cltk.tag.ner import NamedEntityReplacer
from cltk.tag.pos import POSTag
__license__ = 'MIT License. See LICENSE.'
class TestSeq... |
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from guardian.admin import GuardedModelAdmin
from userena.models import UserenaSignup
from usere... |
#
# Test script for the curses module
#
# This script doesn't actually display anything very coherent. but it
# does call (nearly) every method and function.
#
# Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(),
# init_color()
# Only called, not tested: getmouse(), ungetmouse()
#
import os
import... |
import datetime
import getpass
import logging
_order = 'Name', 'Class', 'Module'
_logger = logging.getLogger('unicum')
class PersistentObject(object):
STARTS_WITH = '_'
ENDS_WITH = '_'
JSON_INDENT = 2
@property
def is_modified(self):
return len(self._modified_members) > 0
@property
... |
from wasp_launcher.version import __author__, __version__, __credits__, __license__, __copyright__, __email__
# noinspection PyUnresolvedReferences
from wasp_launcher.version import __status__
import time
from pymongo import MongoClient
from wasp_general.verify import verify_type, verify_value
from wasp_launcher.cor... |
import uuid
from django.conf import settings
from django.db import models
from django.utils import text
import fields
class TimeStampedModel(models.Model):
"""
An abstract base class model. Provides self-updating ``created`` and
``modified`` field.
"""
created = models.DateTimeField(auto_now_a... |
"""the module contains functions for the options route"""
from flask import render_template, request
from easywall_web.login import login
from easywall_web.webutils import Webutils
def options(saved=False):
"""the function returns the options page when the user is logged in"""
utils = Webutils()
if utils.... |
"""
Gwibber Client Interface Library
SegPhault (Ryan Paul) - 05/26/2007
"""
from . import gintegration, resources
import webkit
import urllib2, hashlib, os, simplejson
import Image
# i18n magic
import gettext
_ = gettext.lgettext
DEFAULT_UPDATE_INTERVAL = 1000 * 60 * 5
IMG_CACHE_DIR = os.path.join(resources.CACH... |
from __future__ import absolute_import
import unittest
from datetime import date
from mock import patch
from fakturoid import Fakturoid
from tests.mock import response, FakeResponse
class FakturoidTestCase(unittest.TestCase):
def setUp(self):
self.fa = Fakturoid('myslug', '9ACA7', 'Test App')
class ... |
import urllib
import glance_store as store
from oslo.config import cfg
import six.moves.urllib.parse as urlparse
from glance.common import exception
from glance.common import store_utils
from glance.common import wsgi
import glance.context
import glance.db.simple.api as simple_db
import glance.openstack.common.log as... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
v_what_rast_centroids.py
------------------------
Date : January 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
***********... |
from numpy.testing import *
import numpy as np
from numpy.random import random, normal
from pymc.LazyFunction import LazyFunction
from pymc import stochastic, data, deterministic, Normal, potential, ZeroProbability
verbose = False
@stochastic
def A(value=1.):
return -10.*value
# If normcoef is positive, there wi... |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
ERP+
"""
__author__ = 'António Anacleto'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "António Anacleto"
__status__ = "Development"
__model_name__ = 'suplemento.Suplemento'
import auth, base_models
from orm import *
from form import *
class Suplemento(Mode... |
"""
%dottoxml.py [options] <infile.dot> <outfile.graphml>
convert a DOT file to Graphml XML (and various other formats)
"""
import sys
import locale
import optparse
import dot
# Usage message
usgmsg = "Usage: dottoxml.py [options] infile.dot outfile.graphml"
def usage():
print "dottoxml 1.5, 2013-05-22, Di... |
#!/usr/bin/python
import asm, csv, urllib2, re, sys, base64, datetime, json
"""
Import module for PetFinder data.
Uses their api v2 with oauth to import adoptable animals.
Not sure how long this api/secret will last and whether it's compatible with
other shelters - it was generated for the shelter_id below.
"""
D... |
from absl import flags
from absl.testing import absltest
from dm_construction.utils import geometry
FLAGS = flags.FLAGS
class GeometryTest(absltest.TestCase):
def test_area(self):
# Rectangular triangle
self.assertAlmostEqual(geometry._area(0, 0, 0, 1, 1, 0), 0.5)
# Translate it alongside the x-axis
... |
import fileManager as fm
import camera
import videoMaker as vmaker
import numpy as np
import cv2
from random import shuffle
import shader as pts_shader
import os
import timeit
import math
def generateImg(file,width,length,cam_pos,cam_ori):
files = [f for f in os.listdir(dir) if os.path.isfile(os.path.join(dir,f))]
... |
"""MinIO Admin wrapper using MinIO Client (mc) tool."""
from __future__ import absolute_import
import json
import subprocess
class MinioAdmin:
"""MinIO Admin wrapper using MinIO Client (mc) tool."""
def __init__(
self, target,
binary_path=None, config_dir=None, ignore_cert_check=Fal... |
import os
from mock import patch
from vcr import use_cassette
from django.test import TestCase
from busstops.models import Region, Operator, DataSource
from ...models import VehicleLocation
from ..commands import import_live_acis
class ACISImportTest(TestCase):
@classmethod
def setUpTestData(cls):
Reg... |
import colorsys
from pycbio.sys.immutable import Immutable
class Color(Immutable):
"Color object actually representation is hidden"
def __init__(self, r, g, b, h, s, v):
"""don't call directly use factory (from*) static methods, arguments are 0.0..1.0"""
Immutable.__init__(self)
self.__... |
from pyro.distributions.transforms.haar import HaarTransform
from .unit_jacobian import UnitJacobianReparam
class HaarReparam(UnitJacobianReparam):
"""
Haar wavelet reparameterizer, using a
:class:`~pyro.distributions.transforms.HaarTransform`.
This is useful for sequential models where coupling alo... |
# -*- coding: utf-8 -*-
__author__ = 'fyabc'
# Standard libraries.
from collections import defaultdict
# Dependent libraries.
import pygame.font
import pygame.locals
# Local libraries.
from config.gameConfig import KEYMAP_DIR, RECORDS_DIR, FONT_NAME, CELL_SIZE, GAME_SCREEN_SIZE,\
DEFAULT_LEVELS_NAME, DEFAULT_FON... |
import proto # type: ignore
__protobuf__ = proto.module(
package='google.ads.googleads.v8.enums',
marshal='google.ads.googleads.v8',
manifest={
'CallTypeEnum',
},
)
class CallTypeEnum(proto.Message):
r"""Container for enum describing possible types of property from
where the call wa... |
# -*- coding: utf-8 -*-
from nfe.pysped.xml_sped import XMLNFe, NAMESPACE_SIG, ABERTURA, tira_abertura
import libxml2
import xmlsec
import os
from datetime import datetime
from time import mktime
DIRNAME = os.path.dirname(__file__)
class Signature(XMLNFe):
def __init__(self):
super(Signature, self).__i... |
import json
import six
from st2common.constants import action as action_constants
from st2common import log as logging
from st2common.persistence import action as action_access
from st2common.services import action as action_service
from st2common.policies.concurrency import BaseConcurrencyApplicator
from st2common.se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.