text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | mzdaniel/django-selenium-test-runner | tests/manage.py | Python | bsd-3-clause | 665 | 0.003008 |
# -*- coding: utf-8 -*-
"""Word cloud integration tests using mongo modulestore."""
import json
from operator import itemgetter
from xmodule.x_module import STUDENT_VIEW
from .helpers import BaseTestXmodule
class TestWordCloud(BaseTestXmodule):
"""Integration test for word cloud xmodule."""
CATEGORY = "wo... | edx-solutions/edx-platform | lms/djangoapps/courseware/tests/test_word_cloud.py | Python | agpl-3.0 | 8,875 | 0.000903 |
from tornado import gen
from tornado import web
from tornado import ioloop
import uuid
import os
import pickle
from lib.database.users import user_insert
from lib.database.users import get_user
from lib.database.users import get_user_from_email
from lib.database.reservations import create_ticket_reservation
from lib.... | wannabeCitizen/quantifiedSelf | app/user_auth.py | Python | mit | 6,825 | 0.000586 |
# -*- coding: utf-8 -*-
from os import urandom
from flask import Flask
from flask import request
from flask_httpauth import HTTPDigestAuth
from mgnemu.controllers.check_tape import CheckTape
app = Flask(__name__)
app.config['SECRET_KEY'] = str(urandom(24))
auth = HTTPDigestAuth()
@auth.get_password
def get_pw(usern... | 0xporky/mgnemu-python | mgnemu/routes.py | Python | mit | 1,677 | 0 |
#!/usr/bin/env python
#
# Hello World
#
# Copyright 2012 Cody Van De Mark
#
# This library 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 Free Software Foundation; either
# version 3.0 of the License, or (at your option) any... | renardchien/Software-Development-on-Linux--Open-Source-Course- | Labs/Lab 4/Student Files/Hello.py | Python | lgpl-3.0 | 766 | 0.007833 |
#!/usr/bin/env python3
from math import log, exp
def RungeKutta2aEDO (x0, t0, tf, h, dX):
xold = x0
told = t0
ret = []
while (told <= tf):
ret += [(told, xold)]
k1 = dX(xold, told)
k2 = dX(xold + h*k1, told+h)
xold = xold + h/2 * (k1+k2)
told = round(told + h,3... | paulocsanz/algebra-linear | scripts/runge_kutta_2a.py | Python | agpl-3.0 | 431 | 0.011601 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import urllib.request
import time
from bs4 import BeautifulSoup
def main():
url = 'http://www.pokemonstore.co.kr/shop/main/index.php'
print('For exit, press ctrl + c')
while(True):
try:
with urllib.request.urlopen(url) as f:
i... | munhyunsu/Hobby | TestResponse/testresponse.py | Python | gpl-3.0 | 878 | 0.001139 |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client 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 optparse
import os.path
import shutil
import subprocess
import sys
import time
import traceback
ARCH_MAP = {
'32': {
... | CTSRD-SOAAP/chromium-42.0.2311.135 | native_client/buildbot/buildbot_lib.py | Python | bsd-3-clause | 21,434 | 0.014276 |
from . import commands
from . import compose
from . import dockerrun
from ..core import fileoperations
from ..objects.exceptions import CommandError
class MultiContainer(object):
"""
Immutable class used to run Multi-containers.
"""
PROJ_NAME = 'elasticbeanstalk'
def __init__(self, fs_handler, s... | quickresolve/accel.ai | flask-aws/lib/python2.7/site-packages/ebcli/containers/multicontainer.py | Python | mit | 2,306 | 0.001735 |
e = .1
mean_list = base.List(self.get_theta(key="treatment"), base.Mean, ["control", "treatment"])
if np.random.binomial(1,e) == 1:
self.action["treatment"] = mean_list.random()
self.action["propensity"] = 0.1*0.5
else:
self.action["treatment"] = mean_list.max()
self.action["propensity"] = (1-e) | Nth-iteration-labs/streamingbandit | app/defaults/E-Greedy/get_action.py | Python | mit | 312 | 0.009615 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TekScope.py
#
# Copyright 2016 Samuel Hill <samuel.hill@warwick.ac.uk>
#
# 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... | UltrasoundSam/TekDPO2000 | TekScope.py | Python | gpl-3.0 | 7,366 | 0.007738 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: TFG
# Author: David Candal
# Description: SDR ZigBee
# Generated: Mon Sep 19 21:01:18 2016
##################################################
if __name__ == '__main__':
import ct... | davidcandal/gr-tfg | examples/testNWK.py | Python | gpl-3.0 | 4,815 | 0.0081 |
# Python - 3.6.0
circle_area = lambda circle: round(circle.radius ** 2 * __import__('math').pi, 6)
| RevansChen/online-judge | Codewars/8kyu/geometry-basics-circle-area-in-2d/Python/solution1.py | Python | mit | 100 | 0.02 |
## @file
# This file contained the parser for [Sources] sections in INF file
#
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# dist... | google/google-ctf | third_party/edk2/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py | Python | apache-2.0 | 5,413 | 0.003141 |
import sys
import EulerPy
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def readme():
with open('README.rst') as f:
return f.read()
def requirements():
install_requires = []
with open('requirements.txt') as f:
for line in f:
ins... | rahulg/eulerswift | setup.py | Python | mit | 1,487 | 0.002017 |
import _plotly_utils.basevalidators
class ShowexponentValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="showexponent",
parent_name="scatter3d.marker.colorbar",
**kwargs
):
super(ShowexponentValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/_showexponent.py | Python | mit | 546 | 0 |
from typing import Dict, Iterable, Optional
from iota import AdapterSpec, Address, BundleHash, ProposedTransaction, Tag, \
TransactionHash, TransactionTrytes, TryteString, TrytesCompatible
from iota.adapter import BaseAdapter, resolve_adapter
from iota.commands import CustomCommand, core, extended
from iota.crypto... | iotaledger/iota.lib.py | iota/api_async.py | Python | mit | 57,097 | 0.000841 |
# Generated by Django 1.11.11 on 2018-07-27 18:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0090_degree_curriculum_reset'),
]
operations = [
migrations.AddField(
model_name='degree',
nam... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0091_auto_20180727_1844.py | Python | agpl-3.0 | 1,487 | 0.00269 |
"""
Social.py
Contains elements that enable connecting with external social sites.
Copyright (C) 2015 Timothy Edmund Crosley
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;... | timothycrosley/thedom | thedom/social.py | Python | gpl-2.0 | 14,474 | 0.009811 |
#!/usr/bin/python
##########################################################################
#
# MTraceCheck
# Copyright 2017 The Regents of the University of Michigan
# Doowon Lee and Valeria Bertacco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | leedoowon/MTraceCheck | src_main/codegen_common.py | Python | apache-2.0 | 10,228 | 0.003911 |
#!/usr/bin/env python
"""Test the collector flows."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
from absl import app
from future.utils import iterkeys
from grr_response_core import config
from grr_response_core.lib.parsers import config_f... | dunkhong/grr | grr/server/grr_response_server/flows/general/checks_test.py | Python | apache-2.0 | 4,415 | 0.004304 |
# -*- coding: utf-8 -*-
from lar import *
from scipy import *
import json
import scipy
import numpy as np
import time as tm
import gc
from pngstack2array3d import *
import struct
import getopt, sys
import traceback
#
import matplotlib.pyplot as plt
# ------------------------------------------------------------
# Logg... | cvdlab/lar-running-demo | py/computation/old/step_calcchains_serial_tobinary_filter.py | Python | mit | 8,263 | 0.049498 |
#!/usr/bin/env python
# this program is used to test latency
# don't test RTT bigger than 3 secs - it will break
# we make sure that nothing breaks if there is a packet missing
# this can rarely happen
import select
import socket
import time
import sys
import struct
def pong():
# easy, receive and send back
... | olbat/distem | test/experimental_testing/exps/latency.py | Python | gpl-3.0 | 1,573 | 0.003814 |
#
#
# genWix.py is used to generate a WiX .wxs format file that
# can be compiled by the candle.exe WiX compiler.
#
# Usage: python genWix.py <output_file>
#
# The current directory is expected to be the top of a tree
# of built programs, libraries, documentation and files.
#
# The list of directories traversed is at ... | genehallman/node-berkeleydb | deps/db-18.1.40/dist/winmsi/genWix.py | Python | mit | 10,795 | 0.036035 |
"""
The filterer object.
@author: Chris Scott
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import copy
import time
import logging
import numpy as np
import six
from six.moves import zip
from .filters import _filtering as filtering_c
from ..system.atoms import elements
from . i... | chrisdjscott/Atoman | atoman/filtering/filterer.py | Python | mit | 18,810 | 0.005848 |
from setuptools import setup, find_packages
with open('pyluno/meta.py') as f:
exec(f.read())
setup(
name='pyluno',
version=__version__,
packages=find_packages(exclude=['tests']),
description='A Luno API for Python',
author='Cayle Sharrock/Grant Stephens',
author_email='grant@stephens.co.za'... | grantstephens/pyluno | setup.py | Python | mit | 1,485 | 0 |
# GNU Enterprise Common Library - Base Login Handler
#
# Copyright 2000-2007 Free Software Foundation
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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;... | HarmonyEnterpriseSolutions/harmony-platform | src/gnue/common/datasources/GLoginHandler.py | Python | gpl-2.0 | 9,003 | 0.026325 |
import os
import sys
import glob
try:
import numpy
except ImportError:
print "You need to have numpy installed on your system to run setup.py. Sorry!"
sys.exit()
try:
from Cython.Distutils import build_ext
except ImportError:
print "You need to have Cython installed on your system to run setup.py.... | caglar10ur/anvio | setup.py | Python | gpl-3.0 | 2,549 | 0.016869 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import numpy as np
def glrm_arrests_miss():
missing_ratios = np.arange(0.1, 1, 0.1).tolist()
print "Importing USArrests.csv data and saving for validation..."
arrests_full = h2o.upload_file(pyunit_utils.locate("smal... | pchmieli/h2o-3 | h2o-py/tests/testdir_algos/glrm/pyunit_DEPRECATED_arrests_missingGLRM.py | Python | apache-2.0 | 3,136 | 0.009885 |
from ..sourcefile import SourceFile
def create(filename, contents=b""):
assert isinstance(contents, bytes)
return SourceFile("/", filename, "/", contents=contents)
def items(s):
return [
(item.item_type, item.url)
for item in s.manifest_items()
]
def test_name_is_non_test():
non... | wldcordeiro/servo | tests/wpt/web-platform-tests/tools/manifest/tests/test_sourcefile.py | Python | mpl-2.0 | 5,974 | 0.000167 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, os, shutil, glob, py_compile, subprocess, re, zipfile, time, textwrap
fr... | nozuono/calibre-webserver | setup/installer/windows/freeze.py | Python | gpl-3.0 | 32,114 | 0.004266 |
"""
Lonely Planet Sight Model
"""
from __future__ import absolute_import, print_function
import re
from bs4 import BeautifulSoup
from django.db import models
from django.utils.translation import ugettext as _
from core.models.sight import THSight
from core.utils import urllib2
from .abstract import LonelyPlanetAbst... | jricardo27/travelhelper | travelhelper/apps/lonelyplanet/models/sight.py | Python | bsd-3-clause | 8,871 | 0.000789 |
import os
import io
import shutil
import tempfile
import unittest
from functools import partial
from pathlib import Path
from nbformat import validate
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from .. import engines
from ..log import logger
from ..iorw import load_noteb... | nteract/papermill | papermill/tests/test_execute.py | Python | bsd-3-clause | 16,273 | 0.003318 |
NAME = 'emperor_zeromq'
CFLAGS = []
LDFLAGS = []
LIBS = ['-lzmq']
GCC_LIST = ['emperor_zeromq']
| goal/uwsgi | plugins/emperor_zeromq/uwsgiplugin.py | Python | gpl-2.0 | 98 | 0 |
import pytest
from numpy.testing import assert_allclose, assert_
import numpy as np
from scipy.integrate import RK23, RK45, DOP853
from scipy.integrate._ivp import dop853_coefficients
@pytest.mark.parametrize("solver", [RK23, RK45, DOP853])
def test_coefficient_properties(solver):
assert_allclose(np.sum(solver.B)... | matthew-brett/scipy | scipy/integrate/_ivp/tests/test_rk.py | Python | bsd-3-clause | 1,326 | 0 |
# Generated by Django 3.1 on 2020-08-13 19:23
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
nam... | smokeyfeet/smokeyfeet-registration | src/smokeyfeet/registration/migrations/0001_initial.py | Python | mit | 4,391 | 0.004555 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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... | frankrousseau/weboob | weboob/tools/log.py | Python | agpl-3.0 | 2,262 | 0 |
"""Conversion tool from SQD to FIF
RawKIT class is adapted from Denis Engemann et al.'s mne_bti2fiff.py
"""
# Author: Teon Brooks <teon@nyu.edu>
#
# License: BSD (3-clause)
import os
from os import SEEK_CUR
from struct import unpack
import time
import numpy as np
from scipy import linalg
from ..pick import pick_t... | jaeilepp/eggie | mne/io/kit/kit.py | Python | bsd-2-clause | 28,437 | 0 |
# PROBLEM 3
#
# Modify the below functions acceleration and
# ship_trajectory to plot the trajectory of a
# spacecraft with the given initial position
# and velocity. Use the Forward Euler Method
# to accomplish this.
#from udacityplots import *
import math
import numpy
import matplotlib
h = 1.0 # ... | rhennigan/code | python/spaceshipTrajectory.py | Python | gpl-2.0 | 1,346 | 0.013373 |
# -*- coding: utf-8 -*-
#
# Copyright 2015 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 applica... | simone-campagna/invoice | tests/unittests/test_db_types.py | Python | apache-2.0 | 11,568 | 0.005014 |
"""
Print out some handy system info.
"""
import os
import platform
import sys
print("Build system information")
print()
print("sys.version\t\t", sys.version.split("\n"))
print("os.name\t\t\t", os.name)
print("sys.platform\t\t", sys.platform)
print("platform.system()\t", platform.system())
print("platform.machine()\... | scottclowe/python-continuous-integration | .github/workflows/system_info.py | Python | mit | 575 | 0 |
# Copyright 2013-2016 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | BriData/DBus | dbus-mongo-extractor/tests/test_rollbacks.py | Python | apache-2.0 | 12,580 | 0.000636 |
# ICE Revision: $Id$
"""Information about custom plots"""
from PyFoam.Basics.TimeLineCollection import TimeLineCollection
from PyFoam.Basics.FoamFileGenerator import makeString
from PyFoam.RunDictionary.ParsedParameterFile import FoamStringParser,PyFoamParserError
from PyFoam.Error import error
from PyFoam.ThirdPart... | mortbauer/openfoam-extend-Breeder-other-scripting-PyFoam | PyFoam/Basics/CustomPlotInfo.py | Python | gpl-2.0 | 5,311 | 0.024666 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction signing using the signrawtransaction RPC."""
from test_framework.test_framework impor... | aspaas/ion | test/functional/signrawtransactions.py | Python | mit | 7,930 | 0.003153 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | HybridF5/tempest_debug | tempest/api/identity/admin/v3/test_services.py | Python | apache-2.0 | 4,083 | 0 |
import sys
import unittest
from dynd import nd, ndt
import ctypes
# ToDo: Reenable this with a Cython interface.
#
#class TestCTypesDTypeInterop(unittest.TestCase):
# def test_type_from_ctype_typeobject(self):
# self.assertEqual(ndt.int8, ndt.type(ctypes.c_int8))
# self.assertEqual(ndt.int16, ndt.type... | mwiebe/dynd-python | dynd/nd/test/test_ctypes_interop.py | Python | bsd-2-clause | 2,910 | 0.002405 |
"""
# Relative Path Markdown Extension
During the MkDocs build we rewrite URLs that link to local
Markdown or media files. Using the following pages configuration
we can look at how the output is changed.
pages:
- ['index.md']
- ['tutorial/install.md']
- ['tutorial/intro.md']
## Markdown URLs
When l... | ramramps/mkdocs | mkdocs/relative_path_ext.py | Python | bsd-2-clause | 4,804 | 0 |
"""add kernelspecs
Revision ID: 50a4d84c131a
Revises: b6d005d67074
Create Date: 2017-06-01 16:48:02.243764
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '50a4d84c131a'
down_revision = 'b6d005d67074'
branch_labels = None
depends_on = None
def upgrade():
... | jhamrick/nbgrader | nbgrader/alembic/versions/50a4d84c131a_add_kernelspecs.py | Python | bsd-3-clause | 506 | 0 |
# -*- coding: utf-8 -
#
# This file is part of tproxy released under the MIT license.
# See the NOTICE for more information.
try:
import ctypes
except MemoryError:
# selinux execmem denial
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
ctypes = None
except ImportError:
# Python on Solaris c... | benoitc/tproxy | tproxy/util.py | Python | mit | 3,968 | 0.007056 |
# Copyright (c) 2015 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | paninetworks/neutron | neutron/db/ipam_non_pluggable_backend.py | Python | apache-2.0 | 22,516 | 0.000133 |
#
# Copyright 2008-2015 Semantic Discovery, 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 applicab... | KoehlerSB747/sd-tools | src/main/python/util/StatsAccumulator.py | Python | apache-2.0 | 5,869 | 0.002897 |
#!/usr/bin/env python
__author__ = "Andrew Hankinson (andrew.hankinson@mail.mcgill.ca)"
__version__ = "1.5"
__date__ = "2011"
__copyright__ = "Creative Commons Attribution"
__license__ = """The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of ... | ahankinson/pybagit | pybagit/multichecksum.py | Python | mit | 4,668 | 0.003856 |
# -*- coding: utf-8 -*-
import copy
import datetime
import json
import logging
import subprocess
import sys
import warnings
from email.mime.text import MIMEText
from email.utils import formatdate
from smtplib import SMTP
from smtplib import SMTP_SSL
from smtplib import SMTPAuthenticationError
from smtplib import SMTPEx... | jetyang2005/elastalert | elastalert/alerts.py | Python | apache-2.0 | 55,913 | 0.002755 |
from __future__ import absolute_import
from sentry.models import Activity
from sentry.testutils import APITestCase
class GroupNoteTest(APITestCase):
def test_simple(self):
group = self.group
activity = Activity.objects.create(
group=group,
project=group.project,
... | nicholasserra/sentry | tests/sentry/api/endpoints/test_group_notes.py | Python | bsd-3-clause | 1,576 | 0 |
# -*- coding: utf-8 -*-
#
#
# Copyright 2013 Netflix, 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 ... | nhamplify/aminator | aminator/plugins/blockdevice/base.py | Python | apache-2.0 | 1,648 | 0.00182 |
"""
Test suite for the table class
"""
import six
from pynamodb.compat import CompatTestCase as TestCase
from pynamodb.connection import TableConnection
from pynamodb.constants import DEFAULT_REGION
from pynamodb.tests.data import DESCRIBE_TABLE_DATA, GET_ITEM_DATA
from pynamodb.tests.response import HttpOK
if six.PY3... | khwilson/PynamoDB | pynamodb/tests/test_table_connection.py | Python | mit | 16,242 | 0.001478 |
import argparse
import configargparse
import functools
import inspect
import logging
import sys
import tempfile
import types
import unittest
# enable logging to simplify debugging
logger = logging.getLogger()
logger.level = logging.DEBUG
stream_handler = logging.StreamHandler(sys.stdout)
logger.addHandler(stream_hand... | acx2015/ConfigArgParse | tests/test_configargparse.py | Python | mit | 34,286 | 0.011287 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
db.commit_transaction()
try:
self._forwards(orm)
except E... | looker/sentry | src/sentry/south_migrations/0348_fix_project_key_rate_limit_window_unit.py | Python | bsd-3-clause | 83,050 | 0.007851 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
### 2008-2015 Charlie Barnes.
### 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 la... | charlie-barnes/dipper-stda | pdf.py | Python | gpl-2.0 | 8,846 | 0.010513 |
#! /usr/bin/python
#
# Copyright 2016 IBM Corp.
#
# 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 i... | xively/node-red-nodes | hardware/sensehat/sensehat.py | Python | apache-2.0 | 6,966 | 0.024978 |
# -*- coding: utf-8 -*-
#
# (DC)² - DataCenter Deployment Control
# Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephan Adig <sh@sourcecode.de>
# 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; eit... | sadig/DC2 | components/dc2-lib/dc2/lib/exceptions/authentication.py | Python | gpl-2.0 | 948 | 0 |
import requests
from bs4 import BeautifulSoup
import sys
import os
import pandas
import re
targetURL = "http://www.ubcpress.ca/search/subject_list.asp?SubjID=45"
bookLinks = "http://www.ubcpress.ca/search/"
outputDir = "UBC_Output"
def main():
r = requests.get(targetURL)
soup = BeautifulSoup(r.content, "ht... | reidmcy/pressScrapers | ubcScraper.py | Python | gpl-2.0 | 2,909 | 0.008594 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from multitest.models import Test, Question, Answer
class MultitestViewsTests(TestCase):
def setUp(self):
self.user = User.objects.create(username='user', is_active=True, is_s... | adiq/MultitestApp | multitest/tests.py | Python | mit | 3,600 | 0.003611 |
"""
Call loop machinery
"""
import sys
from ._result import HookCallError, _Result, _raise_wrapfail
def _multicall(hook_name, hook_impls, caller_kwargs, firstresult):
"""Execute a call into multiple python functions/methods and return the
result(s).
``caller_kwargs`` comes from _HookCaller.__call__().
... | RonnyPfannschmidt/pluggy | src/pluggy/_callers.py | Python | mit | 2,097 | 0.000477 |
# Copyright 2014 The Oppia 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 ... | mindpin/mindpin_oppia | core/domain/rights_manager_test.py | Python | apache-2.0 | 11,577 | 0 |
#pylint: disable=missing-docstring
#################################################################
# DO NOT MODIFY THIS HEADER #
# MOOSE - Multiphysics Object Oriented Simulation Environment #
# #
# (c) 2010... | backmari/moose | python/chigger/graphs/Line.py | Python | lgpl-2.1 | 7,589 | 0.002108 |
#!/usr/bin/env python
from __future__ import unicode_literals
'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
nanopb_version = "nanopb-0.3.9.2"
import sys
import re
import codecs
from functools import reduce
try:
# Add some dummy imports to keep packaging tools happy.
import google,... | google/myelin-acorn-electron-hardware | third_party/nanopb/generator/nanopb_generator.py | Python | apache-2.0 | 70,423 | 0.003664 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Lunzhy'
| lunzhy/PyShanbay | gui/__init__.py | Python | mit | 71 | 0.014085 |
#-*- encoding:utf-8 -*-
'''
Created on Nov 30, 2014
@author: letian
'''
import networkx as nx
from Segmentation import Segmentation
import numpy as np
class TextRank4Keyword(object):
def __init__(self, stop_words_file = None, delimiters = '?!;?!。;…\n'):
'''
`stop_words_file`:默认值为None,此时内部停止词表... | MSC19950601/TextRank4ZH | textrank4zh/TextRank4Keyword.py | Python | mit | 7,411 | 0.013252 |
#!/usr/bin/env python
from __future__ import print_function
import UTM # imports the UTM module
Ellipsoid=23-1 # UTMs code for WGS-84
StationNFO=open('station.list').readlines()
for line in StationNFO:
nfo=line.strip('\n').split()
lat=float(nfo[0])
lon=float(nfo[1])
StaName= nfo[3]
Zone,Easting, No... | Caoimhinmg/PmagPy | data_files/LearningPython/ConvertStations.py | Python | bsd-3-clause | 408 | 0.031863 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | Peddle/hue | desktop/libs/notebook/src/notebook/connectors/base.py | Python | apache-2.0 | 5,042 | 0.012297 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2020) Hewlett Packard Enterprise Development LP
#
# 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/licen... | HewlettPackard/oneview-ansible | library/oneview_server_hardware.py | Python | apache-2.0 | 13,959 | 0.002866 |
"""
Tests for tools
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
from statsmodels.tsa.statespace import tools
# from .results import results_sarimax
from numpy.testing import (
assert_equal, assert_array_eq... | hlin117/statsmodels | statsmodels/tsa/statespace/tests/test_tools.py | Python | bsd-3-clause | 4,268 | 0.011949 |
import functools
from django.contrib import admin
from django.contrib.admin.options import operator
from django.core.exceptions import FieldDoesNotExist
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from .models import FakeEmail
class CommaSearchInAdminMixin:
def get_search_id_f... | eviljeff/olympia | src/olympia/amo/admin.py | Python | bsd-3-clause | 5,736 | 0 |
"""
For now just Alazar cards but should also support Acquiris.
"""
from Instrument import Instrument
from atom.api import Atom, Str, Int, Float, Bool, Enum, List, Dict, Coerced
import itertools, ast
import enaml
from enaml.qt.qt_application import QtApplication
class Digitizer(Instrument):
pass
class AlazarATS987... | rmcgurrin/PyQLab | instruments/Digitizers.py | Python | apache-2.0 | 6,043 | 0.025484 |
# This file was created automatically by SWIG 1.3.29.
# Don't modify this file, modify the SWIG interface instead.
"""
wx.webkit.WebKitCtrl for Mac OSX.
"""
import _webkit
import new
new_instancemethod = new.instancemethod
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): ... | ezequielpereira/Time-Line | libs64/wx/webkit.py | Python | gpl-3.0 | 11,969 | 0.009608 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-04 19:14
from __future__ import unicode_literals
import archives.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migra... | phith0n/mooder | archives/migrations/0004_postimage.py | Python | lgpl-3.0 | 1,192 | 0.004288 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 appli... | eltonkevani/tempest_el_env | tempest/api/image/v2/test_images_tags_negative.py | Python | apache-2.0 | 1,762 | 0 |
################################################################
# ##
# Example 1: Converting ArcGIS solar radiation graphics to ##
# horizon coordinate points ##
############################################################... | geocryology/HorizonPy | Examples/Example_1/Example_1_v2.py | Python | gpl-3.0 | 948 | 0.004219 |
# utilities.py
'''General utility functions used throughout plugin'''
import re
import os
import time
import socket
from httplib import HTTPException
from calibre.library import current_library_path
from calibre_plugins.xray_creator.lib.exceptions import PageDoesNotExist
HONORIFICS = 'mr mrs ms esq prof dr fr rev pr ... | szarroug3/X-Ray_Calibre_Plugin | lib/utilities.py | Python | gpl-3.0 | 6,752 | 0.003258 |
import tensorflow as tf
import numpy as np
import time
import datetime
from btgym.algorithms import BaseAAC
from btgym.algorithms.math_utils import cat_entropy
# from btgym.algorithms.runner.synchro import BaseSynchroRunner
from btgym.research.encoder_test.runner import RegressionRunner
# class EncoderClassifier(Bas... | Kismuz/btgym | btgym/research/encoder_test/aac.py | Python | lgpl-3.0 | 30,478 | 0.00233 |
#!/usr/bin/env python3
import unittest
import argparse
from httpclient.httpclient import HttpRequest
class HttpRequstTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_parse_url(self):
host, port, resource = HttpRequest._parse_url('127.0.0.1')
... | mahyarap/httpclient | tests/test_httpclient.py | Python | gpl-3.0 | 1,500 | 0.002 |
import _plotly_utils.basevalidators
class ShowexponentValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="showexponent", parent_name="heatmap.colorbar", **kwargs
):
super(ShowexponentValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/heatmap/colorbar/_showexponent.py | Python | mit | 518 | 0.001931 |
from rest_framework import serializers
class PluginSerializer(serializers.Serializer):
name = serializers.CharField(read_only=True)
author = serializers.CharField(read_only=True)
title = serializers.CharField(read_only=True)
description = serializers.CharField(read_only=True)
js_url = serializers... | igemsoftware2017/USTC-Software-2017 | biohub/core/plugins/serializers.py | Python | gpl-3.0 | 391 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie
#
# 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://... | HappyFaceGoettingen/HappyFaceCore | modules/dCacheInfoPool.py | Python | apache-2.0 | 16,649 | 0.007209 |
#!/usr/bin/env python
"""
Usage example:
1. First realization per model
./parallel_driver.py -p my_Param_ENSO.py --mip cmip6 --modnames all --realization r1i1p1f1 --metricsCollection ENSO_perf
2. All realizations of individual models
./parallel_driver.py -p my_Param_ENSO.py --mip cmip6 --modnames all --realization all... | eguil/ENSO_metrics | pmp_driver/parallel_driver.py | Python | bsd-3-clause | 5,888 | 0.002548 |
import asyncio
import inspect
import logging
import os
import re
import shutil
import sys
import traceback
from collections import defaultdict
from contextlib import suppress
from datetime import datetime
from random import choice
from textwrap import indent, wrap
import aiohttp
import discord
from discord import Clie... | shikhir-arora/Giesela | musicbot/bot.py | Python | mit | 30,622 | 0.001665 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | google/upvote_py2 | upvote/gae/lib/voting/api_test.py | Python | apache-2.0 | 56,967 | 0.004055 |
from __future__ import absolute_import
import codecs
import re
import types
import sys
from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from .constants import encodings, ReparseException
from . import utils
from io import StringIO
try:
from io import BytesIO
except ImportError:
Bytes... | rcarmo/soup-strainer | html5lib/inputstream.py | Python | mit | 32,655 | 0.003859 |
"""
Programmer : EOF
File : tester3.py
Date : 2016.01.10
E-mail : jasonleaster@163.com
Description :
"""
import numpy
from matplotlib import pyplot
from km import KMeans
Original_Data = numpy.array([
[1, 1.5],
[1, 0.5],
[0.5, 0.5],
[1.5, 1.5],
[5, 5],
[6, 5.5],
... | jasonleaster/Machine_Learning | K_Means/tester4.py | Python | gpl-2.0 | 691 | 0.002894 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie
#
# 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 Licens... | HappyFaceGoettingen/HappyFaceCore | render.py | Python | apache-2.0 | 2,708 | 0.005174 |
import time
import pytest
import logging
from repair_tests.repair_test import BaseRepairTest
since = pytest.mark.since
logger = logging.getLogger(__name__)
LEGACY_SSTABLES_JVM_ARGS = ["-Dcassandra.streamdes.initial_mem_buffer_size=1",
"-Dcassandra.streamdes.max_mem_buffer_size=5",
... | aweisberg/cassandra-dtest | upgrade_tests/repair_test.py | Python | apache-2.0 | 1,656 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from decimal import Decimal
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
('crm', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Clarity-89/clarityv2 | src/clarityv2/crm/migrations/0002_auto_20150924_1716.py | Python | mit | 1,692 | 0.004728 |
# Copyright 2013 Gert Kremer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | schubergphilis/twitterwall | tweety/basic_auth.py | Python | apache-2.0 | 4,682 | 0.002349 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import pho
requisites = []
setup(
name='mpho',
version=pho.__version__,
description='PytHon utility for Organizing tasks',
scripts=['scripts/pho'],
long_d... | hvnsweeting/pho | setup.py | Python | mit | 637 | 0 |
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax1 = fig.add_subplot(1, 2, 1, projection="3d")
x = np.linspace(-6 * np.pi, 6 * np.pi, 1000)
y = np.sin(x)
z = np.cos(x)
ax1.plot(x, y, z)
ax2 = fig.add_subplot(1, 2, 2, projection="3d")
X = np.arange(-2... | tongxindao/shiyanlou | shiyanlou_cs892/sub.py | Python | apache-2.0 | 469 | 0 |
from .hand import Hand, TakenCards
class Agent(object):
"""An Agent is a player in the game and may be controlled by a human or
by computer.
"""
def __init__(self, name):
self.name = name
self.hand = Hand()
self.taken_cards = TakenCards()
self.score = 0
def __str_... | reidlindsay/gostop | gostop/core/agent.py | Python | mit | 794 | 0 |
#!/usr/bin/python
# This file is part of pulseaudio-dlna.
# pulseaudio-dlna 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.
# pulsea... | caio2k/pulseaudio-dlna | pulseaudio_dlna/streamserver.py | Python | gpl-3.0 | 18,157 | 0.00022 |
"""
Parsers for file ``/sys/kernel/debug/x86/*_enabled`` outputs
============================================================
This module provides the following parsers:
X86PTIEnabled - file ``/sys/kernel/debug/x86/pti_enabled``
----------------------------------------------------------
X86IBPBEnabled - file ``/sys/... | RedHatInsights/insights-core | insights/parsers/x86_debug.py | Python | apache-2.0 | 3,411 | 0 |
import unittest
import settings
class TestSettings(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.enable_subtitles = settings.enable_subtitles
self.xbmc_language = settings.xbmc_language
self.subtitle_language = settings.subtitle_language
def tearDown(... | andresmargalef/xbmc-plugin.video.ted.talks | resources/lib/settings_test.py | Python | gpl-2.0 | 1,603 | 0.003119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.