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 |
|---|---|---|---|---|---|---|
def Setup(Settings,DefaultModel):
# set1-test_of_models_against_datasets/osm299.py
Settings["experiment_name"] = "set1_Mix_model_versus_datasets_299px"
Settings["graph_histories"] = ['together'] #['all','together',[],[1,0],[0,0,0],[]]
# 5556x_minlen30_640px 5556x_minlen20_640px 5556x_reslen20_299px 5... | previtus/MGR-Project-Code | Settings/set1-test_of_models_against_datasets/mix299.py | Python | mit | 1,829 | 0.006014 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from gui.dwidgets import DMenu
class SettingsMenu(DMenu):
"""docstring for SettingsMenu"""
def __init__(self, parent=None):
super(SettingsMenu, self).__init__(parent)
self.parent = parent
self.menuItems = [
{
'na... | dragondjf/musicplayer | gui/menus/settingsmenu.py | Python | gpl-2.0 | 3,819 | 0.000262 |
import sys
import os
import os.path
from jinja2 import Template
from ConfigParser import ConfigParser
import StringIO
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program> <deploy_cfg_template_file> <file_with_properties>")
print("Properties from <file_with_properties> will be a... | pranjan77/kb_go_express | scripts/prepare_deploy_cfg.py | Python | mit | 2,069 | 0.003867 |
# typeclasses, an educational implementation of Haskell-style type
# classes, in Python
#
# Copyright (C) 2010 Nicolas Trangez <eikke eikke com>
#
# 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... | NicolasT/typeclasses | demo/eq.py | Python | lgpl-2.1 | 1,630 | 0 |
from __future__ import absolute_import
import sys
from kombu.transport import amqplib
from kombu.connection import BrokerConnection
from kombu.tests.utils import TestCase
from kombu.tests.utils import mask_modules, Mock
class MockConnection(dict):
def __setattr__(self, key, value):
self[key] = value
... | glogiotatidis/mozillians-new | vendor-local/lib/python/kombu/tests/transport/test_amqplib.py | Python | bsd-3-clause | 4,458 | 0.000449 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
fabfile.py
~~~~~~~~~~~~~~
A brief description goes here.
"""
try:
from config import MACHINES
except ImportError as e:
print "You should cp config.py.sample config.py, and modify it then"
raise e
for node in MACHINES['slave']:
print node
| luozhaoyu/TTTT | outputSlaves.py | Python | mit | 313 | 0.00639 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2010 - 2011, University of New Orleans
#
# 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 o... | gblanchard4/viamics | framework/tools/heatmap.py | Python | gpl-2.0 | 7,248 | 0.009934 |
from .components_generic import System
from .ports_library import FluidPort, MechPort, CustomPort
class Duct(System):
def __init__(self, name='n/a'):
super().__init__()
self.name = name
self.params['fl_in'] = FluidPort()
self.outputs['fl_out'] = FluidPort()
self.set()
... | adriendelsalle/unsysap | unsysap/components_library.py | Python | bsd-2-clause | 4,949 | 0.001819 |
# Copyright 2013-2015 Blockbridge Networks, 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 appl... | Hybrid-Cloud/cinder | cinder/volume/drivers/blockbridge.py | Python | apache-2.0 | 21,860 | 0 |
#
# Copyright (C) 2013 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope... | alexanderfefelov/nav | python/nav/web/navlets/status.py | Python | gpl-2.0 | 3,566 | 0 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/eventhubs/tests/latest/test_eventhub_commands_consumergroup_test.py | Python | mit | 3,921 | 0.003826 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | djangocali/blog-api | blog-api/config/production.py | Python | bsd-3-clause | 4,350 | 0.001839 |
import asyncio
import pytest
import socket
import subprocess
import sys
import contextlib
import os
import ssl
import time
import logging
import tempfile
import atexit
from collections import namedtuple
from urllib.parse import urlencode, urlunparse
from async_timeout import timeout as async_timeout
import aioredis
i... | ymap/aioredis | tests/conftest.py | Python | mit | 22,698 | 0 |
# @author Jeff Lockhart <jwlock@umich.edu>
# Script for drawing the tripartite network underlying analysis.
# version 1.0
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import sys
#add the parent directory to the current session's path
sys.path.insert(0, '../')
from network_utils import *
#... | jwlockhart/concept-networks | examples/draw_tripartite.py | Python | gpl-3.0 | 3,581 | 0.021502 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Mathieu Jourdan
#
# 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 op... | sputnick-dev/weboob | modules/gdfsuez/pages/homepage.py | Python | agpl-3.0 | 2,508 | 0.001595 |
#
# Copyright 2016 The BigDL 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | intel-analytics/BigDL | python/orca/test/bigdl/orca/learn/test_metrics.py | Python | apache-2.0 | 8,250 | 0.000485 |
# -*- coding: utf-8 -*-
### denote lines that need to be changed for different categories
import sys
reload(sys)
sys.setdefaultencoding("utf-8") # to handle UnicodeDecode errors
from math import ceil # top 20% of rankings
from traceback import format_exc # to handle errors
import pickle # to store art... | priyankamandikal/arowf | backlog.py | Python | apache-2.0 | 3,939 | 0.030972 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012, 2014, 2015 CERN.
#
# Invenio 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... | egabancho/invenio-knowledge | invenio_knowledge/models.py | Python | gpl-2.0 | 12,573 | 0 |
#
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# not... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/reportlab/graphics/barcode/__init__.py | Python | agpl-3.0 | 5,911 | 0.011673 |
import os, sys, json, urlparse, urllib
def get_template(template_basename):
script_directory = os.path.dirname(os.path.abspath(__file__))
template_directory = os.path.abspath(os.path.join(script_directory,
"..",
... | snehasi/servo | tests/wpt/web-platform-tests/referrer-policy/generic/subresource/subresource.py | Python | mpl-2.0 | 3,167 | 0.011683 |
"""
Molecule class.
"""
import numpy as np
from .water_models import SPC_E_atoms, TIP3P_atoms, TIP4P_atoms, TIP5P_atoms
from .gas_models import EPM2_atoms
from .structure_data import MolecularGraph
import networkx as nx
class Molecule(MolecularGraph):
#TODO(pboyd):add bonding calculations for the atoms in each mo... | peteboyd/lammps_interface | lammps_interface/Molecules.py | Python | mit | 18,379 | 0.005985 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'students.views.home', name='home'),
# url(r'^students/', include('students.foo.urls')),
... | pkuhad/django-student | students/urls.py | Python | mit | 684 | 0.010234 |
#!/usr/bin/python
import os,sys,string
if __name__ == "__main__":
# Check the argument list size
if (len(sys.argv) < 3):
sys.stderr.write("USAGE: " + sys.argv[0] + " <input file> <output file>\n")
sys.exit(1)
infilename = sys.argv[1]
outfilename = sys.argv[2]
# U is the mode to ... | jeffamstutz/rfManta | scenes/csafe/CMake/make2cmake.py | Python | mit | 768 | 0.011719 |
from sanic import Sanic
from sanic.views import CompositionView
from sanic.views import HTTPMethodView
from sanic.views import stream as stream_decorator
from sanic.blueprints import Blueprint
from sanic.response import stream, text
bp = Blueprint('blueprint_request_stream')
app = Sanic('request_stream')
class Simpl... | yunstanford/sanic | examples/request_stream/server.py | Python | mit | 1,683 | 0 |
import json
from urllib import urlencode
from nose.tools import ok_
from rest_framework.generics import GenericAPIView
from rest_framework.request import Request
from rest_framework.settings import api_settings
from access.middleware import ACLMiddleware
from amo.tests import TestCase
from users.models import UserPro... | jinankjain/zamboni | mkt/collections/tests/test_authorization.py | Python | bsd-3-clause | 8,106 | 0.00037 |
#!/usr/bin/python
# make-unicode.py -- build the Unicode version of btcrecover from the ASCII version
# Copyright (C) 2014, 2015 Christopher Gurnee
#
# This file is part of btcrecover.
#
# btcrecover is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as pub... | mrmookie/btcrecover | make-unicode.py | Python | gpl-2.0 | 4,149 | 0.002651 |
# RussianSquare - Tetris like block game
# Copyright (C) 2011 Joseph Grasser
#
# 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 optio... | jgrasser/pyRussianSquare | russianSquare.py | Python | gpl-2.0 | 27,299 | 0.0211 |
# future statements for Python 2 compatibility
from __future__ import (
unicode_literals, division, print_function, absolute_import)
# built in modules
import os
import sys
import datetime
# installed modules
import spacy
from unidecode import unidecode
# project modules
try:
import toolbox
import consta... | Jaymebb/MIE | MIE/UTILS/quickumls.py | Python | mit | 10,762 | 0.000093 |
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests.common import HttpCase, TransactionCase
class SomethingCase(TransactionCase):
def setUp(self, *args, **kwargs):
super(SomethingCase, self).setUp(*args, **kwargs)
# TODO Replace this... | Yajo/maintainer-tools | template/module/tests/test_something.py | Python | agpl-3.0 | 1,454 | 0 |
# -*- coding: utf-8 -*-
import cx_Oracle
db = cx_Oracle.connect("username", "password", "10.17.1.220:1521/db")
cursor = db.cursor()
cursor.execute("select loginid from sys_user")
for loginid in cursor:
print("loginid: ", loginid)
cursor.close()
cursor = db.cursor()
#插入一条记录
cursor.execute("""insert into tb_user ... | StupidTortoise/personal | python/oracle_test.py | Python | gpl-2.0 | 1,079 | 0.016684 |
from .relationship_manager import RelationshipManager, ZeroOrMore # noqa
class ZeroOrOne(RelationshipManager):
description = "zero or one relationship"
def single(self):
nodes = super(ZeroOrOne, self).all()
if len(nodes) == 1:
return nodes[0]
if len(nodes) > 1:
... | pombredanne/neomodel | neomodel/cardinality.py | Python | mit | 2,569 | 0.001557 |
#!/usr/bin/python
#
# Urwid container widget classes
# Copyright (C) 2004-2012 Ian Ward
#
# 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 2.1 of the Licen... | mountainstorm/urwid | urwid/container.py | Python | lgpl-2.1 | 84,566 | 0.002814 |
import numpy as np
from scipy.optimize import check_grad
## Two-layer NN with ReLU
# Two-layer NN, with 200 units per layer with ReLu ai = max(0,oi)
# X - (W01) - Layer1 - (W12) - Layer2 - (W23) - Output
# ((D+1)*nh) + ((nh+1)*nh) + ((nh+1)*K)
nh = 200
def getAvgGradient(w, X, y, L, K):
[N,D] = X.shape
W01,... | jihunhamm/Crowd-ML | client/python/loss_nndemo1.py | Python | apache-2.0 | 3,849 | 0.030657 |
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name = 'simplui',
version = '1.0.4',
author = 'Tristam MacDonald',
author_email = 'swiftcoder@gmail.com',
description = 'Light-weight GUI toolkit for pyglet',
url = 'http://simplui.googlecode.com/',
platforms = ['all']... | boskee/simplui | setup.py | Python | bsd-3-clause | 803 | 0.05604 |
#!/usr/bin/python
import asm
"""
Import script for sb1875 csv files
1st March, 2019
"""
START_ID = 1000
ANIMAL_FILENAME = "/home/robin/tmp/asm3_import_data/sb1875_csv/ASM_Animal_Master.csv"
LOG_FILENAME = "/home/robin/tmp/asm3_import_data/sb1875_csv/ASM_Animal_Log.csv"
PERSON_FILENAME = "/home/robin/tmp/asm3_impor... | bobintetley/asm3 | import/org/org_sb1875.py | Python | gpl-3.0 | 11,412 | 0.004118 |
import logging
def registerLoggingHander(dependencies):
plexHandler = PlexLoggerHandler()
for dependency in dependencies:
Log.Debug("Registering LoggerHandler for dependency: %s" % dependency)
log = logging.getLogger(dependency)
log.setLevel('DEBUG')
log.addHandler(plexH... | dantebarba/docker-media-server | plex/Subliminal.bundle/Contents/Code/logger.py | Python | gpl-3.0 | 1,288 | 0.004658 |
# -*- coding: utf-8 -*-
from collections import Counter
from .design_pattern import singleton
@singleton()
class ListUtilsClass(object):
def most_common_inspect(self, list1):
new_list = []
for s1 in list1:
if not isinstance(s1, unicode):
s1 = str(s1).decode("UTF-8")
... | Luiti/etl_utils | etl_utils/list_utils.py | Python | mit | 1,250 | 0.0016 |
'''
Copyright 2015
This file is part of Orbach.
Orbach 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.
Orbach is distributed in the hope t... | awood/orbach | orbach/core/urls.py | Python | gpl-3.0 | 1,005 | 0 |
import glob
from pythonforandroid.toolchain import (
CythonRecipe,
Recipe,
current_directory,
info,
shprint,
)
from os.path import join
import sh
class TwistedRecipe(CythonRecipe):
version = '17.9.0'
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
depends ... | ibobalo/python-for-android | pythonforandroid/recipes/twisted/__init__.py | Python | mit | 1,038 | 0.000963 |
import numpy as np
from sverchok.utils.testing import *
from sverchok.utils.logging import debug, info
from sverchok.utils.geom import CubicSpline
class CubicSplineTests(SverchokTestCase):
def setUp(self):
super().setUp()
vertices = [(-1, -1, 0), (0, 0, 0), (1, 2, 0), (2, 3, 0)]
self.spli... | portnov/sverchok | tests/cubic_spline_tests.py | Python | gpl-3.0 | 1,513 | 0.017845 |
from components.base.automotive_component import AutomotiveComponent
from config import project_registration as proj
from tools.ecu_logging import ECULogger as L
import random
class AbstractECU(AutomotiveComponent):
'''
This abstract class defines the interface of
an ECU as it is found in an automotive n... | PhilippMundhenk/IVNS | ECUSimulation/components/base/ecu/types/abst_ecu.py | Python | mit | 5,802 | 0.018614 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | tomasy23/evertonkrosnodart | tools/export/blender25/io_scene_dae/__init__.py | Python | mit | 6,444 | 0.006518 |
#! /usr/bin/env python
# This file is part of the dvbobjects library.
#
# Copyright 2009-2013 Lorenzo Pallara l.pallara@avalpa.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 vers... | pvdheijden/OpenCaster | libs/dvbobjects/dvbobjects/PSI/UNT.py | Python | gpl-2.0 | 2,864 | 0.013268 |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Is this a triangle?
#Problem level: 7 kyu
def is_triangle(a, b, c):
return (a+b>c) and (b+c>a) and (c+a>b)
| Kunalpod/codewars | is_this_a_triangle.py | Python | mit | 163 | 0.042945 |
from django.contrib import admin
from .models import *
class ProductAdmin(admin.ModelAdmin):
list_display = ('id', 'prd_process_id', 'prd_name',
'prd_display_name', 'prd_owner', 'prd_product_id', 'prd_date',
'prd_class', 'prd_filter', 'prd_is_public', 'prd_is_permanent',)
... | linea-it/dri | api/product/admin.py | Python | gpl-3.0 | 5,841 | 0.002226 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import urlparse
from scrapy import log
from scrapy.http import Request
from base.base_wolf import Base_Wolf
class Wolf(Base_Wolf):
def __init__(self, *args, **kwargs):
super(Wolf, self).__init__(*args, **kwargs)
self.name = 'cnscg'
s... | pczhaoyun/wolf | wolf/spiders/wolves/cnscg.py | Python | apache-2.0 | 1,092 | 0.003663 |
#!/usr/bin/env python
"""
Installation script:
To release a new version to PyPi:
- Ensure the version is correctly set in oscar.__init__.py
- Run: python setup.py sdist upload
"""
from setuptools import setup, find_packages
import os
import sys
from oscar import get_version
PROJECT_DIR = os.path.dirname(__file__)
... | michaelBenin/django-oscar | setup.py | Python | bsd-3-clause | 3,934 | 0.001017 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Laurawly/tvm-1 | python/tvm/relay/op/contrib/ethosu.py | Python | apache-2.0 | 42,334 | 0.001819 |
##
## pyGBot - Versatile IRC Bot
## Copyright (C) 2008 Morgan Lokhorst-Blight, Alex Soborov
##
## 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, ... | pyGBot/pyGBot | pyGBot/Plugins/system/CommandSpec/Seen.py | Python | gpl-3.0 | 3,387 | 0.004724 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
with open('README.rst') as file:
long_description = file.read()
except IOError:
long_description = 'Python lib for sniffets.com'
setup(
name='sniffets',
packages=['sniffets'],
version='0.1.8... | behconsci/sniffets-python | setup.py | Python | mit | 749 | 0.001335 |
"""
Concurrent downloaders
"""
import os
import sys
import signal
import logging
import itertools
from functools import partial
from concurrent.futures import ProcessPoolExecutor
from pomp.core.base import (
BaseCrawler, BaseDownloader, BaseCrawlException,
)
from pomp.contrib.urllibtools import UrllibDownloadWorke... | estin/pomp | pomp/contrib/concurrenttools.py | Python | bsd-3-clause | 5,193 | 0 |
def descriptor(rcut=4, desc_type='se_ar', mneiba=150):
smth_frac = 0.85
if desc_type == 'se_ar':
rmult = 1.5
mneibr = 500
ar_smth = rcut*smth_frac
desc = {
'type': 'se_ar',
'a': {
'sel': [mneiba],
'rcut_smth': ar_smth,
'rcut': rcut,
'neuron': [10, 20, 40],... | Paul-St-Young/solid_hydrogen | qharv_db/dpmd_train.py | Python | mit | 2,815 | 0.013144 |
# -*- coding: utf-8 -*-
"""
netease-dl.weapi
~~~~~~~~~~~~~~~~
This module provides a Crawler class to get NetEase Music API.
"""
import re
import hashlib
import os
import sys
import click
import requests
from requests.exceptions import RequestException, Timeout, ProxyError
from requests.exceptions import ConnectionE... | ziwenxie/netease-dl | netease/weapi.py | Python | mit | 14,637 | 0.000273 |
from __future__ import print_function
# bench related imports
import numpy as np
import shutil
import bquery
import pandas as pd
import itertools as itt
import cytoolz
import cytoolz.dicttoolz
from toolz import valmap, compose
from cytoolz.curried import pluck
import blaze as blz
# other imports
import contextlib
impor... | FrancescElies/bquery | bquery/benchmarks/bench_groupby.py | Python | bsd-3-clause | 2,373 | 0.000421 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
... | sheeshmohsin/shopping_site | app/cart/urls.py | Python | mit | 546 | 0.007326 |
"""autogenerated by genpy from hoverboard/ServoRaw.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import std_msgs.msg
class ServoRaw(genpy.Message):
_md5sum = "cf1c9d17f7bbedbe8dd2c29cdb7700f8"
_type = "hoverboard/ServoRaw"
_has_header = True ... | robotics-silver-surfer/surfer-main | lab3/hoverboard/src/hoverboard/msg/_ServoRaw.py | Python | mit | 5,572 | 0.018844 |
import sys
import struct
ULL_BYTES = struct.calcsize('!Q')
SHORT_BYTES = struct.calcsize('!h')
INDEX_HEADER = 'IDX'
def search(dbfile, prefix):
"""Returns all words having a given prefix using a dbfile."""
idx = Index.from_file(dbfile)
for letter in prefix:
if letter not in idx.nodes:
... | mstepniowski/simpledb | search.py | Python | bsd-2-clause | 2,080 | 0.001923 |
import numpy as np
import struct
import wave
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
import matplotlib.pyplot as plt
CHUNK = 1 << 8
def play(filename):
PlaySound(filename, SND_FILENAME | SND_ASYNC)
fn = r"D:\b.wav"
f = wave.open(fn)
print(f.getparams())
ch = f.getnchannels()
sw = f.getsampwidth(... | DavideCanton/Python3 | audio/freq.py | Python | gpl-3.0 | 663 | 0.001508 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | dennisobrien/bokeh | bokeh/sampledata/tests/test_commits.py | Python | bsd-3-clause | 1,961 | 0.010199 |
# -*- coding: UTF-8 -*-
__copyright__ = """\
Copyright (c) 2012-2013 Luc Saffre.
This software comes with ABSOLUTELY NO WARRANTY and is
distributed under the terms of the GNU Lesser General Public License.
See file COPYING.txt for more information."""
| khchine5/book | lino_book/projects/homeworkschool/__init__.py | Python | bsd-2-clause | 254 | 0 |
# coding=utf8
#
# Copyright 2013 Dreamlab Onet.pl
#
# 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;
# version 3.0.
# This library is distributed in the hope that it will be useful,
# bu... | tikan/rmock | src/rmock/runners/http/proxy/handler.py | Python | lgpl-3.0 | 2,108 | 0.004744 |
#!/usr/bin/env python
# Copyright 2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import unittest
import os
import tempfile
# internal modules:
from yotta.lib.fsutils import mkDirP, rmRf
from yotta.lib.detect import systemDefaultTarg... | BlackstoneEngineering/yotta | yotta/test/ignores.py | Python | apache-2.0 | 6,131 | 0.008481 |
import math
import numpy
import statsmodels.api as sm
lowess= sm.nonparametric.lowess
import esutil
from galpy.util import bovy_coords, bovy_plot
from scipy.interpolate import interp1d,UnivariateSpline
import apogee.tools.read as apread
import isodist
import numpy as np
import matplotlib.pyplot as plt
import os
import ... | jobovy/apogee-maps | py/define_rgbsample.py | Python | bsd-3-clause | 20,638 | 0.02413 |
from ems.typehint import accepts
from ems.resource.repository import Repository
class DictAttributeRepository(Repository):
@accepts(Repository)
def __init__(self, sourceRepo, sourceAttribute='data'):
self._sourceRepo = sourceRepo
self.sourceAttribute = sourceAttribute
def get(self, id_):... | mtils/ems | ems/resource/dict_attribute_repository.py | Python | mit | 1,547 | 0.001939 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Account import Account
from module.plugins.internal.Plugin import set_cookie
class ShareonlineBiz(Account):
__name__ = "ShareonlineBiz"
__type__ = "account"
__version__ = "0.41"
__status__ = "testing"
__description__ = """Sha... | jansohn/pyload | module/plugins/accounts/ShareonlineBiz.py | Python | gpl-3.0 | 2,110 | 0.010427 |
# -*- coding: utf-8 -*-
"""
CSS Testing
:copyright: (C) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from os.path import join
from cssutils import CSSParser
import unittest
import trytond.tests.test_tryton
dir = 'static/css/'
class CSSTest(unit... | gautampanday/nereid-webshop | tests/test_css.py | Python | bsd-3-clause | 1,062 | 0.000942 |
"""Auth pipeline definitions.
Auth pipelines handle the process of authenticating a user. They involve a
consumer system and a provider service. The general pattern is:
1. The consumer system exposes a URL endpoint that starts the process.
2. When a user visits that URL, the client system redirects the user t... | CredoReference/edx-platform | common/djangoapps/third_party_auth/pipeline.py | Python | agpl-3.0 | 35,110 | 0.003019 |
import discord
import random
import aiohttp
from lxml import html as l
async def cyanideandhappiness(cmd, message, args):
comic_number = random.randint(1, 4562)
comic_url = f'http://explosm.net/comics/{comic_number}/'
async with aiohttp.ClientSession() as session:
async with session.get(comic_url... | aurora-pro/apex-sigma | sigma/plugins/fun/cyanideandhappiness.py | Python | gpl-3.0 | 720 | 0.001393 |
import multiprocessing
import socket
import re
import time
def handle(connection, address):
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("process-%r" % (address,))
try:
logger.debug("Connected %r at %r", connection, address)
while True:
d... | ftp21/BoilerPi | server.py | Python | gpl-3.0 | 3,260 | 0.010123 |
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from . import measuring_device
| OCA/stock-logistics-warehouse | stock_measuring_device_zippcube/models/__init__.py | Python | agpl-3.0 | 131 | 0 |
import time
import sys
def createDots(length, delay):
for i in range(length):
print('.', end='')
sys.stdout.flush()
time.sleep(delay)
def createHash(length, delay):
for i in range(length):
print('#', end='')
sys.stdout.flush()
time.sleep(delay)
def createVrDots... | Indmind/Jomblo-Story | module/loading.py | Python | mit | 442 | 0.00905 |
'''
Created on 30 Jun 2015
@author: @willu47
'''
import numpy as np
from numpy.testing import assert_equal, assert_allclose
from SALib.sample.ff import sample, find_smallest, extend_bounds
from SALib.analyze.ff import analyze, interactions
def test_find_smallest():
'''
'''
num_vars = [1, 2, 3, 4, 5, 6, 7... | willu47/SALib | tests/test_ff.py | Python | mit | 6,285 | 0.004455 |
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# 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, modify, merge... | stefanklug/mapnik | scons/scons-local-2.3.6/SCons/compat/__init__.py | Python | lgpl-2.1 | 8,150 | 0.001104 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^(\d+)/$', 'onpsx.gallery.views.index'),
(r'^$', 'onpsx.gallery.views.index'),
)
| chrizel/onpsx | src/onpsx/gallery/urls.py | Python | gpl-3.0 | 160 | 0.00625 |
from logging import StreamHandler
from django.conf import settings
from celery import current_task
from celery.signals import task_prerun, task_postrun
from kombu import Connection, Exchange, Queue, Producer
from kombu.mixins import ConsumerMixin
from .utils import get_celery_task_log_path
routing_key = 'celery_log'... | eli261/jumpserver | apps/ops/celery/logger.py | Python | gpl-2.0 | 4,606 | 0.000434 |
#!/usr/bin/env python
# coding:utf-8
import urllib
domain = 'http://www.liaoxuefeng.com' #廖雪峰的域名
path = r'C:\Users\cyhhao2013\Desktop\temp\\' #html要保存的路径
# 一个html的头文件
input = open(r'C:\Users\cyhhao2013\Desktop\0.html', 'r')
head = input.read()
# 打开python教程主界面
f = urllib.urlopen("http://www.liaoxuefeng.c... | pinggit/plwe | bin/liaoxuefeng_scan.py | Python | mit | 1,649 | 0.002939 |
# Copyright(C) 2011,2012,2013,2014 by Abe developers.
# DataStore.py: back end database access for Abe.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... | ApexCoin/bitnote-abe | Abe/DataStore.py | Python | agpl-3.0 | 122,795 | 0.001678 |
from django.forms import ModelForm, inlineformset_factory, HiddenInput, ModelChoiceField
from .models import BirthForm, SanityPillars, InnateAbility, StabilitySources
class CharBirthForm(ModelForm):
class Meta:
model = BirthForm
fields = ['name', 'pronoun', 'age', 'birthplace', 'drive', 'occupation... | danwchan/trail_of_cthulhu | mythos_website_upgrade/characterbirther/forms.py | Python | gpl-3.0 | 2,580 | 0.018217 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2018-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
import xbmc
if __name__ == '__main__':
xbmc.executebuiltin("Container.Refresh")
| jdf76/plugin.video.youtube | resources/lib/youtube_plugin/refresh.py | Python | gpl-2.0 | 263 | 0 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import tree
def main(argv):
dna = files.read_line(argv[0])
st = tree.SuffixTree(dna)
print '\n'.join(st.traverse())
if __name__ == "__main__":
main(sys.argv[1:])
| cowboysmall/rosalind | src/stronghold/rosalind_suff.py | Python | mit | 288 | 0.010417 |
#
# Copyright 2012 IBM, Inc.
# Copyright 2012-2014 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# T... | txomon/vdsm | tests/configNetworkTests.py | Python | gpl-2.0 | 7,351 | 0 |
__author__ = 'Richard Lincoln, r.w.lincoln@gmail.com'
""" This example demonstrates how optimise power flow with Pyreto. """
import sys
import logging
import numpy
import scipy.io
import pylab
import pylon
import pyreto
from pyreto.util import plotGenCost
from pybrain.rl.agents import LearningAgent
from pybrain.rl.... | rwl/pylon | examples/pyreto/rlopf.py | Python | apache-2.0 | 5,046 | 0.005549 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mozaik_communication, an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mozaik_communication is free software:
# you can redistribute it and/or
# ... | acsone/mozaik | mozaik_communication/mail_mail.py | Python | agpl-3.0 | 1,638 | 0 |
# -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from django.test import TestCase, tag
import factories
from formlibrary.models import CustomForm
@tag('pkg')
class CustomFormTest(TestCase):
def setUp(self):
self.organization = factories.Organization()
self.user = factori... | toladata/TolaActivity | formlibrary/tests/test_models.py | Python | apache-2.0 | 1,601 | 0 |
import argparse
import numpy as np
from PIL import Image
import ocppaths
import ocpcarest
import zindex
import anydbm
import multiprocessing
import pdb
#
# ingest the PNG files into the database
#
"""This file is super-customized for Mitya's FlyEM data."""
# Stuff we make take from a config or the command line i... | openconnectome/open-connectome | scripts/ingest/flyem/flyem_anno_parallel.py | Python | apache-2.0 | 4,133 | 0.031696 |
"""
To plot this, you need to provide the experiment directory plus an output stem.
I use this for InvertedPendulum:
python plot.py outputs/InvertedPendulum-v1 --envname InvertedPendulum-v1 \
--out figures/InvertedPendulum-v1
(c) May 2017 by Daniel Seita
"""
import argparse
import matplotlib
matplotl... | DanielTakeshi/rl_algorithms | es/plot.py | Python | mit | 4,221 | 0.007344 |
import pandas as pd
import numpy as np
from os.path import join as opj
import sys
from fg_shared import *
sys.path.append(opj(_git, 'utils'))
import quickr
corncob = """
require(dplyr)
require(tidyr)
require(purr)
require(corncob)
#####################################################################################... | agartland/utils | corncob_r.py | Python | mit | 3,388 | 0.007701 |
# functions that implement analysis and synthesis of sounds using the Sinusoidal plus Stochastic Model
# (for example usage check the models_interface directory)
import numpy as np
from scipy.signal import resample, blackmanharris, triang, hanning
from scipy.fftpack import fft, ifft, fftshift
import math
import utilFu... | zymsys/sms-tools | software/models/spsModel.py | Python | agpl-3.0 | 7,289 | 0.024283 |
def get_all(tordb):
return tordb.find()
def delete(tordb, obj_id):
tordb.remove([obj_id])
def insert(tordb, obj):
return tordb.insert(obj)
def update_full(tordb, id, obj):
tordb.update({'_id': id}, {'$set': obj})
| noahgoldman/torwiz | torrents/torrents/database.py | Python | mit | 232 | 0.012931 |
def clip_matrix(image_as_matrix, width, height, top, left, expand_by=0):
x1 = left
x2 = left + width
y1 = top
y2 = top + height
crop_img = image_as_matrix[y1-expand_by:y2+expand_by, x1-expand_by:x2+expand_by]
return crop_img
| aeivazi/classroom-tracking | src/face_clipper.py | Python | mit | 257 | 0.007782 |
#!/usr/bin/python
import sys
if (len(sys.argv) < 2):
fn = '/usr/share/ldraw/LDConfig.ldr'
else:
fn = sys.argv[1]
f = open(fn)
for line in f:
if '!COLOUR' in line:
line = line.strip()
ns = line.split()
category = ''
if 'RUBBER' in line:
category = 'material... | segfault87/Konstruktor | scripts/generate_color_table.py | Python | gpl-3.0 | 1,594 | 0.003137 |
#!/usr/bin/env python3
"""
Perform frequency analysis on text. This is already provided by !f, this script
exists for other reasons.
"""
import sys
import argparse
import re
from collections import Counter
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("input", t... | elterminad0r/cipher_tools | src/scripts/freq_analysis.py | Python | gpl-3.0 | 1,559 | 0.009622 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | kaplun/inspire-next | inspirehep/modules/refextract/__init__.py | Python | gpl-3.0 | 1,003 | 0 |
from ConfigParser import SafeConfigParser
def load_ini_file(file_name, defaults={}):
config = SafeConfigParser()
config.readfp(open(file_name))
results = {}
for section in config.sections():
for key, value in config.items(section):
results[section + '.' + key] = value
results... | jsocko515/python-lust | lust/config.py | Python | bsd-3-clause | 359 | 0.002786 |
'''
Created on 06/apr/2015
@author: luca
'''
import cv2
import numpy as np
import xml.etree.ElementTree as ET
import xml.dom.minidom
STATE_NONE = 0
STATE_DRAW = 1
STATE_DELETE = 2
POINT_RADIUS = 3
POINT_COLOR_CANDIDATE = (0,127,255)
LINE_COLOR_CANDIDATE = (0,127,255)
LINE_THICK_CANDIDATE = 2
LINE_COLOR = (0,192,0)
... | greeneyesproject/testbed-demo | gui/pklot/designer.py | Python | mit | 8,338 | 0.020029 |
# coding=utf-8
"""
Binary class deconstruct, reconstruct packet
"""
import copy
class Binary(object):
@staticmethod
def deconstruct_packet(packet):
"""
Replaces every bytearray in packet with a numbered placeholder.
:param packet:
:return: dict with packet and list of buffers
... | shuoli84/gevent_socketio2 | socketio/binary.py | Python | mit | 2,907 | 0 |
# Copyright (C) 2006, 2007, 2008 One Laptop per Child
#
# 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... | godiard/memorize-activity | game.py | Python | gpl-2.0 | 14,959 | 0.000067 |
from distutils.core import setup
setup(
name='jenkins_cli_tool',
version='3.1',
packages=['cli', 'cli.startjob', 'cli.startAndMonitor', 'tests'],
url='https://github.com/hermco/jenkins_cli_tool',
license='MIT',
author='chermet',
author_email='chermet@axway.com',
description='CLI tool fo... | hermco/jenkins_cli_tool | setup.py | Python | mit | 521 | 0 |
#!/usr/bin/env python3
'''
* Copyright 2015 by Benjamin J. Land (a.k.a. BenLand100)
*
* This file is part of chatlogs.
*
* chatlogs 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 ... | BenLand100/chatlogs | wordprofile.py | Python | gpl-3.0 | 2,410 | 0.009129 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# Copyright (C) Gabriel Potter <gabriel@potter.fr>
# This program is published under a GPLv2 license
"""
Python 2 and 3 link classes.
"""
from __future__ import absolute_impor... | 6WIND/scapy | scapy/compat.py | Python | gpl-2.0 | 4,048 | 0.000247 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.