code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import os
from petsc4py import PETSc
import numpy as onp
from veros import logger, veros_kernel, runtime_settings as rs, runtime_state as rst
from veros.core import utilities
from veros.core.streamfunction.solvers.base import LinearSolver
from veros.core.operators import numpy as npx, update, update_add, at, flush
... | dionhaefner/veros | veros/core/streamfunction/solvers/petsc_.py | Python | mit | 8,370 |
"""
================================
Recognizing hand-written digits
================================
An example showing how the scikit-learn can be used to recognize images of
hand-written digits.
This example is commented in the
:ref:`tutorial section of the user manual <getting_started>`.
"""
print __doc__
# Aut... | cdegroc/scikit-learn | examples/plot_digits_classification.py | Python | bsd-3-clause | 2,228 |
# -*- coding: utf-8 -*-
from flask import session, current_app
from quokka_themes import render_theme_template
def render_template(template, theme=None, **context):
theme = theme or []
if not isinstance(theme, (list, tuple)):
theme = [theme]
sys_theme = session.get('theme', current_app.config.ge... | CoolCloud/quokka | quokka/core/templates.py | Python | mit | 452 |
import os
import tarfile
import h5py
import numpy
import six
from six.moves import range, cPickle
from fuel.converters.base import fill_hdf5_file, check_exists
DISTRIBUTION_FILE = 'cifar-10-python.tar.gz'
@check_exists(required_files=[DISTRIBUTION_FILE])
def convert_cifar10(directory, output_directory,
... | nke001/attention-lvcsr | libs/fuel/fuel/converters/cifar10.py | Python | mit | 3,360 |
import os
import sys
class SoftChrootInitError(IOError):
"""Error during soft-chroot initialization"""
pass
class SoftChroot:
"""Soft Chroot module
Provides chroot feature for interation with Web-UI. Since it is not real chroot, so the name is SOFT CHROOT.
The module prevents access to entire fi... | loulich/Couchpotato | couchpotato/core/softchroot.py | Python | gpl-3.0 | 3,963 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/remixmatch | libml/augment.py | Python | apache-2.0 | 10,719 |
#!/usr/bin/python3
'''Implementation of the Beeminder API: https://www.beeminder.com/api
Still very incomplete.'''
import json
import re
import requests
class BeeminderMock:
def __init__(self, mockdata):
self.mockdata = mockdata
@staticmethod
def getidp(ath):
m = re.search('([a-z0-9]+)\.json$', path)
... | sagittarian/beelist | beeminder.py | Python | mit | 4,196 |
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | zaenalarifin/openshot_jmd | openshot/windows/About.py | Python | gpl-3.0 | 2,627 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/agrifood/azure-agrifood-farming/tests/testcase_async.py | Python | mit | 2,509 |
'''
***********************************************************
* Discrete Structures
* Trip Through Germany Program
* Programmer: Mark Eatough
* Course: CSIS 2430
* Created Novermber 3, 2013
***********************************************************
'''
from TimeDistanceMoney import*
class TrainTravel:
... | meatough/Marks-Programs | cs 2430/Assignment12 Germany Trip/TrainClasses.py | Python | gpl-3.0 | 1,163 |
from pandac.PandaModules import *
from direct.showbase.PythonUtil import reduceAngle
from otp.movement import Impulse
import math
class PetChase(Impulse.Impulse):
def __init__(self, target = None, minDist = None, moveAngle = None):
Impulse.Impulse.__init__(self)
self.target = target
if min... | Spiderlover/Toontown | toontown/pets/PetChase.py | Python | mit | 2,267 |
"""py.test for simpleread.py"""
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
from __future__ i... | pachi/eppy | eppy/tests/test_simpleread.py | Python | mit | 4,629 |
from flask import Flask,request, abort
import os
import datetime
import hashlib
from databaseutil import DatabaseUtility
import json
import hmac
import base64
from datetime import datetime as dt, timedelta as td
import config
dbutil = DatabaseUtility()
app = Flask(__name__)
KEY = config.SECRET_KEY # should be same as... | rachitnaruzu/resultnotifier | backend/main.py | Python | mit | 3,402 |
#! python
# WMI query to list all properties and values of the root/cimv2:Win32_BIOS class.
# To use WMI in Python, install the Python for Windows extensions:
# http://sourceforge.net/projects/pywin32/files/pywin32/
# This Python script was generated using the WMI Code Generator, Version 9.02
# http://www.robvan... | kek91/administratorsfriend | sys_win32_bios.py | Python | mit | 1,306 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | meh/servo | python/servo/command_base.py | Python | mpl-2.0 | 13,987 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 10 11:14:28 2018
@author: carlos.arana
Objeto estándar de metadatos
"""
import pandas as pd
from AsignarDimension.AsignarDimension import AsignarDimension
class Meta(object):
def __init__(self, name):
# Descripciones del Parámetro
self.name = name
... | Caranarq/01_Dmine | Scripts/classes/Meta.py | Python | gpl-3.0 | 7,445 |
# -*- coding: utf-8 -*-
import json
import os
import stat
import tarfile
import zipfile
from datetime import datetime, timedelta
from django.conf import settings
from django.core.files import temp
from django.core.files.storage import default_storage as storage
from django.test.utils import override_settings
from un... | kumar303/olympia | src/olympia/devhub/tests/test_views_submit.py | Python | bsd-3-clause | 109,870 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | felipenaselva/repo.felipe | plugin.video.salts/scrapers/scenerls_scraper.py | Python | gpl-2.0 | 4,702 |
# -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import collections
import logging
import datetime
from io import BytesIO, UnsupportedOperation
from .hooks import default_hooks
from .structures import CaseInsensitiveDict
from .auth import... | ktan2020/legacy-automation | win/Lib/site-packages/requests/models.py | Python | mit | 24,872 |
import asyncio
class Menu:
"""An interactive menu class for Discord."""
class Submenu:
"""A metaclass of the Menu class."""
def __init__(self, name, content):
self.content = content
self.leads_to = []
self.name = name
def get_te... | appu1232/Discord-Selfbot | cogs/utils/menu.py | Python | gpl-3.0 | 5,866 |
"""
CanvasSync by Mathias Perslev
February 2017
--------------------------------------------
cryptography.py, module
Functions used to encrypt and decrypt the settings stored in the .CanvasSync.settings file. When the user has specified
settings the string of information is encrypted using the AES 256 module of the ... | perslev/CanvasSync | CanvasSync/settings/cryptography.py | Python | mit | 3,583 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import unittest2
from robottelo.ui.location import Location
from robottelo.ui.locators import common_locators
from robottelo.ui.locators import locators
if six.PY2:
import mock
else:
from unittest import mock
class LocationTestCase(... | sghai/robottelo | tests/robottelo/ui/test_location.py | Python | gpl-3.0 | 2,887 |
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2007 Google 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 ... | wishabi/caja-1 | tools/upload.py | Python | apache-2.0 | 96,830 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2016 Contributor
#
# 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... | quattor/aquilon | lib/aquilon/worker/commands/add_campus.py | Python | apache-2.0 | 1,501 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | RyanSkraba/beam | sdks/python/apache_beam/utils/processes.py | Python | apache-2.0 | 3,589 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gevent_server
import socket
import pytest
import time
from multiprocessing import Process
addr = ("127.0.0.1", 8000)
_CRLF = b'\r\n'
# yield fixtures are demons
# We used to have a yield fixture here and in the server.py tests
# which would sta... | tlake/http-server | test_functests_gevent_server.py | Python | mit | 5,433 |
from kinko.nodes import Number, Keyword
from kinko.utils import split_args
from .base import TestCase, NODE_EQ_PATCHER
class TestUtils(TestCase):
ctx = [NODE_EQ_PATCHER]
def testSplitArgs(self):
self.assertEqual(
split_args([Number(1), Number(2), Keyword('foo'), Number(3)]),
... | vmagamedov/kinko | tests/test_utils.py | Python | bsd-3-clause | 640 |
"""
A python module for reading and changing status of verisure devices through
verisure app API.
"""
__all__ = [
'Error',
'LoginError',
'ResponseError',
'Session'
]
from .session import ( # NOQA
Error,
LoginError,
ResponseError,
Session
)
ALARM_ARMED_HOME = 'ARMED_HOME'
ALARM_ARMED_... | persandstrom/python-verisure | verisure/__init__.py | Python | mit | 460 |
import sys, os
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
import gettext
import stat
import imp
nebula_dir = os.getenv('NEBULA_DIR')
modules_dir = nebula_dir + '/modules'
set_visuals = imp.load_source('set_visuals', modules_dir + '/set_visuals.py')
gettext.bindtextdomain('games_neb... | yancharkin/games_nebula_goglib_scripts | deus_ex_invisible_war/settings.py | Python | gpl-3.0 | 6,894 |
#!/usr/bin/env python
# ============================================================================
'''
This file is part of the lenstractor project.
Copyright 2012 David W. Hogg (NYU) and Phil Marshall (Oxford).
'''
# ============================================================================
if __name__ == '__main... | davidwhogg/LensTractor | LensTractor.py | Python | gpl-2.0 | 14,549 |
"""
Collection of query wrappers / abstractions to both facilitate data
retrieval and to reduce dependency on DB-specific API.
"""
from __future__ import print_function
from datetime import datetime, date
from pandas.compat import range, lzip, map, zip
import pandas.compat as compat
import numpy as np
import traceback... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/pandas/io/sql.py | Python | gpl-3.0 | 10,681 |
from sklearn import datasets
from sklearn.neural_network import MLPClassifier
import traceback
from submissions.aartiste import election
from submissions.aartiste import county_demographics
class DataFrame:
data = []
feature_names = []
target = []
target_names = []
trumpECHP = DataFrame()
'''
Extract... | armadill-odyssey/aima-python | submissions/aartiste/myNN.py | Python | mit | 6,217 |
from calendaradapter.calendar import Calendar
import os
if __name__ == "__main__":
url = os.getenv('EXCHANGE_URL')
username = os.getenv('EXCHANGE_USERNAME')
password = os.getenv('EXCHANGE_PASSWORD')
calendar = Calendar(url=url, username=username, password=password)
for event in calendar.events:
... | bmcmanus/availability | main.py | Python | gpl-3.0 | 428 |
"""Helper to execute actions on the database independantly from the interface
and output format."""
import logging, datetime, sys, re
from slam import generator, models
from slam.log import DbLogHandler
# set-up logging to the database
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
DBLOGHANDLER =... | LAL/SLAM | src/slam/interface.py | Python | apache-2.0 | 32,758 |
import re
import click
from itertools import imap
from mongors import checks, rs, utils
re_addr_port = re.compile(r"(?P<addr>[^:]*)(?::(?P<port>\d*))?")
def cli():
common(obj={})
def sanitize_instances(ctx, param, value):
"""Sanitize instances: add default port and remove duplicates."""
instances = ... | diefans/MongoRS | src/mongors/scripts/__init__.py | Python | apache-2.0 | 2,158 |
# Lint as: python3
"""A few methods to handle NaNs.
Library functions that take a numpy array.
Assumes dimensions are (location, time).
"""
import itertools
import matplotlib.pyplot as plt
import numpy as np
import scipy
import scipy.ndimage
def _assume_2d(array):
if len(array.shape) != 2:
raise ValueError(
... | HopkinsIDD/EpiForecastStatMech | epi_forecast_stat_mech/datasets/nanhandling.py | Python | apache-2.0 | 3,953 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.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 witho... | jeremiedecock/snippets | python/tkinter/python3/button_color.py | Python | mit | 1,422 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
EMAIL_MAX_LENGTH = getattr(settings, 'INVITATIONS_EMAIL_MAX_LENGTH', 254)
class Migration(migrations.Migration):
dependencies = [
m... | EnHatch/django-invitations | invitations/migrations/0002_auto_20151126_0426.py | Python | gpl-3.0 | 893 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | chengduoZH/Paddle | python/paddle/dataset/common.py | Python | apache-2.0 | 6,339 |
# -*- coding: utf-8 -*-
__author__ = 'chinfeng'
from wsgiref.simple_server import WSGIServer
from wsgiref.util import shift_path_info
from wsgiref import validate
import multiprocessing.pool
from gumpy.deco import *
import logging
logger = logging.getLogger(__name__)
class ThreadPoolWSGIServer(WSGIServer):
def ... | chinfeng/gumpy | plugins/simple_wsgi_serv.py | Python | lgpl-3.0 | 4,046 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
# Modified: Patrick Galbraith <patg@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You... | richm/designate | designate/storage/impl_sqlalchemy/models.py | Python | apache-2.0 | 7,386 |
# ********************************************************************** <====
from .. import InvalidArgumentError, TransportError
# ********************************************************************** ====>
import os.path
# ---------------------------------------------------------------------
# Rea... | paulovn/artifact-manager | lib/artmgr/transport/basew.py | Python | gpl-2.0 | 1,523 |
# Copyright 2012, Contrail Systems, Inc.
#
"""
.. attention:: Fix the license string
"""
import requests
import re
import uuid
import json
import time
import socket
import netaddr
from netaddr import IPNetwork, IPSet, IPAddress
import gevent
import bottle
from neutron.common import constants
from neutron.common impor... | Juniper/contrail-dev-controller | src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py | Python | apache-2.0 | 163,825 |
# -*- coding: utf-8 -*-
import time
from multiprocessing.pool import Pool
import colored
import numpy as np
from dnutils import out, stop, trace, getlogger, ProgressBar, StatusMsg, bf, loggers, newlogger, logs, edict, ifnone, \
ifnot, allnone, allnot, first, sleep, __version__ as version, waitabout
import unitt... | danielnyga/dnutils | tests/testp3.py | Python | mit | 8,270 |
"""
file systems on-disk formats (ext2, fat32, ntfs, ...)
and related disk formats (mbr, ...)
"""
| larsks/pydonet | lib/pydonet/construct/formats/filesystem/__init__.py | Python | gpl-2.0 | 103 |
import os
from flask import Flask, request, redirect, url_for, render_template, flash, send_from_directory, Response
from werkzeug.utils import secure_filename
from midi2rdf import midi2rdf
from subprocess import Popen
UPLOAD_FOLDER = '/tmp/'
VIRTUOSO_LOAD = '/scratch/amp/midi/virtuoso-load/'
ALLOWED_EXTENSIONS = set(... | albertmeronyo/midi-rdf | src/service.py | Python | mit | 2,205 |
# ping.py
# Test Fox's connectivity
from discord.ext import commands
class Ping:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def ping(self):
await self.bot.say("Pong!")
def setup(bot):
bot.add_cog(Ping(bot))
| plusreed/foxpy | plugins/core/ping.py | Python | mit | 267 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pclases
def descontar_material_adicional_balas(pdp, articulo, restar = True):
"""
Descuenta el material adicional correspondiente al artículo según
la formulación que indique la línea de fabricación.
Si "restar" es True, descuenta. Si es False, aña... | pacoqueen/ginn | ginn/framework/tmp_consumo.py | Python | gpl-2.0 | 9,513 |
from setuptools import setup, find_packages
import os
import sys
import subprocess
from distutils.errors import DistutilsPlatformError, DistutilsInternalError
from setuptools.command.install import install
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('django-socketio-events')
npm_... | pztrick/django-socketio-events | setup.py | Python | mit | 4,008 |
#!/usr/bin/python
# -*- coding: utf-8 -*
# Copyright: (c) 2017, Julien Stroheker <juliens@microsoft.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_ve... | pilou-/ansible | lib/ansible/modules/cloud/azure/azure_rm_acs.py | Python | gpl-3.0 | 29,457 |
"""
WSGI config for {{ project_name }} project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django imp... | neldom/qessera | qessera/wsgi.py | Python | mit | 493 |
import logging
import os
import time
import numpy as np
import theano.tensor as T
from theano import config
import theano
from blocks.algorithms import (GradientDescent, Adam, Momentum,
CompositeRule, StepClipping)
from blocks.extensions import FinishAfter, Printing, ProgressBar
from bloc... | negar-rostamzadeh/rna | cooking.py | Python | mit | 9,787 |
import random
def generate(data):
ask = ['equivalent resistance $R_T$', 'current from the power supply $I_T$']
which = random.choice([0,1])
data['params']['ask'] = ask[which]
label = ["$R_T$", "$I_T$"]
data['params']['lab'] = label[which]
unit = ["$\\Omega$", "A"]
data['params']['unit'] ... | PrairieLearn/PrairieLearn | exampleCourse/questions/workshop/Lesson1_example3_v3/server.py | Python | agpl-3.0 | 1,005 |
from datetime import datetime, timedelta
import re
from warnings import warn
from .base_handler import BaseHandler
import requests
API_TARGET = "https://api.bitbucket.org/1.0/repositories"
descendants_re = re.compile(r"Forks/Queues \((?P<descendants>\d+)\)", re.IGNORECASE)
class BitbucketHandler(BaseHandler):
... | miketheman/opencomparison | package/repos/bitbucket.py | Python | mit | 3,115 |
# Copyright 2016 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... | clinc/models | syntaxnet/syntaxnet/parser_eval.py | Python | apache-2.0 | 6,000 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import copy
from mitmflib.dnslib import RR,QTYPE,RCODE
from mitmflib.dnslib.server import DNSServer,DNSHandler,BaseResolver,DNSLogger
class ZoneResolver(BaseResolver):
"""
Simple fixed zone file resolver.
"""
def __init__(self,zone,g... | CiuffysHub/MITMf | mitmflib-0.18.4/mitmflib/dnslib/zoneresolver.py | Python | gpl-3.0 | 4,433 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2017 Canonical Ltd
#
# This program 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 in ... | elopio/snapcraft | snapcraft/plugins/plainbox_provider.py | Python | gpl-3.0 | 3,098 |
# Copyright 2015-2018 Capital One Services, 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 agreed ... | FireballDWF/cloud-custodian | tools/c7n_azure/tests/test_datalake.py | Python | apache-2.0 | 1,567 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from cpt.packager import ConanMultiPackager
import os
if __name__ == "__main__":
username = os.getenv("GITHUB_ACTOR")
tag_version = os.getenv("GITHUB_REF")
tag_package = os.getenv("GITHUB_REPOSITORY")
login_username = os.getenv("CONAN_LOGIN_USERNAME")
p... | skypjack/entt | conan/build.py | Python | mit | 1,747 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from datetime import date
class Settings(models.Model):
""" Singleton object containing site wide settings configurable by the trainer. """
class Meta:
... | KITPraktomatTeam/Praktomat | src/configuration/models.py | Python | gpl-2.0 | 5,274 |
def fbnq(n):
a,b=0,1
while b<n:
print(a," ")
# print(a,end=' ')
a,b=b,a+b
print(a)
print ("it's end!")
fbnq(1000)
| jiaorenyu/learning | python/may.py | Python | mit | 126 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from greenlet import getcurrent as get_ident
except ImportError: # pragma: no cover
try:
from thread import get_ident
except ImportError: # pragma: no cover
from dummy_thread import get_ident
def try_import(module):
from importlib im... | youngking/lazyconn | lazyconn/local.py | Python | bsd-3-clause | 9,195 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 27 15:41:46 2014
@author: leo
"""
import numpy as np
td = np.arange(0,50,.05)
Xt = map(lambda x: x*exp(-x) if x <= 1 and x >= 0 else 0, td)
#Xjw = fftshift(fft(Xt))
Xjw = map(lambda jw: (-exp(-1.0-jw)/(1.0+jw))
- (-exp(-1.0-jw)/np.power(1.0+jw,2.0))
+ 1.0/np.pow... | kewitz/mestrado | Analise de Sinais/exercicio423.py | Python | mit | 664 |
#coding=utf-8
import web
web.config.debug = False
web.config.session_parameters['timeout'] = 60 * 10
web.config.session_parameters['ignore_change_ip'] = False
#web.config.session_parameters['secret_key'] = '!AvadD03FDS34%%Sdfas035$$asd'
db = web.db.database(
dbn = 'mysql',
user = 'twifi',
pw = 'twifi123$'... | koakumaping/simple-blog | settings.py | Python | gpl-2.0 | 767 |
#!/usr/bin/python
from basic_discovery import BasicDiscoverer
import re
class Discoverer(BasicDiscoverer):
def discovery(self, *args):
response = self.client.describe_target_groups()
data = []
# Load balancer data cache
LoadBalancersDescrByArn = {}
for TargetGroup in re... | wawastein/zabbix-cloudwatch | zabbix-scripts/scripts/discovery/elbv2.py | Python | gpl-3.0 | 2,103 |
import os
import mock
from zope.interface import implementer
from twisted.trial import unittest
from twisted.internet import endpoints, defer, reactor
from twisted.internet.endpoints import clientFromString
from twisted.internet.defer import inlineCallbacks
from twisted.internet.interfaces import IStreamClientEndpoint
... | warner/foolscap | src/foolscap/test/test_connection.py | Python | mit | 28,403 |
# Obtained from: http://www.djangosnippets.org/snippets/133/
# Author: http://www.djangosnippets.org/users/SmileyChris/
from django.template import loader, Context, RequestContext, TemplateSyntaxError
from django.http import HttpResponse
def render_response(template_prefix=None, always_use_requestcontext=True):
"... | DarwinSalaz/django-profile | userprofile/utils/decorators.py | Python | bsd-2-clause | 3,031 |
"""Factory for creating devices."""
import logging
import math
import time
from google.appengine.api import namespace_manager
from google.appengine.ext import ndb
import flask
from appengine import account, model, pushrpc, rest
from common import detector
DEVICE_TYPES = {}
def static_command(func):
"""Device c... | tomwilkie/awesomation | src/appengine/device.py | Python | mit | 8,484 |
from .main import encode | ikvk/pdf417as_str | pdf417as_str/__init__.py | Python | lgpl-3.0 | 24 |
import lxml.html
import re
import requests
from utils import State
from .people import AZPersonScraper
from .bills import AZBillScraper
# from .committees import AZCommitteeScraper
# from .events import AZEventScraper
class Arizona(State):
scrapers = {
"people": AZPersonScraper,
# 'committees': A... | sunlightlabs/openstates | scrapers/az/__init__.py | Python | gpl-3.0 | 15,823 |
#!/usr/bin/env python
###
## Faraday Penetration Test IDE
## Copyright (C) 2015 Infobyte LLC (http://www.infobytesec.com/)
## See the file 'doc/LICENSE' for the license information
###
config = {
#NMAP
'CS_NMAP' : "nmap",
#OPENVAS
'CS_OPENVAS_USER' : 'admin',
... | RB4-Solutions/cscan | config.py | Python | gpl-3.0 | 1,117 |
#!/usr/bin/python
# Copyright 2017 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 a... | Martin819/salt-formula-opencontrail | _states/contrail.py | Python | apache-2.0 | 8,638 |
from random import randrange
class City:
def __init__(self, name, period, count, success):
self.name = name
self.period = period
self.count = count
self.success = success
class Champion:
def __init__(self, city, success, time):
self.city = city
self.success = success
self.time = time
antithan = C... | theperfectionist89/fotc | championsTest.py | Python | mit | 1,627 |
#!/usr/bin/env python
""" MultiQC Submodule to parse output from Qualimap RNASeq """
from __future__ import print_function
from collections import OrderedDict
import logging
import re
from multiqc import config
from multiqc.plots import bargraph, linegraph
# Initialise the logger
log = logging.getLogger(__name__)
... | robinandeer/MultiQC | multiqc/modules/qualimap/QM_RNASeq.py | Python | gpl-3.0 | 6,595 |
#
# author: Cosmin Basca
#
# Copyright 2010 University of Zurich
#
# 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 a... | cosminbasca/rdftools | rdftools/datagen/lubm_uni2many.py | Python | apache-2.0 | 3,943 |
#Splitting out maringal effects to see if they can be generalized
from statsmodels.compat.python import lzip
import numpy as np
from scipy.stats import norm
from statsmodels.tools.decorators import cache_readonly
#### margeff helper functions ####
#NOTE: todo marginal effects for group 2
# group 2 oprobit, ologit, go... | statsmodels/statsmodels | statsmodels/discrete/discrete_margins.py | Python | bsd-3-clause | 26,644 |
# standard libraries
import os
import collections.abc
import collections
#import http.cookies
# third party libraries
pass
# first party libraries
pass
__where__ = os.path.dirname(os.path.abspath(__file__))
class RequestCookies(collections.abc.Mapping):
def __init__(self, **cookies):
self._cookies ... | brianjpetersen/bocce | bocce/cookies.py | Python | mit | 4,695 |
from __future__ import absolute_import
import time
import itertools
from nose import SkipTest
from celery.datastructures import ExceptionInfo
from celery.tests.utils import Case
def do_something(i):
return i * i
def long_something():
time.sleep(1)
def raise_something(i):
try:
raise KeyError... | couchbaselabs/celery | celery/tests/concurrency/test_pool.py | Python | bsd-3-clause | 2,351 |
from itertools import izip
import random
import numpy as np
from learntools.libs.common_test_utils import use_logger_in_test
from learntools.data import cv_split
from learntools.emotiv import BaseEmotiv, prepare_data
from learntools.emotiv.tests.emotiv_simple import SimpleEmotiv
from learntools.data import Dataset
im... | yueranyuan/vector_edu | learntools/emotiv/tests/test_emotiv_base.py | Python | mit | 2,637 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides tools for making a simulated image for tests.
"""
from astropy.io import fits
import numpy as np
from ..geometry import EllipseGeometry
from ...datasets import make_noise_image
def make_test_image(nx=512, ny=512, x0=None, y0=No... | astropy/photutils | photutils/isophote/tests/make_test_data.py | Python | bsd-3-clause | 3,779 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
urlpatterns = patterns('',
url(r'^$', 'website.views.index'),
url(r'^uploader/$', 'website.views.uploader'),
url(r'^register/$', 'website.views.register'),
url(r'^account/$', ... | vlameiras/cdkeyswholesale | website/urls.py | Python | mit | 1,066 |
from lib.hachoir_parser.network.tcpdump import TcpdumpFile
| Branlala/docker-sickbeardfr | sickbeard/lib/hachoir_parser/network/__init__.py | Python | mit | 60 |
# coding: utf-8
# In[2]:
import time
from bs4 import BeautifulSoup
import sys, io
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.proxy import *
# @author Ranjeet Singh <ranjeetsingh867@gmail.com>
# Modify it according to your requirements
no_of... | ranjeet867/google-play-crawler | crawl_play_store.py | Python | mit | 3,421 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('chat', '0004_auto_20150905_1700'),
]
operations = [
migrations.RenameField(
model_name='message',
ol... | dionyziz/ting | API/chat/migrations/0005_auto_20160511_1921.py | Python | mit | 619 |
import json
class NoEventLoop(NameError):
pass
class DataStore:
def __init__(self, filename=None, evt_loop=None, debug=False):
if not evt_loop:
raise NoEventLoop
self.namespace = {}
self.debug = debug
self.evt_loop = evt_loop
self.filename = filename
... | jackatbancast/bettaDB | bettadb/db.py | Python | mit | 4,168 |
"""The test for binary_sensor device automation."""
from datetime import timedelta
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.binary_sensor import DEVICE_CLASSES, DOMAIN
from homeassistant.components.binary_sensor.device_trigger import ENTITY_TRIGGERS
from hom... | kennedyshead/home-assistant | tests/components/binary_sensor/test_device_trigger.py | Python | apache-2.0 | 8,733 |
# Copyright (C) 2013 Marco Aslak Persson
#
# 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 distri... | nulldatamap/IceLeaf | IceLeaf/parse.py | Python | agpl-3.0 | 7,744 |
#!/usr/bin/env python
"""
Dittohead watcher daemon.
Uses watchdog to watch a given "inbox" input directory where files are landing
from the dittohead clients.
Does not do anything until a `.directory` is renamed to `directory` without a dot.
Then it makes a thread for a `dittohead_worker.py` to operate on that dire... | dgfitch/dittohead | src/server/dittohead_watcher.py | Python | unlicense | 3,682 |
# -*- coding: utf-8 -*-
#
# libxmlquery documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 5 15:13:45 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | nullable/libxmlquery | documentation/conf.py | Python | mit | 8,376 |
from pymongo import MongoClient
import app
import settings
def connect(collection):
client = MongoClient()
d = client[settings.MONGO_DATABASE]
return d[collection]
def bake():
from flask import g
for route in ['index']:
with (app.app.test_request_context(path="/%s.html" % route)):
... | ireapps/lightning-talks | utils.py | Python | mit | 588 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
This module has two important functions:
htmlparser.find_download_links(): this function is used to scrape webpages for download links and html tables,
allowing users to find and download items from a page.
htmlparser.compare(): this... | salbrandi/patella | patella/htmlparser.py | Python | mit | 13,807 |
# Copyright cf-units contributors
#
# This file is part of cf-units and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the :mod:`cf_units` package."""
| SciTools/cf_units | cf_units/tests/unit/__init__.py | Python | lgpl-3.0 | 251 |
import argparse
import uuid
import os
import sys
import hypergan as hg
import hyperchamber as hc
from hypergan.inputs import *
from hypergan.search.random_search import RandomSearch
from hypergan.discriminators.base_discriminator import BaseDiscriminator
from hypergan.generators.base_generator import BaseGenerator
from... | 255BITS/HyperGAN | examples/classification.py | Python | mit | 8,744 |
"""
Extends Yapsy IPlugin interface to pass information about the board to plugins.
Fields of interest for plugins:
args: list of arguments passed to the plugins
sample_rate: actual sample rate of the board
eeg_channels: number of EEG
aux_channels: number of AUX channels
If needed, plugins that need to re... | jfrey-xx/OpenBCI_Python | plugin_interface.py | Python | mit | 1,639 |
#!/usr/bin/env python
# Test whether a client subscribed to a topic receives its own message sent to that topic.
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(o... | telefonicaid/fiware-IoTAgent-Cplusplus | third_party/mosquitto-1.4.4/test/broker/02-subpub-qos2.py | Python | agpl-3.0 | 2,204 |
from setuptools import setup
setup(name='GithubEmailHook',
version='1.0',
description='Github Email Hook',
author='David Shea',
author_email='dshea@redhat.com',
url='http://github.com/dashea/github-email-hook',
packages=['github_email_hook'],
install_requires=open("requirement... | rhinstaller/github-email-hook | setup.py | Python | gpl-2.0 | 347 |
import os
import unittest
import tempfile
import sqlite3
from subsetter import Db
class DummyArgs(object):
logarithmic = False
fraction = 0.25
force_rows = {}
children = 25
config = {}
exclude_tables = []
full_tables = []
buffer = 1000
dummy_args = DummyArgs()
class OverallTest(unitte... | Shoptap/rdbms-subsetter | test_subsetter.py | Python | cc0-1.0 | 5,202 |
from qtpy import QtGui, QtCore, QtWidgets
from qtpy.QtCore import QPoint
class StandardItemModelIterator(object):
def __init__(self, model):
self.model = model
self.pos = 0
def __next__(self):
if self.pos < self.model.rowCount():
item = self.model.item(self.pos)
... | larray-project/larray-editor | larray_editor/combo.py | Python | gpl-3.0 | 9,067 |
"""
ThisIsMyJam OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/thisismyjam.html
"""
from social.backends.oauth import BaseOAuth1
class ThisIsMyJamOAuth1(BaseOAuth1):
"""ThisIsMyJam OAuth1 authentication backend"""
name = 'thisismyjam'
REQUEST_TOKEN_URL = 'http://www.thisismyjam.co... | HackerEcology/SuggestU | suggestu/social/backends/thisismyjam.py | Python | gpl-3.0 | 1,108 |
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, 'index.html', locals()) | SnoozeTime/pythonanywhere | myapi/views.py | Python | apache-2.0 | 129 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.