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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-30 19:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bot', '0010_auto_20171030_1927'),
]
operations = [
migrations.AlterField(
... | foxcarlos/decimemijobot | bot/respaldo/0011_auto_20171030_1928.py | Python | gpl-3.0 | 461 |
import os
import sys
import test_sys.gen_util as util
class test_runner_info:
test_type = "Test"
extra_includes = ["test-sys/run-test.hh"]
extra_globals = []
main_function_name = "run_tests"
test_function_name = "run_test"
args = [' const bool silent = find_silent_flag(argc, argv);... | lukas-ke/faint-graphics-editor | test-sys/test_sys/gen_runner.py | Python | apache-2.0 | 6,673 |
from __future__ import annotations
from typing import Any, Dict, List, Optional
import dataclasses
import json
import logging
from ..config import ACResource, Config
from ..utils import dump_yaml, parse_yaml, dump_json
from .dependency import DependencyManager
from .k8sobject import KubernetesObjectScope, Kubernetes... | datawire/ambassador | python/ambassador/fetch/resource.py | Python | apache-2.0 | 6,311 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('..')
import unittest
from src.book import book
class TestBook(unittest.TestCase):
def test_book(self):
test_1= ["Manager.book[site][hash_key]",
"U001 2016-06-02 22:00~22:00 A",
"U002 2017-08-01 19:00~22:00 A",
"U003 2017-... | cwlseu/recipes | pyrecipes/thoughtsworks/test/test_main.py | Python | gpl-3.0 | 662 |
#!/usr/bin/env python
# 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 distributed in the hope that i... | vrbagalkote/avocado-misc-tests-1 | memory/memhotplug.py | Python | gpl-2.0 | 9,169 |
import logging
import warnings
from dataclasses import dataclass
from hashlib import sha1
from typing import Any, AnyStr, Dict, List, Mapping, NewType, Optional, Type
import saml2.server
import six
from saml2.s_utils import UnknownPrincipal, UnknownSystemEntity, UnravelError, UnsupportedBinding
from saml2.saml import ... | SUNET/eduid-webapp | src/eduid_webapp/idp/idp_saml.py | Python | bsd-3-clause | 10,303 |
import atmPy.general.timeseries as _timeseries
import matplotlib.pylab as plt
from matplotlib.colors import LogNorm as _LogNorm
import numpy as _np
from copy import deepcopy as _deepcopy
class Reflectivity(_timeseries.TimeSeries_2D):
def __init__(self, *args, parent= None, **kwargs):
super().__init__(*args... | hagne/atm-py | atmPy/precipitation/radar.py | Python | mit | 3,475 |
# coding=utf-8
from psycopg2.extras import NamedTupleCursor, Json
from tornado.web import Application, HTTPError
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.httpserver import HTTPServer
from tornado.options import parse_command_line
import momoko
import os
from bank import SelectQuestion, get... | inuyasha2012/tornado-cat-example | example/main.py | Python | mit | 8,865 |
# -*- encoding: utf-8 -*-
from supriya.tools.systemtools.SupriyaObject import SupriyaObject
class Envelope(SupriyaObject):
r'''An envelope.
::
>>> from supriya.tools import *
>>> envelope = synthdeftools.Envelope()
>>> envelope
Envelope(
amplitudes=(0.0, 1.0, 0.0)... | andrewyoung1991/supriya | supriya/tools/synthdeftools/Envelope.py | Python | mit | 5,848 |
# Copyright 2013 Dell 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 app... | citrix-openstack-build/neutron-fwaas | neutron_fwaas/tests.skip/unit/services/firewall/drivers/linux/test_iptables_fwaas.py | Python | apache-2.0 | 11,580 |
#!/usr/bin/python3
def odds_minus_evens(l):
''' Returns the sum of odd numbers in the list minus the sum of evns '''
sum = 0
for x in l:
if x % 2 == 0:
sum -= x
else:
sum += x
return sum
print(odds_minus_evens(range(10)))
| nonZero/demos-python | src/exercises/basic/odds_minus_evens/solution5.py | Python | gpl-3.0 | 281 |
import json
import logging
import random
import re
import requests
import sys
import time
import traceback
from websocket import WebSocketConnectionClosedException
from markdownify import MarkdownConverter
from will import settings
from .base import IOBackend
from will.utils import Bunch, UNSURE_REPLIES, clean_for_pi... | wontonst/will | will/backends/io_adapters/slack.py | Python | mit | 22,435 |
#!/usr/bin/env python
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleads/google-ads-python | examples/extensions/add_sitelinks.py | Python | apache-2.0 | 9,516 |
try:
frozenset
except NameError:
#Import from the sets module for python 2.3
from sets import Set as set
from sets import ImmutableSet as frozenset
class MethodDispatcher(dict):
"""Dict with 2 special properties:
On initiation, keys that are lists, sets or tuples are converted to
multiple ... | wangtaoking1/found_website | 项目代码/html5lib/utils.py | Python | gpl-2.0 | 4,959 |
# ------------------------------------------------------------------------------
#
# Copyright 2011, 2012, 2013 Brent L. Brock and the Craighead Institute
#
# This file is part of Wild Planner.
#
# Wild Planner is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public... | blbrock/WildPlanner-10-Archive- | Scripts/connected_export.py | Python | lgpl-3.0 | 3,799 |
class Solution(object):
def threeSumClosest(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
length = len(nums)
nums.sort()
loss = target - (nums[0] + nums[1] + nums[2])
for i in range(length-2):
lef... | xiezhq-hermann/LeetCode-in-Python | src/three_sum_closest_16.py | Python | mit | 760 |
import tensorflow as tf
from numpy import sqrt
def fully_connected_layer(inputs, input_dim, output_dim, nonlinearity=tf.nn.relu):
weights = tf.Variable(initial_value=tf.truncated_normal(shape=[input_dim, output_dim],
stddev=sqrt(2) / (input_dim +
... | PaddyT/waveform-asr | waveasr/models/layers.py | Python | mit | 5,397 |
'''
Autor: Gurkirt Singh
Start data: 15th May 2016
purpose: of this file is read frame level predictions and process them to produce a label per video
'''
from sklearn.svm import LinearSVC
from sklearn.ensemble import RandomForestClassifier
import numpy as np
import pickle
import os,h5py
import time,json
#import pylab... | gurkirt/actNet-inAct | processing/saveCLFs.py | Python | mit | 4,517 |
import colorsys
import sys
import xml.etree.cElementTree as ET
# from io import BytesIO
from gi.repository import Gtk, Gdk, GObject, Pango
from gi.repository.GdkPixbuf import Pixbuf
from pychess.System import conf
from pychess.System.Log import log
from pychess.System.prefix import addDataPrefix
def createCombo(com... | pychess/pychess | lib/pychess/System/uistuff.py | Python | gpl-3.0 | 16,160 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/primaires/joueur/config.py | Python | bsd-3-clause | 3,710 |
# -*- coding: utf-8 -*-
"""
Internal module for formatting output data in csv, html,
and latex files. This module also applies to display formatting.
"""
from __future__ import print_function
# pylint: disable=W0141
from functools import partial
import numpy as np
from pandas._libs import lib
from pandas._libs.tsli... | harisbal/pandas | pandas/io/formats/format.py | Python | bsd-3-clause | 54,799 |
from __future__ import absolute_import
import logging
from sentry.api.base import Endpoint
from sentry.api.bases.project import ProjectPermission
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.app import raven
from sentry.models import Group, get_group_with_redirect
logger = logging.getLogger(__n... | alexm92/sentry | src/sentry/api/bases/group.py | Python | bsd-3-clause | 2,127 |
#issue in tensortools
from time import sleep, time
import chi
import tensortools as tt
import chi.rl.wrappers
import gym
import numpy as np
import tensorflow as tf
from tensortools import Function
from chi.rl.memory import ReplayMemory
from chi.rl.core import Agent
from chi.rl.memory import ShardedMemory
from chi.rl.w... | rmst/chi | chi/rl/dqn_m.py | Python | mit | 11,810 |
"""
Email message and email sending related helper functions.
"""
import socket
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
# seconds, which slows down the restart of the server.
class CachedDnsName(object):
def __str__(self):
return self.get_fqdn()
def get_fqdn(sel... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/core/mail/utils.py | Python | mit | 459 |
#!/usr/bin/env python
'''Menu
This example demonstrates the use of various menu types in gtk. It
demonstrates the new submenu navigation and scrolling menu features of
gtk 2.0.'''
import gtk
def create_menu(depth, length=5):
if depth < 1:
return None
menu = gtk.Menu()
group= None
for i in ... | chriskmanx/qmole | QMOLEDEV/pygtk-2.16.0/examples/pygtk-demo/demos/menu.py | Python | gpl-3.0 | 2,341 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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... | citrix-openstack/build-ryu | ryu/app/rest_router.py | Python | apache-2.0 | 68,137 |
import os
import json
import re
from BeautifulSoup import BeautifulSoup
from psrd.rules import write_rules
from psrd.files import char_replace
from psrd.universal import parse_universal, print_struct, StatBlockHeading, StatBlockSection
from psrd.sections import ability_pass, entity_pass, find_section, find_all_sections... | devonjones/PSRD-Parser | src/psrd/classes.py | Python | gpl-3.0 | 10,202 |
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | sunqm/pyscf | examples/local_orb/nlocal.py | Python | apache-2.0 | 6,720 |
import pytest
def pytest_runtest_setup(item):
if 'notfixed' in item.keywords:
pytest.skip("Skipping tests that are not fixed yet.")
| elkeschaper/tral | tral/conftest.py | Python | gpl-2.0 | 146 |
# Copyright (c) 2013 New Dream Network, LLC (DreamHost)
#
# 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... | aasoliz/Bitcoin-Statistics | venv/lib/python2.7/site-packages/pbr/tests/test_packaging.py | Python | bsd-3-clause | 28,849 |
import wave
from frostsynth import get_srate, timeslice, interlace
from frostsynth.dump import iter_dumps
def save(source, filename, duration=None):
f = wave.open(filename,"wb")
f.setnchannels(1)
f.setsampwidth(2)
f.setframerate(int(get_srate()))
try:
if duration is None:
f.wr... | frostburn/frostsynth | frostsynth/waveout.py | Python | mit | 789 |
#!/usr/bin/env python
#
# An example on how to read the YAML output from etisnoop
# Pipe etisnoop to this script
#
# License: public domain
import sys
import yaml
for frame in yaml.load_all(sys.stdin):
print("FIGs in frame {}".format(frame['Frame']))
for fib in frame['LIDATA']['FIC']:
if fib['FIGs']:
... | Opendigitalradio/etisnoop | yamlexample.py | Python | gpl-3.0 | 401 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogrinfo.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | luca76/QGIS | python/plugins/processing/algs/gdal/ogrinfo.py | Python | gpl-2.0 | 6,032 |
import os.path
import logging
import subprocess
def get_hash(short=False):
if not os.path.exists('.git'):
logging.warning('*** Not working in a git repository ***')
return 'none'
git_command = ['git', 'rev-parse']
if short:
git_command += ['--short']
git_command += ['HEAD']
... | Stratoscale/skipper | skipper/git.py | Python | apache-2.0 | 687 |
# 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, software
# d... | eayunstack/neutron | neutron/tests/unit/extensions/test_subnet_service_types.py | Python | apache-2.0 | 14,519 |
#!/usr/bin/env python
import socket
import binascii
import time
HOST = '219.223.252.170'
PORT = 6000
BUFSIZE = 307
ADDR = (HOST, PORT)
# TCP socket
try:
tcpCliSoc = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
tcpCliSoc.connect(ADDR)
except socket.error, msg:
print 'Socket Error! Create, bind, li... | lijingpeng/python | script/HTTCPClient.py | Python | gpl-2.0 | 1,648 |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import re
import sys
from spiderfetch import spider
# how many bytes of the file to download before doing a type check
HEADER_SIZE_HTML = 1024
HEADER_SIZE_URLS = 100 * 1024
# ref: file-4.23.tar.gz/magic/Magdir/sgml
... | numerodix/spiderfetch | spiderfetch/filetype.py | Python | gpl-2.0 | 968 |
"""Implementation of a stack data structure."""
from linked_list import LinkedList
class Stack(object):
"""Set properties and methods of Stack class."""
def __init__(self, inbound_data=None):
"""Create new Stack composing from LinkedList."""
self._linked_list = LinkedList(inbound_data)
... | CaHudson94/data-structures | src/Completed/stack.py | Python | mit | 819 |
import subprocess
import os
import errno
import time
import shutil
class img_mount:
def __init__(self, img):
self.__nautilus_state(False)
self._image = img
self._loopback = self.__create_loopback(self._image)
print('created loopback {0}'.format(self._loopback))
self._loopmap... | CrazyBonze/RasPiReader | src/img_mount.py | Python | gpl-3.0 | 7,282 |
from time import time
from benchmark import Benchmark
from optimizer.optimizer import Optimizer
from optimizer.simulator import Simulator
from optimizer.evaluator import Evaluator
from extra.printer import pprint, BLUE
class EvaluatorPerf(Benchmark):
def __init__(self, plant, orderList, testNumber):
Benchmark.__... | fredmorcos/attic | projects/plantmaker/plantmaker-main/src/benchmark/evaluatorperf.py | Python | isc | 3,570 |
#!/usr/bin/env python
"""
Download NLTK data
"""
__author__ = "Manan Kalra"
__email__ = "[email protected]"
import nltk
nltk.download() | manankalra/Twitter-Sentiment-Analysis | demo/download.py | Python | mit | 145 |
# -*- coding: utf-8 -*-
#
# phpMyAdmin documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 26 14:04:48 2012.
#
# 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.
#
# ... | turiyag/gillian | phpmyadmin/doc/conf.py | Python | gpl-2.0 | 9,186 |
##########################################################
# == PunchSense ==
#
# Hardware + Software to detect punches to a boxing
# punch bag and to make fun stuff with the collected data.
#
# == Licensing terms ==
#
# (c)2015 Felipe Correa da Silva Sanches <[email protected]>
#
# This program is free software: yo... | felipesanches/PunchSense | punchsense.py | Python | lgpl-3.0 | 12,126 |
# -*- coding: utf-8 -*-
import re
from nose.tools import eq_
from users.helpers import emaillink, user_data, user_link, users_list
from users.models import UserProfile
def test_emaillink():
email = '[email protected]'
obfuscated = unicode(emaillink(email))
# remove junk
m = re.match(r'<a href="#"><spa... | jinankjain/zamboni | apps/users/tests/test_helpers.py | Python | bsd-3-clause | 2,926 |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 22 02:28:35 2015
@author: Enes Kemal Ergin
List Examples from A Byte of Python
"""
shoplist = ['apple', 'mango', 'carrot', 'banana']
print('I have', len(shoplist), 'items to purchase.')
print('These items are: ', end= ' ')
for item in shoplist:
print(item, end= '... | NAU-ACM/IntroductionToPython | Week 4/list_example_byte_of_python.py | Python | mit | 678 |
# Copyright (c) 2012 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... | yamahata/tacker | tacker/db/db_base.py | Python | apache-2.0 | 8,596 |
"""
Covariance estimators using shrinkage.
Shrinkage corresponds to regularising `cov` using a convex combination:
shrunk_cov = (1-shrinkage)*cov + shrinkage*structured_estimate.
"""
# Author: Alexandre Gramfort <[email protected]>
# Gael Varoquaux <[email protected]>
# Virgile ... | seckcoder/lang-learn | python/sklearn/sklearn/covariance/shrunk_covariance_.py | Python | unlicense | 17,960 |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""Simple event system."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import string
import re
from collections import defaultdic... | nippoo/phy | phy/utils/event.py | Python | bsd-3-clause | 8,471 |
"""
WSGI config for niuforum 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | niutool/niuforum | niuforum/wsgi.py | Python | mit | 393 |
#!/usr/bin/env python
# A library to scrape statistics from Arris CM820 and similar cable modems
# Inspired by https://gist.github.com/berg/2651577
import BeautifulSoup
import requests
import time
cm_time_format = '%a %Y-%m-%d %H:%M:%S'
def get_status(baseurl):
# Retrieve and process the page from the modem
... | wolrah/arris_stats | arris_scraper.py | Python | mit | 5,303 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2011, Monash e-Research Centre
# (Monash University, Australia)
# Copyright (c) 2010-2011, VeRSI Consortium
# (Victorian eResearch Strategic Initiative, Australia)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modificatio... | grischa/mytardis-mrtardis | tardis/tardis_portal/tests/test_views.py | Python | bsd-3-clause | 5,829 |
#!/usr/bin/python3
from scrapers.scrape import scrape_page
# if you want to use this scraper without the RESTful api webservice then
# change this import: from scrape import scrape_page
import re
try:
import pandas as pd
pandasImported = True
except ImportError:
pandasImported = False
BASE_URL = "http://... | ajpotato214/Finance-Data-Scraper-API | finance_data_scraper/scrapers/finviz.py | Python | mit | 4,390 |
# -*- coding: utf-8 -*-
from ddbmock.database import dynamodb
def delete_table(post):
name = post[u'TableName']
table = dynamodb.delete_table(name)
return {
'TableDescription': table.to_dict(verbose=False)
}
| sendgridlabs/ddbmock | ddbmock/operations/delete_table.py | Python | lgpl-3.0 | 235 |
from flask import Flask
from flask.ext.quik import FlaskQuik
from flask.ext.quik import render_template
app = Flask(__name__)
quik = FlaskQuik(app)
@app.route('/', methods=['GET', 'POST'] )
def hello_quik():
return render_template('hello.html', name='quik')
app.run(host='0.0.0.0', debug=True, port=5000)
| avelino/Flask-Quik | tests/example.py | Python | mit | 315 |
# -*- coding: utf-8 -*-
import os
import sys
from sklearn import svm
from sklearn import cross_validation
from sklearn import preprocessing
from sklearn.grid_search import GridSearchCV
import numpy as np
import csv
def output_result(clf):
test_feature_file = np.genfromtxt(open("../data/test.csv", "rb"), delimiter... | Lewuathe/kaggle-repo | data-science-london/src/grid_search.py | Python | mit | 2,134 |
#!/usr/bin/env python
"""
Configuration script for the analyzer of B0s -> K*0 Ds+ Ds- background events
| | |-> tau- nu
| | |-> pi- pi- pi+ nu
... | semkiv/heppy_fcc | background_Bs2DsDsK_with_Ds2TauNu_analysis_cfg.py | Python | gpl-3.0 | 3,807 |
#!/home/oscar/django/biblioteca/biblio-env/bin/python3
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates pasting into an already displayed
# photoimage. note that the current version of Tk updates the whole
# image every time we paste, so to get decent performance, we split
# the image into a set ... | oscarvogel/biblioteca | biblio-env/bin/painter.py | Python | gpl-3.0 | 2,189 |
""" App para almacenar los estudios socioeconómicos.
Este app almacena la información no vital de los estudios socioeconómicos, es decir, los campos
que no se utilizan de forma frecuente en la aplicación.
"""
| erikiado/jp2_online | estudios_socioeconomicos/__init__.py | Python | mit | 214 |
import hashlib
import mock
import uuid
from django.test import TestCase
from ..models import Commander
class CommanderTestCase(TestCase):
def test_generate_token(self):
with mock.patch.object(uuid, 'uuid4', return_value='a_test'):
cmdr = Commander(
name='Branch'
)... | toastdriven/eliteracing | cmdrs/tests/test_models.py | Python | bsd-3-clause | 666 |
# -*- coding: utf-8 -*-
import threading
import time
import sys
from hit.process.processor import ATTMatrixHitProcessor
import traceback
class ThreadedSerialReader(threading.Thread):
def __init__(self, threadID, name, queue, max_readings, serial_port_builder, port, baud, CustomSerial=None,
isF... | Centre-Alt-Rendiment-Esportiu/att | src/python/hit/serial/serial_reader.py | Python | gpl-3.0 | 3,952 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import operator
from collections import OrderedDict
from functools import reduce
try:
from django.apps import apps
get_model = apps.get_model
except ImportError:
from django.db.models.loading import get_model
from django.db import models
... | dgk/django-business-logic | business_logic/rest/views.py | Python | mit | 6,217 |
from tests.test_1 import test_1
from tests.test_2 import test_2
from tests.test_3 import test_3
from tests.test_4 import test_4
from tests.test_5 import test_5
from tests.test_6 import test_6
from tests.test_7 import test_7
from tests.test_8 import test_8
from tests.test_9 import test_9
from tests.test_10 import test_1... | qutip/qutip-benchmark | benchmark/tests/__init__.py | Python | bsd-3-clause | 853 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2017-present MagicStack Inc. and the EdgeDB authors.
#
# 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... | edgedb/edgedb | tests/test_edgeql_coalesce.py | Python | apache-2.0 | 53,344 |
import turtle
def fern(size, pensize):
if pensize < 1:
return
turtle.pensize(pensize)
turtle.forward(size)
turtle.right(55)
fern(2*size/3, pensize-1)
turtle.left(55)
turtle.back(size/2)
turtle.left(60)
fern(size/2, pensize-1)
turtle.right(60)
turtle.back(siz... | chrisglencross/python-lessons | misc/fern.py | Python | mit | 461 |
"""
Load npy xy, plot and save
"""
import os, sys
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
import matplotlib.cm as mpl_cm
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcPa... | peterwilletts24/Python-Scripts | plot_scripts/Rain/Diurnal/sea_diurnal_rain_plot_domain_constrain_large_bay_of_bengal.py | Python | mit | 10,247 |
"""
HLS and Color Threshold
-----------------------
You've now seen that various color thresholds can be applied to find the lane lines in images. Here we'll explore
this a bit further and look at a couple examples to see why a color space like HLS can be more robust.
"""
import numpy as np
import cv2
import matplot... | akshaybabloo/Car-ND | Term_1/advanced_lane_finding_10/color_space_10_8.py | Python | mit | 2,835 |
# Imports for routing
import flask as fl
from app import app
import globes as gb
@app.route('/test/contamination_test')
def contamination_test():
print("hello contamination")
return fl.render_template('html/HomePage.html')
| cliftbar/FlaPyDisaster | FlaPyDisaster/contamination_routes.py | Python | mit | 232 |
from scrapyjs import SplashMiddleware
class SlybotJsMiddleware(SplashMiddleware):
def process_request(self, request, spider):
req = super(SlybotJsMiddleware, self).process_request(request, spider)
splash_auth = getattr(spider, 'splash_auth', None)
if splash_auth and 'Authorization' not in ... | SouthStar/portia | slybot/slybot/splash.py | Python | bsd-3-clause | 800 |
# you can use print for debugging purposes, e.g.
# print "this is a debug message"
# The strategy is to iterate through the string, putting each character onto
# a specific stack, depending on its type.
# A, When we put the character onto the stack, we check to see if the one before it
# is an opposite - eg. { then }... | mickeyshaughnessy/Codility-examples | Brackets.py | Python | mit | 1,226 |
__author__ = 'alexvanboxel'
from datetime import date
from datetime import timedelta
def month(current):
return date(current.year, current.month, 15)
def month_first_day(current):
return date(current.year, current.month, 1)
def month_last_day(current):
d = next_month(current)
return date(d.year, d... | alexvanboxel/demo-devoxx15-luigi | dateutils.py | Python | apache-2.0 | 4,043 |
# -*- coding: utf-8 -*-
# ------
# License: MIT
# Copyright (c) 2013 Kohei Ozaki (eowenr atmark gmail dot com)
"""
CLI of videolectures-dl
"""
import argparse
import sys
from videolectures.util import VideoDownloader
from videolectures import __version__
def parse_args():
"""
Parse arguments of videolecture... | smly/videolectures-dl | videolectures/tool.py | Python | mit | 1,701 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Puzzlebox - Brainstorms - Configuration
#
# Copyright Puzzlebox Productions, LLC (2010-2012)
#
# This code is released under the GNU Pulic License (GPL) version 2
# For more information please refer to http://www.gnu.org/copyleft/gpl.html
__changelog__ = """\
Last Upda... | PuzzleboxIO/brainstorms-python | Puzzlebox/Brainstorms/Configuration.py | Python | agpl-3.0 | 9,943 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('home', '0014_auto_20150916_1847'),
]
operations = [
migrations.AlterFi... | taedori81/gentlecoffee | home/migrations/0015_auto_20150918_1045.py | Python | bsd-3-clause | 535 |
"""
Keys and certificates for tests (KEY1 is a private key of CERT1, etc.)
Generated with::
$ openssl genrsa -des3 -passout pass:test -out key1.key 1024
$ openssl req -new -key key1.key -out key1.csr -passin pass:test
$ cp key1.key key1.key.org
$ openssl rsa -in key1.key.org -out key1.key -passin pass... | mozilla/make.mozilla.org | vendor-local/lib/python/celery/tests/test_security/__init__.py | Python | bsd-3-clause | 5,707 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Linus Unnebäck <[email protected]>
# 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_version': '1.1',... | tsdmgz/ansible | lib/ansible/modules/system/make.py | Python | gpl-3.0 | 4,773 |
#!/usr/bin/env python
#
# Copyright 2012 Jonas Berg
#
# 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... | 640Labs/minimalmodbus | tests/test_minimalmodbus.py | Python | apache-2.0 | 147,947 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complia... | Hybrid-Cloud/conveyor | conveyor/clone/resources/instance/driver/stack_template.py | Python | apache-2.0 | 15,444 |
"""
Django settings for superlists project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pat... | freddyiniguez/cimat_scrum_developer | superlists/superlists/settings.py | Python | gpl-2.0 | 2,729 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Server.description'
db.add_column('mod_server', 'description',
... | upTee/upTee | uptee/mod/south_migrations/0007_auto__add_field_server_description__add_field_server_description_html.py | Python | bsd-3-clause | 8,541 |
#coding:utf-8
from py_rf.decision_tree import DecisionTree
import requests
import random
import sys
import operator
def test_create_decision_tree():
tree = DecisionTree()
def test_predict():
dataset = requests.get('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data').text.split('\n')
... | nel215/py-random-forest | tests/test_decision_tree.py | Python | mit | 1,334 |
"""
.. automodule::
:members:
Agent Class
==================
.. autoclass:: Agent
:members:
"""
import sys
import time
import pdb
if sys.version_info.major==2:
import ConfigParser
from SimPy.SimulationRT import Simulation
else:
import configparser as ConfigParser
import simpy
from pylayers.... | pylayers/pylayers | pylayers/mobility/agent.py | Python | mit | 11,637 |
#####################################################################
# string.py
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# 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 Fou... | bparzella/secsgem | secsgem/secs/variables/string.py | Python | lgpl-2.1 | 1,233 |
#-*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from rest_framework import serializers
class Issue(models.Model):
email = models.CharField(max_length="50", blank=True)
subject = models.CharField(max_length="100")
url = ... | genonfire/portality | issue/models.py | Python | mit | 710 |
from traitlets import Unicode, List
from .base import BasePlugin
from ..api import MissingEntry, Gradebook
class ExportPlugin(BasePlugin):
"""Base class for export plugins."""
to = Unicode("", help="destination to export to").tag(config=True)
student = List(
[], help="list of students to export... | jhamrick/nbgrader | nbgrader/plugins/export.py | Python | bsd-3-clause | 4,603 |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility a... | antoine-de/navitia | source/jormungandr/jormungandr/interfaces/v1/GraphicalIsochrone.py | Python | agpl-3.0 | 4,290 |
from __future__ import unicode_literals
import keyword
import re
from collections import OrderedDict
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
class Command(BaseCommand):
help = "Introspects the database tables in the given database and... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py | Python | agpl-3.0 | 12,078 |
#!/usr/bin/env python3
"""Defines ways to "convert" a file name to an input/output stream."""
from __future__ import absolute_import, division, print_function
from builtins import range
from io import TextIOBase
import math
import os
from emLam.utils import allname, openall
class MultiFileWriter(TextIOBase):
def... | DavidNemeskey/emLam | emLam/corpus/multi_file_writer.py | Python | mit | 2,175 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | openthread/silk | silk/tests/openthread/ot_test_clear_address_cache_for_sed.py | Python | apache-2.0 | 10,633 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | cryptobanana/ansible | lib/ansible/modules/network/nxos/nxos_vrf_af.py | Python | gpl-3.0 | 4,746 |
import os
import re
from sphinx.util.compat import Directive
HTML_THEME_PATH = [os.path.abspath(os.path.join(os.path.dirname(__file__),
'..'))]
# Storage for SEO descriptions.
seo_descriptions = {}
class SeoDescription(Directive):
"""
This directive merely s... | peterhudec/foundation-sphinx-theme | foundation_sphinx_theme/__init__.py | Python | mit | 2,269 |
#!/usr/bin/python
"""
Copyright (C) 2005-2013 MaNGOS <http://getmangos.com/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ... | ralph93/crtoe | contrib/mmap/mmap_extract.py | Python | gpl-2.0 | 2,593 |
from twisted.mail.smtp import ESMTPSenderFactory
from twisted.mail.imap4 import IClientAuthentication
from twisted.mail.smtp import ESMTPSender, ESMTPSenderFactory
from zope.interface import implements
class XOAUTH2Authenticator:
implements(IClientAuthentication)
def __init__(self, user):
self.user =... | pytlakp/intranetref | src/intranet3/utils/smtp.py | Python | mit | 755 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
*********************************************
*
* PlotXmuSpectra
* Plot Xmu spectra
* Files must be in Xmu
* version: 20180206b
*
* By: Nicola Ferralis <[email protected]>
*
***********************************************
'''
print(__doc__)
import numpy as np
impor... | feranick/SpectralMachine | Utilities/PlotXmuSpectra.py | Python | gpl-3.0 | 2,922 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import mock
import p... | baroquebobcat/pants | tests/python/pants_test/java/test_nailgun_executor.py | Python | apache-2.0 | 1,934 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2017-2020 Florian Bruhin (The Compiler) <[email protected]>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | t-wissmann/qutebrowser | tests/unit/scripts/test_importer.py | Python | gpl-3.0 | 4,963 |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from .infoview import InfoBoxDialog
import json
__author__ = "C. Wilhelm"
___license___ = "GPL v3"
class IntuitiveTreeView(QTreeView):
"""Variant of QTreeView with setStretchFirstSection() method"""
def __init__(self, parent=None):... | valmynd/MediaFetcher | src/views/viewbase.py | Python | gpl-3.0 | 5,882 |
from Classes.Meta import Meta
import re
class Parser:
email_regex = re.compile(Meta.REGEX_EMAIL)
mobile_phone_regex = re.compile(Meta.REGEX_MOBILE_PHONE)
home_phone_regex = re.compile(Meta.REGEX_PHONE_HOME)
lat_regex = re.compile(Meta.REGEX_LATITUDE)
long_regex = re.compile(Meta.REGEX_LONGITUDE)
... | nvangijzen/android_data_parser | Classes/Parser/Parser.py | Python | mit | 394 |
from django.contrib.auth import get_user_model
from django.contrib.auth import views as auth_views
from django.core.urlresolvers import resolve
from django.test import Client, TestCase
User = get_user_model()
class TestLoggedUser(TestCase):
def setUp(self):
self.client = Client()
self.user = Use... | jonaqp/heroku | core/tests/tests_views.py | Python | mit | 1,254 |
# Tests need to be a package otherwise ipyparallel will not find them in the package,
# when trying to import the tests in the subprocesses.
# Therefore, LEAVE THIS FILE HERE
| giacomov/3ML | threeML/test/__init__.py | Python | bsd-3-clause | 175 |
from apps.analyzer.models import Category, FeatureCategory
from django.db.models.aggregates import Sum
import math
class Classifier:
def __init__(self, user, feed, phrases):
self.user = user
self.feed = feed
self.phrases = phrases
def get_features(self, doc):
found = {}
... | AlphaCluster/NewsBlur | apps/analyzer/classifier.py | Python | mit | 5,802 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.