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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1/types/pipeline_service.py | Python | apache-2.0 | 11,878 |
"""Creates a line spectrum and plots it
"""
import numpy as np
import hyperspy.api as hs
import matplotlib.pyplot as plt
# Create a line spectrum with random data
s = hs.signals.Spectrum(np.random.random((100, 1024)))
# Define the axis properties
s.axes_manager.signal_axes[0].name = 'Energy'
s.axes_manager.signal_ax... | to266/hyperspy | examples/data_navigation/line_spectrum.py | Python | gpl-3.0 | 774 |
#!/usr/bin/env python
from snmp_helper import snmp_get_oid, snmp_extract
# Beginning of setup
COMMUNITY_STRING = 'galileo'
RT1_SNMP_PORT = 7961
RT2_SNMP_PORT = 8061
IP = '50.76.53.27'
pynet_router1 = (IP, COMMUNITY_STRING, RT1_SNMP_PORT)
pynet_router2 = (IP, COMMUNITY_STRING, RT2_SNMP_PORT)
OID_sysName = "1.3.6.1.2... | philuu12/PYTHON_4_NTWK_ENGRS | wk2_hw/snmp_assign4.py | Python | apache-2.0 | 1,028 |
#!/usr/bin/env python3
import argparse
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from basagc import config # need to import this first to set debug flag
if __name__ == "__main__":
# arg parser for debug flag
parser = argparse.ArgumentParser(description='basaGC: AGC for KSP')
par... | cashelcomputers/basaGC | basagc.py | Python | gpl-2.0 | 892 |
# Copyright 2013-2021 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 PyHyperframe(PythonPackage):
"""HTTP/2 framing layer for Python"""
homepage = "https:... | LLNL/spack | var/spack/repos/builtin/packages/py-hyperframe/package.py | Python | lgpl-2.1 | 592 |
"""
========================
Mack Chainladder Example
========================
This example demonstrates how you can can use the Mack Chainladder method.
"""
import pandas as pd
import chainladder as cl
# Load the data
data = cl.load_sample('raa')
# Compute Mack Chainladder ultimates and Std Err using 'volume' avera... | jbogaardt/chainladder-python | examples/plot_mack.py | Python | mit | 780 |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
import logging
import os
import re
import thread
from gi.repository import Gtk
from gi.repository import GLib
from foobnix.fc.fc import FC
from foobnix.playlists.pls_reader import update_id3_for_pls
from foobnix.util import const, idle_task
from... | sitexa/foobnix | foobnix/gui/treeview/playlist_tree.py | Python | gpl-3.0 | 24,000 |
"""Generic Limiter to ensure N parallel operations
.. note::
The limiter functionality is new.
Please report any issues found on `the retools Github issue
tracker <https://github.com/bbangert/retools/issues>`_.
The limiter is useful when you want to make sure that only N operations for a given process ha... | bbangert/retools | retools/limiter.py | Python | mit | 4,552 |
import sys
import numpy as np
import scipy as sp
import scipy.sparse
from openpnm.solvers import IterativeSolver
from openpnm.utils import logging
logger = logging.getLogger(__name__)
try:
import petsc4py
# Next line must be before importing PETSc
petsc4py.init(sys.argv)
from petsc4py import PETSc
excep... | PMEAL/OpenPNM | openpnm/solvers/_petsc.py | Python | mit | 9,448 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'lxml',
]
setup(name='pyayml',
version='... | aleksandr-rakov/pyayml | setup.py | Python | mit | 885 |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A factory class to build links
"""
from __future__ import absolute_import, division, print_function
class LinkFactory(object):
"""Static Factory class used by build `Link` objects.
The `Link` objects are registerd and ... | fermiPy/fermipy | fermipy/jobs/factory.py | Python | bsd-3-clause | 908 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | cloudbase/neutron-virtualbox | neutron/tests/unit/db/metering/test_db_metering.py | Python | apache-2.0 | 13,144 |
#!/usr/bin/python
import serial
import time
import random
s = None
num_leds = 72
play_time = 5.0
def flush_input():
s.flushInput()
def wait_for_ack():
while s.inWaiting() <= 0:
pass ... | jhogsett/linkit | python/demo3.py | Python | mit | 1,964 |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# Introduction
# ============
#
# This advanced Pyro tutorial demonstrates a number of inference and prediction
# tricks in the context of epidemiological models, specifically stochastic
# discrete time compartmental models with large ... | uber/pyro | examples/sir_hmc.py | Python | apache-2.0 | 24,446 |
from __future__ import with_statement
from nose.tools import assert_equal, assert_raises #@UnresolvedImport
from whoosh import analysis, highlight, fields, qparser, query
from whoosh.compat import u
from whoosh.filedb.filestore import RamStorage
_doc = u("alfa bravo charlie delta echo foxtrot golf hotel india juli... | mzdaniel/oh-mainline | vendor/packages/whoosh/tests/test_highlighting.py | Python | agpl-3.0 | 8,649 |
# -*- coding: utf-8 -*-
import re
from threading import Timer
import sublime
import sublime_plugin
from .console_logging import getLogger
from .daemon import ask_daemon
from .utils import get_settings, is_python_scope, is_repl
logger = getLogger(__name__)
FOLLOWING_CHARS = {"\r", "\n", "\t", " ", ")", "]", ";", "}"... | srusskih/SublimeJEDI | sublime_jedi/completion.py | Python | mit | 7,646 |
# -*- coding: utf-8 -*-
import os
from os.path import join as opj
import sys
import cherrypy
#from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
#from ws4py.websocket import WebSocket
import threading
from babel.support import Translations
import locale
import jinja2
from jinja2 import Environment,... | NikolayChesnokov/webgsrp3 | webserver.py | Python | agpl-3.0 | 6,854 |
# This component generates test points within a zone and calculates view factors of each of these points to the other surfaces of the zone.
#
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Honeybee.
#
# Copyright (c) 2013-2020, Chris Mackey <Chr... | mostaphaRoudsari/Honeybee | src/Honeybee_Indoor View Factor Calculator.py | Python | gpl-3.0 | 90,643 |
#!/usr/bin/env python
"""
Query the github API for the git tags of a project, and return a list of
version tags for recent releases, or the default release.
The default release is the most recent non-RC version.
Recent is a list of unqiue major.minor versions, where each is the most
recent version in the series.
For... | alexandrev/compose | script/versions.py | Python | apache-2.0 | 3,819 |
# -*- coding: utf-8 -*-
# Copyright 2013, 2014, 2015, 2016, 2017, 2018 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR 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,... | kpreid/shinysdr | shinysdr/interfaces.py | Python | gpl-3.0 | 11,304 |
# -*- coding: utf-8 -*-
########################## Copyrights and license ############################
# #
# Copyright 2011-2015 Christian Lupien <christian.lupien@usherbrooke.ca> #
# ... | lupien/pyHegel | pyHegel/gen_poly.py | Python | lgpl-3.0 | 30,296 |
import os
import errno
def delete_file(file_name, dry=False):
if dry:
print(' DRY DELETED: {}'.format(file_name))
else:
os.remove(file_name)
try:
dirname = os.path.dirname(file_name)
os.rmdir(dirname)
print(' DELETED DIR: {}'.format(dirname))
... | logston/python-dircmp | dircmppy/dircmpdel.py | Python | bsd-2-clause | 2,648 |
# Copyright 2016 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/differential_privacy/multiple_teachers/train_student.py | Python | bsd-2-clause | 9,187 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-bigquery-reservation | samples/snippets/noxfile_config.py | Python | apache-2.0 | 1,606 |
from flask import Blueprint, g, url_for
from ..errors import ValidationError, bad_request, not_found
from ..auth import auth
from ..decorators import rate_limit, hub_active
api = Blueprint('api', __name__)
def get_catalog():
return {
'hub': url_for('api.get_hub', _external=True),
'endpoi... | punitvanjani/test1 | api/v1/__init__.py | Python | mit | 1,341 |
from rackattack import api
class Node(api.Node):
def __init__(self, ipcClient, allocation, name, info):
assert 'id' in info
assert 'primaryMACAddress' in info
assert 'secondaryMACAddress' in info
assert 'ipAddress' in info
self._ipcClient = ipcClient
self._allocatio... | Stratoscale/rackattack-api | py/rackattack/tcp/node.py | Python | apache-2.0 | 1,797 |
#!/usr/bin/env python
"""Execute the tests for the pair_align program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usa... | bkahlert/seqan-research | raw/workshop13/workshop2013-data-20130926/trunk/core/apps/razers/tests/run_tests.py | Python | mit | 13,292 |
from django.test import TestCase
from lists.forms import EMPTY_LIST_ERROR, ItemForm
from lists.models import Item, List
class ItemFormTest(TestCase):
def test_form_item_input_has_placeholder_and_css_classes(self):
form = ItemForm()
self.assertIn('placeholder="Enter a to-do item"', form.as_p())
... | MilesDuronCIMAT/book_exercises | chapter_11/lists/tests/test_forms.py | Python | mit | 906 |
import getpass
import sys
import traceback
import paramiko
import interactive
import auth
import util
import json
import requests
class Executer(object):
def __init__(self, name, username, namespace, exec_endpoint='exec.alauda.cn', verbose=False):
self.name = name if username == namespace else '{}/{}'.f... | Lupino/alauda-CLI | alaudacli/execute.py | Python | apache-2.0 | 2,679 |
import os
import sys
from setuptools import setup
if sys.version_info < (3, 2):
print("Sorry, djangocms-lab-members currently requires Python 3.2+.")
sys.exit(1)
# From: https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/
def read(*paths):
"""Build a file path from *paths* and retur... | mfcovington/djangocms-lab-members | setup.py | Python | bsd-3-clause | 2,005 |
# Addresses a bug in the way Python 3.5+ handles
# creation of map constants
opts = {'highlight': True,
'start_line': -1,
'end_line': None
}
print(opts)
| moagstar/python-uncompyle6 | test/simple_source/expression/05_const_map.py | Python | mit | 189 |
# -*- coding: utf-8 -*-
#
# Molecular Blender
# Filename: util.py
# Copyright (C) 2017 Shane Parker, Joshua Szekely
#
# This file is part of Molecular Blender.
#
# Molecular Blender is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... | smparker/Molecular-Blender | util.py | Python | gpl-3.0 | 2,699 |
# Authors:
# Trevor Perrin
# Martin von Loewis - python 3 port
# Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
#
# See the LICENSE file for legal information regarding use of this file.
"""cryptomath module
This module has basic math/crypto code."""
from __future__ import print_function
import os
impor... | scheib/chromium | third_party/tlslite/tlslite/utils/cryptomath.py | Python | bsd-3-clause | 8,434 |
# GUI reader side: like pipes-gui1, but make root window and mainloop explicit
from tkinter import *
from PP4E.Gui.Tools.guiStreams import redirectedGuiShellCmd
def launch():
redirectedGuiShellCmd('python -u pipe-nongui.py')
window = Tk()
Button(window, text='GO!', command=launch).pack()
window.mainloo... | simontakite/sysadmin | pythonscripts/programmingpython/Gui/Tools/pipe-gui2.py | Python | gpl-2.0 | 325 |
# -*- 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 model 'ReferenceFrame'
db.create_table(u'ddsc_core_referenceframe', (
('id', self.gf('d... | ddsc/ddsc-core | ddsc_core/migrations/0009_add_model_ReferenceFrame.py | Python | mit | 6,428 |
# -*- coding: utf-8 -*-
# Copyright 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 requir... | huntxu/fuel-web | nailgun/nailgun/api/v1/validators/plugin_link.py | Python | apache-2.0 | 1,438 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/errors/types/keyword_plan_campaign_keyword_error.py | Python | apache-2.0 | 1,277 |
import unittest
from nose.plugins.skip import SkipTest
import numpy
import theano
import theano.tensor as T
from theano.tests import unittest_tools as utt
from theano.tensor.signal import conv
from theano.tensor.basic import _allclose
class TestSignalConv2D(unittest.TestCase):
def setUp(self):
utt.se... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/tensor/signal/tests/test_conv.py | Python | gpl-2.0 | 4,258 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathPocketBaseGui.py | Python | lgpl-2.1 | 8,004 |
#! /usr/bin/python
"""
dispatch.py
By Paul Malmsten, 2010
pmalmsten@gmail.com
This example continuously reads the serial port and dispatches packets
which arrive to appropriate methods for processing.
"""
from xbee.helpers.dispatch import Dispatch
import serial
PORT = '/dev/ttyUSB0'
BAUD_RATE = 9600
# Open serial... | MengGuo/Jackal_Velodyne_Duke | xbee_communication/XBee-2.2.3/examples/dispatch.py | Python | gpl-2.0 | 1,695 |
""" SQLAlchemy models """
# pylint: disable=no-init
# pylint: disable=too-few-public-methods
# pylint: disable=missing-docstring
from sqlalchemy import Column, Integer, Date, DateTime, Numeric, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Houses(Base):
... | netplusdesign/home-performance-flask-api | chartingperformance/models.py | Python | mit | 8,283 |
# ClockAlarm is a cross-platform alarm manager
# Copyright (C) 2017 Loïc Charrière, Samuel Gauthier
#
# 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 y... | BFH-BTI7301-project1/ClockAlarm | _clockalarm/UI/NotificationWidget.py | Python | gpl-3.0 | 3,442 |
from django.test import TestCase
from wagtail.wagtailcore.models import Collection
class TestCollectionTreeOperations(TestCase):
def setUp(self):
self.root_collection = Collection.get_first_root_node()
self.holiday_photos_collection = self.root_collection.add_child(
name="Holiday phot... | davecranwell/wagtail | wagtail/wagtailcore/tests/test_collection_model.py | Python | bsd-3-clause | 3,008 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from rbnics.reduction_methods.navier_stokes.navier_stokes_pod_galerkin_reduction import NavierStokesPODGalerkinReduction
# from rbnics.reduction_methods.navier_stokes.navier_stokes_rb_reducti... | mathLab/RBniCS | rbnics/reduction_methods/navier_stokes/__init__.py | Python | lgpl-3.0 | 586 |
from afl_utils import afl_vcrash
import os
import unittest
class AflVCrashTestCase(unittest.TestCase):
def setUp(self):
# Use to set up test environment prior to test case
# invocation
pass
def tearDown(self):
# Use for clean up after tests have run
if os.path.exists(... | rc0r/afl-utils | tests/test_afl_vcrash.py | Python | apache-2.0 | 3,795 |
__all__ = ['create_subprocess_exec', 'create_subprocess_shell']
import subprocess
from . import events
from . import protocols
from . import streams
from . import tasks
from .coroutines import coroutine
from .log import logger
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
DEVNULL = subprocess.DEVNULL
class Su... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/asyncio/subprocess.py | Python | gpl-3.0 | 7,182 |
"""
You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope.
What is the maximum number of envelopes can you Russian doll? (put one in... | franklingu/leetcode-solutions | questions/russian-doll-envelopes/Solution.py | Python | mit | 1,024 |
import frappe
def execute():
delivery_notes = frappe.db.get_all(
"Delivery Note", {"status": "Out for Delivery"}, "name")
frappe.reload_doc("stock", "doctype", "delivery_note", force=True)
for delivery_note in delivery_notes:
frappe.db.set_value("Delivery Note", delivery_note.name, "s... | neilLasrado/erpnext | erpnext/patches/v13_0/update_delivery_note_status_to_in_transit.py | Python | gpl-3.0 | 342 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-02-23 22:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournament', '0145_auto_20170211_1825'),
]
operations = [
migrations.AddField(
model_name='league',
... | cyanfish/heltour | heltour/tournament/migrations/0146_league_description.py | Python | mit | 414 |
"""Module grouping tests for the pydov.types.boring module."""
from pydov.types.grondwaterfilter import GrondwaterFilter
from pydov.util.dovutil import build_dov_url
from tests.abstract import AbstractTestTypes
location_wfs_getfeature = 'tests/data/types/grondwaterfilter/wfsgetfeature.xml'
location_wfs_feature = 'test... | DOV-Vlaanderen/pydov | tests/test_types_grondwaterfilter.py | Python | mit | 1,779 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import sys
try:
import cPickle as pickle
except:
import pickle
from qsrlib.qsrlib import QSRlib, QSRlib_Request_Message
from qsrlib_io.world_trace import Object_State, World_Trace
import argparse
import csv
def prett... | yianni/rtd-dbg | qsr_lib/scripts/example_extended.py | Python | mit | 15,681 |
import numpy
from .namedFilter import namedFilter
from .upConv import upConv
def upBlur(*args):
''' RES = upBlur(IM, LEVELS, FILT)
Upsample and blur an image. The blurring is done with filter
kernel specified by FILT (default = 'binom5'), which can be a string
(to be passed to namedFilte... | tochikuji/pyPyrTools | pyrtools/upBlur.py | Python | mit | 2,030 |
#! /usr/bin/env python
from mock import patch
from unittest import TestCase
import pandas as pd
from pandashells.bin.p_cdf import main
class MainTests(TestCase):
@patch(
'pandashells.bin.p_cdf.sys.argv',
'p.cdf -c x -q -n 10'.split())
@patch('pandashells.bin.p_cdf.io_lib.df_to_output')
@p... | moreati/pandashells | pandashells/test/p_cdf_tests.py | Python | bsd-2-clause | 1,185 |
__author__ = 'vsharman'
| andrewgee/service-manager | test/__init__.py | Python | apache-2.0 | 24 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "HW.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you s... | zhu913104/KMdriod | HW/manage.py | Python | mit | 534 |
import logging
import logging.config
import os
# Google App Engine imports.
from google.appengine.ext.webapp import util
# Force Django to reload its settings.
from django.conf import settings
settings._target = None
# Must set this env var before importing any part of Django
os.environ['DJANGO_SETTINGS_MODULE'] = '... | skibaa/smart-sweeper | main.py | Python | apache-2.0 | 1,792 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from flask import render_template
from pattern.web import Newsfeed, plaintext
from alchemyapi import AlchemyAPI
app = Flask(__name__)
reader = Newsfeed()
alchemyapi = AlchemyAPI()
RSS_LIST = [
(u"Lifehacker", "http://feeds.gawker.com/lifehacker/... | vitojph/myrss | myrss.py | Python | gpl-2.0 | 1,343 |
from distutils.core import setup
setup(name='pySpaRSA',
version='1.0',
description='Python implementation of SpaRSA',
author='Eric Jonas',
author_email='jonas@ericjonas.com',
url='http://github.com/ericmjonas/pysparsa/',
packages=['pysparsa'],
)
| ericmjonas/pySpaRSA | setup.py | Python | mit | 288 |
# -*- coding: utf-8 -*-
import json
import urllib
import urllib2
from django.contrib.auth.models import User
from django.core.exceptions import MultipleObjectsReturned
from django.http import Http404
from django.shortcuts import render
from django.views.generic import View
from django.views.generic.detail import Singl... | CivilHub/CivilHub | activities/views.py | Python | gpl-3.0 | 3,027 |
# members.urls
# URLs for routing the members app.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Fri Feb 12 23:30:10 2016 -0500
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: urls.py [d011c91] benjamin@bengfort.com $
"""
URLs for routing the ... | DistrictDataLabs/partisan-discourse | members/urls.py | Python | apache-2.0 | 883 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sqrtrading.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | alexbid/sqrtrading | manage.py | Python | mit | 808 |
"""Support for Toon thermostat."""
import logging
from typing import Any, Dict, List, Optional
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
HVAC_MODE_HEAT,
PRESET_AWAY,
PRESET_COMFORT,
PRES... | leppa/home-assistant | homeassistant/components/toon/climate.py | Python | apache-2.0 | 4,943 |
# -*- coding: utf-8 -*-
__author__ = 'rldotai'
__email__ = 'rldot41@gmail.com'
__version__ = '0.1.0'
| rldotai/rlbench | rlbench/__init__.py | Python | gpl-3.0 | 102 |
"""
rendering.py
--------------
Functions to convert trimesh objects to pyglet/opengl objects.
"""
import numpy as np
from . import util
# avoid importing pyglet or pyglet.gl
# as pyglet does things on import
GL_POINTS, GL_LINES, GL_TRIANGLES = (0, 1, 4)
def convert_to_vertexlist(geometry, **kwargs):
"""
... | dajusc/trimesh | trimesh/rendering.py | Python | mit | 12,335 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('base.views',
url(r'^$', 'home', name='home'),
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += patterns('blog.views',
(r'^blog/', include('blog.urls'), "main"),
)
... | jradd/Django_web_dja | base/urls.py | Python | bsd-3-clause | 321 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | holdenk/spark | python/pyspark/ml/param/shared.py | Python | apache-2.0 | 24,706 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgslineburstsymbollayer.py
---------------------
Date : October 2021
Copyright : (C) 2021 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
... | uclaros/QGIS | tests/src/python/test_qgslineburstsymbollayer.py | Python | gpl-2.0 | 8,941 |
# flask, html + json
from flask import Flask, render_template, request, jsonify, json
# send http post request
from urllib import urlopen, urlencode
# websocket host
from flask_sockets import Sockets
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
# websocket client
from websocket import ... | vagoston/mindtricks | frontend/frontend.py | Python | mit | 2,876 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 0, transform = "None", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_MovingAverage/cycle_0/ar_/test_artificial_1024_None_MovingAverage_0__20.py | Python | bsd-3-clause | 264 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages
from setuptools import setup
import ricecooker
readme = open("README.md").read()
with open("docs/history.rst") as history_file:
history = history_file.read()
requirements = [
"pytest>=3.0.2",
"requests>=2.11.1",
"le_... | learningequality/ricecooker | setup.py | Python | mit | 2,155 |
#!/usr/bin/env python2
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''Read meta information from epub files'''
import os, re, posixpath
from cStringIO import StringIO
from contextlib import closing
from future_builtins import map
from c... | timpalpant/calibre | src/calibre/ebooks/metadata/epub.py | Python | gpl-3.0 | 12,365 |
import datetime
import time
import math
import cv2
import imutils
import numpy
from controllers.logcontroller import LogController
from models.frame import Frame
import settings
#the run interval before logging in seconds
TIME_INTERVAL = 5
MIN_AREA = 500
class VideoController:
"""
A class ... | cmput402w2016/CMPUT402W16T2 | src/controllers/videocontroller.py | Python | apache-2.0 | 4,839 |
#
# UAVCAN DSDL file parser
#
# Copyright (C) 2014-2015 Pavel Kirienko <pavel.kirienko@gmail.com>
#
from __future__ import division, absolute_import, print_function, unicode_literals
import os, re, logging
from io import StringIO
from .signature import Signature, compute_signature
from .common import DsdlException, pr... | zhumingliang1209/Ardupilot | ardupilot/modules/uavcan/libuavcan/dsdl_compiler/pyuavcan/uavcan/dsdl/parser.py | Python | gpl-3.0 | 31,158 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | blrm/openshift-tools | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_serviceaccount.py | Python | apache-2.0 | 61,243 |
# Testing sha module (NIST's Secure Hash Algorithm)
# use the three examples from Federal Information Processing Standards
# Publication 180-1, Secure Hash Standard, 1995 April 17
# http://www.itl.nist.gov/div897/pubs/fip180-1.htm
import sha
import unittest
from test import test_support
class SHATestCase(unittest.... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_sha.py | Python | gpl-2.0 | 971 |
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | bblacey/FreeCAD-MacOS-CI | src/Mod/Arch/ArchSectionPlane.py | Python | lgpl-2.1 | 31,579 |
'''Document model'''
# Copyright 2013 Christopher Foo <chris.foo@gmail.com>
# Licensed under GPLv3. See COPYING.txt for details.
from .binary import *
from .block import *
from .common import *
from .field import *
from .record import *
from .warc import *
| chfoo/warcat | warcat/model/__init__.py | Python | gpl-3.0 | 257 |
"""
Copyright (c) 2009 Simon Hofer
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, su... | saeimn/ESReader | Source/main.py | Python | mit | 1,325 |
# coding=utf-8
__author__ = 'kohlmannj'
import os
import Ity
from Ity.Utilities.FilePaths import get_files_in_path, get_valid_path
class Corpus(object):
def __init__(
self,
path,
name=None,
extensions=(".txt",),
texts_path=None,
metadata_path=None,
output_... | uwgraphics/Ubiqu-Ity | Ity/Utilities/Corpus.py | Python | bsd-2-clause | 2,420 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | dguerri/ansible | lib/ansible/playbook/become.py | Python | gpl-3.0 | 5,422 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import flask
from flask import Flask, render_template
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map
from flask_googlemaps import icons
import os
import codecs
import re
import sys
import struct
import json
import requests
import argparse
import getpa... | rubenmak/PokemonGo-SlackBot | pokeslack.py | Python | mit | 41,898 |
from ..base import HaravanResource
from haravan import mixins
class Customer(HaravanResource, mixins.Metafields):
@classmethod
def search(cls, **kwargs):
"""
Search for customers matching supplied query
Args:
q: Text to search for customers ("q" is short for query)
... | Haravan/haravan_python_api | haravan/resources/customer.py | Python | mit | 628 |
# -*- coding: utf-8 -*-
"""Parse Archimate XML Exchange File Format into a MongoDB DB""" | RafaAguilar/archi2mongodb | archimate2mongodb/pkg/utils/__init__.py | Python | mit | 88 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-19 08:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
... | tmnkv/shrt | shrt/core/migrations/0002_auto_20161019_1154.py | Python | mit | 514 |
#!/usr/bin/env python3
import argparse
import json
from . import networks
from .models import Serializable
parser = argparse.ArgumentParser(prog='choo')
parser.add_argument('--pretty', action='store_true', help='pretty-print output JSON')
parser.add_argument('network', metavar='network', help='network to use, e.g. vr... | NoMoKeTo/transit | src/choo/cli.py | Python | apache-2.0 | 738 |
import hashlib
from twisted.internet.defer import inlineCallbacks
from Tribler.Test.Community.AbstractTestCommunity import AbstractTestCommunity
from Tribler.Test.Core.base_test import MockObject
from Tribler.community.market.community import MarketCommunity, ProposedTradeRequestCache
from Tribler.community.market.co... | vandenheuvel/tribler | Tribler/Test/Community/Market/test_community.py | Python | lgpl-3.0 | 21,400 |
######################################################################
#
# FSP3000R7AmplifierMib modeler plugin
#
# Copyright (C) 2011 Russell Dwarshuis, Merit Network, Inc.
#
# This program can be used under the GNU General Public License version 2
# You can find full information here: http://www.zenoss.com/oss
#
####... | kb8u/ZenPacks.Merit.AdvaFSP3000R7 | ZenPacks/Merit/AdvaFSP3000R7/modeler/plugins/Adva/FSP3000R7AmplifierMib.py | Python | gpl-2.0 | 1,541 |
from _Framework.Control import PlayableControl
class PadControl(PlayableControl):
class State(PlayableControl.State):
def __init__(self, control = None, manager = None, *a, **k):
super(PadControl.State, self).__init__(control, manager, *a, **k)
self._sensitivity_profile = None
... | LividInstruments/LiveRemoteScripts | _Mono_Framework/_deprecated/PadControl.py | Python | mit | 1,089 |
from model.project import Project
import random
import string
def random_string(prefix, maxlen):
symbols = string.ascii_letters + string.digits + " "*5
return prefix + "".join([random.choice(symbols) for i in range(random.randrange(maxlen))])
'''def test_delete_project(app):
if app.project.count() == 0:... | Spike96/Pyhton_Training_Mantis | test/test_delete_project.py | Python | apache-2.0 | 1,388 |
"""yeelight conftest."""
from tests.components.light.conftest import mock_light_profiles # noqa
| sdague/home-assistant | tests/components/yeelight/conftest.py | Python | apache-2.0 | 97 |
from django.conf import settings
from django.core.urlresolvers import resolve
from .. import urls_tips
RAW_SUBDOMAIN_HOSTS = ['tips.pinecast.com', 'tips.pinecast.dev']
if settings.STAGING:
RAW_SUBDOMAIN_HOSTS.append('tips.next.pinecast.com')
class TipsSubdomainMiddleware(object):
def process_request(self, r... | Pinecast/pinecast | payments/middleware/tips_site.py | Python | apache-2.0 | 830 |
from .main import Sabnzbd
def start():
return Sabnzbd()
config = [{
'name': 'sabnzbd',
'groups': [
{
'tab': 'downloaders',
'list': 'download_providers',
'name': 'sabnzbd',
'label': 'Sabnzbd',
'description': 'Use <a href="http://sabnzbd.or... | coolbombom/CouchPotatoServer | couchpotato/core/downloaders/sabnzbd/__init__.py | Python | gpl-3.0 | 1,774 |
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
# Links UserProfile to a User model instance.
user = models.OneToOneField(User)
# The additional attributes.
website = models.URLField(blank=True)
# picture = models.ImageField(upload_to='pro... | hillscottc/quiz2 | quiz2/apps/quiz/models.py | Python | agpl-3.0 | 2,939 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
class Playlists(object):
def playlist_ids(self):
"""
Returns an iterator of all Plex ids of playlists.
"""
self.cursor.execute('SELECT plex_id FROM playlists')
r... | croneter/PlexKodiConnect | resources/lib/plex_db/playlists.py | Python | gpl-2.0 | 3,096 |
bind = 'unix:/tmp/gunicorn.sock'
# bind = '127.0.0.1:8080'
workers = 1 | TornikeNatsvlishvili/GeorgianAutoComplete | backend/gunicorn.py | Python | mit | 70 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test node handling
#
from test_framework.test_framework import BitcoinTestFramework
from test_framew... | terracoin/terracoin | qa/rpc-tests/nodehandling.py | Python | mit | 3,440 |
from flask.ext.security import current_user
def check_admin():
print("ADMIN CHECK")
print("RESULT = %s" % str((current_user and current_user.has_role('Administrator'))))
return (current_user and current_user.has_role('Administrator'))
| UMDIEEE/ieee-web | IEEETestbankApp/views/admin/admin.py | Python | gpl-3.0 | 248 |
# -*- coding: utf-8 -*-
"""
|openid| Providers
----------------------------------
Providers which implement the |openid|_ protocol based on the
`python-openid`_ library.
.. warning::
This providers are dependent on the |pyopenid|_ package.
.. autosummary::
OpenID
Yahoo
Google
"""
# We need absolu... | jasco/authomatic | authomatic/providers/openid.py | Python | mit | 17,262 |
# -*- encoding: utf-8 -*-
# Copyright © 2012 New Dream Network, LLC (DreamHost)
# 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.... | ruyang/ironic | ironic/api/app.py | Python | apache-2.0 | 3,479 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2007 Philippe LAWRENCE
#
# This file is part of pyBar.
# pyBar 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 Licen... | Philippe-Lawrence/pyBar | classPrefs.py | Python | gpl-3.0 | 8,101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.