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 |
|---|---|---|---|---|---|
import re
from rarfile import _next_newvol, _next_oldvol
from ..plugin import StreamerBase, ProcessorBase
class RarStreamer(StreamerBase):
plugin_name = 'rar'
def __init__(self, item, lazy=False):
self.item = item
self.lazy = lazy
def _find_all_first_files(self, item):
"""
... | JohnDoee/thomas | thomas/streamers/rar.py | Python | mit | 2,781 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | WSCU/crazyflie_ros | src/cfclient/utils/singleton.py | Python | gpl-2.0 | 1,499 |
icons = {True : 'fa fa-toggle-on', False : 'fa fa-toggle-off'}
info = {'name' : 'basic', 'number' : '20', 'types' : False}
fields = {'type' : "bool", 'readonly' : True, 'name' : 'Basic', 'web_field' :
False}
def icon(value):
return icons[bool(value)]
def event(payload):
data = {'commandclass' : in... | CTSNE/NodeDefender | NodeDefender/icpe/zwave/commandclass/basic/__init__.py | Python | mit | 540 |
import markdown
from markdown import etree
DEFAULT_URL = "http://www.freewisdom.org/projects/python-markdown/"
DEFAULT_CREATOR = "Yuri Takhteyev"
DEFAULT_TITLE = "Markdown in Python"
GENERATOR = "http://www.freewisdom.org/projects/python-markdown/markdown2rss"
month_map = { "Jan" : "01",
"Feb" : "02",
... | lepture/Vealous | vealous/markdown/extensions/rss.py | Python | bsd-3-clause | 3,693 |
from django.db import models
from django.conf import settings
from django.core.validators import MinValueValidator, MaxValueValidator
from ekratia.topics.models import Topic
class Delegate(models.Model):
"""
Delegate Model stores the delegations made by user in the system.
"""
#: User delgating
us... | andresgz/ekratia | ekratia/delegates/models.py | Python | bsd-3-clause | 857 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.auth.models import Permission
from django.contrib.auth.models import AnonymousUser
try:
from django.conf.urls import url, patterns, include, handler404, handler500
except Impor... | khamaileon/django-guardian | guardian/compat.py | Python | bsd-2-clause | 2,527 |
'''@file test.py
this file will test the asr combined with an lm'''
import os
from six.moves import configparser
import tensorflow as tf
from tensorflow.contrib.framework.python.framework import checkpoint_utils
from nabu.neuralnetworks.classifiers import asr_lm_classifier
from nabu.neuralnetworks.decoders import deco... | JeroenBosmans/nabu | test.py | Python | mit | 5,120 |
# regression test for SAX 2.0 -*- coding: iso-8859-1 -*-
# $Id: test_sax.py,v 1.1.1.1 2006/05/30 06:06:14 hhzhou Exp $
from xml.sax import make_parser, ContentHandler, \
SAXException, SAXReaderNotAvailable, SAXParseException
try:
make_parser()
except SAXReaderNotAvailable:
# don'... | kontais/EFI-MIPS | ToolKit/cmds/python/Lib/test/skipped/test_sax.py | Python | bsd-3-clause | 19,483 |
# Copyright (C) 2011-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2010 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# 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
#
# ... | WebSpider/djangosaml2 | djangosaml2/tests/conf.py | Python | apache-2.0 | 3,818 |
import re
import os
class ACAdapter:
present = False
name = ''
def get_ac_adapters():
r = []
try:
lst = []
lst = os.listdir('/proc/acpi/ac_adapter')
except:
pass
for x in lst:
try:
a = ACAdapter()
a.name = x
ss... | Shanto/ajenti | plugins/power/backend.py | Python | lgpl-3.0 | 2,240 |
from __future__ import absolute_import
from .CoolProp import HAProps, HAProps_Aux, cair_sat | CoolProp/CoolProp-museum | wrappers/Python/CoolProp/HumidAirProp.py | Python | mit | 91 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2012, 2013, 2014, 2015 CERN.
#
# Zenodo 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 o... | otron/zenodo | zenodo/shell.py | Python | gpl-3.0 | 3,274 |
from django.template.base import Library
from static_precompiler.compilers import SASS
from static_precompiler.templatetags.base import BaseInlineNode
register = Library()
compiler = SASS()
class InlineSASSNode(BaseInlineNode):
compiler = compiler
#noinspection PyUnusedLocal
@register.tag(name="inlinesass")
... | woodymit/millstone_accidental_source | celery_manager/static_precompiler/templatetags/sass.py | Python | mit | 551 |
# 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 under t... | cernops/keystone | keystone/common/sql/migrate_repo/versions/085_add_endpoint_filtering_table.py | Python | apache-2.0 | 2,467 |
## Dates in timeseries models
from __future__ import print_function
import statsmodels.api as sm
import pandas as pd
# ## Getting started
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
dates = sm.tsa.datetools.dates_from_range('1700', length=len(da... | bert9bert/statsmodels | examples/python/tsa_dates.py | Python | bsd-3-clause | 1,180 |
"""
NEPI, a framework to manage network experiments
Copyright (C) 2013 INRIA
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 optio... | phiros/nepi | examples/omf/testing/nepi_omf5_iminds_stdin.py | Python | gpl-3.0 | 2,831 |
from __future__ import division # For Python 2 compatibility
"""Pareto smoothed importance sampling (PSIS)
This module implements Pareto smoothed importance sampling (PSIS) and PSIS
leave-one-out (LOO) cross-validation for Python (Numpy).
Included functions
------------------
psisloo
Pareto smoothed importance sa... | tsivula/BDA_py_demos | utilities_and_data/psis.py | Python | gpl-3.0 | 11,215 |
# Plaid stimulus
#
# Copyright (C) 2010-2013 Huang Xin
#
# See LICENSE.TXT that came with this file.
# Taget stimuli
#
# Copyright (C) 2010-2013 Huang Xin
#
# See LICENSE.TXT that came with this file.
from VisionEgg.Gratings import SinGrating2D
from LightData import dictattr
from Core import Stimulus
class Plaid(S... | chrox/RealTimeElectrophy | StimControl/LightStim/Plaid.py | Python | bsd-2-clause | 2,071 |
SUCCESS = 'success'
FAILURE = 'failure'
WARNING = 'warning'
class PyAem2Result():
def __init__(self, response):
self.response = response
self.status = None
self.message = None
def success(self, message):
self.status = SUCCESS
self.message = message
def failur... | wildone/pyaem | pyaem2/result.py | Python | mit | 1,262 |
#!/bin/python
# -*- coding: utf-8 -*-
"""Print."""
from .exceptions import InvalidUsage
from flask import request
def update_token(cursor, connection, token, new_token):
"""Validate Token"""
if request.endpoint == 'login':
args = request.args.to_dict()
user_name = args['user_name']
qu... | shridarpatil/RestApiz | utils/update_token.py | Python | mit | 840 |
from mock import (
call,
Mock,
patch,
)
import os
from unittest import TestCase
from upload_packages import (
get_args,
get_changes,
main,
upload_package,
upload_packages,
)
from utils import temp_dir
CHANGES_DATA = """\
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date:... | mjs/juju | releasetests/tests/test_upload_packages.py | Python | agpl-3.0 | 4,745 |
import os
import numpy as np
import pandas as pd
import datetime as dt
from datetime import timedelta
import folium
from shapely.geometry import Point
import geopandas as gpd
import pkg_resources as pkg
current_path = os.path.abspath(".") + '/tmp_data'
def read_wwln(file):
"""Read WWLN file"""
tmp = pd.read... | jcalogovic/lightning | stormstats/misc.py | Python | mit | 7,099 |
import os
from getgist import GetGistCommons
from tests.conftest import TEST_FILE_CONTENTS
def test_read_file_without_argument(local):
assert local.read() == TEST_FILE_CONTENTS
def test_read_file_with_argument(local):
assert local.read(local.file_path) == TEST_FILE_CONTENTS
def test_read_non_existet_file... | cuducos/getgist | tests/test_local_tools.py | Python | mit | 3,495 |
import json
from tests import create_admin_authorization_header
def test_create_event(notify_api):
with notify_api.test_request_context():
with notify_api.test_client() as client:
data = {
'event_type': 'sucessful_login',
'data': {'something': 'random', 'in_fac... | alphagov/notifications-api | tests/app/events/test_rest.py | Python | mit | 996 |
#!/usr/bin/python2.5
#
# Copyright 2009 Google 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... | alexisvincent/downy | app.py | Python | apache-2.0 | 2,858 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py | Python | mit | 6,197 |
# Date manipulation tool
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2015 Alexandre Dulaunoy - a@foo.be
import calendar
import datetime
import os
import re
def getDateinMonth(year=None, month=None):
if year is None or month is None:
return False
dater = ca... | dragonresearchgroup/conficker-research-tools | lib/datetool.py | Python | bsd-3-clause | 1,203 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y'
TIME_FORMAT = 'H:i:s'
DATE... | rebost/django | django/conf/locale/pl/formats.py | Python | bsd-3-clause | 1,327 |
import os
import sys
from django.conf import settings
DIRNAME = os.path.dirname(__file__)
settings.configure(
DEBUG=True,
DATABASE_ENGINE='sqlite3',
DATABASE_NAME=os.path.join(DIRNAME, 'database.db'),
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3'
}
},... | jsoa/django-tabbed-admin | tabbed_admin/tests/runtests.py | Python | bsd-3-clause | 1,608 |
# -*- coding: utf-8 -*-
#
# 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
#... | fenglu-g/incubator-airflow | airflow/utils/log/es_task_handler.py | Python | apache-2.0 | 7,309 |
import shutil
import tempfile
import subprocess
import os
import sys
import time
from opendm import log
from opendm import system
import locale
from string import Template
class GrassEngine:
def __init__(self):
self.grass_binary = system.which('grass7') or \
system.which('grass... | OpenDroneMap/OpenDroneMap | opendm/grass_engine.py | Python | gpl-3.0 | 4,970 |
#! /usr/bin/env python
'''
oscutils.py -- Open Sound Control builtins for MFP
Copyright (c) 2013 Bill Gribble <grib@billgribble.com>
'''
from ..processor import Processor
from ..mfp_app import MFPApp
from ..bang import Uninit
class OSCPacket(object):
def __init__(self, payload):
self.payload = payloa... | bgribble/mfp | mfp/builtins/oscutils.py | Python | gpl-2.0 | 3,258 |
# Written by Jelle Roozenburg
# see LICENSE.txt for license information
import re, sys, os
from traceback import print_exc
from Tribler.__init__ import LIBRARYNAME
WORDS_REGEXP = re.compile('[a-zA-Z0-9]+')
DEBUG = False
class XXXFilter:
def __init__(self, install_dir):
termfilename = os.pat... | egbertbouman/tribler-g | Tribler/Category/FamilyFilter.py | Python | lgpl-2.1 | 3,896 |
#* PYTHON EMAIL PROJECT *#
#* tests.py *#
#* Fordham CSS September 25 *#
#* ------------------------------------ *#
#* Unit tests for PyDate program *#
from Email_Object import Email
from Get_Emails import Set_Priority
import unittest
# Unit Tests for Set_Priorit... | nickdibari/pydate | tests.py | Python | mit | 1,632 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | tfroehlich82/EventGhost | plugins/EventGhost/__init__.py | Python | gpl-2.0 | 29,902 |
import json
import logging
import ckan.lib.search as search
from pylons import config
from ckan.lib.base import model
from ckan.model import Session
from pylons.i18n.translation import get_lang
from ckan.plugins.interfaces import Interface
from ckanext.dcatapit.model import DCATAPITTagVocabulary
log = logging.getLog... | NicoVarg99/daf-recipes | ckan/ckan/ckanext-dcatapit/ckanext/dcatapit/interfaces.py | Python | gpl-3.0 | 8,552 |
"""
GraphicsWidget displaying an image histogram along with gradient editor. Can be used to adjust the appearance of images.
"""
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph.functions as fn
from .GraphicsWidget import GraphicsWidget
from .ViewBox import *
from .GradientEditorItem import *
from .LinearRegio... | ibressler/pyqtgraph | pyqtgraph/graphicsItems/HistogramLUTItem.py | Python | mit | 7,526 |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
#Author: Raymond Hettinger
#License: MIT License
#http://code.activestate.com/recipes/576693/ revision 9, downloaded 2012-03-28
from .python import iterkeys, iteri... | hlin117/statsmodels | statsmodels/compat/ordereddict.py | Python | bsd-3-clause | 8,996 |
# -*- coding: utf8
"""Random Projection transformers
Random Projections are a simple and computationally efficient way to
reduce the dimensionality of the data by trading a controlled amount
of accuracy (as additional variance) for faster processing times and
smaller model sizes.
The dimensions and distribution of Ra... | alexeyum/scikit-learn | sklearn/random_projection.py | Python | bsd-3-clause | 22,132 |
__author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
import string
import random
class Utils:
@staticmethod
def get_random_text(length_text=10, space_number=1, with_upper_case=True):
results = []
while len(results) < length_text:
char = random.choice(string.ascii_letters[:26]... | tonybeltramelli/pix2code | compiler/classes/Utils.py | Python | apache-2.0 | 1,382 |
# -*- coding: utf-8 -*-
"""
@copyright Copyright (c) 2013 Submit Consulting
@author Angel Sullon (@asullom)
@package sad
Descripcion: Tags para mostrar los menús dinámicos
"""
from django import template
from django.template import resolve_variable, Context
import datetime
from django.template.lo... | submitconsulting/backenddj | apps/sad/templatetags/user_menu.py | Python | bsd-3-clause | 3,420 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2011, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyr... | Ban3/Limnoria | src/test.py | Python | bsd-3-clause | 25,777 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Tommy Winther
# http://tommy.winther.nu
#
# Modified for FTV Guide (09/2014 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
# Modified for TV Guide Fullscren (2016)
# by primaeval - primaeval.dev@gmail.com
#
# This Program i... | im85288/script.tvguide.fullscreen | source.py | Python | gpl-2.0 | 62,215 |
from builtins import object
__author__ = "grburgess"
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from astropy.visualization import quantity_support
import warnings
from threeML.config.config import threeML_config
from threeML.io.calculate_flux import (
_setup_analysis_dictionarie... | giacomov/3ML | threeML/io/plotting/model_plot.py | Python | bsd-3-clause | 26,801 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Jonathan Esterhazy <jonathan.esterhazy at gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
#
# HDP inference code is adapted from the onlinehdp.py script by
# Chong Wang (chongw at cs.princeton.edu).
# http://www.c... | tzoiker/gensim | gensim/models/hdpmodel.py | Python | lgpl-2.1 | 22,940 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
# from mpl_toolkits.mplot3d import Axes3D
import math
x, y, z = np.genfromtxt('list', unpack=True, skip_header=0)
# find lots of points on the piecewise linear curve defined by x and y
M = 1000
t = np.linspace(0, len(x), M)
print(t)
# x = np.i... | cmayes/md_utils | md_utils/path.py | Python | bsd-3-clause | 1,474 |
##############################################################################
#
# A simple formatting example using XlsxWriter.
#
# This program demonstrates the indentation cell format.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright 2013-2022, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter
workbook = x... | jmcnamara/XlsxWriter | examples/cell_indentation.py | Python | bsd-2-clause | 674 |
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, p... | tliron/sincerity | components/skeletons/django/project/manage.py | Python | lgpl-3.0 | 524 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('neuroelectro', '0004_auto_20150805_2021'),
]
operations = [
migrations.RemoveField(
model_name='uservalidation',... | neuroelectro/neuroelectro_org | neuroelectro/migrations/0005_auto_20150805_2052.py | Python | gpl-2.0 | 562 |
from django.apps import AppConfig
class MallsConfig(AppConfig):
name = 'malls'
| jojoriveraa/titulacion-NFCOW | NFCow/malls/apps.py | Python | apache-2.0 | 85 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
polygonize.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... | slarosa/QGIS | python/plugins/sextante/gdal/polygonize.py | Python | gpl-2.0 | 2,791 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sio(CMakePackage):
"""SIO is a persistency solution for reading and writing binary data in... | iulian787/spack | var/spack/repos/builtin/packages/sio/package.py | Python | lgpl-2.1 | 2,029 |
from discord.ext.commands import CommandError
class InvalidTime(CommandError):
'Exception raised, raid time invalid'
pass
class RaidDisabled(CommandError):
'Exception raised, raid not enabled'
pass
class TrainDisabled(CommandError):
'Exception raised, train not enabled'
pass
class GroupTooBi... | FoglyOgly/Meowth | meowth/exts/raid/errors.py | Python | gpl-3.0 | 737 |
from __future__ import absolute_import
from __future__ import print_function
import datetime
from boto.s3.key import Key
from boto.s3.connection import S3Connection
from django.conf import settings
from django.db import connection
from django.forms.models import model_to_dict
from django.utils.timezone import make_awar... | SmartPeople/zulip | zerver/lib/export.py | Python | apache-2.0 | 61,414 |
# Copyright (c) 2010-2012 OpenStack, 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 ... | pvo/swift | test/unit/account/test_server.py | Python | apache-2.0 | 51,979 |
# -*- 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/workflows/tasks/actions.py | Python | gpl-3.0 | 8,467 |
# coding: utf-8
import tweepy
import urllib2
import json
import time
import datetime
import random
consumer_key = 'jNSA6i7eIA564BRMRdMVCDrkF'
consumer_secret = 'L3908LNoYSh8bwIIhgtEJ6PuaFdXGBENaZdsVrG0iRJFMpWa4u'
access_token = '3306456200-8Y9UUXPxM3t6B6KCL9eJxjC1lREmEtQ8zdkBR28'
access_token_secret = 'nd8L1PWQ4CxaBP... | tomleger/time_and_temp | tweepytext.py | Python | mit | 2,337 |
# Copyright 2017 IBM 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 app... | rahulunair/nova | nova/tests/unit/api/openstack/test_requestlog.py | Python | apache-2.0 | 5,673 |
#!/usr/bin/env python
from app import telomere
telomere.run(host='0.0.0.0', debug=True)
| rabramley/telomere | run.py | Python | mit | 89 |
from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from manager import models as pmod
from . import templater
from django.core.mail import send_mail
# This view displays the repairs
def process_request(request):
if not request.user.... | odrolliv13/Hex-Photos | manager/views/repairs.py | Python | apache-2.0 | 1,353 |
import sys
import yaml
import RPi.GPIO as GPIO
import time
import datetime
import structlog
from pathlib import Path
import csv
import os
import glob
from daemon import Daemon
from bmp183 import bmp183
import Adafruit_DHT
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import psycopg2
# from RPi_AS3935 import R... | kmkingsbury/raspberrypi-weather-station | station-code/collectweather.py | Python | apache-2.0 | 18,855 |
"""
Copyright 2015
FOSSEE, IIT Bombay
Use is subject to license terms.
@version 0.2, 15-Aug-2015
@author Manoj G
@email manoj.p.gudi@gmail.com
A generic block to call scilab functions which uses sciscipy wrapper
"""
import gras
import numpy
from scilab import Scilab
class Ge... | manojgudi/sandhi | modules/gr36/gr-scigen/python/scigen.py | Python | gpl-3.0 | 3,017 |
# Copyright 2010 Google Inc.
# Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011, Eucalyptus Systems, Inc.
#
# 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 re... | tpodowd/boto | boto/auth.py | Python | mit | 40,139 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
##-------------------------------------------------------------------
## @copyright 2016 DennyZhang.com
## Licensed under MIT
## https://www.dennyzhang.com/wp-content/mit_license.txt
##
## File : ufw_add_or_remove.py
## Author : Denny <contact@dennyzhang.com>
## Description :
#... | TOTVS/mdmpublic | bash/ufw/ufw_add_or_remove.py | Python | bsd-2-clause | 7,150 |
from model.group import Group
import pytest
def test_add_group(app, db, json_groups):
group = json_groups
with pytest.allure.step('Given a group list'):
old_groups = db.get_group_list()
with pytest.allure.step('When I add a group %s to the list' % group):
app.group.cre... | potolock/proverca | test/test_add_group.py | Python | apache-2.0 | 690 |
# LibreShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of LibreShot Video Editor (http://launchpad.net/libreshot/).
#
# LibreShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the G... | XXLRay/libreshot | libreshot/windows/AddFiles.py | Python | gpl-3.0 | 6,712 |
#!/usr/bin/env python
"""
Grid Tables Extension for Python-Markdown
=========================================
Add parsing of grid tables to Python-Markdown. These differ from simple tables
in that they can contain multi-lined text and (in my opinion) are cleaner
looking than simpe tables. They were inspired by reStruc... | Situphen/Python-ZMarkdown | markdown/extensions/grid_tables.py | Python | bsd-3-clause | 27,960 |
"""
This module holds the AuthKey class.
"""
import struct
from hashlib import sha1
from .._misc.binaryreader import BinaryReader
class AuthKey:
"""
Represents an authorization key, used to encrypt and decrypt
messages sent to Telegram's data centers.
"""
def __init__(self, data):
"""
... | LonamiWebs/Telethon | telethon/_crypto/authkey.py | Python | mit | 1,895 |
# Copyright 2014-2015 Canonical Limited.
#
# This file is part of charm-helpers.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope ... | juju/juju-gui-charm | hooks/charmhelpers/core/templating.py | Python | agpl-3.0 | 3,186 |
# Copyright 2017 the Isard-vdi project authors:
# Josep Maria Viñolas Auquer
# Alberto Larraz Dalmases
# License: AGPLv3
#!flask/bin/python
# coding=utf-8
import json
import time
from flask import (
Response,
redirect,
render_template,
request,
send_from_directory,
url_for,
)
from fl... | isard-vdi/isard | webapp/webapp/webapp/admin/views/AdminViews.py | Python | agpl-3.0 | 12,269 |
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import sys
import imp
import random
imp.reload(sys)
try:
sys.setdefaultencoding('UTF8')
except Exception as E:
pass
try:
import unittest2 as unittest
except ImportError:
import unittest
from popbill import... | linkhub-sdk/popbill.py | cashbilltests.py | Python | mit | 13,587 |
"""init
Revision ID: a578b9de5d89
Revises:
Create Date: 2016-12-13 21:36:44.114754
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a578b9de5d89'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by ... | Lifeistrange/flaskweb | migrations/versions/a578b9de5d89_init.py | Python | mit | 1,286 |
from chaco.api import Plot
from chaco.tools.toolbars.plot_toolbar import PlotToolbar
from traits.api import Type, DelegatesTo, Instance, Enum, \
on_trait_change
class ToolbarPlot(Plot):
# Should we turn on the auto-hide feature on the toolbar?
auto_hide = DelegatesTo('toolbar')
toolbar = Instance(... | tommy-u/chaco | chaco/toolbar_plot.py | Python | bsd-3-clause | 2,172 |
from .base import AbstractStatistics
from ..compat import pickle
from ..price_parser import PriceParser
import datetime
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
class SimpleStatistics(AbstractStatistics):
"""
Simple Statistics provides a bare-bone... | nwillemse/nctrader | nctrader/statistics/simple.py | Python | mit | 6,332 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'EmailMessage.tag'
db.alter_column(u'unisender_emailmes... | ITCase-django/django-unisender | unisender/south_migrations/0003_auto__chg_field_emailmessage_tag__chg_field_emailmessage_list_id.py | Python | mit | 12,888 |
DEFAULT_STEMMER = 'snowball'
DEFAULT_TOKENIZER = 'word'
DEFAULT_TAGGER = 'pos'
TRAINERS = ['news', 'editorial', 'reviews', 'religion',
'learned', 'science_fiction', 'romance', 'humor']
DEFAULT_TRAIN = 'news' | viktorRock/myFirstPythonAPI | pythapp/nltk/nltk_constants.py | Python | unlicense | 222 |
"""Tests for the bob_emploi.lib.fhs module."""
import datetime
import typing
from typing import Any, Dict, Iterator, Optional, Mapping
import unittest
from unittest import mock
from bob_emploi.data_analysis.lib import fhs
# Jobseeker criteria provided per unemployment period.
class _JobseekerCriteria(typing.NamedTu... | bayesimpact/bob-emploi | data_analysis/lib/test/fhs_test.py | Python | gpl-3.0 | 20,364 |
class OrderedDictionary:
def __init__(self):
self._keys=[]
self._values=[]
def __len__ (self):
return len (sef.keys)
def __getitem__ (self, key):
if self.has_key (key):
return self._values[self._keys.index(key)]
else:
return None
def _... | ActiveState/code | recipes/Python/52270_OrderedDictionary/recipe-52270.py | Python | mit | 927 |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import S3CustomController
THEME = "MAVC"
# =============================================================================
class index(S3CustomController):
""" Custom Home Page """
def __call__(self):
response = current.response
output = {}... | flavour/ifrc_qa | modules/templates/MAVC/controllers.py | Python | mit | 5,127 |
#!/usr/bin/env python3
"""
Command line tool to bisect failing CPython tests.
Find the test_os test method which alters the environment:
./python -m test.bisect_cmd --fail-env-changed test_os
Find a reference leak in "test_os", write the list of failing tests into the
"bisect" file:
./python -m test.bisect_... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/test/bisect_cmd.py | Python | apache-2.0 | 4,967 |
"""Recommender model."""
from __future__ import print_function
import sys
import numpy as np
from theano import config, function, shared
import theano.tensor as T
__author__ = "Gianluca Corrado"
__copyright__ = "Copyright 2016, Gianluca Corrado"
__license__ = "MIT"
__maintainer__ = "Gianluca Corrado"
__email__ = "g... | gianlucacorrado/RNAcommender | rnacommender/model.py | Python | mit | 4,612 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: charset.py
__all__ = [
'Charset',
'add_alias',
'add_charset',
'add_codec']
import codecs
import email.base64mime
import email.quoprimime
from ema... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/email/charset.py | Python | unlicense | 14,131 |
# Copyright (c) 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | dims/glance | glance/tests/unit/test_jsonpatchmixin.py | Python | apache-2.0 | 3,189 |
# coding=utf-8
from unittest2 import TestCase
from syntaxnet_wrapper.src.utils.pos_aggregation import pos_aggregate
class TestPostAggregation(TestCase):
def test_pos_aggregate(self):
test_values = [
([{u'1': {u'index': 1, u'token': u'il', u'pos': u'_',
u'feats':... | short-edition/syntaxnet-wrapper | syntaxnet_wrapper/src/utils/test/test_pos_aggregation.py | Python | apache-2.0 | 8,608 |
# 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 | run_experiment.py | Python | apache-2.0 | 5,390 |
# -*- coding: utf-8; mode: Python -*-
# ocitysmap, city map and street index generator from OpenStreetMap data
# Copyright (C) 2010 David Decotigny
# Copyright (C) 2010 Frédéric Lehobey
# Copyright (C) 2010 Pierre Mauduit
# Copyright (C) 2010 David Mentré
# Copyright (C) 2010 Maxime Petazzoni
# Copyright (C) 2010... | ccnz/eqnz-ocitysmap | ocitysmap2/i18n.py | Python | agpl-3.0 | 34,441 |
import math
import time
# Retry decorator with exponential backoff
def retry(tries, delay=1, backoff=2):
"""Retries a function or method until it returns True.
delay sets the initial delay, and backoff sets how much the delay should
lengthen after each failure. backoff must be greater than 1, or else it
isn'... | Heipiao/weibo | retry.py | Python | mit | 1,243 |
from mongothon import create_model, create_model_offline
from pickle import dumps, loads
from unittest import TestCase
from mock import Mock, ANY, call, NonCallableMock
from mongothon import Document, Schema, NotFoundException, Array
from mongothon.validators import one_of
from mongothon.scopes import STANDARD_SCOPES
f... | gamechanger/mongothon | tests/mongothon/model_test.py | Python | mit | 24,340 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import math
from copy import deepcopy
from compas.geometry import scale_vector
from compas.geometry import normalize_vector
from compas.geometry import subtract_vectors
from compas.geometry import cross_vecto... | compas-dev/compas | src/compas/geometry/transformations/matrices.py | Python | mit | 41,266 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import sys
sys.path.insert(0, os.getcwd())
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from studio.core.engines import db
from microsite import app
# this is the Alembic Con... | qisanstudio/qsapp-microsite | src/microsite/migration/env.py | Python | mit | 2,298 |
from django.forms import ModelForm
from ..models import MaternalEligibilityLoss
class MaternalEligibilityLossForm(ModelForm):
class Meta:
model = MaternalEligibilityLoss
fields = '__all__'
| botswana-harvard/tshilo-dikotla | td_maternal/forms/maternal_eligibility_loss_form.py | Python | gpl-2.0 | 213 |
"""parses configuration and returns useful things"""
#pylint: disable=relative-import
#pylint: disable=too-many-ancestors
from etl_framework.ExtractorConfig import ExtractorConfig
from etl_framework.config_mixins.SleepMixin import SleepMixin
from etl_framework.config_mixins.BatchMixin import BatchMixin
from etl_framew... | pantheon-systems/etl-framework | gcloud/configs/pubsub_extractor.py | Python | mit | 1,171 |
# Generated by Django 2.2.13 on 2021-02-05 10:34
from django.db import migrations
from django.db.models import Count
from base.models.group_element_year import GroupElementYear
YEAR_FROM = 2019
def fix_order(apps, schema_editor):
problematic_element_parents = find_problematic_parents()
print("Problematic ... | uclouvain/osis | base/migrations/0566_fix_link_orders.py | Python | agpl-3.0 | 1,354 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
api_key_sid = "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
api_key_secret = "your_api_key_secret"
client = Client(api_key_sid, api_key_secret)
recordings = client.v... | teoreteetik/api-snippets | video/rest/recordings/list-recordings-for-room/list-recordings-for-room.6.x.py | Python | mit | 451 |
from abc import abstractmethod, abstractproperty
from ebu_tt_live.utils import AutoRegisteringABCMeta, AbstractStaticMember, validate_types_only
# Interfaces
# ==========
class INode(object):
"""
This is the foundation of all nodes that take part in the processing of subtitle documents.
The Node should d... | ebu/ebu-tt-live-toolkit | ebu_tt_live/node/interface.py | Python | bsd-3-clause | 2,579 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8221")
else:
access = Ser... | choicoin/chcoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,832 |
# Script to make "simple" geothermal models to show effects of shallow structures.
import numpy as np, sys, os, time, gzip, cPickle as pickle, scipy, gc
from glob import glob
sys.path.append('/tera_raid/gudni/gitCodes/simpeg')
import SimPEG as simpeg
import SimPEG
from SimPEG import NSEM
# Load the solver
sys.path.app... | simpeg/simpegExamples | SciPy2016/MTwork/ForwardModeling_noExtension_GKR/findDiam_MTforward_HKPK1.py | Python | mit | 2,857 |
#!/usr/bin/env python
#This is a runtime-configurable implementation of the
#linear congruentialpseudo-random number generator,
#using the following formula:
#y = (a*z+b) mod m
#where:
#z = the last generate result (or the seed at startup)
#a,b,m = parameters (defaults generated randomly)
#
#Numbers created by the LC a... | ulikoehler/entropy-analysis-tools | RandGen/scripts/lc.py | Python | gpl-3.0 | 1,933 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2011 Umeå University
#
# 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... | natebeacham/saml2 | src/saml2/ecp_client.py | Python | bsd-2-clause | 12,424 |
# Copyright 2018 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.
# Recipe module for Skia Swarming SKQP testing.
DEPS = [
'flavor',
'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/properties',
'run',
... | youtube/cobalt | third_party/skia/infra/bots/recipes/skqp_test.py | Python | bsd-3-clause | 1,366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.