src stringlengths 721 1.04M |
|---|
# -*- 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... |
# -*- coding: utf-8 -*-
from nose import tools
import os
import types
import warnings
from kitchen.pycompat24.sets import add_builtin_set
add_builtin_set()
def logit(msg):
log = open('/var/tmp/test.log', 'a')
log.write('%s\n' % msg)
log.close()
class NoAll(RuntimeError):
pass
class FailedImport(Runt... |
# Copyright (c) 2018 Phil Birkelbach
#
# 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... |
#!/usr/bin/env python
"""
<Program Name>
test_interface.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
January 5, 2017.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Unit test for 'interface.py'.
"""
import os
import time
import datetime
import tempfile
import json
import... |
#!/usr/bin/env python
import urllib2
class PeeringDBClient:
def __init__(self):
return
def asn(self, asn):
try:
loadasn = int(asn)
except ValueError:
print("asn is not an integer")
return
load_url = "https://beta.peeringdb.com/api/asn/" + s... |
from __future__ import with_statement
import types
import newrelic.api.in_function
import newrelic.api.function_trace
import newrelic.api.transaction
import newrelic.api.object_wrapper
import newrelic.api.error_trace
import newrelic.api.web_transaction
class ViewCallableWrapper(object):
def __init__(self, wrapp... |
from time import sleep, time
from subprocess import *
import re
default_dir = '.'
def monitor_qlen(iface, interval_sec = 0.01, fname='%s/qlen.txt' % default_dir):
#pat_queued = re.compile(r'backlog\s[^\s]+\s([\d]+)p')
pat_dropped = re.compile(r'dropped\s([\d]+),')
pat_queued = re.compile(r'backlog\s([\d]+... |
"""
Extract image features from next to last layer (global_pool)
"""
__author__ = 'bshang'
import numpy as np
import h5py
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
import sys
sys.path.append('/home/ubuntu/yelp/mxnet/python')
import mxnet as mx
MODEL = 'inception-v3'
MODEL_PATH = '... |
"""
A command to collect users data and sync with mailchimp learner's list
"""
from logging import getLogger
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db import connection
from lms.djangoapps.certificates import api as ... |
__author__ = 'abdul'
import pymongo
import config
from bson import DBRef
from errors import MongoctlException
from mongoctl_logging import log_warning, log_verbose, log_info, log_exception
from mongo_uri_tools import parse_mongo_uri
from utils import (
resolve_class, document_pretty_string, is_valid_member_add... |
# Copyright 2016 The TensorFlow Authors. 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 ... |
# Copyright (c) 2012 Paul Tagliamonte <paultag@debian.org>
#
# 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 to use, copy, modif... |
"""Common settings and globals."""
import os
import sys
from unipath import Path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
PROJECT_ROOT = Path(__file__).ancestor(3)
# DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level projec... |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class K8sIoApi... |
# -*- coding: utf-8 -*-
# Copyright 2014 Dev in Cachu 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 copy
import sys
import requests
from django.conf import settings
from django.core.management import base
from django.templa... |
import sys
from argparse import ArgumentParser, RawTextHelpFormatter
from typing import Any, Dict, Text
from zerver.lib.actions import set_default_streams
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Set default streams for a realm
Users created under this realm ... |
#!/usr/bin/python3
from NaiveBayesClassifier import NaiveBayesClassifier
from os import listdir
class ClassifierEvaluator:
def __init__(self, nbc):
#The naive bayes classifier object.
self.nbc = nbc
self.number_of_messages_tested = 0
self.true_positives = 0
self.true... |
from __future__ import division
import Test_internal_clashscore
import os,sys
'''
Collect clash information from PROBE in resraints_manager
and compare them
'''
def get_files_data():
'''() -> list,list
reads files
RM_clash_results
PROBE_clash_results
in folder: C:\Phenix\Dev\Work\work\Clashes\junk
R... |
from subprocess import Popen, PIPE
from compressor.conf import settings
from compressor.filters import FilterBase, FilterError
from compressor.utils import cmd_split
class YUICompressorFilter(FilterBase):
def output(self, **kwargs):
arguments = ''
if self.type == 'js':
arguments = se... |
import importlib
import json
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.template import Context, Template
from django.utils.translation import check_for_language, to_locale, get_language
from django.utils.encoding import smart_text
from django.utils.... |
"""Implements HOT-SAX."""
import numpy as np
from saxpy.znorm import znorm
from saxpy.sax import sax_via_window
from saxpy.distance import euclidean
def find_discords_hotsax(series, win_size=100, num_discords=2, alphabet_size=3,
paa_size=3, znorm_threshold=0.01, sax_type='unidim'):
"""HOT... |
# coding=utf-8
#
# Copyright 2016 F5 Networks 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 a... |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK server.
#
# REDHAWK server is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the F... |
from django.apps import apps
from rest_framework import serializers
from rest_framework.settings import api_settings
from drf_queryfields import QueryFieldsMixin
from icekit.api.base_serializers import WritableSerializerHelperMixin, \
WritableRelatedFieldSettings
Image = apps.get_model('icekit_plugins_image.Ima... |
'''
receiver runs the ADC and photoresistor to receive an input signal.
USes MCP3008 ADC via the hardware SPI interface.
Connections are:
MCP3008 VDD -> 3.3V (red)
MCP3008 VREF -> 3.3V (red)
MCP3008 AGND -> GND (orange)
MCP3008 CLK -> SCLK (yellow)
MCP3008 DOUT -> MISO (green)
MCP3008 DIN -> ... |
#!/usr/bin/env python
# coding:utf-8
import os
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath(os.path.join(current_path, os.pardir, os.pardir))
data_path = os.path.abspath(os.path.join(root_path, os.pardir, os.pardir, 'data', "smart_router"))
from xlog import getLogger
xlog = ... |
# Copyright 2013 Rackspace
#
# 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... |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import nmap
import re
import mytools as tool
import sys
from multiprocessing import Pool
from functools import partial
reload(sys)
sys.setdefaultencoding('utf8')
def nmScan(host,portrange,whitelist):
p = re.compile("^(\d*)\-(\d*)$")
# if type(hostlist) != list:
# h... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import logging
import operator
import itertools
import webbrowser
from mgdpck import logging_util
# init logger first
logging_util.init_logger()
logging_util.add_except_name('run_script')
logger = logging.getLogger(__name__)
logger.addHan... |
"""
Copyright (2010-2014) INCUBAID BVBA
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, so... |
import os
import shutil
import stat
import yaml
from strings import *
ignored_paths = ['.git']
class EPackageNotFound(Exception):
pass
class EAmbiguousAtom(Exception):
def __init__(self, valid_packages):
self.valid_packages = valid_packages
message = PACKAGE_TOO_AMBIGUOUS % len(valid_packages)
messa... |
import time
from py532lib.i2c import *
from py532lib.frame import *
from py532lib.constants import *
class NFCmonitor :
def __init__(self) :
self.cardIn = False
self.UUID = []
self.stopped = False
self.cbcardin = None
self.cbcardout = None
#Initialise NFC_re... |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to generate and manage a factory to be passed to a
builder dictionary as the 'factory' member, for each builder in c['builders'].
Speci... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Crossword tool - wordlist
Make a wordlist from a text (in utf-8 encoding)
"""
import os, sys, locale
import re
locale.setlocale(locale.LC_ALL, 'de_DE.utf-8') # affects re's \w
reTEX = re.compile(r'\\\w+')
reNONCHARS = re.compile(r'[^\w\s]')
reSINGLECHAR = re.compile(... |
# DPLib - Asynchronous bot framework for Digital Paint: Paintball 2 servers
# Copyright (C) 2017 Michał Rokita
#
# 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 L... |
# -*- coding: iso-8859-1 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para italiafilm
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# ------------------------------------------------------------
import re
import sys
import urlparse
from core impo... |
import traceback
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.cache import cache
from djcelery import celery
from dotastats.models import MatchHistoryQueue, MatchDetails, SteamPlayer
from dotastats.json.steamapi import GetMatchDetails, GetMatchHistory, GetPlaye... |
# !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2017-09-13 16:05:56
# @Last modified by: José Sánchez-Gallego (gallegoj@uw.edu)
# @Last modified time: 2018-08-06 11:45:33
from __future__ import absolute_import, division, print_function
fr... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.survey.tests import common
from odoo.tests import tagged
from odoo.tests.common import HttpCase
@tagged('-at_install', 'post_install', 'functional')
class TestSurveyFlow(common.TestSurveyCommon, HttpCa... |
from asyncio import coroutine, new_event_loop, set_event_loop, get_event_loop
from unittest.mock import Mock
import sys
from pkg_resources import EntryPoint
import pytest
from asphalt.core.application import Application
from asphalt.core.component import Component
from asphalt.core.context import ApplicationContext, ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... |
import pyparsing as pp
import sys
import traceback
import random
import re
import copy
from mdatetime import MDateTime
class Basket(object):
pass
class Language(object):
def __init__(self,mind):
self.mind = mind
self.initialParser()
def log(self,something):
self.mind.log(something... |
#########
# Notes #
#########
#
# Archive.org won't accept wget user agent string---it can be anything else
#
# When fetching source files from arxiv.org:
# 0408420 gives most recent
# 0408420vN gives version N
# 0408420vN if N > number of versions gives most recent version
# (the behavior is same for old and new... |
import errno
import socket
import subprocess
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from mock import patch, Mock, mock_open
from lighthouse.haproxy.control import (
HAProxyControl,
UnknownCommandError, PermissionError, UnknownServerError
)
if sys.version_inf... |
import os
import sys
import numpy as np
import pickle
from scipy.io.matlab import loadmat
from almc.bayesian_rescal import PFBayesianRescal
from almc.bayesian_rescal import PFBayesianCompRescal
from almc.bayesian_rescal import PFBayesianLogitRescal
def load_dataset(dataset):
if dataset == 'umls':
mat = lo... |
from collections import defaultdict
from datetime import timedelta
import requests
import structlog
from django.conf import settings
from django.utils import timezone
from django_push.subscriber.models import Subscription, SubscriptionError
from rache import schedule_job
from requests.exceptions import MissingSchema
f... |
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import logging
import o... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import hashlib
import json
import logging
import os
import sys
import time
from collections import defaultdict
from imp import load_source
from shutil import copy
from shutil import copyfile
from shutil import copystat
from shutil import copytree
from tempf... |
#!/usr/bin/env python3
#
# Copyright 2013 Simone Campagna
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
from .base import AuthenticationBase
class Delegated(AuthenticationBase):
"""Delegated authentication endpoints.
Args:
domain (str): Your auth0 domain (e.g: username.auth0.com)
"""
def get_token(self, client_id, target, api_type, grant_type,
id_token=None, refresh_token=Non... |
##############################################################################
# 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... |
class RefreshIPOperation(object):
def __init__(self, vm_service, resource_id_parser):
"""
:param vm_service: cloudshell.cp.azure.domain.services.virtual_machine_service.VirtualMachineService
:param resource_id_parser: cloudshell.cp.azure.common.parsers.azure_model_parser.AzureModelsParser
... |
import numpy as np
import theano.tensor as T
import theano
from lasagne import init # from .. import init
from lasagne import nonlinearities # from .. import nonlinearities
from lasagne.layers.base import Layer # from .base import Layer
__all__ = [
"BNLayer",
]
class BNLayer(Layer):
"""
lasagne.layers... |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------##
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free softwa... |
#!/usr/bin/env python
#=======================================================================
# The build_configuration.py tool is used to build the configuration
# details used by the KB to interact with the Graph engine.
# The tool requires to connect to a properly configured OMERO server
# to retrieve all the info... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('cacao', '0003_content_slug'),
]
operations = [
migrations.AlterModelOp... |
# default_settings.py: Default Django settings that it makes sense to apply
# across all installations.
# This refers to Django's 'Site' framework, which Molly does not use. It is
# recommended to leave this at its default setting
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
#... |
#!/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... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
AeroGen
A QGIS plugin
AeroGen Plugin
-------------------
begin : 2017-04-24
git sha : $Format:%H$
... |
# Set up References
import clr
clr.AddReference("System")
clr.AddReference("Microsoft.SharePoint")
from System import Uri
from Microsoft.SharePoint import *
from Microsoft.SharePoint.Administration import SPWebApplication
# Enumeration
# These are simple enumeration methods for walking over various SharePoint
# objec... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Jakub Beranek
#
# This file is part of Devi.
#
# Devi 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 License, or
# (at yo... |
"""Some debugging functions for working with the Scrapy engine"""
# used in global tests code
from time import time # noqa: F401
def get_engine_status(engine):
"""Return a report of the current engine status"""
tests = [
"time()-engine.start_time",
"engine.has_capacity()",
"len(engin... |
import flask
import urllib.request
from tests import OkTestCase
from server.models import db
class TestAuth(OkTestCase):
email = 'martymcfly@aol.com'
staff_email = 'okstaff@okpy.org'
def test_ssl(self):
response = urllib.request.urlopen('https://accounts.google.com')
assert response.code ... |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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 op... |
#!/usr/bin/env python3
### VERY MUCH PYTHON 3 !!!
"""
Example for aiohttp.web basic async service
Uses a background timer to print to a logger
exposes an obvious REST endpoint
It's a template!
Made available under the MIT license as follows:
Copyright 2017 Brian Bulkowski brian@bulkowski.org
Permission is hereby ... |
import unittest
from omelette.compiler.uml import UMLObject
from omelette.compiler.validator import Validator
from omelette.compiler import logging
class ValidatorTest(unittest.TestCase):
def setUp(self):
self.uml_object = UMLObject(name="association")
self.uml_object.required = {"source-object": ... |
"""
switchboard.manager
~~~~~~~~~~~~~~~~
:copyright: (c) 2015 Kyle Adams.
:license: Apache License 2.0, see LICENSE for more details.
"""
import logging
from .base import ModelDict
from .models import (
Switch,
DISABLED, SELECTIVE, GLOBAL, INHERIT,
INCLUDE, EXCLUDE,
)
from .proxy import SwitchProxy
from ... |
BLUECAVA = 1
INSIDEGRAPH = 2
THREATMETRIX = 3
IOVATION = 4
MAXMIND = 5
ANALYTICSENGINE = 6
COINBASE = 7
SITEBLACKBOX = 8
PERFERENCEMENT = 9
MYFREECAMS = 10
MINDSHARE = 11
AFKMEDIA = 12
CDNNET = 13
ANALYTICSPROS = 14
ANONYMIZER = 15
AAMI = 16
VIRWOX = 17
ISINGLES = 18
BBELEMENTS = 19
PIANOMEDIA = 20
ALIBABA = 21
MERCADO... |
# -*- coding: utf-8 -*-
"""
sockjs.tornado.transports.jsonp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JSONP transport implementation.
"""
import logging
from tornado.web import asynchronous
from octoprint.vendor.sockjs.tornado import proto
from octoprint.vendor.sockjs.tornado.transports import pollingbase
from oct... |
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: MinBias_13TeV_cfi.py --conditions auto:startup -n 1000 --eventcontent FEVTDEBUG --relval 9000,100 -s GEN,SIM --datatier GEN-SIM --no_exec
i... |
# -*- coding: utf-8 -*-
"""
ktcal2: This file contains function for SSH brute forcer.
"""
import asyncio
import asyncssh
import itertools
from .data import FoundCredential
__license__ = '''Copyright (c) cr0hn - cr0hn<-at->cr0hn.com (@ggdaniel) All rights reserved.
Redistribution and use in source and binary forms... |
from rest_framework.viewsets import ModelViewSet
from .models import (
ProductCategory,
Product
)
from .serializers import (
ProductCategorySerializerDefault,
ProductCategorySerializerPOST,
ProductSerializerDefault,
ProductSerializerPOST
)
from .permissions import (
ProductPermission... |
from flask import Blueprint, jsonify
from utils import Error, has_service, has_uuid, queue_zmq_message
from shared import db
from models import Subscription
from json import dumps as json_encode
from config import zeromq_relay_uri
subscription = Blueprint('subscription', __name__)
@subscription.route('/subscription'... |
# Copyright 2008 German Aerospace Center (DLR)
#
# 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) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
"""CMS Plugins for the ``cmsplugin_redirect`` app."""
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponseRedirect
from cms.plugins.link.forms import LinkForm
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from .models import ForceRedirectPlug... |
"""
Module to get informations about WLAN devices.
"""
# This module is part of the FritzConnection package.
# https://github.com/kbr/fritzconnection
# License: MIT (https://opensource.org/licenses/MIT)
# Author: Bernd Strebel, Klaus Bremer
import itertools
from ..core.exceptions import FritzServiceError
from .fritzb... |
#
# A module capable of changing alphabet letter cases.
#
# It uses very generic Python functionality to ensure
# backward compatibility.
#
#
# The programme processes a set of characters by default
# If no character is entered for processing, the programme
# simply exists. This can be turned off by setting 'a' to 1
# ... |
"""Miscellaneous utility functions and classes.
This module is used internally by Tornado. It is not necessarily expected
that the functions and classes defined here will be useful to other
applications, but they are documented here in case they are.
The one public-facing part of this module is the `Configurable` cl... |
# Copyright 2014: Mirantis 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 b... |
#! /usr/env/python
"""
Example of a simple diffusion model that uses the LinearDiffuser.
Created July 2013 GT
Last updated August 2013 GT
"""
from landlab.components.diffusion import LinearDiffuser
from landlab.grid import create_and_initialize_grid
from landlab import ModelParameterDictionary
import pylab
import n... |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
import sys, os, yaml, json
import jasy.core.Console as Console
import jasy.core.File as File
from jasy import UserError
from jasy.core.Util import getKey
__all__ = [ "Config", "findConfig", "loadConfig", "writeConfig" ]
def findConfig(fileName):... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from webmentiontools.urlinfo import UrlInfo
from webmentiontools.webmentionio import WebmentionIO
# If you have an access token from webmention.io,
# set it here. Some calls require it.
webmention_io_token = None
wio = WebmentionIO(webmention_io_token)
# Get all links... |
#A library of utility methods that can be used in multiple problems presented
#by Project Euler.
#By Paul Barton
import math
import time
def Eratosthenes(n):
"""
A Sieve of Eratosthenes method for the rapid computation of primes less
than or equal to the provided integer n. Coerces to integer. Returns a l... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import djstripe.fields
class Migration(migrations.Migration):
dependenc... |
from __future__ import print_function
import pytest
import numpy as N
import time
from instant import build_module
import sys
from functools import reduce
c_code = """
void func(int n1, double* array1, int n2, double* array2){
double a;
if ( n1 == n2 ) {
for (int i=0; i<n1; i++) {
a = arra... |
from django.conf import urls
from django.urls import path
from grouprise.features.memberships import views
from grouprise.features.memberships.views import Join
urlpatterns = [
path('<slug:group>/actions/join', Join.as_view(), name='join'),
urls.url(
r'^stadt/groups/join/confirm/(?P<secret_key>[a-z0-9... |
# -*- coding: utf-8 -*-
# Copyright 2019 Juca Crispim <juca@poraodojuca.net>
# This file is part of toxicbuild.
# toxicbuild 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 Lic... |
import os
import lnkr
import term
from toml_config import TomlConfig
from import_section import ImportSection, new_import_section
class AppConfig(TomlConfig):
def __init__(self, path):
if not hasattr(self, 'kind'):
self.kind = "App"
self.attribs = {}
self.import_sections = []
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-05 16:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="myuser",
... |
from __future__ import print_function
import pytest
import requests
from jenkinsapi.jenkins import Requester
from jenkinsapi.custom_exceptions import JenkinsAPIException
from mock import patch
def test_no_parameters_uses_default_values():
req = Requester()
assert isinstance(req, Requester)
assert req.user... |
# A somewhat ugly, utilitarian script takes xml data file output from the Tecan Infinite m1000 Pro
# plate reader and allows for the quick visual inspection of raw data.
#
# Usage: python xml2png.py *.xml
# import math, xml, and dataframe libraries
import numpy as np
from lxml import etree
import pandas as pd
import s... |
"""wsgi server.
TODO:
* proxy protocol
* x-forward security
* wsgi file support (os.sendfile)
"""
import asyncio
import inspect
import io
import os
import sys
from urllib.parse import urlsplit
import aiohttp
from aiohttp import server, hdrs
__all__ = ('WSGIServerHttpProtocol',)
class WSGIServerHttpProtocol(... |
import json
import os
import pytest
import responses
from pryke import Pryke
from tests import add_response
@pytest.fixture(scope="session")
def pryke():
return Pryke("", "", access_token="blah")
@pytest.fixture(scope="session")
@responses.activate
def account(pryke):
add_response(responses.GET, 'https://w... |
# This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2013-2021 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
import argparse
import cmd
import getpass
import shlex
import sys
import time
from pony.orm import db_session, sel... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Violin Memory, 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.apach... |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.views.generic import TemplateView
from polls import views
uuid4="[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}"
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^redirectPage/$', views.redirect_page, name='... |
from __future__ import (print_function, absolute_import,
unicode_literals, division)
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import patois
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload... |
"""Sublime Text plugin to find the Chromium OWNERS for the current file.
In a Chromium checkout, this will search for the closest OWNERS file and list
its contents. Select an entry to copy to the clipboard. You can also open the
displayed OWNERS file, or walk up the directory tree to the next OWNERS file.
"""
import ... |
import datetime
import pandas as pd
import pytz
from pandas_market_calendars.exchange_calendar_bse import BSEExchangeCalendar, BSEClosedDay
def test_time_zone():
assert BSEExchangeCalendar().tz == pytz.timezone('Asia/Calcutta')
assert BSEExchangeCalendar().name == 'BSE'
def test_holidays():
bse_calend... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.