src stringlengths 721 1.04M |
|---|
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from games.views import download, IdenticonDetail
from core.views import ContactV... |
"""Tests of functionality that should work in all vegalite versions"""
import pytest
import pandas as pd
from .. import v1, v2
v1_defaults = {
'width': 400,
'height': 300
}
v2_defaults = {
'config': {
'view': {
'height': 300,
'width': 400
}
}
}
basic_spec = ... |
import unittest
from conformal_predictors.nc_measures.SVM import SVCDistanceNCMeasure
from sklearn.svm import SVC
from numpy import array
class SVMTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_1(self):
x = array([[1, 1], [2, 2]])
y = ar... |
# Copyright 2014-2018 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
#
# Unless required by appl... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'AreaValue.flag'
db.add_column('lizard_layers_areavalue', 'flag', self.gf('django.db.models... |
from rambutan3 import RArgs
from rambutan3.check_args.base.RAbstractTypeMatcher import RAbstractTypeMatcher
from rambutan3.check_args.base.traverse.RTypeMatcherError import RTypeMatcherError
from rambutan3.string.RMessageText import RMessageText
class RRangeSizeMatcher(RAbstractTypeMatcher):
"""
This class is... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import lightconv_cuda
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import wi... |
# Copyright (c) 2014 "Hugo Herter"
# [http://hugoherter.com]
#
# This file is part of Hubbub.
#
# Vega 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 opti... |
from . import NetworkObject
import z3
class AclFirewall (NetworkObject):
def _init(self, node, network, context):
super(AclFirewall, self).init_fail(node)
self.fw = node.z3Node
self.ctx = context
self.constraints = list ()
self.acls = list ()
network.SaneSend (self)
... |
"""
patch_stdout
============
This implements a context manager that ensures that print statements within
it won't destroy the user interface. The context manager will replace
`sys.stdout` by something that draws the output above the current prompt,
rather than overwriting the UI.
Usage::
with patch_stdout():
... |
from lxml import etree
# DNS Results
class DNSResult(object):
"""Abstract skeleton for every DNS result"""
def __init__(self, ttl=1800):
self._etree = etree.Element("result")
self.ttl = ttl
self._result_type = 'dns'
def _get_ttl(self):
return self._etree.get("ttl")
def... |
# Copyright (c) 2020 by Farsight Security, 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 agre... |
#
# Copyright (c) 2015 - Xavier Rubio-Campillo
# This file 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
#
# The source code is distr... |
#!/bin/python2.7
import sys
import threading
from string import maketrans
from random import randint
from time import sleep
# Swaps two random letters
def scramble(letters):
x = list(letters)
a = randint(0, len(letters) - 1)
b = randint(0, len(letters) - 1)
while b == a:
b = randint(0, len(lett... |
from sys import maxsize
class Contact:
def __init__(self, firstname= None, lastname= None, id= None,
homephone= None, mobilephone= None, workphone= None, secondphone= None , all_phones_from_homepage=None,
address=None, email=None, email2=None, email3=None, all_emails=None):
... |
"""
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
def gettext_noop(s):
return s
####... |
# Copyright 2012 OpenStack Foundation
#
# 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 l... |
import unicodedata
import sys
from nltk.stem import PorterStemmer
def split_sentences(text):
sentences = []
for sentence in text.split('\n'):
sentence = sentence.strip()
if sentence:
sentences.append(sentence)
return sentences
stemmer = PorterStemmer()
def stem_... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class KimCNN(nn.Module):
def __init__(self, config):
super(KimCNN, self).__init__()
output_channel = config.output_channel
target_class = config.target_class
words_num = config.words_num
words_dim = config.w... |
# -*- coding: utf-8 -*-
from numpy import * # importation du module numpy
from numpy.linalg import * # importation du module numpy.linalg
from numpy.random import *
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import Axes3D
Ns = 20
# Maillage
h = 1./(Ns + 1)
X = linspace(0,1,Ns+2)
Xh = X[1:Ns+1]
# M... |
#!/usr/bin/env python
'''
antenna pointing module
Andrew Tridgell
June 2012
'''
import sys, os, time
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'cuav', 'lib'))
import cuav_util
mpstate = None
class module_state(object):
def __init__(self):
self... |
"""
WSGI config for nouweo project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... |
from ..base.type import UflType
from .string import UflStringType
class UflNumberType(UflType):
_PYTHON_TYPE = None
def __init__(self, default=None):
self.__default = default or self._PYTHON_TYPE()
@property
def default(self):
return self.__default
@property
def ... |
##
# Copyright 2009-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... |
# $Id: VS.py,v 1.4 2005-07-14 01:36:41 gosselin_a Exp $
# $Log: not supported by cvs2svn $
# Revision 1.3 2004/08/02 17:06:20 gosselin
# pyhdf-0.7.2
#
# Revision 1.2 2004/08/02 15:36:04 gosselin
# pyhdf-0.7-1
#
# Author: Andre Gosselin
# Maurice-Lamontagne Institute
# gosselina@dfo-mpo.gc.ca
"""
VS... |
from south.db import db
from django.db import models
from feeddb.feed.models import *
class Migration:
def forwards(self, orm):
# Deleting field 'Trial.name'
db.delete_column('feed_trial', 'name')
# Deleting field 'Experiment.name'
db.delete_column('feed_expe... |
#!/usr/bin/env python
import argparse
import sqlite3
import sys
import os
import hashlib
from platform import mac_ver
from distutils.version import StrictVersion as version
##############################
######## VARIABLES ###########
# Utility Name
util_name = os.path.basename(sys.argv[0])
# Utility Version
util_v... |
'''
create a program that will allow you to enter events organizable by hour. There must be menu options of some form, and
you must be able to easily edit, add, and delete events without directly changing the source code.
(note that by menu i dont necessarily mean gui. as long as you can easily access the different opt... |
#!/usr/bin/env python
"""
Image scraper utilizing Reddit Python API, PRAW.
Requires PRAW library installed, or pip installed to get it.
Choose a subreddit, it identifies pictures in that sub
and downloads to specified directory.
"""
__author__ = 'lance - github.com/lalanza808'
#######################################... |
# Copyright 2015 Matthieu Courbariaux, Zhouhan Lin
"""
This file is adapted from BinaryConnect:
https://github.com/MatthieuCourbariaux/BinaryConnect
Running this script should reproduce the results of a feed forward net trained
on MNIST.
To train a vanilla feed forward net with ordinary backprop:
... |
from jhbacktest.data import *
import jhbacktest.stats as jhstats
from tabulate import tabulate
import termcolor as tc
class Strategy(object):
def __init__(self, df, slippage=0):
self.__df = df
__data = Data()
self.__df_np = __data.df2numpy(self.__df)
self.__df_index = -1
... |
# -*- coding: utf-8 -*-
'''lazy auto-balancing chainlets'''
from appspace.keys import appifies
from twoq.lazy.mixins import AutoQMixin
from twoq.mixins.filtering import (
FilterMixin, CollectMixin, SetMixin, SliceMixin)
from twoq.mixins.ordering import RandomMixin, OrderMixin
from twoq.mixins.reducing import MathM... |
# Copyright 2015 Planet Labs, 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 wr... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field tumbleposts on 'Story'
db.delete_table('lstory_story_tumbleposts')
def b... |
import click
import docker
from wheezy.template.engine import Engine
from wheezy.template.ext.core import CoreExtension
from wheezy.template.ext.code import CodeExtension
from wheezy.template.loader import DictLoader
from . import templates
import logging
LOG = logging.getLogger(__name__)
LOG_LEVELS = {
"info... |
"""
Data structure for 1-dimensional cross-sectional and time series data
"""
from collections import OrderedDict
from io import StringIO
from shutil import get_terminal_size
from textwrap import dedent
from typing import Any, Callable
import warnings
import numpy as np
from pandas._config import get_option
from pan... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Locating Restriction Sites
Usage:
REVP.py <input> [--compare] [--max=MAX] [--min=MIN]
REVP.py (--help | --version)
Options:
--compare run a speed comparison of various methods
--max=MAX Set the maximum length of palindrome to search for, even
... |
import os
import requests # pip install requests
# The authentication key (API Key).
# Get your own by registering at https://app.pdf.co/documentation/api
API_KEY = "**************************************"
# Base URL for PDF.co Web API requests
BASE_URL = "https://api.pdf.co/v1"
# Direct URL of source PDF file.
Sour... |
import unittest
from fabulous.services import directions
from fabulous.services.secret_example import GOOGLE_DIRECTION_API
from fabulous.services.directions import DIRECTIONS_BASEURL
''' In python3 mock is part of unittest
for python2 we need to install mcok seperately
'''
try:
from unittest.mock import MagicMock,... |
# -*- coding: utf-8 -*-
"""Copyright (C) 2013 COLDWELL AG
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 version.
This program is dist... |
from drizzlepac import astrodrizzle, tweakreg, tweakback
from stwcs import updatewcs
import glob, os, shutil
from astropy.io import fits
from multiprocessing import Pool
from stsci.tools import teal
import argparse
def parse_args():
"""Parse command line arguments.
Parameters:
Nothing
Returns:
... |
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
SLB_2005
^^^^^^^^
Minerals from Stixrude & Lithgow-Bertelloni 2005 and references therein
"""
from __future__... |
import pyemto
import pyemto.utilities as utils
import numpy as np
import os
latpath = "../../../" # Path do bmdl, kstr and shape directories
# each system need to have same number of alloy elements
#systems = [['Fe','Al'],['Fe','Cr']]
systems = [['Fe'],['Al']]
systems = [['Al']]
#concentrations = [[0.5,0.5]]
concent... |
#!/usr/bin/env python3
# coding: utf-8
from __future__ import unicode_literals, print_function
import sys
import itertools
from molbiox.frame.command import Command
from molbiox.io import blast, tabular
"""
If your results come from more than 2 columns, use a SQL database instead.
"""
class CommandAggregate(Command)... |
import httplib2
import urlparse
import urllib
import hdcloud
from . import exceptions
try:
import json
except ImportError:
import simplejson as json
class HDCloudClient(httplib2.Http):
USER_AGENT = 'python-hdcloud/%s' % hdcloud.__version__
BASE_URL = 'http://hdcloud.com/api/v1/'
def _... |
# Django settings for example project.
import os
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
EXAMPLE_PATH = os.path.dirname(CURRENT_PATH)
PROJECT_PATH = os.path.dirname(EXAMPLE_PATH)
import djcelery
djcelery.setup_loader()
try:
import siteuser
except ImportError:
import sys
sys.path.append(... |
# -*- coding: utf-8 -*-
# to workaround sqlalchemy's get_characterset_info bug, which only applies to py2k.
#import mysql.connector
#mysql.connector.MySQLConnection.get_characterset_info=lambda cls:cls.charset
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema impo... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# StackExchange Ocean feeder
#
# Copyright (C) 2015 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# ... |
'''
XbrlOpenSqlDB.py implements an SQL database interface for Arelle, based
on a concrete realization of the Open Information Model and Abstract Model Model PWD 2.0.
This is a semantic representation of XBRL Open Information Model (instance) and
XBRL Abstract Model (DTS) information.
This module may save directly t... |
"""
main entry point for jut tools
"""
import argparse
import sys
import traceback
from jut import defaults, config
from jut.commands import configs, jobs, programs, run, upload
from jut.common import error, is_debug_enabled
from jut.exceptions import JutException
def parse_key_value(string):
"""
interna... |
#! /usr/bin/env python3
"""
server for creating unsigned armory offline transactions
"""
import sys
import logging
import argparse
import json
import time
import threading
import flask
from flask import request
import jsonrpc
from jsonrpc import dispatcher
sys.path.append("/usr/lib/armory/")
from armoryengine.ALL imp... |
import os
import urllib.request
class RESTAPI(object):
"""A general class that handles the local file access or the
retrival of tha file.
"""
def _get_data(self, path_template, url_template, entity_id):
file_path = self._get_file_path(
path_template, url_template, entity_id)
... |
# 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 collections import deque
from math import sqrt
import sys
import copy
import bisect
class Problem:
def __init__(self, initial_board, goal_board):
self.initial_board = Board(initial_board)
self.goal_board = Board(goal_board)
def actions(self, board):
#UDLR
possible_moves =... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import escape
from time import gmtime, strftime, time
import sqlite3
from traceback import format_exc
import config
import os
htime = strftime("%a %Y-%m-%d %H:%M:%S%z",gmtime())
utime = int(time())
def print_message(_body, _section, _level, _time=""):
try:
... |
# coding=utf-8
import threading
import traceback
from six.moves.queue import Queue, Empty
from sickbeard import logger
from sickrage.helper.exceptions import ex
class Event(object):
def __init__(self, event_type):
self._type = event_type
@property
def event_type(self):
"""
Returns... |
import json
import sys
json_str = open( sys.argv[1], 'r' ).read().upper()
python_recipes = json.loads( json_str )
ingr_attr = "INGREDIENTS"
CSV_ATTRIBUTES = []
# Get bag of ingredient_bag
ingredient_bag = []
# Take the ingredient_bag from each recipe to create a new attribute
for recipe in python_recipes:
for ... |
#!/usr/bin/python
from setuptools import setup, find_packages, Command
import os.path, sys
import re
_here = os.path.abspath(os.path.dirname(__file__))
def version():
# This rather complicated mechanism is employed to avoid importing any
# yet unfulfilled dependencies, for instance when installing under
... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... |
import time
import os
import smtplib
import logging
from mailer.lockfile import FileLock, AlreadyLocked, LockTimeout
from socket import error as socket_error
from django.conf import settings
from django.core.mail import send_mail as core_send_mail
try:
# Django 1.2
from django.core.mail import get_connection
... |
# -*- coding: utf-8 -*-
# Unit and doctests for specific database backends.
from __future__ import unicode_literals
import copy
import datetime
from decimal import Decimal, Rounded
import re
import threading
import unittest
import warnings
from django.conf import settings
from django.core.exceptions import Improperly... |
#
# Bindings.py -- Bindings classes for Ginga FITS viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
import math
from ginga.misc import Bunch, Settings, Callback
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(templ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
save mail to file for ablog
"""
from __future__ import print_function # for pylint
import sys
import os
import os.path
import shutil
import datetime
import imaplib
import getpass
import email
import smtplib
try:
from email.MIMEMultipart import MIMEMultipart
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
import re, time, datetime
class StringUtil:
@staticmethod
def isEmpty(x):
if x is None:
return True
x = x.strip()
if len(x)==0:
return True
return False
@staticmethod
def isTrue(x):
if x is None:
... |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... |
#
# Copyright (C) 2009 The Android Open Source Project
#
# 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 la... |
# Guillaume Valadon <guillaume@valadon.net>
"""
Scapy *BSD native support - BPF sockets
"""
from ctypes import c_long, sizeof
import errno
import fcntl
import os
import platform
from select import select
import struct
import time
from scapy.arch.bpf.core import get_dev_bpf, attach_filter
from scapy.arch.bpf.consts i... |
#
# Copyright (C) 2007, 2013-2014 Red Hat, Inc.
# Copyright (C) 2007 Daniel P. Berrange <berrange@redhat.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 License, o... |
#####################################################################################
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Unless a separate license agreement exists between you and Crossbar.io GmbH (e.g.
# you have purchased a commercial license), the license terms below apply.
#
# Should you enter ... |
#!/usr/bin/env python
# Copyright (c) 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/LICE... |
import numpy as np
import networkx as nx
from neighbors import *
'''
Algo:
node table has column: included_in_component.
Pluck element with included_in_component = 0
define white_states = {element}
while white_states:
build component around this node.
store component data
update node table - set ... |
# jsb.plugs.wave/gadget.py
#
#
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persist import PlugPersist
gadgeturls = PlugPersist('gadgeturls')
gadgeturls.data['gadget'] = 'https://jsonbot.appspot.com/gadget.xml'
gadgeturls.data['poll'] = 'https://jsonbot.appspo... |
from urllib.parse import unquote
from flask import request, url_for
from playhouse.shortcuts import model_to_dict, dict_to_model
from decimal import Decimal
def to_dict(obj):
"""
Helper method that returns a mongoengine document in python dict format
"""
from models import ReferralProgram
def ... |
"""
Alternating Least Square with lambda weighted regularization
Zhou et al
both explicit and implicit version (of Koren) are implemented
code can be run in parallel in local with setting parallel = True
"""
import numpy as np
from multiprocessing import Pool
from scipy.sparse import diags, csr_matrix
from utils import... |
"""
Utilities for manipulating Geometry WKT.
"""
from django.utils import six
def precision_wkt(geom, prec):
"""
Returns WKT text of the geometry according to the given precision (an
integer or a string). If the precision is an integer, then the decimal
places of coordinates WKT will be truncated t... |
# Portions Copyright (C) 2015 Intel Corporation
''' Code for running Gridlab and getting results into pythonic data structures. '''
import sys
import os
import subprocess
import platform
import re
import datetime
import shutil
import traceback
import math
import time
import tempfile
import json
from os.path import joi... |
import numpy as np
import utils as cu
import libDetection as det
import dataProcessor as dp
from utils import emptyMatrix
###############################################
# Hard Negative Mining
###############################################
class HardNegativeMining():
def __init__(self,currentModel,maxVectorsPerIma... |
import sys
import os
import pandas as pd
import numpy as np
import yaml
from uncertainties import ufloat, unumpy
import pyqtgraph
from glob import glob
from ftclass import FTData, FTBatch
from fittingroutines import *
from utils import CreateDatabase, CompressData, AddDatabaseEntry
# Qt related modules
from PyQt5.QtW... |
import unittest
from fom.api import FluidApi
from fom.errors import (
Fluid400Error,
Fluid401Error,
Fluid404Error,
Fluid406Error,
Fluid412Error,
Fluid413Error,
Fluid500Error,
)
from _base import FakeFluidDB
class ErrorTest(unittest.TestCase):
def setUp(self):
self.db = Fak... |
# coding: utf-8
from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor
class VH1IE(MTVServicesInfoExtractor):
IE_NAME = 'vh1.com'
_FEED_URL = 'http://www.vh1.com/feeds/mrss/'
_TESTS = [{
'url': 'http://www.vh1.com/episodes/0umwpq/hip-hop-squares-kent-jones-vs-nick-young-season-1-ep-12... |
import logging
pvl_logger = logging.getLogger('pvlib')
import numpy as np
import pandas as pd
from nose.tools import raises
from numpy.testing import assert_almost_equal
from pandas.util.testing import assert_frame_equal, assert_series_equal
from pvlib.location import Location
from pvlib import clearsky
from pvlib i... |
#!/usr/bin/python
"""Test for the exceptions of cleanroom.
@author: Tobias Hunger <tobias.hunger@gmail.com>
"""
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import cleanroom.exceptions as ex
import cleanroom.location as location
def test_base_exceptions(... |
from typing import *
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
nums = sorted(nums)
idx1 = 0
l = len(nums)
closest = None
closest_dist = 2 ** 31 - 1
has_eq = False
while idx1 < l - 2:
idx2, idx3 = idx1 + 1, l -... |
"""
Moisés Lora Pérez
"""
from turtle import *
def init():
reset()
setup(600,600)
setworldcoordinates(-300,-300,300,300)
def drawC():
circle(30)
def drawP():
forward(30)
left(72)
forward(30)
left(72)
forward(30)
left(72)
forward(30)
left(72)
... |
__author__ = 'miko'
from de.hochschuletrier.jpy.overlays.Overlay import Overlay
from de.hochschuletrier.jpy.Constants import Constants, Fonts
from Tkinter import Label
from PIL import Image, ImageTk
class QuestionOverlay(Overlay):
def __init__(self, *args, **kwargs):
Overlay.__init__(self, *args, **kwargs)
self.... |
import traceback
import requests
import time
import imghdr
from os.path import exists, isfile, join, isdir
from os import makedirs, listdir, walk
from flask import Blueprint, request, send_from_directory, render_template
filestore = Blueprint('callback', __name__)
@filestore.route('/clone', methods=["POST"])
def clo... |
# Django settings for estudiocafe project.
from local_settings import *
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to th... |
import os
import ConfigParser
from supervise_web.svio import svstat, svcontrol, supervise
config = None
def daemon_info():
info = {}
for dir_name in os.listdir(_service_dir()):
dir_path = os.path.join(_service_dir(), dir_name)
if not os.path.isdir(dir_path):
continue
info[... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... |
import fiona, shapely, logging, sys, os, random
from shapely import affinity, speedups
from shapely.geometry import mapping, shape, Polygon
speedups.enable()
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
class randomly_move():
'''Con esta clase se pretende el mover aleatoriamente una serie de ... |
##
# Copyright (c) 2006-2017 Apple 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 l... |
###############################################################################
# #
# 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 #
... |
"""Analyze a set of multiple variables with a linear models
multiOLS:
take a model and test it on a series of variables defined over a
pandas dataset, returning a summary for each variable
multigroup:
take a boolean vector and the definition of several groups of variables
and test if the group has a f... |
#!/usr/bin/env python
"""HTTP API logic that ties API call handlers with HTTP routes."""
import json
import time
import traceback
import urllib2
# pylint: disable=g-bad-import-order,unused-import
from grr.gui import django_lib
# pylint: enable=g-bad-import-order,unused-import
from django import http
from werkzeug... |
# -*- coding: utf-8 -*-
import argparse
import pdb
import traceback
from typing import List, Tuple
def test_ip(ip: int, rules: List[Tuple[int, int]], max_addr: int) -> bool:
for (start, end) in rules:
if start <= ip <= end:
break
else:
if ip < max_addr:
return True
... |
#!/usr/bin/env python
# encoding: utf-8
from t import T
import os
import platform
import subprocess
import signal
import time
import requests,urllib2,json,urlparse
class TimeoutError(Exception):
pass
def command(cmd, timeout=60):
"""Run command and return the output
cmd - the command to run
timeout - m... |
"""SCons.Tool
SCons tool selection.
This looks for modules that define a callable object that can modify
a construction environment as appropriate for a given tool (or tool
chain).
Note that because this subsystem just *selects* a callable that can
modify a construction environment, it's possible for people to defin... |
# -*- coding: UTF-8 -*-
import os, processing
from qgis.PyQt import QtGui, uic, QtCore, QtWidgets
from qgis.core import QgsProject, QgsMapLayerProxyModel, QgsMessageLog, Qgis
from qgis.PyQt.QtWidgets import QMessageBox
GUI, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'window.ui'))
class Interface(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.