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 |
|---|---|---|---|---|---|
# Copyright 2012 Nebula, 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 agree... | wolverineav/horizon | horizon/test/tests/workflows.py | Python | apache-2.0 | 11,478 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-27 16:15
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('legislative', '0020_auto_20180424_1009'),
]
operatio... | access-missouri/am-django-project | am/legislative/migrations/0021_auto_20180427_1115.py | Python | bsd-2-clause | 848 |
# -*- coding: utf-8 -*-
"""
pybitcoin
~~~~~
:copyright: (c) 2014 by Halfmoon Labs
:license: MIT, see LICENSE for more details.
"""
# data structure constants
UINT_MAX = 2**32-1
# protocol constants
SATOSHIS_PER_COIN = 10**8
MAX_BYTES_AFTER_OP_RETURN = 80
# fee defaults
STANDARD_FEE = 1000 # 1000 sa... | blockstack/pybitcoin | pybitcoin/constants.py | Python | mit | 412 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/transaction_stream.py | Python | mit | 9,665 |
"""Provide dependency graph"""
import miasm2.expression.expression as m2_expr
from miasm2.core.graph import DiGraph
from miasm2.core.asmbloc import asm_label, expr_is_int_or_label, expr_is_label
from miasm2.expression.simplifications import expr_simp
from miasm2.ir.symbexec import symbexec
from miasm2.ir.ir import irb... | rom1sqr/miasm | miasm2/analysis/depgraph.py | Python | gpl-2.0 | 22,510 |
import traceback
import string
import os
import sys
import shutil
from FDO import *
import unittest
class DeleteTest(unittest.TestCase):
def setUp(self):
if not os.path.isdir("DeleteTest/SDF"):
os.makedirs("DeleteTest/SDF")
if not os.path.isdir("DeleteTest/SQLite"):
os.maked... | jumpinjackie/fdo-swig | Lang/Python/UnitTest/Src/DeleteTest.py | Python | lgpl-2.1 | 2,955 |
from django.db import models
from django.urls import reverse
class VoterData(models.Model):
name = models.CharField(max_length=36, verbose_name="Vardas")
surname = models.CharField(max_length=36, verbose_name="Pavardฤ")
id_code = models.IntegerField(max_length=36, verbose_name="Asmens Kodas")
class Vote... | 00riddle00/internet-voting-authorization | ivreg/models.py | Python | mit | 782 |
# -*- coding: utf-8 -*-
from WbtEvo import WbtEVO
from WbtEvo import WbtPaper
from WbtEvo import WbtOLDbutGOLD
from WbtEvo import WbtUbi
from storyLineObj_plus import Sl_text, Sl_State, Sl_TrigObj
from tool import Tool
import simplejson as json
import codecs
t = Tool()
wp = None
if __name__ == "__mai... | christiansacchi/code-forest | storyline2_3_project_composer-Sara_Script-python/edo.py | Python | mit | 3,274 |
import itertools, sys
spinner = itertools.cycle(['-', '/', '|', '\\'])
while True:
sys.stdout.write(spinner.next())
sys.stdout.flush()
sys.stdout.write('\b')
| 2Dsharp/college | Fall-18/CG/PipeAnimation.py | Python | mit | 177 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import imp
def FindModule(name):
"""Gets the path of the named module.
This is useful for cases where we want to use subprocess.call on a module we
h... | modulexcite/catapult | catapult_build/module_finder.py | Python | bsd-3-clause | 551 |
# coding:utf8
import re
import requests
from bs4 import BeautifulSoup
baseurl = 'http://www.102468.com'
url = baseurl + '/?m=vod-type-id-1-pg-{p}.html'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0'
}
def make_request(url, session=None):
inner = False
if... | brunobell/PracticalPythonScripts | sucker_102468_com.py | Python | mit | 2,602 |
#!/usr/bin/env python
#coding: iso-8859-15
#
# Make AntennaField.conf and iHBADeltas.conf file for given station and date
#
import sys,pgdb, pg
from datetime import *
from copy import deepcopy
from math import *
import numpy as np
import MLab as mlab
from database import *
# get info from database.py
dbName=getDBname... | jjdmol/LOFAR | MAC/Deployment/data/Coordinates/make_all_station_file.py | Python | gpl-3.0 | 7,992 |
# This query is designed to be run against
# "Larry's data with Longitude/Latitude | fulldata" at:
# http://mewert-langmap.appspot.com/map?1onlw3HTjsXX_1dSnJS9RscD1-6uW8jN_GsSQ6HCSje0/oa4lgf8
#
# It requres a 'continent' column, a idsurfacescale column, and sometimes a
# language column.
# Array of family names and t... | sarum90/langmapper | static/snippets/africalevelsurfacetones.py | Python | mit | 4,100 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from uthportal.tasks.course import CourseTask
class ee353(CourseTask):
document_prototype = {
"code": "ee353",
"announcements": {
"link_site": "",
"link_eclass": "http://eclass.uth.gr/eclass/modules/announcements/rss.php?c=MHX32... | kkanellis/uthportal-server | uthportal/library/inf/courses/ee353.py | Python | gpl-3.0 | 604 |
# Copyright 2016 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 to in writing, s... | tseaver/google-cloud-python | logging/google/cloud/logging/handlers/transports/base.py | Python | apache-2.0 | 1,740 |
from scipy import misc
from pathlib import Path
import image_utils as img
import hashlib
import os
from base64 import b64encode
for dir in os.listdir(os.path.join('res', 'orig')):
for file in os.listdir(os.path.join('res', 'orig', dir)):
if os.path.isfile(os.path.join('res', 'orig', dir, file)):
md5 = hashlib.md... | Proch92/euroClassifier | classificator/convert_images.py | Python | apache-2.0 | 905 |
import copy
import numpy as np
import nengo
from nengo.utils.network import with_self
class EnsembleArray(nengo.Network):
def __init__(self, neurons, n_ensembles, ens_dimensions=1, label=None,
**ens_kwargs):
if "dimensions" in ens_kwargs:
raise TypeError(
"'... | ZeitgeberH/nengo | nengo/networks/ensemblearray.py | Python | gpl-3.0 | 2,042 |
import cmdline
print("\n----- cmdline module -----\n")
print('* ' + '\n* '.join(dir(cmdline)))
print("\n----- parse_args() document -----\n")
print(cmdline.parse_args.__doc__)
| skitazaki/python-school-ja | src/mylib-sample.py | Python | mit | 178 |
#!/usr/bin/env python
#
# This script is based on the one found at http://vim.wikia.com/wiki/VimTip280
# but has been generalised. It searches the current working directory for
# *_test.py (good) or test_*.py (bad) files and runs each of the unit-tests
# found within.
#
# When run from within Vim as its 'makeprg' with ... | omalsa04/dotfiles | bin/alltests.py | Python | apache-2.0 | 1,875 |
# -*- 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 'Punn.youtube_id'
db.add_column('punns_punn', 'youtube_id',
self.gf('dj... | carquois/blobon | blobon/punns/migrations/0016_auto__add_field_punn_youtube_id.py | Python | mit | 5,502 |
from types import ModuleType
import logging
from KINCluster.core.cluster import Cluster
from KINCluster.core.extractor import Extractor
from KINCluster import settings as sets
class KINCluster:
__log = logging
__log.basicConfig(level=logging.INFO)
def __init__(self, pipeline, cluster=Cluster, extractor=E... | memento7/KINCluster | KINCluster/KINCluster.py | Python | mit | 1,586 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.logger import logger
try:
from opus_core.opus_gdal import OpusGDAL
except:
raise ImportError, 'failed to import OpusGDAL from opus_... | apdjustino/DRCOG_Urbansim | src/opus_gui/results_manager/run/indicator_framework/visualizer/visualizers/geotiff_map.py | Python | agpl-3.0 | 3,968 |
"""Constants for the Hue component."""
import logging
LOGGER = logging.getLogger('.')
DOMAIN = "hue"
API_NUPNP = 'https://www.meethue.com/api/nupnp'
| MartinHjelmare/home-assistant | homeassistant/components/hue/const.py | Python | apache-2.0 | 150 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/modules/cephalopod/blueprint.py | Python | gpl-3.0 | 1,345 |
# coding=utf-8
# Copyright 2021 The SLOE Logistic 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... | google-research/sloe-logistic | sloe_experiments/est_gamma.py | Python | apache-2.0 | 3,474 |
from __future__ import absolute_import
import sys
import pip
from pip.compat import stdlib_pkgs
from pip.basecommand import Command
from pip.operations.freeze import freeze
from pip.wheel import WheelCache
DEV_PKGS = ('pip', 'setuptools', 'distribute', 'wheel')
class FreezeCommand(Command):
"""
Output ins... | sigmavirus24/pip | pip/commands/freeze.py | Python | mit | 3,086 |
import socket, requests, json, codecs
from flask import Flask, request, jsonify
from manager import AcquireManager, HeartBeatManager
app = Flask(__name__)
manager = AcquireManager()
heart = HeartBeatManager()
@app.route('/')
def index():
return 'Hello World!'
@app.route('/get_my_ip')
def get_my_ip():
return ... | puhitaku/Remote-Sekisan-PyRemix | main.py | Python | mit | 1,112 |
# -*- python -*-
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from gdb_test import AssertEquals
import gdb_test
def test(gdb):
gdb.Command('break main')
AssertEquals(gdb.ResumeCommand('co... | leighpauls/k2cro4 | native_client/tests/gdb/call_from_gdb.py | Python | bsd-3-clause | 528 |
import os
from django import VERSION as DJANGO_VERSION
import oscar
from oscar.defaults import * # noqa
# Path helper
location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'),
... | vicky2135/lucious | tests/settings.py | Python | bsd-3-clause | 4,196 |
def multiples(x):
if x % 147 == 0:
return 'Fang'
elif x % 7 == 0:
return 'Fizz'
elif x % 15 == 0:
return 'Foo'
return 'Far'
| the-zebulan/CodeWars | katas/beta/multiples_2.py | Python | mit | 164 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-03-04 05:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djsend', '0002_auto_20160303_1712'),
]
operations = [
migrations.RemoveField... | rivasd/djPsych | djsend/migrations/0003_auto_20160304_0048.py | Python | gpl-3.0 | 2,647 |
## taken from http://www.djangosnippets.org/snippets/1289/
from django import template
from django.template import loader, Node, Variable
from django.utils.encoding import smart_str, smart_unicode
from django.template.defaulttags import url
from django.template import VariableDoesNotExist
register = template.... | jantoniomartin/django-machinery | indumatic/templatetags/breadcrumbs.py | Python | agpl-3.0 | 3,000 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Ferreyra, Jonathan <jalejandroferreyra@gmail.com>
# Copyright 2011 Fernandez, Emiliano <emilianohfernandez@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General ... | informaticameg/Posta | tools/pathtools.py | Python | gpl-3.0 | 2,123 |
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import Http404
from django.shortcuts import render
from .helpers import *
def listing(request):
random_article = None
article_list = helper_get_published_article()
paginator = Paginator(article_list, 10)
page ... | masood09/GaleArticles | article/views.py | Python | mit | 1,396 |
from mediadrop.forms.admin.storage.localfiles import *
| jobsafran/mediadrop | mediacore/forms/admin/storage/localfiles.py | Python | gpl-3.0 | 55 |
class TestStateLookup(object):
def test_simple_lookup(self):
from schedule.window import AWS_INSTANCE_STATES
assert AWS_INSTANCE_STATES.STOPPED == [80, 'stopped']
def test_state_value_matches_dict_values(self):
from schedule.window import AWS_INSTANCE_STATES
di = {u'Code': 16, ... | LostProperty/schedule | tests.py | Python | mit | 399 |
# -*- coding: utf-8 -*-
# Copyright 2019 Joan Marรญn <Github@JoanMarin>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
| odoo-colombia/l10n-colombia | l10n_co_product_uom/__init__.py | Python | agpl-3.0 | 159 |
#!/usr/bin/env python
# Usage: ./regrtest.py
import sys
import os, os.path
import subprocess
from subprocess import Popen, PIPE, call
import csv
timeout="2"
def isexec (fpath):
if fpath == None: return False
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
def which(program):
fpath, fname = o... | sav-tools/covenant | tests/play/regrtest.py | Python | mit | 4,962 |
# stacker, Python module for stacking of interferometric data.
# Copyright (C) 2014 Lukas Lindroos
#
# 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 yo... | centowen/stacker | uv/__init__.py | Python | gpl-2.0 | 8,256 |
#!/usr/bin/env python
###############################################################################
#
# Copyright 2010 Locomatix, 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
#
# ... | locomatix/locomatix-python | locomatix/cli/delete_all_fences.py | Python | apache-2.0 | 1,745 |
L = [lambda x: x ** 2, # Inline function definition
lambda x: x ** 3,
lambda x: x ** 4] # A list of 3 callable functions
for f in L:
print(f(2)) # Prints 4, 8, 16
print(L[0](3)) # Prints 9
def f1(x): return x ** 2
def ... | simontakite/sysadmin | pythonscripts/learningPython/lambdas1.py | Python | gpl-2.0 | 587 |
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: step2 --conditions auto:run2_mc_HIon --scenario HeavyIons -n 2 --eventcontent AODSIM -s RAW2DIGI,L1Reco,RECO --datatier AODSIM --beamspot R... | tuos/RECO2AOD | cfg/round3/v1/mc/step2_RAW2DIGI_L1Reco_DIJET_AODSIM.py | Python | mit | 3,961 |
# coding=utf-8
"""
ยฉ 2014 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | linkedin/naarad | lib/luminol/src/luminol/correlator.py | Python | apache-2.0 | 4,691 |
# -------------------------------------------------------------------
# Switch Class
# -------------------------------------------------------------------
# source: Brian Beck, PSF License, ActiveState Code
# http://code.activestate.com/recipes/410692/
class switch(object):
""" Readable switch construct... | AmritaLonkar/trunk | SU2_PY/SU2/util/switch.py | Python | gpl-2.0 | 1,518 |
"""
Barplot timeseries
==================
_thumb: .6, .4
"""
import numpy as np
import seaborn as sns
sns.set(style="white")
planets = sns.load_dataset("planets")
years = np.arange(2000, 2015)
g = sns.factorplot("year", data=planets, palette="BuPu",
size=6, aspect=1.5, x_order=years)
g.set_xticklab... | jakevdp/seaborn | examples/timeseries_of_barplots.py | Python | bsd-3-clause | 332 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | denny820909/builder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/unit/test_config.py | Python | mit | 43,114 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014 Alex Forencich
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 righ... | sephalon/python-ivi | ivi/agilent/agilentDSOX4022A.py | Python | mit | 1,689 |
# Copyright (c) 2014 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 ... | sebrandon1/neutron | neutron/extensions/dvr.py | Python | apache-2.0 | 2,605 |
"""Excitation lists base classes
"""
from math import sqrt
import numpy as np
import gpaw.mpi as mpi
from gpaw.output import initialize_text_stream
class ExcitationList(list):
"""General Excitation List class.
"""
def __init__(self, calculator=None, txt=None):
# initialise empty list
l... | qsnake/gpaw | gpaw/lrtddft/excitation.py | Python | gpl-3.0 | 2,982 |
""" This module loads all the classes from the VTK IO library into its
namespace. This is a required module."""
import os
if os.name == 'posix':
from libvtkIOPython import *
else:
from vtkIOPython import *
| naucoin/VTKSlicerWidgets | Wrapping/Python/vtk/io.py | Python | bsd-3-clause | 217 |
# -*- coding: utf-8 -*-
import sys
from collections import namedtuple, OrderedDict
from itertools import chain
from contextlib import contextmanager
import numpy
from AnyQt.QtWidgets import (
QGraphicsWidget, QGraphicsObject, QGraphicsLinearLayout, QGraphicsPathItem,
QGraphicsScene, QGraphicsView, QGridLayou... | cheral/orange3 | Orange/widgets/unsupervised/owhierarchicalclustering.py | Python | bsd-2-clause | 57,860 |
# encoding: utf-8
# module PyQt4.QtCore
# from /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import sip as __sip
from .QAnimationGroup import QAnimationGroup
class QSequentialAnimationGroup(QAnimationGroup):
""" QSequentialAnimationGroup(QObj... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtCore/QSequentialAnimationGroup.py | Python | gpl-2.0 | 2,169 |
"""In-memory representation of interfaces and other data structures.
The objects in this module are used to build a representation of an XML interface
file in memory.
@see: L{reader} constructs these data-structures
@see: U{http://0install.net/interface-spec.html} description of the domain model
@var defaults: Defau... | turtledb/0install | zeroinstall/injector/model.py | Python | lgpl-2.1 | 8,460 |
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__email__ = 'jeffrey.freeman@syncleus.com'
__li... | Syncleus/apex | tests/test_apex.py | Python | apache-2.0 | 671 |
# -*- coding:utf-8 -*-
import tornado.web
import turbo.app
from turbo import app_config
from turbo.core.exceptions import ResponseError, ResponseMsg
# start use session from here
# from lib.session import SessionStore, SessionObject
from turbo.template import turbo_jinja2
class MixinHandler(turbo.app.BaseHandler):
... | wecatch/app-turbo | demos/jinja2-support/apps/base.py | Python | apache-2.0 | 2,105 |
import time
import grovepi
from threading import Thread
class Sensor(Thread):
def __init__ (self, pin, avg_fraction=0.8):
Thread.__init__(self)
self.name = "Grove sound sensor"
self.shortname = "Sound"
self.pin = pin
self.avg_fraction = avg_fraction
self.value = 0
... | mywdka/grovepi_sensorlogger | sensors/sound.py | Python | gpl-3.0 | 1,185 |
"""Support for the Amazon Polly text to speech service."""
import logging
import voluptuous as vol
from homeassistant.components.tts import PLATFORM_SCHEMA, Provider
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
CONF_REGION = 'region_name'
CONF_ACCESS_KEY_ID = 'aws_acces... | MartinHjelmare/home-assistant | homeassistant/components/amazon_polly/tts.py | Python | apache-2.0 | 6,590 |
"""
SoftLayer.CLI.helpers
~~~~~~~~~~~~~~~~~~~~~
Helpers to be used in CLI modules in SoftLayer.CLI.modules.*
:license: MIT, see LICENSE for more details.
"""
from SoftLayer.CLI import exceptions
def resolve_id(resolver, identifier, name='object'):
"""Resolves a single id using a resolver functio... | cloudify-cosmo/softlayer-python | SoftLayer/CLI/helpers.py | Python | mit | 956 |
def render(blocks, name):
with open(name, "wb") as f:
for block in blocks:
f.write(block.content)
| vasili-v/ctauto | ctauto/renderer.py | Python | gpl-3.0 | 122 |
import re
from django import forms
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from decommentariis.models import CommentaryEntry, TEIEntry, TEISection
from decommentariis.models import Cohort, CohortMembers, CohortTexts
from crispy_forms.helper import FormHelper
from c... | scotartt/commentarius | decommentariis/decommentariis/forms.py | Python | gpl-2.0 | 2,980 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from collections import OrderedDict
from typing import Dict, List
import numpy as np
from fairseq.data import data_utils
from... | hfp/libxsmm | samples/deeplearning/sparse_training/fairseq/fairseq/data/multi_corpus_dataset.py | Python | bsd-3-clause | 4,849 |
class Tile():
def __init__(self, blocked, block_sight=None):
self.blocked = blocked
if block_sight is None: block_sight = blocked
self.block_sight = block_sight | jonathanabennett/practicerl | Tile.py | Python | gpl-3.0 | 179 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='amdtk',
version='1.0.0',
description='Acoustic Model Discovery Toolkit',
author='Lucas Ondel',
author_email='lucas.ondel@gmail.com',
packages=[
'amdtk',
'amdtk/io',
'amdtk/densities',
'amdtk/mod... | amdtkdev/amdtk | setup.py | Python | mit | 378 |
#!/usr/bin/python3
from numpy import *
import sys
import os.path
inputfile = sys.argv[1]
outputdir = sys.argv[2]
filename = os.path.basename(inputfile)
dotpos = filename.rindex('.')
basename = filename[:dotpos]
extension = filename[dotpos+1:]
sliceSize = float(sys.argv[3])
sliceNumber = 0
outputFileName = "%s/%s.... | fzenke/pubsim | mov/tiser_slice.py | Python | gpl-2.0 | 928 |
import os
from datetime import datetime
import shutil
from twisted.trial import unittest
from scrapy.extensions.spiderstate import SpiderState
from scrapy.spiders import Spider
from scrapy.exceptions import NotConfigured
from scrapy.utils.test import get_crawler
class SpiderStateTest(unittest.TestCase):
def tes... | pawelmhm/scrapy | tests/test_spiderstate.py | Python | bsd-3-clause | 1,418 |
import time
import sys
commands = {
'OUTPUT_RESET': 'A2',
'OUTPUT_STOP': 'A3',
'OUTPUT_POWER': 'A4', # seems to max out around 0x1F with 0x20 backwards
'OUTPUT_SPEED': 'A5',
'OUTPUT_START': 'A6',
'OUTPUT_POLARITY': 'A7', # 0x01 forwards, 0x00 toggle, 0xFF backwards
}
motors = {
'A': 1,
... | loopspace/microbit | lego/sender.py | Python | mit | 1,789 |
def fit_model(name, model, X_train, y_train, X_test, X_last, pred, pred_last):
"""Fits a classification model (for our purposes this is LR, LDA and QDA)
using the training data, then makes a prediction and subsequent "hit rate"
for the test data."""
from flask import Flask, request, render_templat... | ivtransgruasortiz/paquete_pip | ciff_2017_af3_asio/fit_model.py | Python | mit | 1,446 |
# 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
# distributed u... | openstack/barbican | barbican/common/policies/secrets.py | Python | apache-2.0 | 4,101 |
import re
import requests,time
import difflib
import xbmc,xbmcaddon
from ..scraper import Scraper
from ..common import clean_search, random_agent,send_log,error_log
from ..modules import cfscrape
scraper = cfscrape.create_scraper()
dev_log = xbmcaddon.Addon('script.module.universalscrapers').getSetting("dev_log")
heads... | felipenaselva/felipe.repository | script.module.universalscrapers/lib/universalscrapers/scraperplugins/serieswatch.py | Python | gpl-2.0 | 6,840 |
#
# opencv_version_check - displays the opencv version on the machine
#
# Start from command line using 'python opencv_version_check.py'.
import cv2
import cv2.cv
def main():
# opencv_version_check - prints opencv version
print "OpenCV %s" % cv2.__version__
if __name__ == "__main__":
main()
| j71200/drone | scripts/opencv_version_check.py | Python | gpl-3.0 | 310 |
from setuptools import setup, find_packages
setup(
name="peinfo",
version="3.0.0",
author="Facebook, Marcus LaFerrera (@mlaferrera)",
url="https://github.com/PUNCH-Cyber/stoq-plugins-public",
license="Apache License 2.0",
description="Gather relevant information about an executable using pefile... | PUNCH-Cyber/stoq-plugins-public | peinfo/setup.py | Python | apache-2.0 | 386 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
import requests
from psychopy import logging, prefs
import wx
from datetime import datetim... | psychopy/versions | psychopy/app/connections/news.py | Python | gpl-3.0 | 2,755 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**ISClipper test suite.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Softwar... | drayanaindra/inasafe | safe_qgis/test/test_qgis_environment.py | Python | gpl-3.0 | 2,248 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) Vauxoo (<http://vauxoo.com>).
# All Rights Reserved
###############Credits#########################################... | 3dfxsoftware/cbss-addons | account_reconcile_advance_tax/__openerp__.py | Python | gpl-2.0 | 1,869 |
from dataclasses import dataclass
from decimal import Decimal
from typing import Union
from babel.numbers import get_currency_precision
from django.conf import settings
from django.contrib.sites.models import Site
from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange
class TaxError(Exception):
"""Def... | maferelo/saleor | saleor/core/taxes.py | Python | bsd-3-clause | 2,095 |
# -*- coding: utf-8 -*-
# Scrapy settings for findJob project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest... | Gavsum/JobScrape | findJob/findJob/settings.py | Python | mit | 3,706 |
import os, shutil, re, glob, subprocess, logging, gzip
from autotest.client.shared import log, global_config, software_manager
from autotest.client import utils
GLOBAL_CONFIG = global_config.global_config
_LOG_INSTALLED_PACKAGES = GLOBAL_CONFIG.get_config_value('CLIENT',
... | ColinIanKing/autotest | client/base_sysinfo.py | Python | gpl-2.0 | 15,628 |
# -*- coding: utf-8 -*-
# ยฉ 2016-TODAY LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
class TestPaymentTransaction(TransactionCase):
def setUp(self, *args, **kwargs):
super(TestPaymentTransaction, self).setUp(*args, **kw... | stephen144/odoo-payment | payment_authorize_auto_reconcile/tests/test_payment_transaction.py | Python | agpl-3.0 | 6,205 |
# Copyright 2013 C. A. Fitzgerald
#
# 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 w... | riotopsys/rss-fetch | rssfetch/rss_handler.py | Python | apache-2.0 | 1,782 |
# -*- coding: utf-8 -*-
from settings import *
import sys
if '%d' in MEDIA_URL:
MEDIA_URL = MEDIA_URL % MEDIA_VERSION
if '%s' in ADMIN_MEDIA_PREFIX:
ADMIN_MEDIA_PREFIX = ADMIN_MEDIA_PREFIX % MEDIA_URL
TEMPLATE_DEBUG = DEBUG
MANAGERS = ADMINS
# You can override Django's or some apps' locales with these folder... | adamfisk/littleshoot-client | server/common/appengine/patch/common/appenginepatch/ragendja/settings_post.py | Python | gpl-2.0 | 3,683 |
# Copyright 2018 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/sim/simulator.py | Python | apache-2.0 | 44,153 |
#!/usr/bin/env python
"""
This is where the mainline sits and is responsible for setting up the logging,
the argument parsing and for starting up dashmat.
"""
from dashmat.actions import available_actions
from dashmat.collector import Collector
from dashmat.errors import BadTask
from delfick_app import App as Delfick... | realestate-com-au/dashmat | dashmat/executor.py | Python | mit | 3,227 |
import tkinter as tk
from tkinter import Button
import time
import numpy as np
from PIL import ImageTk, Image
PhotoImage = ImageTk.PhotoImage
UNIT = 100 # ํฝ์
์
HEIGHT = 5 # ๊ทธ๋ฆฌ๋์๋ ์ธ๋ก
WIDTH = 5 # ๊ทธ๋ฆฌ๋์๋ ๊ฐ๋ก
TRANSITION_PROB = 1
POSSIBLE_ACTIONS = [0, 1, 2, 3] # ์, ํ, ์ข, ์ฐ
ACTIONS = [(-1, 0), (1, 0), (0, -1), (0, 1)] #... | zzsza/TIL | reinforcement_learning/textbook summary/environment.py | Python | mit | 10,109 |
#jaula-change.py
import bge, bpy
import Player
from Level import Level
def main():
cont = bge.logic.getCurrentController()
obj = cont.owner
print("hola", obj.name)
touch = obj.sensors["Touch"]
replace = obj.actuators["replacemesh"]
if touch.positive:
scn = bge.logic.getC... | husk00/audiogames | argentina/src/lib/jaulachange.py | Python | gpl-3.0 | 727 |
# -*- coding: utf-8 -*-
from irc3.compat import asyncio
from irc3d import IrcServer
import irc3
@irc3.plugin
class Plugin(object):
def __init__(self, context):
self.log = context.log
self.context = context
@irc3.event(irc3.rfc.CONNECTED)
def connected(self, **kw):
self.context.jo... | mrhanky17/irc3 | examples/dcc_send_and_get.py | Python | mit | 2,286 |
from ..utils import *
##
# Minions
class UNG_020:
"""Arcanologist"""
pass
class UNG_021:
"""Steam Surger"""
pass
class UNG_027:
"""Pyros"""
pass
class UNG_846:
"""Shimmering Tempest"""
pass
##
# Spells
class UNG_018:
"""Flame Geyser"""
requirements = {PlayReq.REQ_TARGET_TO_PLAY: 0}
pass
class U... | jleclanche/fireplace | fireplace/cards/ungoro/mage.py | Python | agpl-3.0 | 730 |
from __future__ import print_function
# Time: O(n)
# Space: O(1)
# Rotate an array of n elements to the right by k steps.
#
# For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
#
# Note:
# Try to come up as many solutions as you can, there are at least 3 different ways to solv... | kamyu104/LeetCode | Python/rotate-array.py | Python | mit | 2,999 |
import htmls
from django import test
from django.conf import settings
from django.template.loader import render_to_string
from model_bakery import baker
from devilry.devilry_account.templatetags import devilry_account_tags
class TestDevilryUserVerboseInline(test.TestCase):
def test_no_fullname_cssclass(self):
... | devilry/devilry-django | devilry/devilry_account/tests/test_devilry_account_tags.py | Python | bsd-3-clause | 5,952 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
# Copyright (C) 2018 Ben McGinnes <ben@gnupg.org>
#
# 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 S... | gpg/gpgme | lang/python/examples/howto/mutt-groups.py | Python | lgpl-2.1 | 2,447 |
#!/usr/bin/env python3
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_... | sinraf96/electrum | qa/rpc-tests/bip9-softforks.py | Python | mit | 9,959 |
#!/usr/bin/env python -t
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Jonathan Delvaux <pyshell@djoproject.net>
# 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... | djo938/supershell | pyshell/arg/accessor/test/container_test.py | Python | gpl-3.0 | 792 |
# 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 applicable ... | tensorflow/tensorflow | tensorflow/tools/graph_transforms/python/transform_graph_test.py | Python | apache-2.0 | 3,185 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pisi.actionsapi import cmaketools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
WorkDir="ntadej-tano-78a3b67"
def setup():
shelltools.makedirs("build")
shelltools.cd("build")
cmaketools.configure... | aydemir/pardus-magic | tano/actions.py | Python | bsd-3-clause | 794 |
# -*- coding: utf-8 -*-
#
# Copyright ยฉ 2010 Andreas Blixt
#
# This file is part of Storyteller.
#
# Storyteller 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 opt... | blixt/storyteller | src/storyteller/utils.py | Python | gpl-3.0 | 3,118 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-03-01 06:42
from __future__ import unicode_literals
import os
from django.db import migrations
from django.contrib.auth.hashers import make_password
def create_default_superuser(apps, schema_editor):
"""
Creates a default super user
"""
Use... | dakshgautam/squealy | squealy/migrations/default_superuser.py | Python | mit | 2,046 |
from algorithms.sorting.bubblesort import bubble_sort
def test_bubble_sort_small(array_ints_small, assert_sorted):
assert_sorted(array_ints_small, bubble_sort)
def test_bubble_sort_large(array_ints_large, assert_sorted):
assert_sorted(array_ints_large[:800], bubble_sort)
| dieb/algorithms.py | tests/sorting/test_bubblesort.py | Python | mit | 283 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | gandreello/openthread | tests/scripts/thread-cert/Cert_5_1_05_RouterAddressTimeout.py | Python | bsd-3-clause | 5,990 |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 28 22:49:20 2013
stab
This is a direct re-implementation of Des Higham's SDE scripts.
Mean-square and asymptotic stability test for Euler-Maruyama
SDE is
dX = \lambda X dt + \mu X dW, X(0) = X_0
with \lambda = -3, \mu = \sqrt{3}, X_0 = 1.
@author: ih3
"""
impor... | IanHawke/HighamSDEs | stab.py | Python | unlicense | 1,407 |
# Copyright 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 requ... | afaheem88/tempest_neutron | tempest/thirdparty/boto/test_ec2_security_groups.py | Python | apache-2.0 | 3,379 |
# Copyright (C) 2009 Stijn Cole
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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 require... | rwl/PyDyn | pydyn/AugYbus.py | Python | apache-2.0 | 1,727 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.