src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
"""Nagios module for monitoring available updates via slackpkg."""
import subprocess
import sys
import os
# pylint: disable=invalid-name
# run check-updates to poll mirror for changes
result = []
try:
result = subprocess.check_output("myslackpkg check-updates", shell=True).split("\n")
excep... |
# -*- coding:utf-8 -*-
"""
plumbca.cache
~~~~~~~~~~~~~
CacheHandler for the collections control.
:copyright: (c) 2015 by Jason Lai.
:license: BSD, see LICENSE for more details.
"""
import asyncio
import logging
import re
import os
from .config import DefaultConf
from .collection import IncreaseC... |
# 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 ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: realms.proto
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
fr... |
"""The WaveBlocks Project
This file contains code for the representation of potentials for a single component.
These potential are of course scalar ones.
@author: R. Bourquin
@copyright: Copyright (C) 2010, 2011 R. Bourquin
@license: Modified BSD License
"""
import sympy
import numpy
from MatrixPotential import Mat... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.text = u'\u041b\u0435\u0432 \u041d\u0438\u043a\u043e... |
from __future__ import absolute_import
from __future__ import print_function
import importlib
import json
import logging.config
import platform
from zope.interface.declarations import implementer
import six.moves.urllib.parse
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.application ... |
import os
import shlex
import subprocess
import time
import logging
from cadotask import Polynomials
import cadoprograms
import cadoparams
import datetime
import fcntl
import pickle
import copy
import threading
def str_time(t):
m, s = divmod(t, 60)
h, m = divmod(m, 60)
return "%02d:%02d:%02d" % (h, m, s)
... |
from wtypes.control import WSetHandlers, WEvalRequired
from wtypes.list import WList
from wtypes.magic_macro import WMagicMacro
from wtypes.symbol import WSymbol
class Try(WMagicMacro):
def call_magic_macro(self, exprs, scope):
# In python, the try statement has two forms:
# try/clause/except+/e... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Andrew Jewett (jewett.aij at g mail)
# http://www.chem.ucsb.edu/~sheagroup
# License: 3-clause BSD License (See LICENSE.TXT)
# Copyright (c) 2012, Regents of the University of California
# All rights reserved.
"""
ltemplify.py
The "ltemplify.py" script... |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Test for Flood Population Evacuation Raster Impact Function.**
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 Genera... |
import logging
from corehq.apps.sms.mixin import SMSBackend, SMSLoadBalancingMixin
from corehq.apps.sms.util import clean_phone_number
from corehq.apps.twilio.forms import TwilioBackendForm
from dimagi.ext.couchdbkit import *
from twilio.rest import TwilioRestClient
from django.conf import settings
class TwilioBackend... |
from tornado.httpclient import HTTPRequest, AsyncHTTPClient
from httpclient_session.mocks import MockRequest
from httpclient_session.cookies import extract_cookies_to_jar
from httpclient_session.contrib.cookies import RequestsCookieJar
class Session(object):
def __init__(self, httpclient_class=None, **kwargs):
... |
#!/usr/bin/env python
# encoding: utf-8
"""
Grid computation of dust attenuation for old vs. young stellar populations.
2015-05-12 - Created by Jonathan Sick
"""
import argparse
from androcmd.phatpipeline import PhatCatalog
from androcmd.baselineexp import SolarZPipeline, ThreeZPipeline
def main():
args = pars... |
#!/usr/bin/env python
# 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... |
# -*- coding: utf-8 -*-
# import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import time
from selenium.webdriver.support.ui import Select
"""
Usage:
pyth... |
# Inside an async function
import crasync
import asyncio
import time
profiles = []
async def main(loop):
client = crasync.Client()
profile = await client.get_profile('2CYUUCC8')
print(profile)
print('Current Trophies: ' + str(profile.current_trophies))
chest_cycle = ', '.join([profile.get_chest... |
#!/home/chai/workspace/GitHub/ImageFusion/bin/python
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl Made optimize an opti... |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
#
# 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 License, or
# (at your option) any later... |
# Derived from: neutron/tests/functional/base.py
# neutron/tests/base.py
#
# 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/license... |
"""
Authors: Kostas Stamatiou, Donnie Marino
Contact: kostas.stamatiou@digitalglobe.com
Unit test the workflow class
"""
from gbdxtools import Interface
from gbdxtools.workflow import Workflow
from auth_mock import get_mock_gbdx_session
import vcr
import unittest
import os
import json
"""
How to use the mock_gbdx_se... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numba import nodes
from numba.reporting import getpos
class StatementDescr(object):
is_assignment = False
class LoopDescr(object):
def __init__(self, next_block, loop_block):
self.next_block = next_block
... |
import numpy as np
import scipy as sp
#====================================================================
# EOSMod: Equation of State Model
# eoslib- library of common equation of state models
#====================================================================
# mgd_ref_model()
# ref_model: BM3, ... |
# 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 ... |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'Michał Ciołczyk'
VIRTUAL_COPERNICUS = True
MCAST_GRP = '234.6.6.6'
MCAST_PORT = 3666
FLOOR = '1' # 1 at the moment only
ROOM = 'kitchen' # kitchen|corridor
DELAY = 5 # in seconds
DEBUG = True
from serial import Serial
if VIRTUAL_COPERNICUS:
# ----- BEGIN INI... |
#!/usr/bin/env python
# Copyright 2011 Google Inc.
# Copyright 2013 Patrick von Reth <vonreth@kde.org>
# 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://ww... |
"""Python setuptools installer module"""
# -----------------------------------------------------------------------------
from codecs import open
from os import pardir, path
from setuptools import setup, find_packages
# -----------------------------------------------------------------------------
AUTHOR = "Clemson D... |
# Copyright 2011 OpenStack Foundation
# 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Pierre-Yves Chibon
Author: Pierre-Yves Chibon <pingou@pingoured.fr>
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.... |
#!/bin/env python
# -*- coding: utf-8 -*-
# vim: set fileencoding-utf8 :
from WeatherClient import WeatherClient
class WeatherClientPrinter(object):
def printAlmanacXml(self,almanacResponse):
"""
Imprimeix les dades de almanac resultants del recurs en xml.
:param almanacResponse:
... |
# -*- coding: utf8 -*-
import time
from django.contrib.auth import authenticate
from django.test.utils import override_settings
from django.utils import unittest
from nopassword.models import LoginCode
from nopassword.utils import get_user_model
class TestLoginCodes(unittest.TestCase):
def setUp(self):
... |
#!/usr/bin/env python
import sys
from os.path import exists
from setuptools import setup
import versioneer
# NOTE: These are tested in `continuous_integration/travis/test_imports.sh` If
# you modify these, make sure to change the corresponding line there.
extras_require = {
"array": ["numpy >= 1.13.0", "toolz >= ... |
# Django settings for cc project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': '', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # O... |
from os import path as os_path, listdir as os_listdir
from traceback import print_exc
from sys import stdout
from Tools.Directories import fileExists
from Tools.Import import my_import
from Plugins.Plugin import PluginDescriptor
import keymapparser
class PluginComponent:
firstRun = True
restartRequired = False
d... |
#!/usr/bin/env python3
from __future__ import absolute_import
import os
import sys
import logging
import datetime
import json
import argparse
import socket
import tempfile
from collections import defaultdict
import contextlib
# disable InsecureRequestWarning
import urllib3
sys.path.append(os.path.join(os.path.dirname... |
#
# 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 us... |
#!/usr/bin/env python
"""
Johnson Controls Proprietary Objects for FX/FEC Line
"""
from bacpypes.primitivedata import (
Real,
Boolean,
CharacterString,
Enumerated,
Unsigned,
Atomic,
)
from bacpypes.object import (
Object,
DeviceObject,
AnalogValueObject,
AnalogInputObject,
A... |
from mergesort import *
def comeca(sequencia,entrada,entrada2,entrada3):
div=open(entrada3,'w')
t=open(entrada,'r')
saida=open(entrada2,'w')
x=t.readlines()
if (x[-1][-1])<>'\n':
comp=x[-1][-1]
comp=comp+'\n'
x.insert(-1,co... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 The pycan developers. All rights reserved.
# Project site: https://github.com/questrail/pycan
# Use of this source code is governed by a MIT-style license that
# can be found in the LICENSE.txt file for the project.
import os
import time
import threading
import unittest
impo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Stephen Fromm <sfromm@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': ... |
from pyspark.sql import SQLContext, Row
from vina_utils import get_ligand_from_receptor_ligand_model
"""
Creates data frame of residue list
sqlCtx - spark SQL context
residue_listRDD - RDD for creating data frame. It had been created by load_file_select_hydrogen_bond function
"""
def create_df_residue_list(sqlCtx,... |
#!/usr/bin/env python
# This file is part of BlackPearl.
# BlackPearl 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.
# BlackPearl i... |
# Tastypie specific
from tastypie import fields
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.resources import ModelResource
# Data specific
from api.cache import NoTransformCache
from iati.models import ContactInfo, Activity, Organisation, AidType, FlowType, Sector, CollaborationType, \
Tie... |
#!/usr/bin/python
import smbus
import math
import paho.mqtt.client as mqtt
# Power management registers
power_mgmt_1 = 0x6b
power_mgmt_2 = 0x6c
def read_byte(adr):
return bus.read_byte_data(address, adr)
def read_word(adr):
high = bus.read_byte_data(address, adr)
low = bus.read_byte_data(address, adr+1)... |
import datetime
from django.db.models import Sum
from django.db.models import F
from . import models
CART_ID = 'CART-ID'
class ItemAlreadyExists(Exception):
pass
class ItemDoesNotExist(Exception):
pass
class Cart:
def __init__(self, request):
cart_id = request.session.get(CART_ID)
if ... |
"""CalendarEvents API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class CalendarEventsAPI(BaseCanvasAPI):
"""CalendarEvents API Version... |
# -*- coding: utf-8 -*-
""" License
Copyright (C) 2016 YUNOHOST.ORG
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) a... |
# Copyright (c) 2016-present, Facebook, 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... |
# regression test for SAX 2.0 -*- coding: iso-8859-1 -*-
# $Id: test_sax.py,v 1.24.16.1 2004/03/20 08:20:03 fdrake Exp $
from xml.sax import make_parser, ContentHandler, \
SAXException, SAXReaderNotAvailable, SAXParseException
try:
make_parser()
except SAXReaderNotAvailable:
# do... |
# Este archivo es el encargado de recibir la placa leída y decidir si dejar
# pasar a un vehículo o no, dependiendo de la configuración de este. Además,
# busca si la placa está registrada en el sistema, en caso de estarlo, busca
# el usuario asociado al vehículo.
# Este archivo básicamente maneja las ... |
# Copyright 2016 Autodesk 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 writing... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2017-2018 Nick Hall
#
# 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 License, or
# (at your option) a... |
import os
import liveandletdie
HERE = os.path.dirname(__file__)
PROJECT_PATH = os.path.abspath(os.path.join(HERE, '..'))
SAMPLE_APPS_DIR = os.path.join(PROJECT_PATH, 'sample_apps')
class Base(object):
def teardown(cls):
liveandletdie.port_in_use(8001, kill=True)
def test_default_url(self, scheme='... |
# -*- coding: utf-8 -*-
"""Commands for managing load balancers."""
import click
from ...jobs import loadbalancers as loadbalancer_jobs
from ...jobs.exceptions import AwsError
from ...jobs.exceptions import ImproperlyConfigured
from ...jobs.exceptions import MissingKey
from ...jobs.exceptions import Non200Response
... |
from collections import OrderedDict
from collections import namedtuple
import six
from parameterized import parameterized
from conans.errors import ConanException
from conans.model.ref import ConanFileReference
from conans.model.requires import Requirements
from conans.test.unittests.model.transitive_reqs_test import... |
""" Python test discovery, setup and run of test functions. """
import fnmatch
import functools
import inspect
import re
import types
import sys
import py
import pytest
from _pytest._code.code import TerminalRepr
from _pytest.mark import MarkDecorator, MarkerError
try:
import enum
except ImportError: # pragma: n... |
# -*- Python -*-
#
# @file polynomial_qsa.py
# @brief Validation of sensitivity evaluation for quantiles with the Polynomial model
#
# Copyright (C) 2017 Airbus-IMACS
#
# Written by Sofiane Haddad, haddad@imacs.polytechnique.fr
# Nabil Rachdi, nabil.rachdi@... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Order.billing_address'
db.alter_column(u'orders_order'... |
#!/usr/bin/env python
# Copyright 2015-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 ... |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... |
"""Demonstrate the Kuramoto-Sivashinsky (KS) system."""
# The Kuramoto-Sivashinsky (KS) system:
# u_t = -u*u_x - u_xx - u_xxxx,
# where x ∈ [0, L], periodic BCs,
# is the simplest (?) PDE that admits chaos (requires L>=12?):
#
# Its numerical solution is best undertaken
# with Fourier decomposition for the spat... |
# Copyright (c) 2015 Huawei Technologies Co., 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 applic... |
"""
Displays Agg images in the browser, with interactivity
"""
# The WebAgg backend is divided into two modules:
#
# - `backend_webagg_core.py` contains code necessary to embed a WebAgg
# plot inside of a web application, and communicate in an abstract
# way over a web socket.
#
# - `backend_webagg.py` contains a c... |
import sublime, sublime_plugin
try: # python 3
from .functions import *
from .openfunctions import *
except ValueError: # python 2
from functions import *
from openfunctions import *
def plugin_loaded():
ENVIRON['PATH'] += str(
sublime.load_settings("TeXPreview.sublime... |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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/licens... |
import re
from unidecode import unidecode
from ..utils import translation, squeeze, check_str, check_empty
from .phonetic_algorithm import PhoneticAlgorithm
class Soundex(PhoneticAlgorithm):
"""
The Soundex algorithm.
[Reference]: https://en.wikipedia.org/wiki/Soundex
[Authors]: Robert C. Russel, Ma... |
#!/usr/bin/env python
from distutils.command.install_data import install_data
from distutils.sysconfig import get_python_lib, get_config_var
from distutils.core import setup, Extension
from distutils.dep_util import newer
from distutils.log import info
from distutils import sysconfig
import distutils.file_util
import d... |
import json as json_mod
import pytest
from instantauth.coders import ConstantCoder, PlainCoder
from instantauth.coders.urlquery import URLQueryCoder, SimpleURLQueryCoder
from instantauth.coders.json import JsonCoder
constant = ConstantCoder('encode', 'decode')
plain = PlainCoder()
surlquery = SimpleURLQueryCoder()
j... |
from rest_framework import serializers
class AuthUserSerializer(serializers.Serializer):
id = serializers.IntegerField(read_only=True)
# Therapist or patient..
type = serializers.IntegerField(read_only=True)
username = serializers.CharField(read_only=True)
first_name = serializers.CharField()
... |
from matplotlib.colors import LinearSegmentedColormap
from numpy import nan, inf
cm_data = [[1., 0., 0.282353],
[1., 0., 0.282353],
[1., 0., 0.290196],
[1., 0., 0.298039],
[1., 0., 0.305882],
[1., 0., 0.313725],
[1., 0., 0.321569],
[1., 0., 0.329412],
[1., 0., 0.337255],
[1., 0., 0.345098],
[1., 0., 0.352941],
[1., 0.,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MLDataHub
# Copyright (C) 2017 Iván de Paz Centeno <ipazc@unileon.es>.
#
# 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; version 3
# of the Lic... |
#
# This file is part of ErlangTW. ErlangTW 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without e... |
import contextlib
import hashlib
import logging
import os
from pip._vendor import contextlib2
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from types import TracebackType
from typing import Dict, Iterator, Optional, Se... |
import json
import base64
import requests
from datetime import datetime, timedelta
from requests.exceptions import RequestException
from modules.utils.data import prepare_binary_from_url
def check_store(bot, url):
if bot.store:
return bot.store.get(url)
def response(bot, message, chat_id):
setattr(... |
#!/usr/bin/python
import re
import os
import sys
import datetime
### Input is Glasgow coma patients who are dead as command line argument.
### Data is collected 48 hours before their death occurance for some random patients
### From patients 48 hours data, Oligos file is created
### This file is splitted into individu... |
# -*- coding: utf-8 -*-
#
# Desc: This file is part of the ecromedos Document Preparation System
# Author: Tobias Koch <tobias@tobijk.de>
# License: MIT
# URL: http://www.ecromedos.net
#
import os, sys
import lxml.etree as etree
from net.ecromedos.error import ECMDSError, ECMDSPluginError
from net.ecromedos.co... |
# -*- coding: utf-8 -*
import clutter
import gobject
import easyevent
import logging
import os
import time
from touchwizard.loading import LoadingWidget
logger = logging.getLogger('touchwizard')
class Canvas(clutter.Actor, clutter.Container, easyevent.User):
"""Wizard main actor which manages the user interfac... |
# Copyright 2014-2015 Novartis Institutes for Biomedical Research
# 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 applic... |
#University of South Carolina
#CSCE206 Scientific Application Programming
#Fall 2014 Final project
#Poker game
import Tkinter
from Tkinter import *
import random
def shuffledeck():
deck = []
for s in ['Clubs', 'Diamonds', 'Hearts', 'Spades']:
for n in range(2, 15):
deck.append([n, s]... |
import os
class TicTacToeBoard:
"""
Since the value for X and O is arbitrary. It behooves us to make an
effort to never hardcode these values.
"""
X = True
O = False
_ = None
_d8 = [
lambda x: TicTacToeBoard._rotation(x, 0),
lambda x: TicTacToeBoard._rotation(x, 1),
... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... |
from math import isnan
import warnings
import unittest
from unittest.mock import MagicMock
import numpy as np
from numpy.testing import assert_array_equal
from Orange.data import \
Instance, Domain, Unknown, Value, \
DiscreteVariable, ContinuousVariable, StringVariable
class TestInstance(unittest.TestCase):... |
from django.http import HttpResponse, HttpResponseRedirect
from django.http import HttpResponseForbidden
from django.http import HttpRequest
from django.http import Http404
from django.template.loader import render_to_string
from django.template import RequestContext
from django.shortcuts import render_to_response
from... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Wash'
db.create_table(u'brew_master_wash', (
... |
import json
import os
import urllib2
from sendgrid.helpers.mail import *
from sendgrid import *
# NOTE: you will need move this file to the root
# directory of this project to execute properly.
def build_hello_email():
"""Minimum required to send an email"""
from_email = Email("test@example.com")
subject... |
import distutils, os
from setuptools import Command
from distutils.util import convert_path
from distutils import log
from distutils.errors import *
__all__ = ['config_file', 'edit_config', 'option_base', 'setopt']
def config_file(kind="local"):
"""Get the filename of the distutils, local, global, or per-user co... |
"""
Django admin page for bulk email models
"""
from config_models.admin import ConfigurationModelAdmin
from django.contrib import admin
from lms.djangoapps.bulk_email.forms import CourseAuthorizationAdminForm, CourseEmailTemplateForm
from lms.djangoapps.bulk_email.models import BulkEmailFlag, CourseAuthorization, C... |
# Python
import os
import sys
# Django
from django.conf import global_settings
# Update this module's local settings from the global settings module.
this_module = sys.modules[__name__]
for setting in dir(global_settings):
if setting == setting.upper():
setattr(this_module, setting, getattr(global_setting... |
## tut3.py
## tut3.m implemented in Python for cantera
## cf. http://www.cantera.org/docs/sphinx/html/matlab/tutorials/tut3.html
############################################################################
## Copyleft 2016, Ernest Yeung <ernestyalumni@gmail.com>
## 20160125
## ... |
# -*- coding: utf-8 -*-
import threading
from pibooth.controls import GPIO
class BlinkingThread(threading.Thread):
"""Thread which manage blinking LEDs synchronously.
"""
def __init__(self):
threading.Thread.__init__(self)
self.daemon = True
self._leds = []
self._tick =... |
import os
import shutil
import subprocess
import sys
from setuptools import setup, find_packages, Command
src_dir = 'src/python'
package_directory = 'cloudfoundry_client'
package_name = 'cloudfoundry-client'
loggregator_dir = 'loggregator'
sys.path.insert(0, os.path.realpath(src_dir))
version_file = '%s/%s/__init__.... |
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), either version 3 of the ... |
import sys
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix, classification_report
if len(sys.argv) != 2:
print("Enter the model option.")
exit()
if sys.argv[1] == "--hunpos":
check = 0;
elif sys.argv[1] == "--crf++":
check = 1
else:
print "Enter correct option."
exit()
dir_pa... |
##########################################################################
#
# Copyright (c) 2012, Image Engine Design 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:
#
# * Redistrib... |
def test_contract_factory_availability_with_no_dependencies(chain):
provider = chain.provider
is_available = provider.are_contract_dependencies_available('Math')
assert is_available is True
def test_contract_factory_availability_with_missing_dependency(chain):
provider = chain.provider
is_availa... |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina and others.
# 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 t... |
# Copyright 2015 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... |
#!/bin/env python
import os
from setuptools import setup
def find_xdg_data_files(syspath, relativepath, pkgname, data_files=[]):
for (dirname, _, filenames) in os.walk(relativepath):
if filenames:
syspath = syspath.format(pkgname=pkgname)
subpath = dirname.split(relativepath)[1]
... |
#!/usr/bin/python
# interpolate scalar gradient onto nedelec space
from dolfin import *
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
Print = PETSc.Sys.Print
# from MatrixOperations import *
import numpy as np
#import matplotlib.pylab as plt
import PETScIO as IO
import common
import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.