src stringlengths 721 1.04M |
|---|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
"""
trakt.py --- Jen Plugin for accessing trakt data
Copyright (C) 2017, Jen
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 optio... |
__author__ = 'herve.beraud'
from datetime import datetime, timedelta
from django import template
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.utils.timesince import timesince
from community.models import InformationMessage
from exercises.models import Category
fr... |
#!/usr/bin/env python3
import logging
import sched
import time
import cdsmon.source
import cdsmon.fetch
import cdsmon.update
class Monitor:
def __init__(self, source, fetch, update):
self._source = source
self._fetch = fetch
self._update = update
self._next = 0
def exec(self)... |
# Copyright (c) 2013 Rackspace Hosting 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
#
# Unles... |
#!/usr/bin/python
from argparse import ArgumentParser
from sys import stdin
from string import ascii_uppercase
from naiveplot import NaivePlot, Curve, Point, Line
class NaiveParserPlotter:
"""Class for reading and plotting"""
def __init__(self):
"""Setup place holders"""
self.args = None
... |
import json
import re
import traceback
from couchpotato import Env
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import tryInt, tryFloat, splitString
from couchpotato.core.logger import CPLog
from couchpotato.cor... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '25/04/16'
__license__ = "GPL"
__copyright__ = 'kartoza.com'
import os
import json
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from healthsites.map_clustering import cluster, parse_bbox
from healthsites.mod... |
#!/usr/bin/python
from Adafruit_PWM_Servo_Driver import PWM
import time, os, sys
from random import randint
# Initialise the PWM device using the default address
pwm = PWM(0x70)
pwm.setPWMFreq(100)
brightRed = 3
brightGreen = 5
humidRed = 7
humidGreen = 9
tempRed = 11
tempGreen = 13
pwm.setPWM(brightRed, 0, 0)
pwm.... |
import maya.cmds as mc
from functools import partial
import os
import System.utils as utils
class GroupSelected:
def __init__(self):
self.objectsToGroup = []
def showUI(self):
# build the grouping GUI
self.findSelectionToGroup()
if len(self.objectsToGroup) == 0:
return
self.dUiElement... |
# Copyright 2010 Ramon Xuriguera
#
# This file is part of BibtexIndexMaker RCE.
#
#
# BibtexIndexMaker RCE 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... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# (c) 2013 Mike Lewis
import logging; log = logging.getLogger(__name__)
from . import BaseAuthenticatedEndpointTestCase, BaseUserlessEndpointTestCase
class EventsEndpointTestCase(BaseAuthenticatedEndpointTestCase):
"""
General
"""
def test_event(self):
... |
from django.db import models
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager,
PermissionsMixin)
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.mail import send_mail
class UserManager(B... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,too-ma... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
"""
WSGI config for myvoice project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... |
# -*- coding: utf-8 -*-
"""Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal... |
# -*- coding: utf-8 -*-
"""
Bubbles Addon
Copyright (C) 2016 Viper2k4
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... |
import numpy as np
from .q_thread_learner import QThreadLearner
class RecurrentThreadLearner(QThreadLearner):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.lstm_state_for_training = self.network.get_lstm_state()
def reset(self):
super().reset()
se... |
# Copyright (c) David Wilson 2015, 2016, 2021
#
# Licensed under the GPL version 3
import lib.boincindicator.basetypes.Struct as struct
import lib.boincindicator.util.xmlutil as xmlutil
from xml.etree import ElementTree
class AvailableProject(struct.Struct):
def __init__(self):
self.fields = [
... |
# -*- coding: utf-8 -*-
#
# My_Project documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 29 14:24:11 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
# ossohelper.py - Helper to osso functions
#
# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
#
# This file is part of carman-python.
# Modified for inclusion in Panucci (June 2009).
#
# carman-python is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... |
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from ..scraper import _ParserScraper
class RHJunior(_ParserScraper):
stripUrl = 'https://www.rhjunior.com/%s/'
imageSearch = '//div[contains(@class, "entry-content")]//img'
multipleImagesPerS... |
try:
# Python 3
import urllib.parse as urllibparse
except ImportError:
# Python 2
import urllib as urllibparse
from .. import DeenPlugin
class DeenPluginUrl(DeenPlugin):
name = 'url'
display_name = 'URL'
cmd_name = 'url'
cmd_help='URL encode/decode data'
def __init__(self):
... |
import datetime
import json
import traceback
from django.shortcuts import render
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
from django.http import HttpResponse
from django.contrib.auth.models import User
# from models i... |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='dicom2fem',
description='Generation of finite element meshes from DICOM images',
long_desctioption="Generation of finite element meshes using c... |
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
mnist = input_data.read_data_sets("MNIST_data/",one_hot = True) #导入数据
sess = tf.InteractiveSession() #开启一个Session
def weight_variable(shape): #定义一个权重变量
initial = tf.truncated_normal(shape,stddev=0.1) #初始化一个正态分布噪声,标准差为0.... |
# This file is part of PlexPy.
#
# PlexPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PlexPy is distributed in the hope t... |
'''
ptop.core.plugin
This module define the BaseClass for plugin. It defines the basic rules that are to be followed by a new plugin.
'''
class Plugin(object):
'''
Base Plugin class
'''
def __init__(self,name,sensorType,interval):
'''creates an instance of the class
I... |
from django.test import TestCase
from lists.models import Item, List
from django.utils.html import escape
class HomePageTest(TestCase):
def test_uses_home_template(self):
response = self.client.get('/')
self.assertTemplateUsed(response, 'home.html')
class ListViewTest(TestCase):
def test_us... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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 requ... |
from __future__ import absolute_import
from typing import Any, Callable, Iterable, Tuple
from collections import defaultdict
import datetime
import six
from six import text_type
from django.db.models import Q, QuerySet
from django.template import loader
from django.conf import settings
from zerver.lib.notifications ... |
#!/usr/bin/env python
import fcntl, struct, time, array
#
# There are two steps to creating a rumble effect
# 1/ describe the effect and give it to the driver using an
# ioctl.
# There a 3 paramaters:
# strength: from 0 to 0xffff - this code takes a value from 0 to
# 1 and ... |
from django.contrib import admin
from django import forms
from .models import SocialApp, SocialAccount, SocialToken
from ..account import app_settings
from ..utils import get_user_model
User = get_user_model()
class SocialAppForm(forms.ModelForm):
class Meta:
model = SocialApp
widgets = {
... |
import functools
import warnings
from datetime import date, datetime
from dateutil import parser
from decimal import Decimal
from pyticketswitch.exceptions import InvalidParametersError
def date_range_str(start_date, end_date):
"""Convert a set of dates to string readable by the API
Args:
start_date... |
# -*- coding: utf-8 -*-
#import wxversion
#wxversion.select('2.8.11')
import wx
import os
import sys
import wx.combo
import wx.lib.agw.foldpanelbar as fpb
_ = wx.GetTranslation
def GetCollapsedIconData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\x... |
from __future__ import print_function
import requests
import os, sys
import subprocess
import json
import ipdb
from Bio import Entrez
from Bio import Medline
class PubmedGetter(object):
def __init__(self, pmid):
self.authors = []
self.title = ""
self.journal = ""
self.pmid = pmid
... |
"""
5-fold CV - log loss 0.4687
"""
import numpy as np
import os
from sklearn import ensemble, feature_extraction, preprocessing
from sklearn.calibration import CalibratedClassifierCV
from otto_utils import consts, utils
MODEL_NAME = 'model_08_random_forest_calibrated'
MODE = 'holdout' # cv|submission|holdout
# i... |
# Copyright 2015 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 applicable... |
from simpleMediaCenter.interface.Interface import InterfaceListable
from simpleMediaCenter.player.Omxplayer import Omxplayer
from simpleMediaCenter.player.Twitchplayer import Twitchplayer
from simpleMediaCenter.player.Youtubeplayer import Youtubeplayer
from simpleMediaCenter.browser.Browser import *
import logging
impo... |
#!/usr/bin/env python
#
# Copyright (c) 2009 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... |
#-*- coding:utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import print_function
from __future__ import unicode_literals
import re
class Tex(object):
"""Wraps a string of TeX such that wrapping it in
:class:`~flask.Marku... |
# * *************************************************************
# *
# * Soft Active Mater on Surfaces (SAMoS)
# *
# * Author: Rastko Sknepnek
# *
# * Division of Physics
# * School of Engineering, Physics and Mathematics
# * University of Dundee
# *
# * (c) 2013, 2014
# *
# * School of Scienc... |
from .. import POINTOID, BOXOID, LSEGOID, CIRCLEOID
from ..geometry import Point, Box, Lseg, Circle
from ...python.functools import Composition as compose
from . import lib
oid_to_type = {
POINTOID: Point,
BOXOID: Box,
LSEGOID: Lseg,
CIRCLEOID: Circle,
}
# Make a pair of pairs out of a sequence of four objects
de... |
#!/usr/bin/env python
# this script replaces hashtags with a sphinx URL string (to the github issues or pull request)
# written by Jon with regex code by Jeremy
import re
input_path = 'psychopy/CHANGELOG.txt'
output_path = 'docs/source/changelog.md'
def repl_link(match):
name = match.group('name').strip()
... |
"""This plugin triggers schedules events.
The different commands are triggered:
* every 10 seconds
* at the start of every minute
* ..hour
* ..day
* ..month
* ..year
All these events are triggered as soon as possible, i.e. 'Day' will be
triggered at 0:00, month on the 1st at 0:00, etc.
"""
##... |
import copy
import re
from io import BytesIO
from itertools import chain
from urllib.parse import quote, urlencode, urljoin, urlsplit
from django.conf import settings
from django.core import signing
from django.core.exceptions import (
DisallowedHost, ImproperlyConfigured, RequestDataTooBig,
)
from django.core.fil... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Create tif rasters from xyz files by linear interpolation using griddata.
"""
import argparse
import math
import os
from osgeo import gdal
from osgeo import osr
import numpy as np
from raster_tools import datasets
WIDTH = 0.5
HEIGHT = 0.5
NO_DATA_VALUE = np.finfo('f... |
"""eztest - A python package to do performance/load test
Copyright (C) 2018 lgt, version 1.0 by lgt
* https://github.com/lgt1001/eztest
"""
from setuptools import setup
setup(
name="eztest",
version="2.0.2",
description="eztest is a Python package and execution used for performance testing or load testing... |
DEBUG = True
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'TEST_NAME': ':memory:',
},
}
# Hosts/domain names that are valid for this site; required if DEBUG is Fals... |
# Copyright 2017 OVH SAS
# 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... |
# deal with unicode literals: http://www.python.org/dev/peps/pep-0263/
# vim: set fileencoding=utf-8 :
"""
----------------
IMAP SYNC ENGINE
----------------
Okay, here's the deal.
The IMAP sync engine runs per-folder on each account.
Only one initial sync can be running per-account at a time, to avoid
hammering the... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from numpy import pi
# from numpy import cos
# from numpy import sin
from numpy.random import random
from numpy import zeros
# from numpy import linspace
from numpy import floor
from modules.growth import spawn_curl
NMAX = 10**6
SIZE = 512
ONE = 1./SIZE
PROCS = 2
INIT_... |
# Django settings for forager project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'forage... |
# Copyright (C) 2011-2020 Aratelia Limited - Juan A. Rubio and contributors
#
# Portions Copyright (C) 2014 Dan Nixon
# (see https://github.com/DanNixon/PlayMusicCL)
#
# This file is part of Tizonia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... |
#!/usr/bin/env python
import os
import os.path
import sys
import math
import time
import struct
import argparse
import platform
import itertools
import subprocess
guiscad_template = """\
module showlines(clr, lines) {{
for (line = lines) {{
delta = line[1]-line[0];
dist = norm(delta);
the... |
"""
Wrapper for reading from and writing to the SDOW database.
"""
import os.path
import sqlite3
import helpers as helpers
from breadth_first_search import breadth_first_search
class Database(object):
"""Wrapper for connecting to the SDOW database."""
def __init__(self, sdow_database, searches_database):
if... |
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
kPluginNodeName = "MitsubaVolume"
kPluginNodeClassify = "shader/volume"
kPluginNodeId = OpenMaya.MTypeId(0x87033)
class volume(OpenMayaMPx.MPxNode):
def __init__(self):
OpenMayaMPx.MPxNode.__init__(self)
mSourcefile... |
''' ---------------------------------------------------------------------------------------------------------------- '''
''' These below are the membership groups and their membership customized replies. Edit this area to expand the bot. '''
''' --------------------------------------------------------------------------... |
from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class DeviceFilterRemote(RemoteModel):
"""
Network traffic rules; on most routers and firewalls, this corresponds to an access control list entry. In JunOS packet mode configurations, it corresponds to a rule (a co... |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
import socket
import os
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bo... |
# NSConf videos renamer
# Alex Hunsley 2013
#
# This quick hack fixes the WTF that is the file naming of the NSConf videos.
# Note that the files are renamed by making copies, rather than
# renamed in place, to avoid annoying irreversible screwups.
#
import csv
import os.path
import sys
import string
import shutil
# ... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, 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... |
# This file is part of Bika LIMS
#
# Copyright 2011-2016 by it's authors.
# Some rights reserved. See LICENSE.txt, AUTHORS.txt.
from Acquisition import aq_parent
from Products.CMFPlone.utils import safe_unicode
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import to_utf8
from Products.CMFCore.util... |
# Written by Arno Bakker
# see LICENSE.txt for license information
#
# Razvan Deaconescu, 2008:
# * corrected problem when running in background
# * added usage and print_version functions
# * uses getopt for command line argument parsing
import sys
import shutil
import time
import tempfi... |
# Django settings for genome_designer project.
import logging
import os
from django.conf import global_settings
# EntrezGene wants an email to use it's API.
EMAIL = "millstone_user@gmail.com"
# The absolute path of the settings.py file's directory.
# Useful for settings that require absolute paths like templates.
... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
import unittest
from pycoin.ecdsa import generator_secp256k1
from pycoin.ecdsa.ellipticcurve import Point, NoSuchPointError
from pycoin.encoding import hash160_sec_to_bitcoin_address
from pycoin.key import Key
from pycoin.key.BIP32Node import BIP32Node
from pycoin.key.Key import InvalidPublicPairError, InvalidSecretEx... |
from extract_and_vector.dbi.downloads.extract import process_download_for_extractor
from .setup_test_extract import TestExtractDB
class TestProcessDownloadForExtractor(TestExtractDB):
def test_process_download_for_extractor(self):
# Make sure nothing's extracted yet and download text is not to be found
... |
import warnings
warnings.simplefilter(action="ignore", category=RuntimeWarning)
warnings.simplefilter(action="ignore", category=PendingDeprecationWarning)
import os.path
from tempfile import NamedTemporaryFile
from hicexplorer import hicConvertFormat
import pytest
REMOVE_OUTPUT = True
# DIFF = 60
DELTA_DECIMAL = 0
RO... |
"""
Student Views
"""
import datetime
import json
import logging
import uuid
import warnings
from collections import namedtuple
import analytics
import dogstats_wrapper as dog_stats_api
from bulk_email.models import Optout
from courseware.courses import get_courses, sort_by_announcement, sort_by_start_date
from djang... |
#!/usr/bin/python3
from functools import partial
from math import ceil
import tkinter as tk
from zoom_map import ZoomMap
class _Context(tk.Text):
CONTEXT_COUNT = 3 # Lines to display before/after the current one
# TODO: What about files with over 99,999 lines?
LINE_NUMBER_WIDTH = 5 # Number of charact... |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... |
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = '0.30.0'
def pip_git_to_setuptools_git(url):
match = re.match(r'git\+https://github.com/(?P<organization>[^/]+)/(?P<repository>[^/]+).git@(?P<tag>.+)', url.strip())
if match:
url = 'htt... |
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms import StringField, PasswordField, SubmitField, RadioField, validators, IntegerField, SelectField, BooleanField,DecimalField
from wtforms.validators import DataRequired, Email, Length
from flaskext.mysql import ... |
# Cut Groups
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
# create a box and some groups of faces on it
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(Group_1, [13,... |
# -*- 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
from xml.etree import ElementTree
# calling example
def main():
configdict = ConvertXmlToDict('config.xml')
pprint(configdict)
# you can access the data as a dictionary
print configdict['settings']['color']
configdict['settings']['color'] = 'red'
# or you can access it... |
#
# Copyright (c) SAS Institute 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 w... |
import unittest
import os
from flask import current_app
from flask_testing import TestCase
from app import create_app
app = create_app()
class TestDevelopmentConfig(TestCase):
def create_app(self):
app.config.from_object('app.config.DevelopmentConfig')
return app
def test_app_is_development(... |
from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView, DeleteView
from .base import GenericListView, GenericCreateView
from ..models import GuidanceSystem
from ..forms import GuidanceSystemForm
from django.core.urlresolvers import reverse_lazy
from django.core.urlresolvers ... |
#!/usr/bin/env python
"""This script is given "A collection of DNA strings in FASTA format having
total length at most 10 kbp" and returns "The adjacency list corresponding to
O3. You may return edges in any order".
"""
import argparse
from Bio import SeqIO
from Bio.Alphabet import generic_dna
def main(args):
"... |
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from djblets.webapi.errors import DOES_NOT_EXIST
from reviewboard.webapi.resources import resources
from reviewboard.webapi.resources.base_original_file import \
BaseOriginalFileResource
class OriginalFileResource(Base... |
# ICE Revision: $Id$
"""A wrapper to run a solver as a CTest"""
import sys
import os
from os import path
import subprocess
import shutil
import traceback
import inspect
from PyFoam.ThirdParty.six.moves import cPickle as pickle
import time
from PyFoam.Applications.CloneCase import CloneCase
from PyFoam.Applications... |
#!/usr/bin/python
import inkscapeMadeEasy_Base as inkBase
import inkscapeMadeEasy_Draw as inkDraw
class RLC(inkBase.inkscapeMadeEasy):
# ---------------------------------------------
def drawBipoleGeneral(self, parent, position=[0, 0], value='Z', label='Bipole', angleDeg=0, flagVolt=True,
... |
import pytest
import unittest
from libweasyl import staff
from libweasyl.models import site
from weasyl import define as d
from weasyl import comment
from weasyl import shout
from weasyl.error import WeasylError
from weasyl.test import db_utils
@pytest.mark.usefixtures('db')
class TestRemoveComment(object):
gen... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.forms import (TextInput, DateInput, FileInput, CheckboxInput,
ClearableFileInput, Select, RadioSelect, CheckboxSelectMultiple)
from django.forms.extras import SelectDateWidget
from django.forms.forms import BaseForm, ... |
import os.path
import pathlib
from typing import Dict
import matplotlib as mpl
# This has to happen before pyplot is imported to avoid needing an X server to draw the graphs.
# pylint: disable=wrong-import-position
mpl.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
from decksite.data import deck
fro... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from .test_table import SetupData
from ..bst import BST, FastRBT
from ..sorted_array import SortedArray
from ..table import QTable, Row
from ... import units as u
from ...time import Time
from ..column import BaseColumn
f... |
import json
from contextlib import closing
from contextlib import contextmanager
import mysql.connector
from edx.analytics.tasks.url import get_target_from_url
# TODO: use a database that is unique to this particular test run to isolate it.
class DatabaseService(object):
def __init__(self, config, database_n... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
import sys
sys.path.append('../')
from PyQt4 import QtGui, QtCore
from sekvens_gui import Ui_MainWindow
import graf2il
class MeinProgramm(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
XMLFileToCompileName = 'test'
... |
#!/usr/bin/python
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
The core object model for the Decoder Generator. The dg_input and
dg_output modules both operate in terms of these classe... |
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from webvm.models import Slave, Snapshot, VirtualMachine, MachineImage, HwConfiguration, JobQueueItem
from bearded_adventure.common import CamelCaseJSONSerializer
from tastypie import fields
from tastypie.authentication import ApiKeyAuthentication
c... |
# -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <g.t@majerti.fr>
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
import logging
from transaction import commit
import sqlalchemy
from autonomie_base.models.base import DBSESSION
logger = logging.getLogger(__name__)
GROUP... |
import argparse
from .deserializers import CoverageDeserializer
from .deserializers import NosetestDeserializer
from .deserializers import RadonDeserializer
class CoverageParser(object):
def __init__(self):
self.base_parser = argparse.ArgumentParser(
description='Get Python Coverage',
... |
from frappe import _
from frappe.widgets.moduleview import add_setup_section
def get_data():
data = [
{
"label": _("Users and Permissions"),
"icon": "icon-group",
"items": [
{
"type": "doctype",
"name": "User",
"description": _("System and Website Users")
},
{
"type": "docty... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Classe permettant de regrouper des éléments d’interface utilisateur"""
from .UI import UI
from ..Sequence import Sequence
from ..constantes import ENTREE, MAJ_ENTREE
class Conteneur(UI):
"""Classe permettant de regrouper des éléments d’interface utilisateur
Ce... |
import numpy as np
from scipy.misc import imsave
from libcore import Img
from libcore import DistortionCorrection, DistortionCorrectionPoint
image_path = '../schraegbild_tempelhof.jpg'
def main():
b1()
def b1():
image = Img.load_image(image_path)
target_image_size_height = 900
target_image_size_w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.