src stringlengths 721 1.04M |
|---|
from mamba import description, it, _it
from pathlib import Path
from unittest.mock import MagicMock
from crowd_anki.anki.adapters.anki_deck import AnkiDeck
from crowd_anki.history.anki_deck_archiver import AnkiDeckArchiver
with description(AnkiDeckArchiver) as self:
with it("inits repo, archives the deck there an... |
#!/usr/bin/env python3
import torch
from .. import settings
def pivoted_cholesky(matrix, max_iter, error_tol=None):
from ..lazy import lazify, LazyTensor
batch_shape = matrix.shape[:-2]
matrix_shape = matrix.shape[-2:]
if error_tol is None:
error_tol = settings.preconditioner_tolerance.val... |
import json
from datetime import datetime, timedelta
from flask import (flash,
make_response,
render_template,
request)
from breezeminder.app import app
from breezeminder.forms.marta import MartaRouteStatusForm
from breezeminder.models.marta import (Route,
... |
#!/usr/local/bin/python
import re
import sys
import os
# Parameter 1: target, either "all" or in the form of "BRCA00XX"
# Parameter 2: option, either "stat" or "fastq"
# E.g. python filter.py BRCA0001 stat
# python filter.py BRCA0001 fastq
# python filter.py all stat
# python filter.py all fastq
def Fi... |
#!/usr/bin/env python
#
# Copyright (c) 2013-2016, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
import sys
i... |
#! /usr/bin/env python
# Copyright 1994 by Lance Ellinghouse
# Cathedral City, California Republic, United States of America.
# All Rights Reserved
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from pyvows import Vows, expect
from thumbor.context import Context... |
#!/local/bin/python
from locus import *
from convert import *
from run_bayenv import *
from compute_average_bf import *
from bf2qvalues import *
from standardize import *
import sys, string, re, os, commands, time, random
#from random import *
DEBUG = False
SKIP_COVAR = False #True if skipping building the null mo... |
from django.contrib import admin
from django.db import models
from django.forms import Textarea, TextInput
from taggit.managers import TaggableManager
from taggit.forms import TagWidget
from ..core.admin import DittoItemModelAdmin
from .models import Account, Bookmark
@admin.register(Account)
class AccountAdmin(adm... |
import requests
host = 'localhost'
configuration = 'Debug'
service_name = 'DEQEnviro/MapService'
token_url = 'http://{}:6080/arcgis/admin/generateToken'.format(host)
update_soe_url = 'http://{}:6080/arcgis/admin/services/types/extensions/update'.format(
host)
upload_url = 'http://{}:6080/arcgis/admin/uploads/uplo... |
from functools import partial
import weakref
from kivy.compat import iteritems
from kivy.factory import Factory
from kivy.lang import ParserRuleProperty, Parser, ParserException, ParserRule as kivy_ParserRule, Builder as kivy_Builder
from kivy.logger import Logger
from kivy.weakproxy import WeakProxy
from kvlang.kvTree... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, redirect
from django.http import HttpResponseForbidden
from django.template import RequestContext
from oppgavegen.generation_folder.generation import generate_level
from oppgavegen.view_logic.rating import *
from... |
import RPi.GPIO as GPIO
import requests
import time
import threading
import os
import base64
import string
import random
import datetime
"GPIO.setmode(BOARD)"
def closeLock():
p = GPIO.PWM(12,50) #sets pin 12 to PWM and sends 50 signals per second
p.start(7.5) #starts by sending a pulse at 7.5% to c... |
#!/usr/bin/env python
#
#Copyright (c) 2012 Shane R. Spencer
#
#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, copy, modify... |
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... |
"""
Download interface for data from RAOB network
"""
from io import StringIO
import datetime
import pytz
from paste.request import parse_formvars
from pyiem.util import get_dbconn
from pyiem.network import Table as NetworkTable
def m(val):
"""Helper"""
if val is None:
return "M"
return val
def... |
#!/usr/bin/env python
"""
This script generates a force and velocity vector diagram for a cross-flow
turbine.
"""
from __future__ import division, print_function
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
from scipy.interpolate import interp1d
import seaborn as sns
from px... |
# -*-# coding: utf-8 -*-
"""
Created on Wed May 01 11:44:49 2013
@author: Martin Siggel <martin.siggel@dlr.de>
"""
from __future__ import print_function
import sys, os
from datetime import date
tiglpath = os.path.dirname(os.path.realpath(__file__)) + '/../..'
sys.path.append(tiglpath + '/bindings')
import bindings_... |
"""
Views
"""
from flask import render_template, request, redirect, url_for
from app import app
import models
import json
import collections
rating_to_process = None
# MAIN page
@app.route("/")
def index():
return render_template("index.html")
# SURVEY page
@app.route("/survey")
def survey():
global bookT... |
"""
Collaboration-related routines
1) Class Catalog -- resources to retrieve File* classes by different criteria
2) Script utilities: collect scripts (standalone applications) across collaborator packages
"""
from collections import OrderedDict
import importlib
import a99
import os
import glob
import copy
__all__... |
import re
from project.urlsconf import url_patterns
from project.response import HttpResponseNotFound, HttpResponseServerError
from project.exceptions import Http404
def application(environ, start_response):
try:
response = path_to_response(environ)
except Http404:
response = HttpResponseNot... |
# -*- coding: utf-8 -*-
import sys
import pandas as pd
import calendar
import os
from DataAccess import DownloadData
import wa.General.data_conversions as DC
import wa.General.raster_conversions as RC
def main(Dir, Startdate='', Enddate='',
latlim=[-50, 50], lonlim=[-180, 180], cores=False, Waitbar = 1):
... |
from collections import OrderedDict
class Rgb:
def __init__(self, r = 0.0, g = 0.0, b = 0.0):
self.r = r
self.g = g
self.b = b
def rgba(self):
return "rgb({},{},{})".format(
max(0.0, min(1.0, self.r)),
max(0.0, min(1.0, self.g)),
max(0.0, min(1.0, self.b)))
def hex(self):
return "#{:02x}{:02x}{... |
# This code allows one to use SWIG wrapped objects from weave. This
# code is specific to SWIG-1.3 and above where things are different.
# The code is basically all copied out from the SWIG wrapper code but
# it has been hand edited for brevity.
#
# Prabhu Ramachandran <prabhu@aero.iitm.ernet.in>
####################... |
"""
Implementation of Bishop figure in chess command line client.
"""
import logging
import math
from . import figure
from ..board import Board
class Queen(figure.Figure):
"""
Queen figure for chess implementation.
"""
def _is_move_correct(self, x_index, y_index):
# Move x_index or y_... |
# -*- coding: utf-8 -*-
import os.path as path
import site
import matplotlib
from itertools import cycle
VERSION = "0.1.0-dev"
NANCHI_MAIN_CAPTION = "NanchiPlot %s"%(VERSION)
# Colors
PANEL_BG_COLOR = "#ababab"
FRAME_BG_COLOR = "#aaf0f0"
AXES_BG_COLOR = "#efefef"
FIGURE_BG_COLOR = "#fafafa"
LINE_COLOR = "#000000"
GR... |
import os
from glob import glob
import pandas as pd
from load_settings import settings
from utils.utils import compress_file, decompress_file
RESULTS_TPL = '{0}.hdf'
class ResultNotFound(Exception):
'''Simple exception thrown if result cannot be found in results manager or on disk'''
pass
class Stormtrac... |
import esprit
from octopus.lib import plugin
from octopus.core import app
def _default_mapping():
default_mapping = app.config.get("ELASTIC_SEARCH_DEFAULT_MAPPING")
if default_mapping is None:
return None
if "mappings" in default_mapping:
return default_mapping
if "_default_" in defau... |
import scrapy
from scrapy.http import JsonRequest, Request
from scrapy import Selector
import time
import re
import w3lib.html
import pprint
class ZjlotterySpider(scrapy.Spider):
name = "zjlottery"
custom_settings = {
'DATABASEPIPELINE_ENABLED': True,
}
def start_requests(self):
... |
from __future__ import unicode_literals
import unittest
from .utils import slugify, corrected
from . import utils
class correctedTest(unittest.TestCase):
def test_it_works(self):
utils._corrections_cache = {
'all': {
'a0': 'a1',
},
'foo': {
... |
# -*- coding:Utf-8 -*-
# Dieren Theater - lachambre.be to json sausage machine
# Copyright (C) 2012 Laurent Peuch <cortex@worlddomination.be>
#
# This program 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 Free Software ... |
# 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... |
HOME_TIMELINE = [
{
'coordinates': None,
'truncated': False,
'created_at': 'Tue Aug 28 21:16:23 +0000 2012',
'favorited': False,
'id_str': '240558470661799936',
'in_reply_to_user_id_str': None,
'entities': {
'urls': [
],
'h... |
# -*- coding: utf-8 -*-
###############################################################################################
#
# MediaPortal for Dreambox OS
#
# Coded by MediaPortal Team (c) 2013-2015
#
# This plugin is open source but it is NOT free software.
#
# This plugin may only be distributed to and executed... |
#!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. 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 ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
from . import _osx as osx
from . import _tty as tty
from .exceptions import (
UnsupportedOSError, XcodeMissingError, BrewMissingError,
SymlinkError, AppMissingError, StowError
)
from ._lib import lazyproperty
from ._sh import (
B... |
##########
#### Run the test suite for Shoreditch Gamerunner
##########
import unittest
import os, sys
import argparse
import test
def list_modules(dir, module_path = ''):
modules = []
for f in os.listdir(dir):
module_name, ext = os.path.splitext(f) # Handles no-extension files, etc.
if os.path.isdir('test/' +... |
#!/usr/bin/env python3
# -*- mode: python -*-
# This script is used to prepare the tarballs that a version 002 client
# submits for further processing. It copies the tarballs and their MD5
# sums to the archive (after checking) and sets the state links, so
# that the dispatch script will pick them up and get the ball
... |
# This admin command is to save having to move Hansard Entries
# individually in the admin console, which is not fun - or particularly
# safe - when there are more than one or two of them
from dateutil import parser
import sys
from django.conf import settings
from django.contrib.contenttypes.models import ContentType... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Task queue which deprecates TestMetadata and kicks off jobs to delete old
row data when tests stop sending data for an extended period of time.
"""
from _... |
from typing import Dict
from gi.repository import Gtk
from .gdebug import debug
from .gtk_extras import dialog_extras as de
from gettext import gettext as _
from .prefs import Prefs
class CheckEncoding:
"""A class to read a file and guess the correct text encoding."""
encodings = ['iso8859', 'ascii', 'latin_... |
# -*- coding: utf-8 -*-
"""
Knowledge base of all built-on formatters.
"""
from __future__ import absolute_import
from behave.formatter import _registry
# -----------------------------------------------------------------------------
# DATA:
# -------------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 Free Software Foundation, either version 3 of the License, or
# (at your opt... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... |
"""
Problem Statement
In the previous challenge, you wrote code to perform an Insertion Sort on an
unsorted array. But how would you prove that the code is correct? I.e. how
do you show that for any input your code will provide the right output?
Loop Invariant
In computer science, you could prove it formally with a l... |
#! /usr/bin/env python
from __future__ import unicode_literals, print_function
import sys
import re
import pybindgen
import pybindgen.settings
pybindgen.settings.deprecated_virtuals = False
from pybindgen.typehandlers import base as typehandlers
from pybindgen import ReturnValue, Parameter, Module, Function, FileCod... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-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... |
import logging
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.debug import sensitive_variables
from django.core.exceptions import PermissionDenied
from django.utils.crypto import constant_time_compare
from django.utils.lru_cache import lru_cache
from django.utils.encoding import forc... |
#!/usr/bin/python
import random
board = []
size = 0
def board_print():
global board
for row in board:
print " ".join(row)
def new_game():
global board,size
board = []
size = input("Enter board size:") ## Input will automatically convert it to integer
for row in range(size):
board.append(["0"] * size )
b... |
"""Utilities for loading test data."""
import datetime
import json
import os
import random
from rdr_service.code_constants import (
BIOBANK_TESTS,
CONSENT_FOR_STUDY_ENROLLMENT_MODULE,
EMAIL_QUESTION_CODE,
FIRST_NAME_QUESTION_CODE,
LAST_NAME_QUESTION_CODE,
LOGIN_PHONE_NUMBER_QUESTION_CODE,
... |
# -*- coding: utf-8 -*-
#
# (c) 2016 Boundless, http://boundlessgeo.com
# This code is licensed under the GPL 2.0 license.
#
import os
from PyQt4 import QtGui, QtCore
from qgis.gui import QgsFilterLineEdit
from geogig import config
class ConfigDialog(QtGui.QDialog):
versioIcon = QtGui.QIcon(os.path.dirname(__file... |
from typing import Tuple, Union, List
from appconf.manager import SettingManager
from refprocessor.age_parser import AgeRight
from refprocessor.common import ValueRange, RANGE_IN
from refprocessor.result_parser import ResultRight
class RefProcessor:
def __init__(self, ref: dict, age: List[int]):
actual_k... |
__author__ = 'Hao'
from rdflib import Namespace, RDF
from itertools import chain
import argparse
from SPARQLWrapper import SPARQLWrapper, JSON
import json
from rdflib import Namespace, RDF
PROV = Namespace("http://www.w3.org/ns/prov#")
BIBO = Namespace("http://purl.org/ontology/bibo/")
VCARD = Namespace("http://www.w... |
# tensorflow, numpy를 사용하기위해 import
import tensorflow as tf
import numpy as np
# Deep learning을 위해 데이터를 읽습니다.
data = np.loadtxt('./data.csv',delimiter=',',unpack=True,dtype='float32')
# csv자료의 0부터 2번째 까지의 feature를 x_data에 넣습니다.
# 나머지는 분류가 되는 데이터로 y_data에 넣습니다.
x_data = np.transpose(data[0:3])
y_data = np.transpose(da... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 David Arroyo Menéndez
# Author: David Arroyo Menéndez <davidam@gnu.org>
# Maintainer: David Arroyo Menéndez <davidam@gnu.org>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... |
import bee
from bee.segments import *
class staticselector(bee.worker):
# selection pointer
v_sel = variable("int")
startvalue(v_sel, 0)
#get selected identifier
selected = output("pull", "id")
v_selected = variable("id")
connect(v_selected, selected)
@modifier
def get_selected(s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-19 12:13
from __future__ import unicode_literals
from django.db import migrations, models
from django.utils.text import slugify
def create_sectors(apps, schema_editor):
SectorModel = apps.get_model('climatemodels', 'Sector')
SectorModel.objects.... |
#!/usr/bin/env python
def wire_port2port(d):
for host in d.keys():
hubs = d[host]
for i in range(len(hubs)):
for j in range(i+1,len(hubs)):
if hubs[i] == hubs[j]:
print "PORT_TO_PORT %s %i %i" % (host,i,j)
print "PORT_TO_PORT %s %i %i" % (host,j,i)
def make_hub_map(d):
hu... |
# -*- coding: utf-8 -*-
"""
Created on May 7, 2011
@author: jake
"""
from decimal import Decimal
import moneyed
import pytest
from moneyed import Money
from .testapp.forms import (
MoneyForm,
MoneyFormMultipleCurrencies,
MoneyModelForm,
OptionalMoneyForm,
)
from .testapp.models import ModelWithVanill... |
# -*- coding: utf-8 -*-
import time
from threading import Lock
from collections import deque
import opuslib
from .constants import *
class SoundQueue:
"""
Per user storage of received audio frames
Takes care of the decoding of the received audio
"""
def __init__(self, mumble_object):
sel... |
from pitchfork.pitchfork import search, Review
import json
import unittest
class TestReview(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.review = search('mogwai', 'come on')
def test_review(self):
self.assertIsInstance(self.review, Review)
def test_review_album(self):
... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 14:58
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
#!/usr/bin/python3
# Copyright 2015-2017 Zack Scholl. All rights reserved.
# Use of this source code is governed by a AGPL
# license that can be found in the LICENSE file.
import sys
import json
import socket
import time
import subprocess
import os
import glob
import argparse
import logging
import statistics
import a... |
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core import serializers
from... |
import help_text
import asyncio
import argparse
import logging
from random import randint
clients = []
class SimpleChatClientProtocol(asyncio.Protocol):
"""
This class is the heart of the Chat Server. For each client that
connects to the server, an instance of this class is created. These
instances ... |
from rinoh.document import DocumentSection
from rinoh.paragraph import Paragraph
from rinoh.structure import GroupedFlowables
from .base import (ContentsPart, DocumentBase, DocumentOptions,
TableOfContentsSection)
class ArticleFrontMatter(GroupedFlowables):
def __init__(self):
self.to... |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... |
# -*- coding: utf-8 -*-
"""Main module."""
import pandas as pd
import csv
import time
import itertools
import json
#initialization class
class Init:
def __init__(self, filename):
self.filename = filename
self.data = []
#read as pandas data frame
def DataPD(self):
data = pd.read_csv... |
# =============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 12394.py
# Description: UVa Online Judge - 12394
# =============================================================================
while True:... |
"""This file downloads a particular volume of Marathi Vishwakosh (https://marathivishwakosh.maharashtra.gov.in/) and saves the pages spread across twenty files using a modulo of 20 to the number of Vishkosh page entry.
Run using 'python vishwkosh_book.py volume' from terminal where volume is the Volume of Vishwakosh y... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ROOT_DIR = os.path.dirname(BASE_DIR)
SITE_ID = 1
SECRET_KEY = '__FAKE__'
INTERNAL_IPS = [
'0.0.0.0',
'127.0.0.1',
]
ALLOWED_HOSTS = [
'0.0.0.0',
'127.0.0.1',
]
ADMINS = [
'admin@localhost',
]
DAT... |
import subprocess
import time
import speaker
import fileinput
import os
class StartUp(object):
def __init__(self):
self.speakery=speaker.newSpeaker()
self.server=""
self.dispatcher = ""
self.nav = ""
self.voice = ""
self.serial = ""
self.alert = ""
self.cruncher = ""
self.ctr = 0
def monitor(self... |
from __future__ import division, absolute_import, print_function
import collections
import pickle
import sys
from os import path
import numpy as np
from numpy.compat import asbytes
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal, assert_array_equal,
assert_array_almost_equal, ass... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'User.email'
db.alter_column(u'survey_user', 'email', s... |
import pytest
import re
@pytest.mark.parametrize('dependency', [
'cron-apt',
'ntp'
])
def test_cron_apt_dependencies(Package, dependency):
"""
Ensure critical packages are installed. If any of these are missing,
the system will fail to receive automatic updates.
The current apt config uses cr... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
#! /usr/bin/env python3
#
# Copy from old style database to new style
#
import mysql.connector
from mysql.connector.errors import Error
import MyLogger
import MyDB
import argparse
def loadDatatypes(tgt) -> dict:
a = {}
tgt.execute('SELECT name,id FROM datatype;')
for row in tgt: a[row[0]] = row[1];
re... |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
# Zadání:
#########
#
# Implementujte následující úlohy:
#
# - swap(a,b), která navzájem vymění tyto dva prvky
# - Napište funkci, která vypisuje 1,-1,1,-1 …
# - Napište funkci, která vypisuje výsledek operace (−1)^k pro k=0,…,100.
# Zamyslete se nad rychlostem výpočtu, navrhněte alternativní postupy
# - Napište fun... |
# standard libraries
import copy
import unittest
# third party libraries
import numpy
# local libraries
from nion.swift import Application
from nion.swift import DocumentController
from nion.swift.model import DataGroup
from nion.swift.model import DataItem
from nion.swift.model import Persistence
from nion.swift.tes... |
# vim: set expandtab ts=4 sw=4 filetype=python:
import datetime
import os
import rfc822
import time
import unittest
import urllib
import mock
from pitz.project import Project
from pitz.entity import Entity, Person, Task, Status, Milestone, \
Activity, Estimate, Tag, Comment, Component
import pitz.static
from pitz... |
import random
import compas
import pytest
from compas.geometry import Point
from compas.geometry import Polygon
from compas.utilities import pairwise
if not compas.IPY:
def test_data():
p = Polygon([Point(random.random(), random.random(), random.random()) for i in range(10)])
assert p.data == p.v... |
import sys
import numpy as np
import cv2
"""
Authors: Lawton Mizell, Tyler Hall
routine for image segmentation and
detection of numbers and arithemic operations
opencv 3.0+
"""
def segment(im):
"""
:param im:
Image to detect digits and operations in
"""
gray = cv2.cvtColor(im,cv2.COLOR_BG... |
"""@file ms_loss.py
contains the MsLoss.
Temporary naming of file and class"""
import loss_computer
import tensorflow as tf
class MsLoss(loss_computer.LossComputer):
"""A loss computer that calculates the loss"""
def __call__(self, targets, logits, seq_length):
# target is actually only required for it's shape... |
import os
import logging
from lxml import html
from dateutil.parser import parse
import metafolder
from krauler.threaded import ThreadedKrauler
from krauler.signals import on_meta
log = logging.getLogger(__name__)
class MetaFolderKrauler(ThreadedKrauler):
@property
def metafolder(self):
if not hasa... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Framework and base classes for coordinate frames/"low-level" coordinate
classes.
"""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
# Standard library
import inspec... |
import pytest
from pytest import mark
from decent.schema import *
from decent.error import *
## Helpers
def ok(x):
return x
## Empty schema
def test_empty_schema_valid_value():
schema = Schema({})
assert schema({}) == {}
@mark.parametrize('value', [None, object(), [], 123, True, False, "Hello"])
def t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Bot:
def __init__(self, command):
self.command = command['command']
self.data = command['data']
self.hash = None
def generate_hash(self):
def calc(string):
return modified_scientific_notation(ascii_digits(string))... |
# Copyright 2012-2013 Eric Ptak - trouch.com
#
# 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 l... |
from pogle_math import Vector, Matrix4x4, Transform
__author__ = 'Clement JACOB'
__copyright__ = "Copyright 2013, The Python OpenGL Engine"
__license__ = "Closed Source"
__version__ = "0.0.1"
__email__ = "clems71@gmail.com"
__status__ = "Prototype"
class Light(object):
def __init__(self, pos=Vector(0.0, 0.... |
from distutils.core import setup
import sys
# This is a simple and fragile way of passing the current version
# from cmake to setup as I assume no one else will use this.
#
# This script has to have the version always specified as last argument.
version = sys.argv.pop()
setup(
name='createrepo_c',
description... |
import errno
from fcntl import LOCK_EX, LOCK_NB, LOCK_SH, LOCK_UN
import logging
import os
import random
import re
import signal
import subprocess
import sys
import threading
import time
try: # Prefer system installation of Mesos protos if available
from mesos_pb2 import *
from containerizer_p... |
# -*- coding: utf-8 -*-
# This file is part of the Rocket Web Server
# Copyright (c) 2012 Timothy Farrell
#
# See the included LICENSE.txt file for licensing details.
# Import System Modules
import time
import unittest
try:
from queue import Queue
except ImportError:
from Queue import Queue
try:
from func... |
# -*- coding: utf-8 -*-
# @Author: ZwEin
# @Date: 2016-06-21 12:36:47
# @Last Modified by: ZwEin
# @Last Modified time: 2016-09-29 21:54:12
import os
import re
import sys
import json
import copy
import types
import string
import collections
import phonenumbers
from datetime import datetime
from crf_tokenizer imp... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
class HumanTrajGenerator:
def __init__(self, T, dt):
self.T = T
self.dt = dt
# set some parameters
self.v_max = 1.0
self.a_max = 0.6
self.k_v = 0.8
self.k_hr = 0.6
self.th_hr... |
# This file is a part of Squirrel project
#
# Copyright (C) 2014, Alexander Kurbatov <sir.alkurbatov@yandex.ru>
#
# Squirrel 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
... |
import theano
import theano.tensor as T
import numpy
class HiddenLayerModel(object):
def __init__(self, rng, input, n_in, n_out, W=None, b=None,
activation=T.tanh):
"""
Typical hidden layer of a MLP: units are fully-connected and have
sigmoidal activation function. Weight ... |
#
# Copyright (c) 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.