src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python3
import collections
# skim seems to be intensive and doing a lot of work even though in some
# cases it could do less. For example, in add, you can stop skimming if after
# skimming the first two cells the carrier is 0.
# we need more kinds of skimming, at least two (i.e. the skim as we ... |
"""Unit tests for chartjs api."""
import json
from django.test import TestCase
from django.urls import reverse
from chartjs.util import NULL, value_or_null
from demoproject.models import Meter
class LineChartJSTestCase(TestCase):
def test_line_chartjs(self):
resp = self.client.get(reverse("line_chart")... |
# Filesystem Extension
from extensions import base
import os
import time
class Extension(base.Extension):
def __init__(self, config):
super().__init__(config)
self.root = os.path.realpath(
os.path.expanduser(
self.config['root']
)
)
if not os.path.exists(self.root):
os.mkdir(self.root)
sel... |
from pybuilder import BuildFailedException
__author__ = 'Mirko Rossini'
import unittest
import shutil
from integrationtest_support import IntegrationTestSupport
from common import BUILD_FILE_TEMPLATE_COVERAGE
class DjangoEnhancedPluginTest(IntegrationTestSupport):
def test_django_coverage(self):
self.wr... |
# *-* coding: UTF-8 *-*
from google.appengine.api import app_identity
from google.appengine.api import taskqueue
from audi.contrib import jinja_bootstrap
import os
import sys
import i18n
import logging
import traceback
import webapp2
import httpagentparser
def handle_error(request, response, exception):
exc_type... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Restricted environment to execute application's code
-------------------------------------------------... |
# -*- coding: utf-8 -*-
# Copyright 2013 django-htmlmin authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import six
import codecs
import unittest
from htmlmin.minify import html_minify
from os.path import abspath, dirname, join
resou... |
# -*- coding: utf-8 -*-
u"""elegant command parser.
:copyright: Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdc,... |
#!/usr/bin/env python3
# Copyright (c) 2016 The PlanBcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
from test_framework.test_framework import PlanbcoinTestFra... |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... |
from bson.son import SON
from pymongo import Connection
import gridfs
from gridfs.errors import NoFile
from xmodule.modulestore.mongo import location_to_query, Location
from xmodule.contentstore.content import XASSET_LOCATION_TAG
import logging
from .content import StaticContent, ContentStore
from xmodule.exceptions... |
# -*- coding: utf-8 -*-
import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
#('administrator', 'administrator@localhost.com'),
)
MANAGERS = ADMINS
DATABASE_FILE = os.path.join(PROJECT_PATH, 'database/data.sql')
DATABASES = {
'default': {
... |
import collections
import functools
import random
import time
from .lfu import LFUCache
from .lru import LRUCache
from .rr import RRCache
from .ttl import TTLCache
try:
from threading import RLock
except ImportError:
from dummy_threading import RLock
_CacheInfo = collections.namedtuple('CacheInfo', [
'h... |
#!/usr/bin/env python
#---------------------------------------------------------------------------------------------------
# Script to find the youngest logfiles of completed jobs for a given FiBS task.
#---------------------------------------------------------------------------------------------------
import os,sys
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# alan2 - An openbox menu builder
# Copyright (C) 2013 Semplice Project
#
# 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... |
_base_ = '../htc/htc_r50_fpn_1x_coco.py'
# model settings
model = dict(
type='SCNet',
roi_head=dict(
_delete_=True,
type='SCNetRoIHead',
num_stages=3,
stage_loss_weights=[1, 0.5, 0.25],
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-13 02:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... |
__author__ = 'bensoer'
from crypto.algorithms.algorithminterface import AlgorithmInterface
from tools.argparcer import ArgParcer
import random
class RandomCaesarCipher(AlgorithmInterface):
__alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
__scrambledAlphabet = ""
__seed = 5
__offse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = u'Andrea Zonca'
SITENAME = u'OpenProceedings'
SITEURL = ''
TIMEZONE = 'America/Los_Angeles'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM... |
from ekratia.conversations.models import Thread
from ekratia.referendums.models import Referendum
from django_email import EmailTemplate
import logging
logger = logging.getLogger('ekratia')
def notify_comment_node(request, node, object_type):
"""
Method to create new comment for the current Thread
"""
... |
# python-moretools
#
# many more basic tools for python 2/3
# extending itertools, functools and operator
#
# Copyright (C) 2011-2016 Stefan Zimmermann <zimmermann.code@gmail.com>
#
# python-moretools is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License a... |
import web.util.tools as tools
import os
from web import app
import lib.es as es
def get(p):
# get host and index from the global config
h = tools.get_conf(p['host'], p['navigation']['id'], 'host', 'http://localhost:9200')
n = tools.get_conf(p['host'], p['navigation']['id'], 'index', '')
return {
... |
# coding=utf-8
__author__ = 'Abhineet Saxena'
"""
The Code for the ACM XRDS Hello World! column collects summary statistics for thethe CNN architecture constructed
from the architecture detailed at Google TensorFlow MNIST Expert tutorial:
https://www.tensorflow.org/versions/r0.7/tutorials/mnist/pros/index.html
Note:... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
"""
Sample script for fitting sinusoidal data. This script
uses the data file: sample_AD_data.csv
This data was logged on: 2017-03-08 12:40 pm using an arduino
A/D pin and an associated test circuit.
Author: HMokhtarzadeh
Date: April 13, 2017
"""
import pandas as pd
import numpy as np
#
# Load Data
#
path_data = ... |
import os
import numpy as np
from scipy.misc import imread,imresize
from urllib.request import urlretrieve
def load_notmnist(path=".", letters='ABCDEFGHIJ',
img_shape=(28,28),test_size=0.25,one_hot=False):
root = os.path.join(path, "notMNIST_small")
# download data if it's missing. If y... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import time
from xmlrpclib import ServerProxy
from optparse import OptionParser
class VMCreate:
_url = 'https://rpc.gandi.net/xmlrpc/'
def __init__(self, config):
self.api = ServerProxy(self._url)
if not (config.apikey and config.domain):
... |
import unittest
from dart.client.python.dart_client import Dart
from dart.engine.no_op.metadata import NoOpActionTypes
from dart.model.action import ActionData, Action, ActionState
from dart.model.datastore import Datastore, DatastoreData, DatastoreState
from dart.model.trigger import Trigger, TriggerState
from dart.m... |
__source__ = 'https://leetcode.com/problems/the-maze/'
# Time: O(m*n)
# Space: O(m*n)
#
# Description: 490. The Maze
#
# There is a ball in a maze with empty spaces and walls.
# The ball can go through empty spaces by rolling up, down, left or right,
# but it won't stop rolling until hitting a wall. When the ball stop... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
import frappe.permissions
import frappe.async
from frappe import _
from frappe.utils.csvutils import getlink
from frappe.utils.dateutils import parse_date
... |
#!/usr/bin/env python
#coding:utf-8
# os/sys/math/time/random
import os,sys,math,time,random,datetime
# print os.sep #路径分隔符
# print os.name #系统
# print os.getcwd() #获取当前路径
# print os.getenv() #获取环境变量
# print os.putenv() #设置环境变量
# print os.listdir('/Users') #获取特定路径下的文件和目录
# print os.remove() 删除文件
# print os.removedirs(... |
import os
from configparser import ConfigParser, ExtendedInterpolation
import six
from pax import units, utils
from pax.exceptions import InvalidConfigurationError
def load_configuration(config_names=(), config_paths=(), config_string=None, config_dict=None, maybe_call_mongo=False):
"""Load pax configuration us... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.18
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
#
# Copyright (C) 2011, 2013-2015 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed ... |
"""Compatibility fixes for older version of python, numpy and scipy
If you add content to this file, please give the version of the package
at which the fixe is no longer needed.
# XXX : copied from scikit-learn
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael... |
#!/usr/bin/env python
import os
import logging
class SerfHandler(object):
def __init__(self):
self.name = os.environ['SERF_SELF_NAME']
self.role = os.environ.get('SERF_TAG_ROLE') or os.environ.get('SERF_SELF_ROLE')
self.logger = logging.getLogger(type(self).__name__)
if os.environ[... |
import numpy
import scipy
import matplotlib.pyplot as pyplot
import astropy.io.fits as pyfits
CIAO1 = pyfits.getdata('CIAO1.fits')
CIAO2 = pyfits.getdata('CIAO2.fits')
CIAO3 = pyfits.getdata('CIAO3.fits')
CIAO4 = pyfits.getdata('CIAO4.fits')
fig = pyplot.figure(0)
fig.clear()
ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.4])
... |
# !/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Vincent<vincent8280@outlook.com>
# http://wax8280.github.io
# Created on 2017/10/11 12:30
import click
import multiprocessing
import web2kindle.script.guoke_scientific
import web2kindle.script.zhihu_dail... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... |
# Copyright 2015 - Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
import discord
from discord.ext import commands
import random
import MySQLdb
# ********************************************** #
# DEFINITIONS ********************************** #
# ********************************************** #
# Bot Description
description = '''Official Zealot Gaming Discord bot!'''
# Define Bot
... |
from curses import wrapper
import curses
import logging
logger = logging.getLogger('scorer.ui')
def printGames(stdscr, matches, selected):
stdscr.clear()
stdscr.addstr(0, 0, "The Following games \
are available Right now\n", curses.color_pair(1))
for index, game in enumerate(matches):
if ... |
# -*- coding: utf-8 -*-
# vispy: testskip
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt5.QtCore import (QAbstractItemModel, QFile, QIODevice,
QItemSelectionModel, QModelIndex, Qt, QRect, QCoreApplication, QMetaObject)
from PyQt5 import QtWidgets
from PyQt5.uic import loadUi
from config import CLASSIFICATION_FILE_NAME
class TreeItem(object... |
# Copyright 2010-2011 Josh Kearney
#
# 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 agre... |
#!/usr/bin/python2
from __future__ import print_function
import unittest
import logging
logging.basicConfig(level=logging.INFO)
import datetime
import gzip
import json
import os
# own modules
from DataLogger import DataLogger as DataLogger
from Timeseries import Timeseries as Timeseries
from TimeseriesArray import Time... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""Default settings for libpaste."""
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import appconf
from . import enums
class LibPasteConf(appconf.AppConf):
class Meta:
prefix = 'libpaste'
BA... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
###############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2013 Cassio Paixao
#
# 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 ... |
from zope.cachedescriptors.property import Lazy as cachedproperty
import logging
import sys
import zeit.push.interfaces
import zope.security.proxy
log = logging.getLogger(__name__)
class FindTitle(object):
def __call__(self):
name = self.request.form.get('q')
if not name:
return ''
... |
# Copyright 2014 Rackspace, 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 writin... |
# 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 law or a... |
import os
import sys
import time
import traceback
from celery import log
from celery.datastructures import ExceptionInfo
from celery.utils.functional import partial
from celery.utils import timer2
def apply_target(target, args=(), kwargs={}, callback=None,
accept_callback=None, pid=None):
if accept_callb... |
from django import http
from django.conf import settings
from django.views.decorators.http import require_http_methods
import json
from twitter import utils
@require_http_methods(['POST'])
def get_data(request):
if 'twitter_handle' not in request.POST.keys():
return http.HttpResponseServerError()
tw... |
from simpleparse.common import numbers, strings, comments
from simpleparse import generator
from simpleparse.parser import Parser
from simpleparse.dispatchprocessor import *
import re
from .Linki import Linki
from .Logger import WranglerLogger
from .Node import Node
from .PNRLink import PNRLink
from .Supplink import S... |
#!/usr/bin/env python3
# Response.py: given text, return a response.
import nltk
import random
import re
import emotes
nicknames = {
'134968288772882432': ['Hawkaloo', 'Hawke', 'Hawkey', 'Hawkey Hawke'],
'136190686230741002': ['Trambles', 'Trambelus', 'Trambuck', 'Buck', 'Applebuck', 'Applepone', 'Best Appl... |
#!/usr/bin/env python
import sys, os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import StrMethodFormatter
from matplotlib.dates import MonthLocator
import seaborn as sb
sb.set()
checks = (
pd.read_csv(sys.stdin)
.assign(
month_dt = lambda df: pd.to_dat... |
from plenum.common.constants import ROOT_HASH, MULTI_SIGNATURE, PROOF_NODES, TXN_TYPE, DATA, TXN_TIME, STATE_PROOF, \
MULTI_SIGNATURE_VALUE, MULTI_SIGNATURE_PARTICIPANTS, MULTI_SIGNATURE_SIGNATURE, \
MULTI_SIGNATURE_VALUE_LEDGER_ID, \
MULTI_SIGNATURE_VALUE_STATE_ROOT, MULTI_SIGNATURE_VALUE_TXN_ROOT, MULTI_S... |
# -*- coding: utf-8 -*-
"""
Created on Jan 11, 2013
@author: Mourad Mourafiq
About: This is an attempt to solve the Quora challenge Feed Optimizer.
"""
import itertools
import copy
import math
from random import choice, random
BRUTE_FORCE = 1
ANNEALING_SIMULATED = 2
class Story(object):
"""
Story object
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AlgorithmDialogBase.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from spider import *
sys.path.append("..")
from utils import Utils
class MergersAndAcquisitionsSpider(Spider):
def __init__(self):
Spider.__init__(self)
self.school = 'wiki'
def processMergers(self):
utils = Utils()
wiki_dict = {'... |
import argparse
from time import time
import csv
import os
from py_db import db
db = db("nba_shots")
def initiate():
start_time = time()
print "\nexporting to .csv"
for statType in ('Player', 'Team', 'PlayerCareer'):
for rangeType in ('Reg', 'Pre', 'Post'):
print '\t', statType, rang... |
import argparse
import glob
import os
import sys
def prep_filename(gff_dir):
# strip off trailing '/'
gff_dir = gff_dir.rstrip('/')
return os.path.join(gff_dir, '{}_gffs_concatenated.gff'.format(gff_dir))
def combine_gffs(gff_file_list, filename):
# sort gff files, just in case
gff_file_list ... |
from django.conf import settings
def sitevars(request):
context = {}
try:
context['static_root'] = settings.MEDIA_ROOT
context['media_root'] = settings.MEDIA_ROOT
context['media_url'] = settings.MEDIA_URL
context['static_url'] = settings.STATIC_URL
context['se... |
# 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 ... |
import numpy as np
import numpy.ma as ma
from netCDF4 import Dataset
#from mpl_toolkits.basemap import Basemap
#from multiprocessing import Pool
#import gsw ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2014 Ivo Nunes/Vasco Nunes
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#######################################################
'''
module: utilities.basic2
Created:Aug 21, 2012
author: nickmilon
Description: Description: Simple utilities (2) and Vars - Very Limited IMPORTS HERE !
'''
###############################... |
"""The PLSOM."""
import logging
from typing import Callable, Dict, Optional, Tuple
import numpy as np
from tqdm import tqdm
from somber.som import BaseSom
from somber.components.initializers import range_initialization
from somber.components.utilities import Scaler
logger = logging.getLogger(__name__)
class PLSom... |
# -*- coding: utf-8 -*-
import os
import string
import json
import pandas as pd
import numpy as np
from scipy.stats.stats import pearsonr
from dateutil.parser import parse
from common import globals as glob
SPECIAL_CHARS = string.punctuation.replace("_", "")
SPECIAL_CHARS = string.punctuation.replace("-", "")
SPECIAL_... |
import ctypes
import ctypes.util
__all__ = ('RegisterEventHotKey', 'EventHotKeyID')
Carbon = ctypes.cdll.LoadLibrary(ctypes.util.find_library('Carbon'))
# CFTypeRef CFRetain(CFTypeRef cf);
Carbon.CFRetain.argtypes = [ctypes.c_void_p]
Carbon.CFRetain.restype = ctypes.c_void_p
# void CFRelease(CFTypeRef cf);
Carbon.C... |
'''
Buildozer
=========
Generic Python packager for Android / iOS. Desktop later.
'''
__version__ = '0.30dev'
import os
import re
import sys
import zipfile
import select
import codecs
from buildozer.jsonstore import JsonStore
from sys import stdout, stderr, exit
from re import search
from os.path import join, exist... |
from selenium.common.exceptions import *
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from php4dvd.pages.page import Page
from php4dvd.pages.login_page import LoginPage
... |
from .models import Event, Meeting
from rest_framework import serializers
class EventSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Event
fields = ('id', 'place', 'start', 'stop', 'title', 'status', 'description', 'organizer', 'meeting', 'picture')
class HackerAgendaEven... |
from numpy import *
from scipy.integrate import quadrature, romberg, fixed_quad
from scipy.special import gammaln, betaln, digamma, polygamma, betainc, gamma
import pdb
from hypergeom import hyper3F2regularizedZ1, hyper3F2Z1, hyper3F2aZ1
def dirichlet_integrate(alpha):
normalizer = exp(sum(gammaln(alpha)) - gamma... |
import sys
import os
import io
import signal
import traceback
import socket
from twisted.internet import reactor
from twisted.web import server
from twisted.logger import Logger, textFileLogObserver
from txjsonrpc.auth import wrapResource
from heisen.config import settings
from heisen.core.log import logger
from heis... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 version.
#
# This program is distrib... |
# Copyright (C) 2017 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY K... |
# Hashlist implemetation.
# Copyright (c) 2015, Andre Lucas
# 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, ... |
"""
Websocket based API for Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/developers/websocket_api/
"""
import asyncio
from contextlib import suppress
from functools import partial
import json
import logging
from aiohttp import web
import voluptu... |
# Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import os
import re
import sys
import time
from datetime import datetime, timedelta
from datetime import tzinfo as tzinfo_base
from itertools import islice
from marv_api.utils import NOTSET
def chunked(iterable, chunk_size):
itr = iter(... |
#! /usr/bin/env python3
import os
import re
import sys
import stat
import datetime
FSF = 'by the Free Software Foundation, Inc.'
this_year = datetime.date.today().year
pyre_c = re.compile(r'# Copyright \(C\) ((?P<start>\d{4})-)?(?P<end>\d{4})')
pyre_n = re.compile(r'# Copyright ((?P<start>\d{4})-)?(?P<end>\d{4})')
n... |
from xml.etree import ElementTree
import logging
log = logging.getLogger('xiboside.xlf')
def parse_file(path):
layout = None
try:
_xlf = Xlf(path)
except ElementTree.ParseError, err:
log.error(err.message)
return None
except IOError, err:
log.error("%s: %s" % (err.strer... |
"""
Mouse input.
This module contains a class implementing pygame mouse input.
"""
__author__ = 'Florian Krause <florian@expyriment.org>, \
Oliver Lindemann <oliver@expyriment.org>'
__version__ = ''
__revision__ = ''
__date__ = ''
from types import FunctionType
import pygame
from . import defaults
from ..misc._t... |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : IOST_LoadConfigFileDialog.py
# Version : 1.01
# Date : Sep 21, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT... |
import attr
from attr.validators import instance_of
command_string = """RLRDDRLLDLRLUDDULLDRUUULDDLRLUDDDLDRRDUDDDLLURDDDLDDDRDURUDRDRRULUUDUDDRRRLRRRRRLRULRLLRULDRUUDRLRRURDDRLRULDLDULLLRULURRUULLRLLDDDDLLDURRUDLDLURDRDRDLUUUDDRDUUDDULLUURRDRLDDULURRRUDLLULULDLLURURUDRRRRUDRLRDLRRLDDRDDLULDLLLURURDUDRRRRUULURLRDULDRL... |
# -*- coding: utf-8 -*-
"""Demonstration / usage example for the new features.
Created on Fri Mar 24 13:58:36 2017
@author: Juha Jeronen, juha.jeronen@tut.fi
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm
import matplotli... |
import json
import redistrib.command as comm
import base
from models.base import db
from models.proxy import Proxy
from models.cluster import Cluster
import models.task
class HttpRequest(base.TestCase):
def test_http(self):
with self.app.test_client() as client:
self.assertEqual({'nodes': [],... |
# Copyright 2009 Matt Chaput. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
## EN CASTELLANO
# ex: /
url(r'^$', views.landing, name='landing'),
url(r'^buscar/$', views.buscar, name='buscar'),
url(r'^cookies/$', views.cookies, name='cookies'),
url(r'^privacidad/$', views... |
"""
intro.py
DESCRIPTION:
Functions implementing the beginning of the JeoparPy introduction sequence.
Intro music plays, the title fades in over a background, and the subtitle
appears. Upon pressing any key, the rules screen appears. Pressing a key
again ends the sequence.
USAGE:
Main should only need to ca... |
from pandas import DataFrame, Series
import pandas as pd
import numpy as np
import random as r
from scipy import stats
import scipy
import math
# Calculate crime_y12_y12 rate
un_rate=pd.read_csv('Zip_county.csv')
Unemp=pd.read_csv('crate_year.csv')
crime=pd.read_csv('Python_totalsheet.csv')
crime=crime[[... |
#------------------------------------------------------------------------------
'''Class-style Model
This fixture is used to test the importing of models, handled by the
`theories.handshake()` module. As of 0.4.11, models can:
- be located in the `lamana.models` folder
- module and classes can have any pythonic name... |
#!/usr/bin/env python
import logging
from datetime import datetime
logging.basicConfig(level=logging.WARNING)
import os
import urllib2, base64, json
import dateutil.parser
def from_ISO8601( str_iso8601 ):
return dateutil.parser.parse(str_iso8601)
def to_ISO8601( timestamp ):
return timestamp.isoformat()
de... |
from .base import Base
class Capture(Base):
@classmethod
def get_resource_class(cls, client):
from ..resources.captures import Captures
return Captures(client)
@property
def id(self):
return self._get_property("id")
@property
def mode(self):
return self._get_... |
from __future__ import print_function
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
import random
from pattern.db import Datasheet
from pattern_text.nl import tag, predicative
from pattern.vector import SVM, KNN, NB, count, shuffled
# This example demonstrates a Support ... |
# This file is part of SickRage.
#
# URL: https://www.sickrage.tv
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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, o... |
import os
import shutil
from pathlib import Path
from typing import List
from configVar import config_vars
import logging
from utils import dock_util
from .subprocessBatchCommands import ShellCommand
log = logging.getLogger(__name__)
from .baseClasses import PythonBatchCommandBase
from .removeBatchCommands import Rm... |
"""
Default statement functions.
"""
from muddery.statements.statement_func_set import BaseStatementFuncSet
import muddery.statements.action as action
import muddery.statements.condition as condition
import muddery.statements.attribute as attribute
import muddery.statements.rand as rand
import muddery.statements.skill... |
## \file
## \ingroup tutorial_roofit
## \notebook -nodraw
## Likelihood and minimization: fitting with constraints
##
## \macro_code
##
## \date February 2018
## \authors Clemens Lange, Wouter Verkerke (C++ version)
from __future__ import print_function
import ROOT
# Create model and dataset
# ----------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.