src stringlengths 721 1.04M |
|---|
# coding: utf-8
from __future__ import absolute_import
import unittest
from webtest import TestApp
import os, sys, subprocess, json
gcloud_info = json.loads(subprocess.check_output(['gcloud', 'info', '--format=json']))
sdk_path = os.path.join(gcloud_info["installation"]["sdk_root"], 'platform', 'google_appengine')
sy... |
# -*- coding: utf-8 -*-
"""
BobSwitch
~~~~~~~~~~~~~~
Online HTML5 version of the backpackers card game switch, also known as
crazy eights and a lot of different names. This version follows the rules
that I know.
:copyright: (c) Copyright 2013 by Bob
:license: BSD, see LICENSE for more d... |
import sys
sys.path.insert(1,"../../../")
import h2o, tests
def glm_mean_residual_deviance(ip,port):
cars = h2o.import_file(path=h2o.locate("smalldata/junit/cars_20mpg.csv"))
s = cars[0].runif()
train = cars[s > 0.2]
valid = cars[s <= 0.2]
predictors = ["displacement","power","weight","accelerati... |
#!/usr/bin/env python
#-*- encoding: utf8 -*-
import json
import rospy
import actionlib
import random
import re
from mhri_msgs.msg import RenderItemAction, RenderItemResult, RenderItemFeedback
from mhri_msgs.srv import GetInstalledGestures, GetInstalledGesturesResponse
class FakeMotionRender:
def __init__(self)... |
""" This is a large test designed to find bugs in the code and errors in the
database
"""
from .patches import TestCase
from .. import database
exocat = database.load_db_from_url()
class TestCatalogue_Planet(TestCase):
def test_isTransiting(self):
x = [planet.isTransiting for planet in exocat.planets]... |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... |
import array
class Canvas:
BLANK=' '
HLINE='-'
VLINE='|'
HLARROW='<'
HRARROW='>'
VUARROW='^'
VDARROW='v'
INTERSECT='+'
XINTERSECT='*'
WAVEVLLINE='('
WAVEVRLINE=')'
WAVEHLINE='~'
def __init__(self,col,row):
self.row=row
self.column=col
self... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Timu EREN
#
# 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 requir... |
#!/usr/bin/env python
# Copyright 2013 David Irvine
#
# This file is part of openlava-python
#
# openlava-python 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 o... |
#!/usr/bin/env python
# Copyright (C) 2012,2013,2015(H),2016
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or mo... |
from enum import Enum
class TargetPython(Enum):
python2 = 0
python3crystax = 1
python3 = 2
# recipes that currently break the build
# a recipe could be broken for a target Python and not for the other,
# hence we're maintaining one list per Python target
BROKEN_RECIPES_PYTHON2 = set([
# pythonhelper... |
# Copyright 2015 Google.
#
# 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, softw... |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from widgetastic.utils import partial_match
from cfme.common.provider import cleanup_vm
from cfme.services.catalogs.catalog_item import CatalogItem
from cfme.services.service_catalogs import ServiceCatalogs
from cfme.infrastructure.provider import InfraProvider... |
"""
Django settings for PSEP project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
import torch
import torch.nn.functional as F
import torch.nn as nn
from matplotlib.cm import get_cmap
from torch.autograd import Variable
from torch.utils.data import TensorDataset, DataLoader
from torchvision import datasets
from torchvision.transforms import transforms
import matplotlib.pyplot as plt
english_labels... |
from decimal import Decimal
from django.test import TestCase
from natspec_utils.decorators import TextSyntax
from cuescience_shop.models import Product, Client, Order
from django.test.client import Client as TestClient
from cart.cart import Cart
class Request(object):
def __init__(self):
self.data = {}
... |
from rest_framework import relations
from tablib.compat import unicode
from multi_import.helpers import strings
list_separator = ";"
def to_string_representation(field, value):
if hasattr(field, "to_string_representation"):
return field.to_string_representation(value)
if isinstance(field, relation... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2017 Bitergia
#
# 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 la... |
#! /usr/bin/env python
"""lzcomp %s -- compression/decompression utility using the LZCOMP algorithm."""
from __future__ import print_function
import argparse
import sys
import os
import lzcomp
import platform
def get_binary_stdio(stream):
""" Return the specified standard input, output or errors stream as a
... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import platform
import os
class IbmJava(Package):
"""Binary distribution of the IBM Java Softwar... |
###########################################################
#
# Copyright (c) 2005-2008, 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 w... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
migrations.swappable_dependency(settings... |
# Copyright (c) 2015 by Miblo <miblodelcarpio@gmail.com>
# All rights reserved
#
# 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 later ... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
import matplotlib
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
import matplotlib.pyplot as plt
from pylab import *
import numpy as np
from ... |
import time
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt, pyqtSlot, QThread, pyqtSignal
from PyQt5.QtWidgets import QCompleter, QTableWidgetItem
from client_fva.models.ContactDropDown import ContactModel
from client_fva.models.MyRequest import MyRequestModel
from client_fva.session_storage i... |
"""
This module contains the base ``Instance`` classes that concrete classes
inherit from. Specifically, there are three classes:
1. ``Instance``, that just exists as a base type with no functionality
2. ``TextInstance``, which adds a ``words()`` method and a method to convert
strings to indices using a DataIndexer... |
from numpy import nonzero
from quick.multitrack.MultiTrackCommon import getGSuiteFromGalaxyTN
from gold.application.HBAPI import Track, doAnalysis, AnalysisSpec, GlobalBinSource
from quick.statistic.DistanceMetricsFoundationStat import DistanceMetricsFoundationStat
from quick.statistic.PointCountPerMicroBinV2Stat impor... |
# -*- 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... |
#!/usr/bin/env python
"""Standalone script to check FAUCET configuration, return 0 if provided config OK."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed unde... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import mysql.connector
import datetime
class Parcelle(object):
database = 'IENAC14_asa'
user = 'root'
password = 'root'
host = '127.0.0.1'
def __init__(self,id_parc,compteur=None,nom=None,lat=None,lon=None,altitude=None):
if id_parc>0:
self.load(id_parc)
else:
... |
"""Framework for creating tools that employ a robust command-line interface."""
from __future__ import absolute_import
import os
import shutil
# TODO: interface to datagrok.ansicolor ?
class CLIManager(object):
"""Captures the boilerplate involved in making a decent command-line
interface for a multi-functio... |
# -*- encoding: utf-8 -*-
############################################################################
# Module for OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Zenpar - http://www.zeval.com.mx/
# All Rights Reserved.
##########################################################################... |
import argparse
import os
import shutil
import cv2
def blur_ratio(filename):
# Positive blur ratio - the lower the more blurred the photo is
image = cv2.imread(filename)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
return cv2.Laplacian(gray, cv2.CV_64F).var()
def blur_distribution(photo_dir):
... |
import json
import copy
SETUP = [
[
{'rank': '1', 'side': 3},
{'rank': '2', 'side': 3},
{'rank': '3', 'side': 3},
{'rank': '3', 'side': 3},
{'rank': '4', 'side': 3},
{'rank': '4', 'side': 3},
{'rank': '4', 'side': 3},
{'rank': '5', 'side': 3},
... |
# coding=utf-8
#
# Copyright 2017 Google 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 ap... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'bootstrap_page.ui'
#
# Created: Wed Oct 16 14:56:05 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... |
#_**_ coding: utf-8 _*_
"""
Module for parsing configuration files
Application will use hard coded configuration file for its behaviur
hzzapp.conf in root directory should be written according to RFC 8822 style
Created 10. Dec 2014
Author: Hrvoje Novosel<hnovosel@live.com>
"""
import ConfigParser
#classes for e... |
#!/usr/bin/python
# Example using a character LCD connected to a Raspberry Pi or BeagleBone Black.
import time
import Adafruit_CharLCD as LCD
# Raspberry Pi pin configuration:
# lcd_rs = 27 # Note this might need to be changed to 21 for older revision Pi's.
# lcd_en = 22
# lcd_d4 = 25
# lcd_d5 ... |
"""
This file contains all the models that are used in our system
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from autoslug import AutoSlugField
from django.core.urlresolvers import reverse
from django.contrib.auth.models import... |
import cv2
from cube import Cube, FormStencil, TABLE_STENCIL, FormFilter
# import cube
from kinect import Kinect
from kinectCaptureHelper import KinectCaptureHelper
from visiontools import VisionTools
import numpy as np
import math
import time
class RobotLocator():
PIXEL_SHIFT = 3
def __init__(self):
... |
import torch
import torch._C as _C
import torch.utils.hooks as hooks
from collections import OrderedDict
class Function(_C._FunctionBase):
"""Records operation history and defines formulas for differentiating ops.
Every operation performed on :class:`Variable` s creates a new function
object, that perfor... |
from PIL import Image
class InMemoryImage:
"""
A very simple class to represent an image.
"""
def __init__(self, w, h, c=3,
b=b'', encrypted=False):
"""
Instantiate a new image.
:param w: The width of the image (px).
:param h: The height of the image (... |
import sys
import pytest
from flask import current_app,url_for
from flask_wtf import Form
from wtforms import TextField
from faker import Faker
import arrow
import uuid
import stripe
from unifispot.core.models import Wifisite,Device,Guesttrack,Guest
from unifispot.core.guestutils import init_track,validate_track,redi... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
#
# 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; eithe... |
import unittest
import arff
import math
import numpy as np
import openmlpimp
import os
class VerifySuccessiveHalvingRunTest(unittest.TestCase):
@staticmethod
def obtain_config(data_point, param_indices):
# data_points = list<mixed>
# param_indices = dict<int, str>
config = []
... |
import logging
import requests
import rdflib
from rdflib import Namespace
from rdflib.namespace import RDF
from rdflib.namespace import SKOS
from prefixcommons.curie_util import contract_uri
from ontobio.ontol import Ontology, Synonym
# TODO: make configurable
GEMET = Namespace('http://www.eionet.europa.eu/gemet/200... |
import unittest
from biothings_explorer.registry import Registry
from biothings_explorer.user_query_dispatcher import SingleEdgeQueryDispatcher
from .utils import get_apis
reg = Registry()
class TestSingleHopQuery(unittest.TestCase):
def test_ma2protein(self):
"""Test gene-protein"""
seqd = Singl... |
from csc.divisi.tensor import DictTensor
from csc.divisi.ordered_set import OrderedSet
from csc.divisi.labeled_view import LabeledView
def add_triple_to_matrix(matrix, triple, value=1.0):
'''
Adds a triple (left, relation, right) to the matrix in the 2D unfolded format.
This is the new add_assertion_tupl... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import str
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from builtins import open, open
import os
import tempfile
import shutil
from nipype.testing import (assert_equal, a... |
"""
invoke_tools.lxc.docker
"""
from __future__ import print_function
import os
import json
import getpass
class Docker:
"""
Docker
"""
@staticmethod
def __print_line(line):
"""
"""
try:
line = line.decode('utf-8')
except:
print("Could not d... |
# coding=utf8
"""
Generator from todo to todo format string.
from todo.generator import generator
generator.generate(todo) # return str
"""
from models import Task
from models import Todo
class TodoGenerator(object):
"""
Generator from python list to string.
"""
g_newline = "\n"
def g_id(... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-05-11 22:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exile', '0006_seccion_posicion'),
]
operations = [... |
# Copyright 2014 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.
import shutil
import tempfile
import unittest
from telemetry.core import exceptions
from telemetry.core import platform as platform_module
from telemetry.in... |
#!/usr/bin/env python
"""
################################################################################
# #
# shijian_examples_clocks #
# ... |
# Copyright (c) 2013 Mirantis 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 writi... |
# -*- coding: utf-8 -*-
# #############################################################################
#
# Brazillian Carrier Correios Sigep WEB
# Copyright (C) 2015 KMEE (http://www.kmee.com.br)
# @author: Michell Stuttgart <michell.stuttgart@kmee.com.br>
#
# Sponsored by Europestar www.europestar.com.br
... |
######################################### Built-in Functions #########################################
abs(x) # Return the absolute value of a number
# .........................................
all(iterable) # Return True if all elements of the iterable are true
# equivalent to:
def all(iterable):
for element i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014, Deutsche Telekom AG - Laboratories (T-Labs)
#
# 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... |
# coding: utf-8
from django.db import models
STATUS_GOOD_CODES = (
('S001', u'Пакет не был найден по указанному URL'),
('S002', u'Пакет загружен на сервер'),
('S004', u'Пакет рассылается'),
('S005', u'Пакет отправлен, ожидаем удаление информации о '
u'пакете из системы'),
('S006', u'... |
#!/usr/bin/env python
import logging
import struct
from pif_ir.bir.objects.bir_struct import BIRStruct
from pif_ir.bir.objects.packet_instance import PacketInstance
from pif_ir.bir.utils.bir_parser import BIRParser
from test_common import yaml_eth_struct_dict
def fail(case):
logging.error("Test Case {}: Failed".... |
from CCAPython.gov.cca import Services
from CCAPython.gov.cca.ports import ConnectionEventService
from CCAPython.gov.cca.ports import EventType
from CCAPython.framework.info.connectioninfo import ConnectionEvent
from CCAPython.framework.common.typemap import TypeMapDict
from CCAPython.framework.common.exceptions import... |
# Copyright 2014-2016 OpenMarket Ltd
#
# 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 w... |
#!/usr/bin/env python
"""
The SSL module performs ssl-related
enumeration tasks.
@author: Gabor Seljan (gabor<at>seljan.hu)
@version: 1.0
"""
import sys
from ..config import Config
from ..process_manager import ProcessManager
from ..generic_service import GenericService
class SslEnumeration(GenericService, ProcessMa... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# JewelCraft jewelry design toolkit for Blender.
# Copyright (C) 2015-2019 Mikhail Rachinskiy
#
# 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, eith... |
BRANCH = "mozilla-beta"
MOZ_UPDATE_CHANNEL = "beta"
MOZILLA_DIR = BRANCH
OBJDIR = "obj-l10n"
EN_US_BINARY_URL = "http://ftp.mozilla.org/pub/mozilla.org/mobile/candidates/%(version)s-candidates/build%(buildnum)d/android-api-9/en-US"
#STAGE_SERVER = "dev-stage01.srv.releng.scl3.mozilla.com"
STAGE_SERVER = "stage.mozilla.... |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.views.generic import RedirectView
from django.db.models import get_models
import django_databrows... |
# Copyright 2014-2016 OpenMarket Ltd
#
# 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 w... |
#!/usr/bin/env python
from setuptools import setup
setup(name='screenkey', version='0.5',
description='A screencast tool to display keys',
author='Pablo Seminario',
author_email='pabluk@gmail.com',
maintainer='Yuri D\'Elia',
maintainer_email='wavexx@thregr.org',
license='GPLv3+',
... |
import dbus
import logging
from dbus.mainloop.glib import DBusGMainLoop
from usbcreator.backends.base import Backend
from usbcreator.misc import *
DISKS_IFACE = 'org.freedesktop.UDisks'
DEVICE_IFACE = 'org.freedesktop.UDisks.Device'
PROPS_IFACE = 'org.freedesktop.DBus.Properties'
import time
class UDisksBackend(Back... |
from typing import Callable, Optional
import rx
from rx import from_future
from rx.core import Observable
from rx.disposable import CompositeDisposable, SingleAssignmentDisposable
from rx.internal.concurrency import synchronized
from rx.internal.utils import is_future
def _merge(*sources: Observable,
max_... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-03 22:06
from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
depen... |
import numpy as __np__
import matplotlib.pyplot as __plt__
def third(s1,s2,s3,s4,s5):
"""
Third order aberrations:
Ray aberrations
Field curve
Distortion
input: third order aberration coefficient
sigma 1~5
output: third order aberration graph
"""
print("third order aberration")
py = __np__.linspace(-... |
import nltk
import glob
import pickle
import numpy as np
from fann2 import libfann
### Unigram perplexity
# obvious
alpha = 0.5
nExamples = 0
fileToEntropy = {}
# load pickle
wordsInOrder = pickle.load( open( "wordsInOrder.p", "rb" ) )
wordProb = pickle.load( open( "wordProbability.p", "rb" ) )
# load neural netwo... |
"""add files table
Revision ID: 50344aecd1c2
Revises: 1bb187bcd401
Create Date: 2015-04-13 08:08:08.682803
"""
# revision identifiers, used by Alembic.
revision = '50344aecd1c2'
down_revision = '1bb187bcd401'
import re
import sys
from alembic import op, context
import sqlalchemy as sa
import git.exc
import gertty... |
# Hidden Markov Models
#
# Author: Ron Weiss <ronweiss@gmail.com>
# and Shiqiao Du <lucidfrontier.45@gmail.com>
# API changes: Jaques Grobler <jaquesgrobler@gmail.com>
"""
The :mod:`sklearn.hmm` module implements hidden Markov models.
**Warning:** :mod:`sklearn.hmm` is orphaned, undocumented and has known
numerical s... |
# The MIT License (MIT)
#
# Copyright (c) 2016 David I Urbina
#
# 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, mo... |
import attr
from cfme.utils.appliance.plugin import AppliancePlugin
from cfme.utils.appliance.plugin import AppliancePluginException
from cfme.utils.log import logger_wrap
from cfme.utils.quote import quote
from cfme.utils.wait import wait_for
class SystemdException(AppliancePluginException):
pass
@attr.s
clas... |
import time
import pickle
from socket import error as socket_error
from status import CLIENT_TIMEOUT
def dump_file(data):
try:
with file('temp.db') as f:
string_file = f.read()
db = pickle.loads(string_file)
except:
db = list()
db.append(data)
with open('temp.db', ... |
# Mock a Swift server with autopkgtest results
# Author: Martin Pitt <martin.pitt@ubuntu.com>
import os
import tarfile
import io
import sys
import socket
import time
import tempfile
import json
try:
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse, parse_qs
except I... |
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
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, merg... |
#!/usr/bin/python
''' Module to control the picaxe OLED.
Updated to work with both 16x2 and 20x4 versions.
Requires new picaxe fw that inverts serial polarity, i.e. N2400 -> T2400.
The oled modules work fine off the RPi 3v3, which avoids the need for level shifting.
Requires the installation of the python seria... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import subprocess
C_GREEN = '\033[92m'
C_BLUE = '\033[94m'
C_END = '\033[00m'
def grouping(fileList):
root = {}
for path in fileList:
current = root
for p in path.rstrip('\n').split('/'):
current.setdefault(p, {})
... |
# -*- coding: utf-8 -*-
import skimage.io
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import selectivesearch
import numpy as np
import skimage.transform
import os
import shutil
import caffe
from PIL import Image
candidates = set()
merged_candidates = set()
refined = set()
final = set()
final_... |
#Cross-modal oddball experiment
#Erik Marsja, erik at marsja.se (http://www.marsja.se)
#Import the modules needed
import time, os, re, random
from datetime import datetime
from sgen import trialCreator#My custom made randomzation script
#Psychopy stuff
from psychopy import visual, core, data, event, logging, gui, sou... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# ThinkOpen Solutions Brasil
# Copyright (C) Thinkopen Solutions <http://www.tkobr.com>.
#
# This... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import abc
import subprocrunner
import typepy
from humanreadable import ParameterError
from .._common import run_command_helper
from .._const import TcSubCommand, TrafficDirection
from .._iptables import IptablesMangleMarkEntry
from .._logger im... |
import autocomplete_light
autocomplete_light.autodiscover()
from .forms import (
SelectMultipleHelpTextRemovalMixinTestCase,
FkModelFormTestCase,
OtoModelFormTestCase,
GfkModelFormTestCase,
MtmModelFormTestCase,
GmtmModelFormTestCase,
TaggitModelFormTestCase
)
from .fields import ChoiceFie... |
import datetime
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import get_storage_class
from django.core.files.images import get_image_dimens... |
# ***************************************************************************
# * (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
# * (c) 2009, 2010 Ken Cline <cline@frii.com> *
# * (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006 Christian Boos <cboos@neuf.fr>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribu... |
import datetime
import functools
from pyratemp import TemplateSyntaxError, TemplateRenderError
from django.contrib.auth import PermissionDenied
from django.shortcuts import get_object_or_404, redirect, render
from refugeedata.models import Distribution, Template
from .forms import DistributionHashForm
def standar... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... |
# python 3.5
import getpass
from random import shuffle
def player_one():
docs = open('GPL.txt').read().split()
shuffle(docs)
wort = docs[1]
return wort
player_input = input('1 or 2 players?: ')
player = int(player_input)
word = ''
while word == '':
if player == 1:
while len(word) < 3:
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import copy
from mock import Mock, patch
from testtools import TestCase
from spreadflow_core.scheduler import Scheduler
from spreadflow_delta.test.matchers import MatchesSendDeltaIte... |
import django
from media_tree.models import FileNode
from media_tree.admin.utils import get_current_request, is_search_request, \
get_request_attr
from django.contrib.admin.views.main import ChangeList
from django.db import models
class MediaTreeChangeList(ChangeList):
def is_filtered(self, request):
... |
# -*- coding: utf-8 -*-
"""
shipit.git
~~~~~~~~~~
Operations on git repositories.
"""
import os
import tempfile
import subprocess
def get_remotes():
"""
Get a list of the git remote URLs for this repository.
Return a dictionary of remote names mapped to URL strings if remotes were
found.
Othe... |
#!/usr/bin/env python
# -*- coding: ascii -*-
"""settings.py - tool for reading/storing settings of the main program and algorithm parameters"""
import ConfigParser
import io
import numpy as np
import logging
import os
import sys
import threading
from defines import *
# Standard parameters if no settings.ini is avai... |
import mock
import pytest
from dallinger.models import Participant
from dallinger.experiment import Experiment
class TestModuleFunctions(object):
@pytest.fixture
def mod(self):
from dallinger import recruiters
return recruiters
def test__get_queue(self, mod):
from rq import Queue... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.