src stringlengths 721 1.04M |
|---|
# test_birkhoff.py - unit tests for Birkhoff--von Neumann decomposition
#
# Copyright 2015 Jeffrey Finkelstein.
#
# This file is part of Birkhoff.
#
# Birkhoff is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, e... |
# TmLibrary - TissueMAPS library for distibuted image analysis routines.
# Copyright (C) 2016 Markus D. Herrmann, University of Zurich and Robin Hafen
#
# 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 Softwa... |
import base64
import ignore
consumer_key = ignore.TWITTER_CONSUMER_KEY
consumer_secret = ignore.TWITTER_CONSUMER_SECRET
access_token = ignore.TWITTER_ACCESS_TOKEN
access_secret = ignore.TWITTER_ACCESS_SECRET
def get_bearer_token(consumer_key, consumer_secret):
# get bearer token for application only requests
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseNotFound
from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from .forms import *
from .models import *
from shippings.models im... |
# PyJVM (pyjvm.org) Java Virtual Machine implemented in pure Python
# Copyright (C) 2014 Andrew Romanenco (andrew@romanenco.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Classified Polygon on
Land Cover Metadata Definitions.
Contact : ole.moller.nielsen@gmail.com
.. note:: 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
t... |
from bs4 import BeautifulSoup as bs
import sys
htmlfile = sys.argv[1]
htmlfile = open(htmlfile,'r', encoding="utf-8")
bs_html = bs(htmlfile, 'lxml')
table = bs_html.find('table')
headings = []
for th in table.find('tr').find_all('th'):
headings.append(th.get_text())
datasets = []
for row in table.find_all("t... |
#!/usr/bin/env python
from setuptools import setup
__version__ = '0.0.1'
CLASSIFIERS = map(str.strip,
"""Environment :: Console
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Natural Language :: English
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming ... |
#!/usr/bin/env python
# coding: utf-8
import getpass
from re import search
from subprocess import Popen, PIPE
from winrm import Session
from sys import exit, argv
if len(argv) < 2 :
exit('Sposób użycia: %s <polecenie>' % argv[0])
polecenie = " ".join(argv[1:])
exitCode = 0
class PowerShellEr... |
from __future__ import print_function
from os import sys, path
try:
from skbuild import setup
except ImportError:
print('scikit-build is required to build from source.', file=sys.stderr)
print('Please run:', file=sys.stderr)
print('', file=sys.stderr)
print(' python -m pip install scikit-build')
... |
# 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 may ... |
#!/usr/bin/python
import sys
import os
from subprocess import call
from Bio import SeqIO
print "Usage: mitobim_run.py NumberOfReads ListOfFiles Reference [miramito/quickmito/seedmito] missmatch"
try:
nreads = sys.argv[1]
except:
nreads = raw_input("Introduce number of reads: ")
try:
lista = sys.argv[2]
... |
########################################################################
# File : StalledJobAgent.py
########################################################################
""" The StalledJobAgent hunts for stalled jobs in the Job database. Jobs in "running"
state not receiving a heart beat signal for more than stalle... |
# -*- coding: utf-8 -*-
import sys
import sublime
import sublime_plugin
PY_MAJOR_VER = sys.version_info[0]
PY_MINOR_VER = sys.version_info[1]
def selections(view, default_to_all=True):
regions = [r for r in view.sel() if not r.empty()]
if not regions and default_to_all:
regions = [sublime.Region(0, ... |
from contextlib import contextmanager
import logging
from sqlalchemy import (Column, create_engine, DateTime, Integer)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.sql import func
from sqlalchemy.schema import FetchedValue
from sqlalche... |
import numpy as np
from numpy.linalg import norm
from sim_problem import SimProblem, STR
import phase_controller
import math
class GPJump(SimProblem):
def __init__(self):
super(GPJump, self).__init__('urdf/BioloidGP/BioloidGP.URDF',
fps=1000.0)
self.__init__sim... |
# -*- coding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
# All Rights Reserved.
# info@vauxoo.com
#####################################################... |
#!/usr/bin/env python
#
# Copyright 2014 Institute for Theoretical Information Technology,
# RWTH Aachen University
# www.ti.rwth-aachen.de
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... |
# -*- coding: utf-8 -*-
import unittest
from urllib import quote
from iktomi.web.reverse import URL
from iktomi.web.url_templates import UrlTemplate
from iktomi.web.url_converters import Converter, ConvertError
class URLTests(unittest.TestCase):
def test_rendering_without_params(self):
'Url without para... |
"""
Consider to convection diffusion problem
-alpha*u`` - u` = f in (0, 1)
u = g on \partial(0, 1)
1) f = alpha*pi**2*sin(pi*x) - pi*cos(pi*x), u(0) = u(1) = 0
2) f = 0, u(0) = 0, u(1) = 1
Use supg stabilization and in both cases estimate the constant from
Cea's lemma.
"""
# FIXME add problem 2
# FIXME add supg n... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
#
# Copyright (c) 2012 NTT DOCOMO, INC
# Copyright (c) 2011 University of Southern California / ISI
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Licens... |
class Formula:
def __ne__(self, other):
return not (self == other)
def flatten(self):
return self
def getVariable(self, mapping):
if self not in mapping:
mapping[self] = freshVariable()
return mapping[self]
class Variable(Formula):
def __init__(self, x):
... |
import math
from PyEngine3D.Utilities import *
def always_pass(*args):
return False
def cone_sphere_culling_actor(camera, actor):
to_actor = actor.transform.pos - camera.transform.pos
dist = length(to_actor)
if 0.0 < dist:
to_actor /= dist
rad = math.acos(np.dot(to_actor, -camera.tran... |
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
import random
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
class Generator(nn.Module):
def __init__(... |
import os
import unittest
from django.core import mail
from django.core.exceptions import ValidationError
from django.forms import TextInput
from django.test import TestCase
import datetime
from django.urls import reverse
from members import cron
from members.forms import PersonNumberField
from members.models import... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yeison/Documentos/Desarrollo/Pinguino/GitHub/pinguino-ide/pinguino/qtgui/gide/bloques/inside/inside2_bool.ui'
#
# Created: Wed Mar 16 13:19:41 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in t... |
# Copyright 2013 Douglas Linder
# 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... |
from django.core.management.base import BaseCommand, CommandError
from jeutennis.models import table_joueurs, table_match, table_tournoi
from django.utils import timezone
import datetime
import random
import time
from collections import OrderedDict
list_tournoi = []
id_tournoi = []
list_part = []
domicile = []
exterie... |
from pycp2k.inputsection import InputSection
class _each255(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... |
# server.py
#
# Copyright 2003-2004,2007 Wichert Akkerman <wichert@wiggy.net>
import select
import socket
from pyrad import host
from pyrad import packet
import logging
logger = logging.getLogger('pyrad')
class RemoteHost:
"""Remote RADIUS capable host we can talk to.
"""
def __init__(self, address, s... |
import inspect
class MiddlewareDuplicationError(Exception):
def __init__(self, middleware_name, middleware_names):
message = ("Middleware `{}` was already found in `{}` middlewares!"
.format(middleware_name, middleware_names))
super().__init__(message)
class MiddlewareMissing... |
#!/usr/bin/python
# Copyright 2014-2019, The Tor Project, Inc.
# See LICENSE for license information
# This is a kludgey python script that uses ctypes and openssl to sign
# router descriptors and extrainfo documents and put all the keys in
# the right places. There are examples at the end of the file.
# I've used t... |
from synbiomts import dbms
from Bio import SeqIO
import xlrd
from openpyxl import load_workbook
get = lambda cell: cell[0].value # for openpyxl
# Initialize DataBase
DB = dbms.DataBase()
'''
-----------------------------------------------------------------------------------
Cambray, Guillaume, Joao C. Guimaraes, Vive... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# arkolect.py
#
# Copyright 2014 Ángel Coto <codiasw@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the ... |
# Copyright (c) 2015 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
"""API for accessing the metadata and file storage"""
from regolith.database import dump_database, open_dbs
from regolith.runcontrol import DEFAULT_RC, load_rcfile, filter_databases
from regolith.storage import store_client, push
def load_db(rc_file="regolithrc.json"):
"""Create a Broker instance from an rc file"... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('lrs.views',
url(r'^$', 'home'),
url(r'^statements/more/(?P<more_id>.{32})$', 'statements_more'),
url(r'^statements', 'statements'),
url(r'^activities/state', 'activity_state'),
url(r'^activities/profile', 'activity_profile'... |
# -*- coding: utf-8 -*-
# Copyright (c) 2002 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to search for text in files.
"""
from __future__ import unicode_literals
import os
import re
from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot
from PyQt5.QtGui import QCursor
from PyQt... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... |
# -*- coding: utf-8 -*-
## @file testsuite/python/dataBufferTest.py
## @date jul. 2016
## @author PhRG - opticalp.fr
##
## Test the features of the DataProxy
#
# Copyright (c) 2016 Ph. Renaud-Goud / Opticalp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and as... |
import logging
import numpy
from cis.exceptions import UserPrintableException
from cis.plotting.generic_plot import Generic_Plot
class Heatmap(Generic_Plot):
def __init__(self, packed_data_items, plot_args, *mplargs, **mplkwargs):
# Do this here because if this is ungridded data, we won't be able to com... |
# -*- coding: utf-8 -*-
"""
Netconfigit Fortinet device class
"""
__license__ = "MIT License"
__author__ = "Eric Griffin"
__copyright__ = "Copyright (C) 2014, Fluent Trade Technologies"
__version__ = "1.1"
import logging
import os
import time
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class... |
"""
This file contains the live logs page sub-class
"""
#####################################
# Imports
#####################################
# Python native imports
from PyQt5 import QtCore, QtWidgets, QtGui
import logging
from inputs import devices, GamePad
import time
#############################... |
# Copyright 2014 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 -*-
"""
eve-swagger.definitions
~~~~~~~~~~~~~~~~~~~~~~~
swagger.io extension for Eve-powered REST APIs.
:copyright: (c) 2016 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app as app
from eve_swagger import OrderedDict
def defini... |
# Copyright 2017 Max Planck Society
# Distributed under the BSD-3 Software license,
# (See accompanying file ./LICENSE.txt or copy at
# https://opensource.org/licenses/BSD-3-Clause)
"""Training AdaGAN on various datasets.
Refer to the arXiv paper 'AdaGAN: Boosting Generative Models'
Coded by Ilya Tolstikhin, Carl-Joha... |
# Copyright 2021 The Google Earth Engine Community Authors
#
# 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... |
import random
import xmlrpclib
from twisted.web import xmlrpc
from basics import basics
import Database
class Finances(xmlrpc.XMLRPC, basics):
def __init__(self):
basics.__init__(self)
self.oDatabase = Database.Database()
self.debugFinances = 1
def getCashAccountBook(se... |
#!/usr/bin/env python
# Copyright NumFOCUS
#
# 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.txt
#
# Unless required by applicable law or ... |
#!/usr/bin/env python2.7
#-*- coding: UTF-8 -*-
from category import Category
from gi.repository import Wnck, Gdk, Gtk, GObject, Notify, GLib
from activityrecord import ActivityRecord
from threading import Thread, Event
from time import sleep, time
import copy
class TimeTracker(Thread):
"""Core module of this pro... |
# -*- coding: utf-8 -*-
# -----------------------#
# License: GPL #
# Author: NeuronalMotion #
# -----------------------#
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QGraphicsLinearLayout
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript
from PyKDE4 import kdecore
import subprocess
im... |
"""
Does the following:
1. Generates and saves random secret key
2. Removes the taskapp if celery isn't going to be used
3. Removes the .idea directory if PyCharm isn't going to be used
4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/
TODO: this might have to be moved to a pre_gen_hook
A portio... |
# coding=UTF-8
#
# Samsung-Tools
#
# Part of the 'Linux On My Samsung' project - <http://loms.voria.org>
#
# Copyleft (C) 2010 by
# Fortunato Ventre - <vorione@gmail.com> - <http://www.voria.org>
#
# 'Samsung-Tools' is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from six.moves import xrange
def get_monthly_results(goal_doctype, goal_field, date_col, filter_str, aggregation = '... |
import os
import logging
from droptopus import config, settings
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QDialog,
QDialogButtonBox,
QFileDialog,
QFormLayout,
QHBoxLayout,
QLabel,
QLineEdit,
QMessageBox,
QPushButton,
)
from PyQt5.QtGui import QPixmap
class EditIte... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# UFO-launcher - A multi-platform virtual machine launcher for the UFO OS
#
# Copyright (c) 2008-2009 Agorabox, Inc.
#
# This 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 Foun... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.conf import settings as django_settings
from askbot.utils.console import ProgressBar
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards met... |
import re
import time
import zmq
#
# The input file is expected to have on each line:
# 1. a video_id
# 2. a tab
# 3. a channel_id
# The provided file (below: INPUT_FILE) matches that format.
#
# cfg
INPUT_FILE = "py/10_pairs_of_vid_and_chan_ids.txt"
PORT = 5557
# globals
context = None
pusher = None
def m... |
def process_line(line) -> int:
tokens = line.split(";")[0].strip(",").strip("\n").split(" ")
if tokens[0] == "CLS":
return 0x00E0
if tokens[0] == "RET":
return 0x00EE
if tokens[0] == "JP":
if tokens[1] == "V0":
return 0xB000 + int(tokens[1], base=16)
else:
... |
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import random
import datetime
# Import the three change making algorithms
sys.path.insert(0, "../divide-conquer/")
sys.path.insert(0, "../dynamic-programming")
sys.path.insert(0, "../greedy")
from changeslow import changeslow
from chan... |
"""Copyright 2009 Chris Davis
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
dist... |
"""
Note: The expected error strings may change in a future version of mypy.
Please update as needed.
"""
def test_model(assert_mypy_output):
assert_mypy_output("""
from pynamodb.models import Model
from pynamodb.expressions.operand import Path
class MyModel(Model):
pass
reveal_typ... |
#!/usr/bin/env python
#-------------------------------------------------------------------
# The MIT License
#
# Copyright (c) 2009 Patrick Mueller
#
# 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... |
# coding: utf-8
'''
This module provides classes for curve fitting.
There are a polynomial fitter (L{PolyFitter}) and
a fitter for regression models (L{ModelFitter}).
'''
from abc import ABCMeta, abstractmethod
import numpy
import sympy
from sitforc import numlib, symlib
class Fitter(object):
'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-18 06:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0018_auto_20170217_2220'),
]
operations = [
migrations.RemoveField(
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import namedtuple
from ...map import Flags, SimpleEnum
INITIAL_START_TIME = '0001-01-01T00:00:00Z'
class State(SimpleEnum):
ABSENT = 'absent' # Does not exist.
PRESENT = 'present' # Exists but is not running.
RUNNING... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from slackclient import SlackClient
import yaml
import datetime
import pytz
import json
global message_string
token = "ADD-YOUR-TOKEN"# found at https://api.slack.com/web#authentication
sc = SlackClient(token)
users = sc.api_call("users.list")
users_dict =... |
# Copyright 2018-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... |
from django.test import TestCase
from django.test.client import Client
from django.conf import settings
from importlib import import_module
from waffle.models import Switch
class TestAccessibilitySwitcher(TestCase):
def setUp(self):
self.client = Client()
# http://code.djangoproject.com/ticket/1... |
'''
This case can not execute parallelly
@author: Legion
'''
import os
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.host_operations as host_ops
import zstackwoodpecker.operations.resource_... |
import asyncio
import unittest
from test.test_asyncio import functional as func_tests
class ReceiveStuffProto(asyncio.BufferedProtocol):
def __init__(self, cb, con_lost_fut):
self.cb = cb
self.con_lost_fut = con_lost_fut
def get_buffer(self, sizehint):
self.buffer = bytearray(100)
... |
"""
/***************************************************************************
Name : View STR Relationships
Description : Main Window for searching and browsing the social tenure
relationship of the participating entities.
Date : 24/May/2014
copyr... |
import logging
import sys
import unittest
from tonalmodel.diatonic_tone import DiatonicTone
from tonalmodel.diatonic_tone_cache import DiatonicToneCache
from tonalmodel.modality import ModalityType
from tonalmodel.tonality import Tonality
from transformation.functions.tonalfunctions.tonality_permutation import Tonalit... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
from keras.callbacks import TensorBoard
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.layers.convolutional import Convolution2D
from keras.layers.convolutional import MaxPooling2D
from kera... |
# -*- coding: utf-8 -*-
import sys
import getopt
from bianalyzer import BianalyzerText
from bianalyzer.abstracts import download_abstracts
from bianalyzer.biclustering import get_keyword_biclusters, GreedyBBox, get_keyword_text_biclusters, \
save_keyword_text_biclusters
from bianalyzer.biclustering.keywords_analys... |
from collections import OrderedDict
from dnd.char_sheet.fields import Field
###############################################################################
# Text class
# - supports newlines via the 2 literal characters '\n'
###############################################################################
class Text... |
import sys
import os
import webbrowser
from mtm.util.Assert import *
import mtm.util.MiscUtil as MiscUtil
import mtm.util.PlatformUtil as PlatformUtil
from mtm.util.Platforms import Platforms
from mtm.util.CommonSettings import ConfigFileName
import mtm.ioc.Container as Container
from mtm.ioc.Inject import Inject
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import logging
logger = logging.getLogger(__name__)
import subprocess
from collections import defaultdict
user_scores = defaultdict(int)
git_log = subprocess.check_output("git log --shortstat --n... |
# rut.py - functions for handling Paraguay RUC numbers
# coding: utf-8
#
# Copyright (C) 2019 Leandro Regueiro
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of th... |
import logging
from smtplib import SMTPException
from captcha.fields import ReCaptchaField
from django import forms
from django.conf import settings
from django.core import mail
from django.template import loader
logger = logging.getLogger("chmvh_website.{0}".format(__name__))
class ContactForm(forms.Form):
c... |
import sys
from mock import patch
from pytest import (
raises, fixture
)
import logging
from ..test_helper import argv_kiwi_tests
import kiwi.xml_parse
from kiwi.tasks.base import CliTask
from kiwi.exceptions import KiwiConfigFileNotFound
class TestCliTask:
@fixture(autouse=True)
def inject_fixtures(se... |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import os
from lxml.etree import ElementTree, SubElement
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QSplashScreen, QPixmap
from opus_core.misc i... |
#!/usr/bin/env python3
"""
Copyright (c) 2015-2018 Nitrokey UG
This file is part of libnitrokey.
libnitrokey is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later v... |
from mitmproxy.tools.console import keymap
from mitmproxy.test import taddons
from unittest import mock
import pytest
def test_binding():
b = keymap.Binding("space", "cmd", ["options"], "")
assert b.keyspec() == " "
def test_bind():
with taddons.context() as tctx:
km = keymap.Keymap(tctx.master)... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
# Database backends unit tests.
# @file db_backends_unittest.py
# @author Sylvain Pasche
#
# This file belongs to the SYNTHESE project (public transportation specialized software)
# Copyright (C) 2002 Hugues Romain - RCSmobility <contact@rcsmobility.com>
#
# This program is free software; you can redi... |
#----------------------------------------------------------------------
# Copyright 2012, 2013 Arndt Droullier, Nive GmbH. 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, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
# tested modules
import brainx
import image_png
#
# Class with temporary fake output
#
import sys
class FakeStdOut:
def write(self, *args, **kwargs):
pass
def flush(self):
pass
#
# Classes with tests
#
class TestBrainfuck... |
#!/usr/bin/env python3
import getopt
import sys
import re
import random
import sqlite3
def main():
g_input_fn = False
g_do_search = False
g_dict_fn = False
g_words = []
try:
opts, args = getopt.getopt(sys.argv[1:],
"hi:d:s:v",
["help", "input=", "dict=", "search="])
except getopt.GetoptError as err:
... |
"""
SSH.py. Creates and maintains an SSH connection
Ronsse Maxim <maxim.ronsse@ugent.be | ronsse.maxim@gmail.com>
"""
import paramiko as paramiko
import Logger
from Kube.Config import MASTER_NODE_NAME, NODES
from MainConfig import DO_LOG_SSH_CMDS_TO_FILE, LOG_SSH_FILE
# used to cache an often used SSH connection
mas... |
import sys
import shutil
import subprocess
import argparse
import os
import commands
from multiprocessing import Pool
parser = argparse.ArgumentParser(description='Assemble reads extracted from each region')
parser.add_argument('--bed', help='.bed file of SV regions', type=str)
parser.add_argument('--dipspades', help=... |
"""Provides an HTTP API for mobile_app."""
import secrets
from typing import Dict
from aiohttp.web import Request, Response
import emoji
from nacl.secret import SecretBox
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import Reque... |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... |
#!/usr/bin/env python
'''
Transformation of Neo4J result object into a d3 friendly dictionary.
'''
def dedupe_dict_list(duped, id_prop="id"):
'''Dedupe a list of dicts by a dictionary property'''
deduped = list({v[id_prop]:v for v in duped}.values())
return deduped
def neo_node_to_d3_node(node):
d3no... |
from django.conf import settings
from bson.objectid import ObjectId
import boto
from boto.s3.connection import S3Connection
from boto.s3.key import Key
class S3Error(Exception):
"""
Generic S3 Exception.
"""
pass
def s3_connector(bucket):
"""
Connect to an S3 bucket.
:param bucket: The b... |
# Copyright (C) 2014 MediaMath, Inc. <http://www.mediamath.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 appli... |
import calendar
import datetime
from django.contrib.gis.geos import Point
from django.utils.timezone import utc
from mock import MagicMock, patch
import pyicloud
from location import models
from location.tests.base import BaseTestCase
from location.consumers import icloud
class iCloudTest(BaseTestCase):
def set... |
"""
Problem 58:
Starting with 1 and spiralling anticlockwise in the following way,
a square spiral with side length 7 is formed.
37 36 35 34 33 32 31
38 17 16 15 14 13 30
39 18 5 4 3 12 29
40 19 6 1 2 11 28
41 20 7 8 9 10 27
42 21 22 23 24 25 26
43 44 45 46 47 48 49
It is interesting to note that the odd sq... |
# Copyright (c) 2012 NetApp, Inc.
# Copyright (c) 2015 Goutham Pacha Ravi. All rights reserved.
# 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
#
# ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.