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 |
|---|---|---|---|---|---|
# python standard library
import logging
import itertools as it
# numpy/scipy
import numpy as np
from scipy import ndimage as nd
from scipy.misc.common import factorial
from numpy.linalg import det
try:
from scipy.spatial import Delaunay
except ImportError:
logging.warning('Unable to load scipy.spatial.Delauna... | jni/ray | ray/features/convex_hull.py | Python | mit | 4,946 |
# -*- coding: utf-8 -*-
import logging, json
from flask import request, redirect, url_for
import utilities as _Utilities
import db as _DB
import paybook.sdk as paybook_sdk
def index():
return redirect(url_for('static', filename='index.html'))
def signup():
try:
# Log call and get params:
logger = logging.get... | Paybook/lite-python | endpoints.py | Python | mit | 10,331 |
# -*- encoding: utf-8 -*-
# #############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... | hivam/doctor_dental_care | models/doctor_list_reportt.py | Python | agpl-3.0 | 1,407 |
import copy
import operator
import warnings
import weakref
import numpy as np
from numpy import char as chararray
from pyfits.column import (ASCIITNULL, FITS2NUMPY, ASCII2NUMPY, ASCII2STR,
ColDefs, _AsciiColDefs, _FormatX, _FormatP, _VLF,
_get_index, _wrapx, _unw... | ClaudioNahmad/Servicio-Social | Parametros/CosmoMC/prerrequisitos/plc-2.0/lib/python2.7/site-packages/pyfits-3.2.2-py2.7-linux-x86_64.egg/pyfits/fitsrec.py | Python | gpl-3.0 | 39,594 |
import json
import logging
from .forms import StaffingForm
from .models import FireStation, Staffing, FireDepartment
from django.core.serializers.json import DjangoJSONEncoder
from tastypie import fields
from tastypie.authentication import SessionAuthentication, ApiKeyAuthentication, MultiAuthentication
from tastypie.a... | ROGUE-JCTD/vida | vida/firestation/api.py | Python | mit | 4,167 |
import os
from os.path import expanduser
import io
import json
from . import PY3
from .log import printf
if PY3:
import urllib.request as req
else:
import urllib2 as req
# ################################### Config ################################
home_dir = os.path.join(expanduser("~"), "uarm", "")
if not os.... | uArm-Developer/pyuarm | pyuarm/config.py | Python | mit | 2,140 |
"""Get song lyrics from lyricwiki"""
from urlparse import urljoin
import re
from madcow.util import Module, strip_html
from madcow.util.http import getsoup
from madcow.util.google import Google, NonRedirectResponse
from madcow.util.text import *
class Main(Module):
pattern = re.compile(r'^\s*sing\s+(.+?)\s*$', r... | ToxicFrog/lancow | madcow/modules/lyrics.py | Python | gpl-3.0 | 1,884 |
# -*- python -*-
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
# 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 versio... | jocelynmass/nrf51 | toolchain/arm_cm0/arm-none-eabi/lib/thumb/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,477 |
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# 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://... | pelmers/rust | src/etc/lldb_rust_formatters.py | Python | apache-2.0 | 11,707 |
#!/usr/bin/env python
import pyaudio
import wave
import sys
CHUNK = 1024
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
# instantiate PyAudio (1)
p = pyaudio.PyAudio()
# Open strea (2)
stream = p.open(format=p.get_fo... | sstadick/SpeakEasy | scripts/pyaudio_test.py | Python | cc0-1.0 | 676 |
# Copyright 2012 Matthew Wall
# See the file LICENSE.txt for your full rights.
#
# Thanks to Jim Easterbrook for pywws. This implementation includes
# significant portions that were copied directly from pywws.
#
# pywws was derived from wwsr.c by Michael Pendec (michael.pendec@gmail.com),
# wwsrdump.c by Svend Skafte ... | maniac103/weewx | bin/weewx/drivers/fousb.py | Python | gpl-3.0 | 78,706 |
# inherited by CreatureInitialise
from ._base import CreatureBase
from ..dice.ability_die import AbilityDie
from typing import *
class CreatueInitAble(CreatureBase):
def set_ability_dice(self, **settings) -> None:
"""
Rewritten so that cleaning module does the cleaning.
Formerly it would... | matteoferla/DnD-battler | DnD_battler/creature/_init_abilities.py | Python | mit | 6,160 |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkCellDataToPointData(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
... | chrisidefix/devide | modules/vtk_basic/vtkCellDataToPointData.py | Python | bsd-3-clause | 497 |
"""HTTP specific constants."""
KEY_AUTHENTICATED = 'ha_authenticated'
KEY_USE_X_FORWARDED_FOR = 'ha_use_x_forwarded_for'
KEY_TRUSTED_NETWORKS = 'ha_trusted_networks'
KEY_REAL_IP = 'ha_real_ip'
KEY_BANS_ENABLED = 'ha_bans_enabled'
KEY_BANNED_IPS = 'ha_banned_ips'
KEY_FAILED_LOGIN_ATTEMPTS = 'ha_failed_login_attempts'
KE... | MungoRae/home-assistant | homeassistant/components/http/const.py | Python | apache-2.0 | 445 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | silenceli/nova | nova/db/api.py | Python | apache-2.0 | 67,076 |
from __future__ import print_function
from builtins import range
import time
import pytest
def test_max_memory_restart(worker):
N = 20
worker.start(
flags="--processes 1 --greenlets 1 --max_memory 50 --report_interval 1")
worker.send_tasks(
"tests.tasks.general.Leak",
[{"size": ... | Serenytics/mrq | tests/test_memoryleaks.py | Python | mit | 2,710 |
from parlay.testing.unittest_mixins.adapter import AdapterMixin
from parlay.testing.unittest_mixins.reactor import ReactorMixin
from twisted.trial import unittest
from twisted.internet import defer
from twisted.python import failure
from twisted.internet.task import Clock
from parlay.server.broker import Broker, run_i... | PromenadeSoftware/Parlay | parlay/test/test_protocols_base_protocol.py | Python | gpl-3.0 | 2,375 |
# The MIT License
#
# Copyright (c) 2015 the bpython authors.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mo... | MarkWh1te/xueqiu_predict | python3_env/lib/python3.4/site-packages/bpython/curtsiesfrontend/_internal.py | Python | mit | 2,126 |
# this file conatins default parameters for Lichen.py
DEFAULT_LOW = 150
DEFAULT_HIGH = 200
DEFAULT_DIRECTORY = "~/Programming/Lichen/"
DEFAULT_IMAGE = "Lichen.jpg"
DEFAULT_CSV = "percentage_of_lichen_on_a_rock.csv"
| shaief/lichen-python | lichen/DEFAULTS.py | Python | gpl-3.0 | 220 |
#!/usr/bin/env python2
__author__ = 'danielTsky'
__version__ = '0.0'
import numpy as np
def main():
pass
if __name__ == '__main__':
main() | danielskol/ml-cipher-cracker | src/map_inference.py | Python | mit | 151 |
#! /usr/bin/env python3
#
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
"""
Python3 script to scrape x keyboard layout file and produce translations.
To use this script, you must have a ... | calamares/calamares | src/modules/keyboard/layout-extractor.py | Python | gpl-3.0 | 3,090 |
# Problem name: 11550 Demanding Dilemma
# Problem url: https://uva.onlinejudge.org/external/115/11550.pdf
# Author: Andrey Yemelyanov
import sys
import math
def readline():
return sys.stdin.readline().strip()
def main():
n_tests = int(readline())
for t in range(n_tests):
V, E = [int(x) for x in readline().split... | andrey-yemelyanov/competitive-programming | cp-book/ch2/ownlibs/graph/_11550_DemandingDilemma.py | Python | mit | 1,296 |
from setuptools import setup, find_packages
setup(
name='bleach',
version='1.1.5',
description='An easy whitelist-based HTML-sanitizing tool.',
long_description=open('README.rst').read(),
author='James Socol',
author_email='james@mozilla.com',
url='http://github.com/jsocol/bleach',
lice... | nirmeshk/oh-mainline | vendor/packages/bleach/setup.py | Python | agpl-3.0 | 908 |
#!/usr/bin/python
#
# CPBL 2013-2014 September
# Incorporated old cpblTables.py, ie interface for prducing tables to be used by cpblTables.tex.
# Take a TSV/CSV file or (2014) a pandas DataFrame and generate a .tex include file that is used by my cpblTables.sty tools.
"""
2014 April: Provide tools for extracting a set ... | cpbl/cpblUtilities | textables/core.py | Python | gpl-3.0 | 69,599 |
#!/usr/bin/env python
""" nav_square.py - Version 1.1 2013-12-20
A basic demo of the using odometry data to move the robot
along a square trajectory.
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2012 Patrick Goebel. All rights reserved.
This program is free software; y... | KristofRobot/frobo | frobo_nav/nodes/nav_umbmark_cw.py | Python | mit | 7,200 |
import itertools
import abc
try:
from collections.abc import Mapping, Sequence
except ImportError:
from collections import Mapping, Sequence
from copy import deepcopy
from . import utils
from . import pycompat
def needs_parentheses(source):
def code(s):
return compile(s, '<variable>', 'eval').co_... | cool-RR/PySnooper | pysnooper/variables.py | Python | mit | 3,656 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import sys
import os
sys.path.append(os.path.abspath('..'))
__all__ = ['config_tools']
from . import config_tools
| anubia/py_pg_tools | config/__init__.py | Python | agpl-3.0 | 167 |
'''
Created on Mar 2, 2017
@author: PJ
'''
import sys
import os
import collections
sys.path.append(os.path.abspath("../../.."))
from BaseScouting.load_django import load_django
from BaseScouting.api_scraper.the_blue_alliance.ApiDownloader import ApiDownloader
from Scouting2017.api_scraper.the_blue_alliance.Populate... | ArcticWarriors/scouting-app | ScoutingWebsite/Scouting2017/api_scraper/the_blue_alliance/scrape_api.py | Python | mit | 3,144 |
try:
import unittest2 as unittest
except ImportError:
import unittest
import rope.base.project
import rope.base.builtins
from rope.base import libutils
from ropetest import testutils
class ObjectInferTest(unittest.TestCase):
def setUp(self):
super(ObjectInferTest, self).setUp()
self.proj... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/rope/ropetest/objectinfertest.py | Python | mit | 14,552 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Answered by Billy Wilson Arante
# Last updated on 2016/12/05 EST
# Write python code that defines the variable
# age to be your age in years, and then prints
# out the number of days you have been alive.
age = 30
days_per_year = 365
print age * days_per_year | arante/udacity | cs101/lesson1/spirit_age.py | Python | gpl-3.0 | 312 |
from ..utils import *
##
# Minions
class GVG_039:
"""Vitality Totem"""
events = OWN_TURN_END.on(Heal(FRIENDLY_HERO, 4))
class GVG_040:
"""Siltfin Spiritwalker"""
events = Death(FRIENDLY + MURLOC).on(Draw(CONTROLLER))
class GVG_042:
"""Neptulon"""
play = Give(CONTROLLER, RandomMurloc()) * 4
class GVG_066:... | jleclanche/fireplace | fireplace/cards/gvg/shaman.py | Python | agpl-3.0 | 798 |
"""
A script for testing / benchmarking HMM Implementations
"""
import argparse
import collections
import logging
import time
import hmmlearn.hmm
import numpy as np
import sklearn.base
LOG = logging.getLogger(__file__)
class Benchmark:
def __init__(self, repeat, n_iter, verbose):
self.repeat = repeat... | hmmlearn/hmmlearn | scripts/benchmark.py | Python | bsd-3-clause | 8,715 |
#File: Ex024_Using_FreeCAD_Solids_as_CQ_Objects.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python co... | hyOzd/cadquery | examples/FreeCAD/Ex024_Using_FreeCAD_Solids_as_CQ_Objects.py | Python | lgpl-3.0 | 1,709 |
import numpy as np
import scipy as sp
from itertools import product
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_gre... | zorroblue/scikit-learn | sklearn/decomposition/tests/test_pca.py | Python | bsd-3-clause | 27,961 |
import argparse
import logging
import os
import time
import traceback
import json
import redis
import ray
from ray.autoscaler.autoscaler import LoadMetrics, StandardAutoscaler
import ray.cloudpickle as pickle
import ray.gcs_utils
import ray.utils
import ray.ray_constants as ray_constants
from ray.utils import (binary... | stephanie-wang/ray | python/ray/monitor.py | Python | apache-2.0 | 18,136 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_cli
"""
import gzip
import unittest
import bz2file
import click
from vulyk.cli import admin, batches, db
from vulyk.models.task_types import AbstractTaskType
from vulyk.models.tasks import Batch, AbstractAnswer, AbstractTask
from vulyk.models.user import Group, ... | mrgambal/vulyk | tests/test_cli.py | Python | bsd-3-clause | 7,059 |
#!/usr/bin/python
#
# This is a 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 Ansible library is distributed in the hope that i... | mtnbikenc/ansible-modules-extras | cloud/amazon/s3_bucket.py | Python | gpl-3.0 | 13,778 |
#可选练习一较简单,故略过
from socket import *
import time
servername='127.0.0.1'
serverPort=800
clientSocket=socket(AF_INET,SOCK_DGRAM)
for i in range(1,11):
stime=time.time()
message=str(i)+' '+str(time.time())
clientSocket.sendto(message.encode(),(servername,serverPort))
clientSocket.close() | moranzcw/Computer-Networking-A-Top-Down-Approach-NOTES | SocketProgrammingAssignment/作业2-UDPping程序/UDP_Heartbeat_client.py | Python | mit | 331 |
"""Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
from google.protobuf import text_format
from tensorflow.core.framework import op_def_pb2
from tensorflow.python.framework import op_def_registry
from tensorflow.python.framework import ops
from tensorflow.python.ops import op_def_libra... | shishaochen/TensorFlow-0.8-Win | tensorflow/python/ops/gen_data_flow_ops.py | Python | apache-2.0 | 45,781 |
from django.contrib import admin
from .models import Question, Choise
# Register your models here.
class ChoiceInline(admin.TabularInline):
model = Choise
extra = 3
class QuestionAdmin(admin.ModelAdmin):
list_display = ('question_text', 'pub_date', 'was_published_recently')
list_filter = ['pub_date'... | DmitryDmitrienko/blog-dev | help/helpblog/admin.py | Python | apache-2.0 | 629 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Scott Hendrickson"
__license__="Simplified BSD"
import sys
import datetime
import fileinput
from io import StringIO
# Experimental: Use numba to speed up some fo the basic function
# that are run many times per record
# from numba import jit
# use fastest optio... | DrSkippy/Gnacs | acscsv/acscsv.py | Python | bsd-2-clause | 13,140 |
from collections import defaultdict as ddict
import itertools
def unique(seq): return len(set(seq)) == len(seq)
# This module provides a view of the ssa graph that can be modified without
# touching the underlying graph. This proxy is tailored towards the need of
# cfg structuring, so it allows easy duplication and i... | xtiankisutsa/MARA_Framework | tools/decompilers/Krakatau/Krakatau/java/graphproxy.py | Python | lgpl-3.0 | 4,787 |
#!/usr/bin/env python
"""
Description:
Create a two-state state machine where one state writes to userdata and
the other state reads from userdata, and spews a message to rosout.
Usage:
$> ./user_data.py
Output:
[INFO] : State machine starting in initial state 'SET' with userdata:
[]
[INF... | ReconCell/smacha | smacha_ros/test/executive_smach_tutorials/smach_tutorials/examples/user_data.py | Python | bsd-3-clause | 1,464 |
# Copyright 2021 Google LLC. 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 o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/compute/beta/firewall.py | Python | apache-2.0 | 16,746 |
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
from django.conf import settings
def cabot_login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=settings.LOGIN_URL):
"""
The login_required() decorator, but disabled if ind... | Affirm/cabot | cabot/cabotapp/decorators.py | Python | mit | 489 |
import numpy as np
from bokeh.layouts import column, grid
from bokeh.models import ColumnDataSource, CustomJS, Slider
from bokeh.plotting import figure, output_file, show
output_file('dashboard.html')
tools = 'pan'
def bollinger():
# Define Bollinger Bands.
upperband = np.random.randint(100, 150+1, size=10... | bokeh/bokeh | examples/howto/layouts/dashboard.py | Python | bsd-3-clause | 2,837 |
import sqlite3
db="sites.db"
def main():
conn = sqlite3.connect(db)
c.execute('select * from ')
if __name__ == "__main__":
main()
| JeroenDeDauw/a4g | gridcalc/gendatastatic.py | Python | gpl-3.0 | 138 |
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger('main')
| ZhQYuan/kpush | backend/kpush/share/log.py | Python | mit | 76 |
import re
from . import inlinepatterns
from . import util
from . import odict
def build_treeprocessors(md_instance, **kwargs):
""" Build the default treeprocessors for Markdown. """
treeprocessors = odict.OrderedDict()
treeprocessors["inline"] = InlineProcessor(md_instance)
treeprocessors["prettify"] ... | ryfeus/lambda-packs | Tensorflow_OpenCV_Nightly/source/markdown/treeprocessors.py | Python | mit | 12,649 |
# churn.py - create a graph of revisions count grouped by template
#
# Copyright 2006 Josef "Jeff" Sipek <jeffpc@josefsipek.net>
# Copyright 2008 Alexander Solovyov <piranha@piranha.org.ua>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later ve... | vmg/hg-stable | hgext/churn.py | Python | gpl-2.0 | 6,887 |
from pprint import pprint # noqa
import unittest
from .support import TestCase
class OLMTest(TestCase):
@unittest.skip("This takes a few minutes to run")
def test_mbox(self):
fixture_path, entity = self.fixture("bill_rapp.olm")
self.manager.ingest(fixture_path, entity)
self.assertSuc... | alephdata/ingestors | tests/test_olm.py | Python | mit | 843 |
import json
import string
import nltk.metrics.agreement
def format_show_name(name):
num_dict = {
"0": 'zero',
"1": 'one',
"2": 'two',
"3": 'three',
"4": 'four',
"5": 'five',
"6": 'six',
"7": 'seven',
"8": 'eight',
"9": 'nine',
"10": 'ten',
"11": 'eleven',
"12": 'twelve',
"13": 'thirteen',
... | willwest/broadwaydb | munge/join_data.py | Python | mit | 4,080 |
#Install pyvisa, use easy_install for example:
#easy_install pyvisa
import visa
class DSA815(object):
def __init__(self):
pass
def conn(self, constr="USB0::0x1AB1::0x0960::DSA8Axxxxxxx::INSTR"):
"""Attempt to connect to instrument"""
self.inst = visa.instrument(constr)
def identi... | colinoflynn/dsa815 | dsa815/dsa815.py | Python | bsd-3-clause | 1,455 |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn import datasets
iris = datasets.load_iris()
X = iris.data
y =iris.target
kmeans = KMeans(n_clusters=3).fit(X)
output = kmeans.labels_
plt.scatter(X[y==0,0], X[y==0,1])
plt.scatter(X[y==1,0], X[y==1,1])
plt.scatter(X[... | matija94/show-me-the-code | data-science/CollectiveIntelligence/com/AI/singi/kolo1/iris1.py | Python | mit | 501 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Audit groups and removes inactive users.
"""
import datetime
from django.contrib.auth.models import Group, User
fr... | lonnen/socorro | webapp-django/crashstats/authentication/management/commands/auditgroups.py | Python | mpl-2.0 | 4,373 |
import unittest
from SeaBattle import Position, User, Utils
class TestBoard(unittest.TestCase):
def setUp(self):
pass
def testPositive(self):
self.assertTrue(True, "What?")
#def testNegative(self):
# self.assertTrue(False, "Failed as expected")
def testGet... | rsouflaki/Python_SeaBattle | TestBoard.py | Python | mit | 1,554 |
#!/usr/bin/env python
def longest_increasing_subsequence(X):
"""Returns the Longest Increasing Subsequence in the Given List/Array"""
N = len(X)
P = [0] * N
M = [0] * (N+1)
L = 0
for i in range(N):
lo = 1
hi = L
while lo <= hi:
mid = (lo+hi)//2
if (X[... | ryucc/CS766_FINAL | internals/lis.py | Python | mit | 748 |
"""Module providing simple logging capabilities."""
import logging
import sys
from typing import List, Optional, Union
import uuid
# pip install rainbow_logging_handler.
from rainbow_logging_handler import RainbowLoggingHandler
from lib.globals import set_default_log
DEBUG = True
TRACE = False
DEFAULT_LOG_NAME = ... | stevepryde/spnaughts | lib/log.py | Python | gpl-3.0 | 4,805 |
import os
import itertools
import pytest
os.environ['SETUPTOOLS_SCM_DEBUG'] = '1'
VERSION_PKGS = ['setuptools', 'setuptools_scm']
def pytest_report_header():
import pkg_resources
res = []
for pkg in VERSION_PKGS:
version = pkg_resources.get_distribution(pkg).version
res.append('%s version... | esben/setuptools_scm | testing/conftest.py | Python | mit | 1,659 |
#!/usr/bin/python
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
import procgame.game, sys, os
import procgame.config
import random
import procgame.sound
sys.path.insert(0,os.path.pardir)
import bingo_emulator.common.units as units
import bingo_em... | bingopodcast/bingos | bingo_emulator/bull_market/game.py | Python | gpl-3.0 | 103,079 |
# GummybearLib version 1 (major.micro)
import socket
import re
import time
import threading
import random
import uuid
class GummybearError(Exception): pass
class GummybearChannelError(Exception): pass
class GummybearRuntimeError(Exception): pass
class thread(object):
def __init__(self, caller, loop, name, target, ... | Coilest/Gummybear | Gummybear.py | Python | mit | 8,212 |
def f():
try:
a = 1
except:
b = 1
| idea4bsd/idea4bsd | python/testData/copyPaste/Whitespace.after.py | Python | apache-2.0 | 59 |
import logging
import pickle
from django.test import TestCase
from haystack.models import SearchResult
from core.models import MockModel
from core.tests.mocks import MockSearchResult
class CaptureHandler(logging.Handler):
logs_seen = []
def emit(self, record):
CaptureHandler.logs_seen.append(reco... | soad241/django-haystack | tests/core/tests/models.py | Python | bsd-3-clause | 6,564 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | realms-team/solmanager | libs/smartmeshsdk-REL-1.3.0.1/libs/VManagerSDK/vmanager/models/ap_state_changed.py | Python | bsd-3-clause | 6,883 |
"""Support for WeMo device discovery."""
from __future__ import annotations
from collections.abc import Sequence
from datetime import datetime
import logging
from typing import Optional
import pywemo
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntr... | rohitranjan1991/home-assistant | homeassistant/components/wemo/__init__.py | Python | mit | 9,076 |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 Antmicro <www.antmicro.com>
# Copyright (c) 2019 David Shah <dave@ds0.me>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_bo... | litex-hub/litex-boards | litex_boards/targets/xilinx_zcu104.py | Python | bsd-2-clause | 4,423 |
from openerp.osv import osv, fields
class attributes(osv.Model):
_name = "product.attribute"
def _get_float_max(self, cr, uid, ids, field_name, arg, context=None):
result = dict.fromkeys(ids, 0)
if ids:
cr.execute("""
SELECT attribute_id, MAX(value)
... | ovnicraft/openerp-restaurant | website_sale/models/product_characteristics.py | Python | agpl-3.0 | 3,642 |
from __future__ import unicode_literals
import re
import uuid
from django.db import models
from django.core.validators import RegexValidator
US_PHONE_FORMAT = r'^(\+1\s?)?\(?(\d{3})\)?[\s-]?(\d{3})[\s-]?(\d{4})$'
def numeric_uuid_generator():
return str(uuid.uuid4().int)[:10]
class PhoneNumberField(models.C... | ZeroCater/zc_common | zc_common/fields.py | Python | mit | 1,452 |
test = {
'name': 'Problem EC',
'points': 2,
'suites': [
{
'cases': [
{
'code': r"""
>>> # Testing status parameters
>>> slow = SlowThrower()
>>> stun = StunThrower()
>>> SlowThrower.food_cost
4
>>> StunThrower.food_cost
... | sophiarora/Ants-project | tests/EC.py | Python | apache-2.0 | 5,738 |
import os,sys
import Image, ImageDraw
import random
if len(sys.argv) < 2:
print 'Use: visualizeLog.py logFile'
sys.exit()
imgDir = '/home/caicedo/data/allimgs/'
log = [x.replace(',','').replace('[','').replace(']','').split() for x in open(sys.argv[1])]
log = [x for x in log if len(x) > 10]
random.shuffle(log)
... | jccaicedo/localization-agent | scripts/visualizeLog.py | Python | mit | 732 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from solution import Solution
nums = [0, 5]
sol = Solution()
res = sol.jump(nums)
print(res)
| zhlinh/leetcode | 0045.Jump Game II/test.py | Python | apache-2.0 | 141 |
from Scouting2017.model.reusable_models import Match, OfficialMatch, Team, TeamComments, TeamPictures, ScoreResultMetric, Competition, TeamCompetesIn
from Scouting2017.model.models2017 import OfficialMatchScoreResult, ScoreResult, Scout
| ArcticWarriors/scouting-app | ScoutingWebsite/Scouting2017/model/__init__.py | Python | mit | 238 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/framework/meta_graph.py | Python | apache-2.0 | 33,596 |
# coding=utf-8
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | google/driblet | workflow/dags/dag_test.py | Python | apache-2.0 | 3,051 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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
#
# Unle... | fpieper/py2neo | test/core/1-main/bind_unbind_test.py | Python | apache-2.0 | 6,160 |
#!/usr/bin/python
from teryt2osm.osm_boundary import load_osm_boundary
from teryt2osm.utils import setup_locale
setup_locale()
boundary = load_osm_boundary("../data/boundary_poland.osm")
#boundary = load_osm_boundary("../data/boundary_simple.osm")
print repr(boundary)
#print repr(boundary.polygons)
class Location(ob... | slachiewicz/teryt2osm | util/test_boundary.py | Python | gpl-2.0 | 559 |
# Copyright 2020 Mycroft AI 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... | forslund/mycroft-core | test/integrationtests/voight_kampff/generate_feature.py | Python | apache-2.0 | 2,177 |
# -*- coding: utf-8 -*-
import pytest
import turnstile.models.message as message
from turnstile.checks import CheckIgnore
from turnstile.checks.commit_msg.specification import check
def test_check():
commit_1 = message.CommitMessage('something', 'https://github.com/jmcs/turnstile/issues/42 m€sságe')
result_... | zalando/turnstile | tests/checks/test_specification_check.py | Python | apache-2.0 | 1,332 |
# flake8: noqa
# from a GFF and a FASTA file, create smaller GFFs, one for each sequence ID
import os
import sys
base_dir = sys.argv[1]
gff_fn = sys.argv[2]
fasta_fn = sys.argv[3]
gffs = []
# parse GFF and write out separate GFFs
cur_seqid = None
cur_seqid_fh = None
fh = open(gff_fn, "r")
for line in fh.readlines(... | ginkgobioworks/edge | example/split_gff.py | Python | mit | 2,068 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/services/ad_group_criterion_customizer_service/transports/base.py | Python | apache-2.0 | 4,050 |
"""Support for water heater devices."""
from datetime import timedelta
import logging
import functools as ft
import voluptuous as vol
from homeassistant.helpers.temperature import display_temp as show_temp
from homeassistant.util.temperature import convert as convert_temperature
from homeassistant.helpers.entity_comp... | joopert/home-assistant | homeassistant/components/water_heater/__init__.py | Python | apache-2.0 | 9,162 |
# -*- coding: utf-8 -*-
class TagMeta(type):
"""
Metaclass for all Tags
"""
def __new__(meta, name, bases, dct):
if name != 'Tag':
if 'code' not in dct:
raise TypeError('code is not defined in tag: %s' % name)
if 'description' not in dct:
... | openlabs/gls_unibox_api | gls_unibox_api/tags.py | Python | bsd-3-clause | 1,666 |
# -*- coding: utf-8 -*-
import os
import datetime
from django.conf import settings
from django.core.exceptions import ValidationError
from children.models import Child
from dictionaries.models import Dictionary
import pyexcel
def get_extension(file):
return os.path.splitext(file.name)[1].lower()
def _validate_e... | mitrofun/kids2 | src/apps/loader/validators.py | Python | mit | 7,480 |
from django.apps import AppConfig
class RestateConfig(AppConfig):
name = 'restate'
| MrSami/sandbox | alpagu/restate/apps.py | Python | mit | 89 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.abstract_variables.ln_sampling_probability_for_bias_correction_mnl import ln_sampling_probability_for_bias_correction_mnl
class ln_sampling_probability_for_bias_correction_mnl_SSS... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/household_x_gridcell/ln_sampling_probability_for_bias_correction_mnl_SSS.py | Python | gpl-2.0 | 2,599 |
"""
Django settings for epto_project project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os... | robzenn92/EpTODocker | epto_project/epto_project/settings.py | Python | mit | 3,139 |
from tcga_encoder.utils.helpers import *
from tcga_encoder.data.data import *
from tcga_encoder.definitions.tcga import *
from tcga_encoder.definitions.nn import *
from tcga_encoder.definitions.locations import *
from tcga_encoder.algorithms import *
import seaborn as sns
from scipy import special
sns.set_style("white... | tedmeeds/tcga_encoder | tcga_encoder/models/dna/manual_predictions_rsem_gaussian.py | Python | mit | 11,932 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | eadgarchen/tensorflow | tensorflow/compiler/tests/stateless_random_ops_test.py | Python | apache-2.0 | 4,817 |
"""Convenience functions for working with svn.
This module does not include any tasks, only functions.
At this point, these functions do not use any kind of library. They require
the svn binary on the path."""
from paver.easy import sh, Bunch, path
def _format_revision(revision):
if revision:
revision =... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/paver/svn.py | Python | agpl-3.0 | 2,061 |
from keras.wrappers.scikit_learn import KerasClassifier
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Flatten, Activation
from keras.layers.convolutional import Convolution2D, ZeroPadding2D, MaxPooling2D
from keras import optimizers
from keras.preprocessing.image import ImageDat... | Griger/Intel-CervicalCancer-KaggleCompetition | test.py | Python | gpl-3.0 | 1,340 |
#!/usr/bin/env python
from socket import *
if __name__ == '__main__':
port445=0
port135=0
target = raw_input("Enter host to scan: ")
targetIP = gethostbyname(target)
print 'Starting scan on host ',targetIP
for i in range(20, 1025):
s = socket(AF_INET,SOCK... | sushingg/python | work/port_scan_host_detect.py | Python | gpl-3.0 | 908 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | wubr2000/googleads-python-lib | examples/dfp/v201411/network_service/get_all_networks.py | Python | apache-2.0 | 1,482 |
from five import grok
from zope.interface import Interface
from zope.component import getMultiAdapter
from plone.app.layout.viewlets.interfaces import IPortalFooter
class InfoBarViewlet(grok.Viewlet):
grok.name('bh.blog.InfoBarViewlet')
grok.context(Interface)
grok.require('zope2.View')
grok.viewletma... | potzenheimer/buildout.bh | src/bh.blog/bh/blog/infobar.py | Python | mit | 533 |
#!/usr/bin/python
import urllib2
rcode = urllib2.urlopen('https://sslv3.dshield.org/vulnpoodle.png').read()
print rcode
| Charles-521/CodeSnippet | python/zabbix-sms/testtls.py | Python | gpl-3.0 | 125 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
from muntjac.util import IEventListener
class IComponentEventListener(IEventListener):
pass
| rwl/muntjac | muntjac/event/component_event_listener.py | Python | apache-2.0 | 141 |
from django.conf.urls.defaults import *
## reports view
urlpatterns = patterns('aquatest_reports.views',
(r'^reports$', 'reports'),
(r'^sampling_points$', 'sampling_points'),
(r'^report_testers$', 'testers'),
(r'^date_range$', 'date_range'),
(r'^create_report$', 'create_report'),
(r'^export_csv... | icomms/wqmanager | apps/aquatest_reports/urls.py | Python | bsd-3-clause | 416 |
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import useragents, validate
from streamlink.stream import HLSStream, HTTPStream, RTMPStream
log = logging.getLogger(__name__)
@pluginmatcher(re.compile(
r"https?://17\.live/.+/live/(?P<channel>[^/&?]+)"
))
cl... | melmorabity/streamlink | src/streamlink/plugins/app17.py | Python | bsd-2-clause | 2,253 |
################################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
Unit tests for `bernoulli` module.
"""
import warnings
warnings.s... | SalemAmeen/bayespy | bayespy/inference/vmp/nodes/tests/test_bernoulli.py | Python | mit | 3,598 |
import fnmatch
from time import sleep
import uuid as GenUUID
import os, sys, shutil
import codecs
from PIL import Image, ImageFile
from django.db import models
from django.conf import settings
from opencontext_py.apps.ocitems.manifest.models import Manifest
from opencontext_py.apps.ocitems.mediafiles.models import Medi... | ekansa/open-context-py | opencontext_py/apps/imports/poggiociv/tbimages.py | Python | gpl-3.0 | 27,860 |
"""Migrates the private key encrypted column from AES to fernet encryption scheme.
Revision ID: ed422fc58ba
Revises: 4bcfa2c36623
Create Date: 2015-10-23 09:19:28.654126
"""
import base64
# revision identifiers, used by Alembic.
revision = 'ed422fc58ba'
down_revision = '4bcfa2c36623'
import six
from StringIO import... | rpicard/lemur | lemur/migrations/versions/ed422fc58ba_.py | Python | apache-2.0 | 9,340 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.