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 |
|---|---|---|---|---|---|
"""Support for a demo mailbox."""
from hashlib import sha1
import logging
import os
from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError
from homeassistant.util import dt
_LOGGER = logging.getLogger(__name__)
MAILBOX_NAME = "DemoMailbox"
async def async_get_handler(hass, config, dis... | fbradyirl/home-assistant | homeassistant/components/demo/mailbox.py | Python | apache-2.0 | 2,449 |
"""
==============================================
Feature agglomeration vs. univariate selection
==============================================
This example compares 2 dimensionality reduction strategies:
- univariate feature selection with Anova
- feature agglomeration with Ward hierarchical clustering
Both metho... | cdegroc/scikit-learn | examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py | Python | bsd-3-clause | 3,663 |
#!/usr/bin/python3
#created by Christoph Latzer on 2017-01-31
#
#Name: writeToMYSQ.py
#
#Intended function: write lists/arrays to the MYSQL Database
#
#modified by on
#CL 2017-05-15 integrated reading of config file in this file
import logging
logging.info('Enter subrutine writeToMYSQ.py')
from mysql.connector impor... | ch010402/heating | writeToMysql.py | Python | mit | 4,311 |
'''
Created on 20. jan. 2012
@author: jpaasen_adm
'''
from framework.mynumpy import zeros, eye
def cholesky(A, n):
''' Calculates the Cholesky decomposition of the Hermitian matrix A such that U is upper triangular and U'*U = A '''
U = zeros([n, n], A.dtype)
for i in range(n):
upperColS... | jpaasen/cos | framework/linalg/matrixDecomp.py | Python | mit | 3,374 |
import argparse
import unittest
from util import *
# To run this script, HDFS should be installed locally and configured for S3 support.
# Please refer to s3-suppport.md in SSM repo's doc directory.
DEST_DIR = "s3a://xxxctest"
class TestS3(unittest.TestCase):
# copy to S3
def test_s3(self):
file_p... | littlezhou/SSM-1 | supports/integration-test/test_s3.py | Python | apache-2.0 | 1,750 |
import os
import re
from datetime import datetime
class Date:
def __init__(self, filename=None):
self.filename = filename
@staticmethod
def parse(date: str) -> str:
date = date.replace('YYYY', '%Y') # 2017 (year)
date = date.replace('YY', '%y') # 17 (year)
date = date.re... | ivandokov/phockup | src/date.py | Python | mit | 4,327 |
import re
import gzip
import logging
from dipper.sources.OMIMSource import OMIMSource
from dipper.models.Model import Model
from dipper.models.assoc.OrthologyAssoc import OrthologyAssoc
from dipper.models.Genotype import Genotype
from dipper.models.GenomicFeature import Feature, makeChromID, makeChromLabel
from dipper... | TomConlin/dipper | dipper/sources/NCBIGene.py | Python | bsd-3-clause | 32,581 |
'''
Servants is of primary interest to Python component developers.
The module names should sufficiently described their intended uses.
'''
__revision__ = "$Id: __init__.py,v 1.4 2005/02/25 23:42:32 dfugate Exp $"
| ACS-Community/ACS | LGPL/CommonSoftware/acspy/src/Acspy/Servants/__init__.py | Python | lgpl-2.1 | 214 |
"""
This component provides basic support for Lupusec Home Security system.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/lupusec
"""
import logging
import voluptuous as vol
from homeassistant.helpers import config_validation as cv
from homeassistan... | PetePriority/home-assistant | homeassistant/components/lupusec/__init__.py | Python | apache-2.0 | 2,593 |
import os
import shutil
from bot.utils.attributeobject import DictionaryObject, AttributeObject
class Storage(AttributeObject):
def __init__(self, base_dir):
super().__init__("_base_dir", "_cache")
self._base_dir = base_dir
self._cache = {}
def get_for_chat_id(self, chat_id):
... | alvarogzp/telegram-bot | bot/storage/__init__.py | Python | agpl-3.0 | 4,349 |
# helpviewer.py
import os
import subprocess
# Hardcoded list of available help viewers
# FIXME: khelpcenter support would be nice
#KNOWN_VIEWERS = ["/usr/bin/yelp", "/usr/bin/khelpcenter"]
KNOWN_VIEWERS = ["/usr/bin/yelp"]
class HelpViewer:
def __init__(self, docu):
self.command = []
self.docu = ... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/UpdateManager/HelpViewer.py | Python | gpl-3.0 | 984 |
#-*- coding: utf-8 -*-
# absolute_import makes shure this module won't clash with the library
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# This makes sure celery knows where settings are, so we don't need to set it
# when calling it from the command line
os.environ.se... | xmnlab/AlertaDengue | AlertaDengue/AlertaDengue/celery.py | Python | gpl-3.0 | 504 |
import asyncio
import functools
import wrapt
def futurized(o):
''' Makes the given object to be awaitable.
:param any o: Object to wrap
:return: awaitable that resolves to provided object
:rtype: asyncio.Future
Anything passed to :code:`futurized` is wrapped in :code:`asyncio.Future`.
This m... | kwarunek/aiounittest | aiounittest/helpers.py | Python | mit | 4,741 |
from selector import Selector
class AnySelector ( Selector ) :
def __call__( self, path ) :
return True
| rcthomas/capcom | capcom/selector/any_selector.py | Python | bsd-3-clause | 126 |
#!/usr/bin/env python
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in ... | nightpool/git-timeclock | git-timeclock.py | Python | gpl-3.0 | 4,207 |
def setup(pin_dht, loudness_pin):
print("setup")
def read_data(should_read_co2):
return [-1, -1, -1, -1]
def show_data(co2, temperature, humidity, loudness, timestamp):
print("Show data")
def cleanup():
return
| royveshovda/pifog | source/piclient/sensorpi/read_faker.py | Python | apache-2.0 | 234 |
# This file is part of ucgrad, Copyright 2008 David M. Rogers.
#
# ucgrad 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.
#
# ... | frobnitzem/forcesolve | cg_topol/ucgrad/__init__.py | Python | gpl-3.0 | 1,294 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/moonlight | moonlight/glyphs/repeated.py | Python | apache-2.0 | 1,334 |
#!/usr/bin/env python
from db_test import DBDakTestCase
from daklib.dbconn import DebVersion
from sqlalchemy import Table, Column, Integer, func
from sqlalchemy.orm import mapper
import unittest
class Version(object):
def __init__(self, version):
self.version = version
def __repr__(self):
r... | purism/pdak | tests/dbtest_debversion.py | Python | gpl-2.0 | 2,196 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Akretion
# (<http://www.akretion.com>).
#
# This program is free software: you can redistribute it and/or modify
# it unde... | OpenUpgrade-dev/OpenUpgrade | addons/fleet/migrations/8.0.0.1/post_migration.py | Python | agpl-3.0 | 1,304 |
from qm.fields import TextField, SetField
from qm.test.classes import ssh_host
import sys
import os
class RemoteHost(ssh_host.SSHHost):
# The wrapper script name to be used to invoke
# remote programs
wrapper = TextField()
wrapper_args = SetField(TextField())
def Run(self, path, arguments, enviro... | openvsip/openvsip | support/QMTest/remote_host.py | Python | gpl-2.0 | 985 |
# Copyright 2013 Pau Haro Negre
# based on C++ code by Carl Staelin Copyright 2009-2011
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | pauh/neuron | test/test_cognon_extended.py | Python | apache-2.0 | 8,950 |
from math import factorial
def combination(n, k):
numerator = factorial(n)
denominator = (factorial(k) * factorial(n - k))
return numerator/denominator
print(combination(20 + 20, 20))
| SonnyBrooks/ProjectEulerSwift | ProjectEulerSwift/Problem15.py | Python | mit | 198 |
from difflib import get_close_matches
if "get_forecasts(" not in __CODE:
print "You are not currently calling get_forecasts"
elif "average" not in locals():
print "The variable 'average' was not defined!"
print "Potential variables in your source code:", ", ".join(get_close_matches("average", locals()))
e... | RealTimeWeb/checkme | instructor_tests/cw12_1.py | Python | gpl-2.0 | 449 |
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils import timezone
# Create your models here.
@python_2_unicode_compatible # Compatibilidade com o python2
class Question(models.Model):
question_tex... | zicamc/ProSoccerSelection | polls/models.py | Python | gpl-3.0 | 1,110 |
#!/usr/bin/python
# Transformer un entier positif en un nombre de semaines et de jours
print('Donne moi une valeur : ', end='')
foo = int(input())
# I ❤ Python
print(foo, 'jours c\'est', foo // 7, 'semaine(s) et', foo % 7, 'jours')
| sumaxime/LIFAP1 | TP/TP1/Code/Python/4E.py | Python | mit | 235 |
import wx
import Global
from frameplayopt import FramePlayOptions
from panellogo import PanelLogo
from framedict import FrameDictionary
class MainFrame(wx.Frame):
def __init__(self):
BUTTON_SIZE = ((200,-1))
wx.Frame.__init__(self, parent=None,
title=Global.APP_... | afsungur/MemWord | mem.py | Python | gpl-3.0 | 2,541 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Mate Soos
#
# 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; version 2
# of the License.
#
# This program is distributed in th... | SmallLars/cryptominisat | tests/simp-checks/checks.py | Python | lgpl-3.0 | 3,483 |
from django.core.exceptions import ValidationError
from cyder.base.tests import ModelTestMixin, TestCase
from cyder.core.ctnr.models import Ctnr
from cyder.cydns.txt.models import TXT
from cyder.cydns.domain.models import Domain
class TXTTests(TestCase, ModelTestMixin):
def setUp(self):
self.ctnr = Ctnr.... | akeym/cyder | cyder/cydns/txt/tests/test_models.py | Python | bsd-3-clause | 1,817 |
from subprocess import call
import unittest
class TestDaemonizer(unittest.TestCase):
def test_permissions(self):
try:
pf = open(".tmp", 'w')
call(["echo", "test", ">", ".tmp"])
pid = str(pf.read().strip())
pf.close()
except IOError:
pid ... | damienstanton/p3daemon | test_daemonizer.py | Python | mit | 480 |
from __future__ import unicode_literals
from django.apps import AppConfig
class LibraryConfig(AppConfig):
name = 'library'
| django-school-management/ssms | ssms/common/facilities/library/apps.py | Python | lgpl-3.0 | 130 |
import os, json, subprocess
celcius_config = None
home_path = '~'
env_home_path = os.environ.get('HOME')
if env_home_path != None:
home_path = env_home_path
dot_celcius_path = os.path.join(home_path, '.celcius')
config_file = os.path.join(dot_celcius_path, 'config.json')
if os.path.exists(config_file):
with o... | claymcleod/celcius | lib/celcius/utils/file_utils.py | Python | mit | 789 |
# -*- coding: UTF-8 -*-
import larv
import pymunk
from pymunk.vec2d import Vec2d
class PositionComponent(larv.Component):
"""
x and y are standarized coordinates,
but the rect should be in pygame's.
"""
def __init__(self, x, y, rect = None):
self.x = x
self.y = y
# self.posi... | GMadorell/Shades | Code/Pieces/Components/PositionComponent.py | Python | mit | 419 |
import chimera.core.log
from chimera.core.remoteobject import RemoteObject
from chimera.core.exceptions import ChimeraException
from chimera.core.version import _chimera_name_, _chimera_long_description_
from chimera.util.coord import Coord
from chimera.util.position import Position
from chimera.util.filenamesequenc... | wschoenell/chimera_imported_googlecode | src/chimera/util/image.py | Python | gpl-2.0 | 13,397 |
"""
This scripts implements cross disease predicitons using RQF model trained on dengue
"""
from infodenguepredict.models.quantile_forest import build_model, build_lagged_features, calculate_metrics
from infodenguepredict.data.infodengue import get_cluster_data, get_city_names
from infodenguepredict.predict_settings i... | AlertaDengue/InfoDenguePredict | infodenguepredict/models/cross_prediction_RQF.py | Python | gpl-3.0 | 3,729 |
import footnote
import json
FOOTNOTES = json.loads("""
[
["giffgaff_free",
"giffgaff free calls and texts to giffgaff numbers lasts for 3 months from each top-up."],
["fonome_quiet",
["poor", "Both of Fonome’s contact telephone numbers are currently unavailable."]],
["not_uk", "Auracall and GO-SIM have mo... | petef4/payg | test_footnote.py | Python | mit | 1,530 |
# -*- encoding: latin-1 -*-
# Latin-1 encoding needed for countries list.
"""Place names and other constants often used in web forms.
"""
def uk_counties():
"""\
Return a list of UK county names.
"""
# Based on http://www.gbet.com/AtoZ_counties/
# Updated 2007-10-24
return [x.strip()[2:] for x ... | grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/WebHelpers-1.3-py2.7.egg/webhelpers/constants.py | Python | apache-2.0 | 10,831 |
#!/usr/bin/python
import os,sys,glob,shutil
fullset = range(1,198)
outfiles = []
completednumbers = []
queueline = []
for file in glob.glob('*.nrrdGauSmooth.tiff'):
completednumbers.append(int(file.split('.')[0].split('_')[1]))
redo = [int(i) for i in fullset]
redo3 = list(set(redo).difference(completednumbers))
str... | sthyme/ZFSchizophrenia | cluster_pErk_imageprocessing/warped_smoothing_queuecheck.py | Python | mit | 425 |
import os
import sys
from distutils.core import setup
if sys.version_info[0] >= 3:
from distutils.command.build_py import build_py_2to3 as build_py
from distutils.command.build_scripts import build_scripts_2to3 as build_scripts
else:
from distutils.command.build_py import build_py
from distutils.command... | bhuvneshdev/coreference | setup.py | Python | gpl-2.0 | 1,769 |
# -*- coding: utf-8 -*-
##
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
# This file is part of openmano
# 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 ... | nfvlabs/openmano | openmano/nfvo.py | Python | apache-2.0 | 126,529 |
# Xandikos
# Copyright (C) 2016-2017 Jelmer Vernooij <jelmer@jelmer.uk>, et al.
#
# 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; version 3
# of the License or (at your option) any later version ... | jelmer/xandikos | xandikos/store/config.py | Python | gpl-3.0 | 4,820 |
# -*- coding: utf-8 -*-
import csv
from django.contrib import admin
from django.urls import reverse
from django.http import HttpResponse
from django.urls import reverse
from django.utils.encoding import smart_str
from djspace.core.admin import PROFILE_LIST
from djspace.core.admin import GenericAdmin
from djspace.regi... | carthagecollege/django-djspace | djspace/registration/admin.py | Python | bsd-3-clause | 5,497 |
import rdflib
from rdflib.term import URIRef, Variable
from PyOpenWorm.dataObject import DataObject, InverseProperty
from PyOpenWorm.context import Context
from PyOpenWorm.context_store import ContextStore
from .DataTestTemplate import _DataTest
try:
from unittest.mock import MagicMock, Mock
except ImportError:
... | gsarma/PyOpenWorm | tests/ContextTest.py | Python | mit | 12,077 |
import copy
from flask import current_app
from .test_base import BaseTestCase
from inspectors.inspections.serializers import (
supervisor_schema,
inspector_schema,
inspection_schema,
)
from inspectors.inspections.util import (
SchemaLoader
)
from inspectors.inspections.mo... | codeforamerica/mdc-inspectors | tests/test_serializers.py | Python | bsd-3-clause | 3,415 |
# encoding: utf-8
"""
configuration.py
Created by Thomas Mangin on 2009-08-25.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""
import os
import sys
import stat
import time
import socket
from pprint import pformat
from copy import deepcopy
from struct import pack,unpack
from exabgp.util.ip import isip... | mshahbaz/exabgp | lib/exabgp/configuration/file.py | Python | bsd-3-clause | 86,704 |
"""
Author: RedFantom
License: GNU GPLv3
Copyright (c) 2017-2018 RedFantom
"""
from ._widget import ThemedWidget
import tkinter as tk
from tkinter import ttk
class ThemedStyle(ttk.Style, ThemedWidget):
"""
Style that supports setting the theme for a Tk instance. Can be
used as a drop-in replacement for no... | SAOImageDS9/SAOImageDS9 | ttkthemes/ttkthemes/themed_style.py | Python | gpl-3.0 | 1,570 |
#!/usr/bin/env python3
import time
import random
import socket
from flask import Flask, render_template, redirect, url_for, request, jsonify
import config
log = None
# classes
class Agent():
def __init__(self, ip, cw=True, node=None, state='initial'):
self.ip = ip
self.cw = cw
self.state... | secgroup/MTFGatheRing | code/web.py | Python | mit | 7,006 |
# AML package
# Author: Francesco Racciatti (racciatti.francesco@gmail.com)
__version__ = '2.0'
__all__ = ['aml']
| francescoracciatti/aml | aml/__init__.py | Python | mit | 115 |
# Adolpy - Algorithmic Differentiation Through Operator Overloading on
# Python using the Forward Method.
#
# Copyright (C) 2008 Luis Zarrabeitia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | zarrabeitia/adolpy | adolpy/common.py | Python | gpl-3.0 | 4,460 |
"""
The module implements Fisher Discriminant Analysis.
"""
__author__ = 'Michael Kagan mkagan@cern.ch'
#
# Code based on sklearn LDA code written by: Matthieu Perrot
# Mathieu Blondel
#
# using algorithms as described in:
# Zhang, et. al. 'Regularized Discriminant Analysis, R... | ml-slac/deep-jets | training/fisher.py | Python | mit | 37,255 |
"""This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
"""This file contains class definitions for:
Hist: represents a histogram (map ... | flychen50/thinkstat | thinkstats2.py | Python | mit | 54,008 |
# encoding: utf8
import signal
import traceback
from uuid import uuid4
from multiprocessing import Pool
from functools import partial
from collections import defaultdict
import time
from henet import logger
def _run(func, *args):
try:
result = func(*args)
except Exception:
return False, trace... | AcrDijon/henet | henet/workers.py | Python | apache-2.0 | 1,978 |
import cloudinary
def consts(request):
return dict(
THUMBNAIL = {
"crop": "fit", "width": 240,
},
CLOUDINARY_CLOUD_NAME = cloudinary.config().cloud_name
) | plankter/augeo-cloud | core/context_processors.py | Python | mit | 199 |
#!/usr/bin/env python
"""End to end tests for GRR administrative flows."""
from grr_response_test.end_to_end_tests import test_base
class TestGetClientStats(test_base.EndToEndTest):
"""GetClientStats test."""
platforms = test_base.EndToEndTest.Platform.ALL
def runTest(self):
f = self.RunFlowAndWait("GetC... | google/grr | grr/test/grr_response_test/end_to_end_tests/tests/administrative.py | Python | apache-2.0 | 1,599 |
import warnings
import numpy as np
import scipy as sp
import pandas as pd
from collections import namedtuple
from openpnm.utils import Workspace, logging
from openpnm.utils.misc import PrintableList, SettingsDict, Docorator
docstr = Docorator()
logger = logging.getLogger(__name__)
ws = Workspace()
@docstr.get_section... | TomTranter/OpenPNM | openpnm/core/Base.py | Python | mit | 72,439 |
# 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... | allenlavoie/tensorflow | tensorflow/python/layers/base_test.py | Python | apache-2.0 | 20,688 |
"""
The Job Agent class instantiates a CE that acts as a client to a
compute resource and also to the WMS.
The Job Agent constructs a classAd based on the local resource description in the CS
and the current resource status that is used for matching.
"""
__RCSID__ = "$Id$"
from DIRAC ... | marcelovilaca/DIRAC | WorkloadManagementSystem/Agent/JobAgent.py | Python | gpl-3.0 | 26,847 |
import unittest
import math
import jit
class TestTypes(unittest.TestCase):
def test_static_types(self):
self.assertEqual(jit.Type.void.type, jit.TYPES.VOID)
self.assertEqual(jit.Type.sbyte.type, jit.TYPES.SBYTE)
self.assertEqual(jit.Type.ubyte.type, jit.TYPES.UBYTE)
self.assertEqua... | gergo-/pylibjit | libjit-python/tests.py | Python | gpl-2.0 | 17,451 |
# Copyright (c) 2010 ActiveState Software Inc. All rights reserved.
import sys
import os
from os import path as P
import logging
from operator import attrgetter
import collections
import activestate
import six
from pkg_resources import Requirement
from applib import sh
from applib import log
from applib import textui... | igemsoftware/SYSU-Software2013 | project/Python27_32/Lib/site-packages/pypm/client/command.py | Python | mit | 36,612 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | YoshikawaMasashi/magenta | magenta/music/melody_encoder_decoder.py | Python | apache-2.0 | 12,985 |
from django.conf.urls.defaults import *
from django.contrib import admin
import dbindexer
handler500 = 'djangotoolbox.errorviews.server_error'
# django admin
admin.autodiscover()
# search for dbindexes.py in all INSTALLED_APPS and load them
dbindexer.autodiscover()
urlpatterns = patterns('',
('^_ah/warmup$', 'd... | NetDBNCKU/GAE-Conference-Web-App | urls.py | Python | bsd-3-clause | 485 |
# source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget
import sys
import os
import re
import traceback
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from electrum import util
from electrum.i18n import _
from .util import MONOSPACE_FONT... | neocogent/electrum | electrum/gui/qt/console.py | Python | mit | 11,814 |
# -*- coding: utf-8 -*-
"""Collection of tests around common path and url shorthands."""
from __future__ import unicode_literals
import pytest
from cookiecutter.config import BUILTIN_ABBREVIATIONS
from cookiecutter.repository import expand_abbreviations
@pytest.mark.parametrize(
('template', 'abbreviations', '... | michaeljoseph/cookiecutter | tests/repository/test_abbreviation_expansion.py | Python | bsd-3-clause | 1,903 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#############################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits########################... | thinkasoft/ProyectoRD-dev | l10n_ve_withholding_muni/__openerp__.py | Python | agpl-3.0 | 2,330 |
# -*- coding: utf-8 -*-
# This file is part of Knitlib.
#
# Knitlib 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.
#
# ... | fashiontec/knitlib | src/knitlib/plugins/dummy_plugin.py | Python | lgpl-3.0 | 1,842 |
import copy
import logging
import os
import re
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from ConfigParser import Error as ConfigParserError, SafeConfigParser
from decimal import Decimal
from django import forms
from django.conf import settings as django_settings
f... | c4mb0t/django-setman | setman/utils.py | Python | bsd-3-clause | 20,042 |
import numpy as np
class Batching:
def __init__(self, x, y):
self.x = np.array(x)
self.y = np.array(y)
self.last_batch_start = 0
self.last_batch_end = 0
def next_batch(self, batch_size):
self.last_batch_start = self.last_batch_end
self.last_batch_end = self.las... | NicRSkinner/cnn-number-identification-tf | Batching.py | Python | gpl-3.0 | 532 |
"""
A PyrobotSimulator world. A large room with two robots and
two lights.
(c) 2005, PyroRobotics.org. Licensed under the GNU GPL.
"""
from pyrobot.simulators.pysim import TkSimulator, TkPioneer, \
PioneerFrontSonars, PioneerFrontLightSensors
def INIT():
# (width, height), (offset x, offset y), scale:
s... | emilydolson/forestcat | pyrobot/plugins/worlds/Pyrobot/Challenge1.py | Python | agpl-3.0 | 1,162 |
"""
Tests for `bx.align.score`.
"""
import unittest
from io import StringIO
from numpy import (
allclose,
array,
cumsum,
)
import bx.align.maf
import bx.align.score
aligns = [("CCACTAGTTTTTAAATAATCTACTATCAAATAAAAGATTTGTTAATAATAAATTTTAAATCATTAACACTT",
"CCATTTGGGTTCAAAAATTGATCTATCA----------TGGT... | bxlab/bx-python | lib/bx/align/score_tests.py | Python | mit | 3,688 |
import sys, pygame, math
from Ball import *
pygame.init()
class Ball():
def __init__(self, images, speed, pos=[0,0]):
self.speedx = speed[0]
self.speedy = speed[1]
self.speed = [self.speedx, self.speedy]
self.images = []
for image in images:
self.images ... | KRHS-GameProgramming-2015/Epic-Pong | Ball.py | Python | bsd-2-clause | 4,032 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | NoctuaNivalis/qutebrowser | qutebrowser/completion/completionwidget.py | Python | gpl-3.0 | 14,330 |
# -*- coding: utf-8 -*-
"""
SHARE Seismic Source Toolkit
Attribute computation on ASZ layer.
Author: Fabian Euchner, fabian@sed.ethz.ch
"""
############################################################################
# This program is free software; you can redistribute it and/or modify #
# it under the terms... | feuchner/seismicsource-toolkit | mt_seismicsource/engine/asz.py | Python | gpl-2.0 | 7,504 |
# flake8: noqa
from __future__ import unicode_literals
from .abc import ABCIE
from .abc7news import Abc7NewsIE
from .abcnews import (
AbcNewsIE,
AbcNewsVideoIE,
)
from .academicearth import AcademicEarthCourseIE
from .acast import (
ACastIE,
ACastChannelIE,
)
from .addanime import AddAnimeIE
from .adob... | dntt1/youtube-dl | youtube_dl/extractor/extractors.py | Python | unlicense | 25,750 |
import json
import sys
import fileutil
KeyTable = {
'medallion': 'm',
'hack_license': 'h',
'vendor_id': 'v',
'rate_code': 'c',
'store_and_fwd_flag': 'fw',
'pickup_datetime': 'pd',
'dropoff_datetime': 'dd',
'passenger_count': 'p',
'trip_time_in_secs': 's',
'trip_distance': 'd',
... | XDATA-Year-3/geoapp | utils/load_pg.py | Python | apache-2.0 | 2,574 |
# File: xmldocutils.py
# * P_LZ_COPYRIGHT_BEGIN ******************************************************
# * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
# * Use is subject to license terms. *
# * P_LZ_COPYRIGHT_END *********************************... | mcarlson/openlaszlo | WEB-INF/lps/server/sc/xmldocutils.py | Python | epl-1.0 | 6,492 |
"""Benchmark Walk algorithm"""
import numpy as np
import bench
import obsoper.walk
class BenchmarkWalk(bench.Suite):
def setUp(self):
longitudes, latitudes = np.meshgrid([1, 2, 3],
[1, 2, 3],
indexing="ij")
sel... | met-office-ocean/obsoper | benchmarks/bench_walk.py | Python | bsd-3-clause | 551 |
class Breakpoint():
def __init__(self, breakpointNumber):
self.breakpointNumber = breakpointNumber
class BreakpointPPUByTime(Breakpoint):
def __init__(self, breakpointNumber, scanline, tick):
Breakpoint.__init__(self, breakpointNumber)
self._scanline = scanline
self._t... | aLaix2/O-Nes-Sama | DebuggerClient/Breakpoint.py | Python | gpl-3.0 | 1,060 |
from __future__ import print_function
import os
import ssl
import sys
import cassandra
from cassandra import auth
from cassandra.cluster import Cluster
import yaml
from cdeploy import cqlexecutor
class Migrator:
def __init__(self, migrations_path, session):
print('Reading migrations from {0}'.format(mig... | Kuwagata/cdeploy | cdeploy/migrator.py | Python | apache-2.0 | 5,863 |
# Source:
# http://stackoverflow.com/questions/21839676/how-to-write-a-downloadhandler-for-scrapy-that-makes-requests-through-socksipy
from txsocksx.http import SOCKS5Agent
from scrapy.core.downloader.handlers.http11 import HTTP11DownloadHandler, ScrapyAgent
from twisted.internet import reactor
from scrapy.xlib.tx impo... | MisterTofu/scrapy-midleware | middleware/TorProxy.py | Python | gpl-3.0 | 1,353 |
"""Tablib - Command-line Interface table export support.
Generates a representation for CLI from the dataset.
Wrapper for tabulate library.
"""
from tabulate import tabulate as Tabulate
class CLIFormat:
""" Class responsible to export to CLI Format """
title = 'cli'
DEFAULT_FMT = 'plain'
@clas... | kennethreitz/tablib | src/tablib/formats/_cli.py | Python | mit | 611 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | projects/greedy_infomax/experiments/super_greedy_blockwise.py | Python | agpl-3.0 | 5,943 |
###########################################################################
# Number 3
###########################################################################
import sys
import os
import pandas as pd
import datetime
import os.path
import glob
import csv
import re
path=sys.argv[1]
# Failed reads
#os.system('pore... | currymj/hackathon-identification-group2 | group2_report1_question3.py | Python | gpl-2.0 | 2,006 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 (t... | plumgrid/plumgrid-nova | nova/network/linux_net.py | Python | apache-2.0 | 71,298 |
from ncclient import manager
import ncclient
import xml.etree.ElementTree as ET
host = "192.168.1.1"
username="root"
password="root"
config_xml="""
<config>
<of11-config:capable-switch xmlns:of11-config="urn:onf:of111:config:yang">
<ofdpa10:vni xmlns:ofdpa10="urn:bcm:ofdpa10:ac... | macauleycheng/AOS_OF_Example | 000-Netconf/03-VxLAN/04_create_vni/edit-config-create-vni-only.py | Python | apache-2.0 | 847 |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
"""
`Unit tests for cargo.clients.Postgres`
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
2016 Jared Lunde © The MIT License (MIT)
http://github.com/jaredlunde
"""
import unittest
import psycopg2
from cargo.cursors import *
from... | jaredlunde/cargo-orm | unit_tests/clients/Postgres.py | Python | mit | 4,947 |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 5 05:22:05 2015
@author: rep
"""
import os
files = os.listdir('.')
layer_names = open('./Vancouver_layer_names.txt','w')
#layer_names.write('Vancouver_layer Layer Names: \n')
out = open('edmon_data_complete'+'.'+'js','w')
for f in files:
if f.startswith('ed') and f... | terratenney/CODE | data/data_merege.py | Python | gpl-3.0 | 546 |
"""
STDP example in Brian
=====================
Simulation of a single LIF neuron driven by 250 input spike trains.
Connection weights are adjusted using STDP. The weight changes are recorded
and plotted at the end of the simulation.
"""
from brian import *
Ninputs = 250
eqs = "dV/dt = (Vrest-V)/tau : volt"
Vrest ... | achilleas-k/brian-scripts | stdp/brian_stdp.py | Python | apache-2.0 | 2,216 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | kdart/pycopia | core/pycopia/OS/FreeBSD/rcconfig.py | Python | apache-2.0 | 3,319 |
#
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Zimbra, Inc.
#
# The contents of this file are subject to the Zimbra Public License
# Version 1.3 ("License"); you may not use this file except in
# compliance with the License. You may obtain a c... | nico01f/z-pec | ZimbraServer/src/python/pylibs/localconfig.py | Python | mit | 1,786 |
from flask.ext.mongoengine.wtf import model_form
from mongoengine import *
class User(Document):
email = StringField(required=True)
password = StringField(required=True)
def is_authenticated(self):
return True
def is_active(self):
return True
def get_id(self):
return sel... | bootandy/flask-sample | product/models.py | Python | mit | 508 |
################################################################
# LiveQ - An interactive volunteering computing batch system
# Copyright (C) 2013 Ioannis Charalampidis
#
# 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 ... | wavesoft/LiveQ | liveq-jobmanager/jobmanager/io/teamqueue.py | Python | gpl-2.0 | 1,361 |
import agagd_core.models as agagd_models
import django_tables2 as tables
default_bootstrap_header_column_attrs = {
"class": "table",
"thead": {"class": "thead-dark"},
"th": {"scope": "col"},
}
class TopDanTable(tables.Table):
pin_player = tables.Column(
orderable=False,
linkify={
... | usgo/agagd | agagd/agagd_core/tables/top_players.py | Python | mit | 1,316 |
from .kernel import BashKernelBuffered
| NII-cloud-operation/Jupyter-LC_wrapper | lc_wrapper/bash/__init__.py | Python | bsd-3-clause | 39 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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... | deepmind/neural_testbed | neural_testbed/likelihood/utils_test.py | Python | apache-2.0 | 1,794 |
from unittest import mock
from aiohttp import web
import pytest
from aiohttp.test_utils import make_mocked_coro
from sockjs.transports import htmlfile
@pytest.fixture
def make_transport(make_manager, make_request, make_handler, make_fut):
def maker(method="GET", path="/", query_params={}):
handler = mak... | aio-libs/sockjs | tests/test_transport_htmlfile.py | Python | apache-2.0 | 2,175 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, platform, requests, time
pparev = input("ppa revision number: ")
pparev = '-ppa'+str(pparev)
series = os.popen("lsb_release -c").read().split('\t')[1].strip() #input("distro series: ")
#series = os.popen("cat /etc/debian_version").read().split('/')[0].strip()... | sam81/pychoacoustics | prep-release/make_deb.py | Python | gpl-3.0 | 3,436 |
#!/usr/bin/env python
#------------------------------------------------------------------------------#
# errors.py #
# #
# Copyright (c) 2009, Code A La Mode, original autho... | sanand0/open-data-india | errors.py | Python | gpl-3.0 | 4,050 |
#!/usr/bin/env python
# encoding: utf-8
__author__ = "Carlos González Sesmero"
# When import with * symbol.
__all__ = ["config", "const", "settings",
"analyx", "entities", "funcionalityx", "utils"]
# print("Importamos {} en el path {}".format(__name__, __path__))
| carlos-gs/MiStuRe | misture_core/MISTURE/__init__.py | Python | gpl-3.0 | 276 |
#!/usr/bin/env python
'''It calculates the coverage distribution for a samtools pileup file.
It requires a samtools pileup file.The script can generate a plot with the distribution and/or a text file with the
distribution values.
'''
# Copyright 2009 Jose Blanca, Peio Ziarsolo, COMAV-Univ. Politecnica Valencia
# This... | JoseBlanca/franklin | scripts/stats/sam_pileup_distrib.py | Python | agpl-3.0 | 2,775 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | vincent-noel/libSigNetSim | libsignetsim/cwriter/CWriterModels.py | Python | gpl-3.0 | 6,919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.