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 _plotly_utils.basevalidators
class OrientationValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="orientation", parent_name="contour.colorbar", **kwargs
):
super(OrientationValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/contour/colorbar/_orientation.py | Python | mit | 493 |
"""~directions "<start>" "<end>" (in quotes) return a result from the google maps result for directions from <start> to <end>"""
import re
import requests
import googlemaps
from googlemaps import Client as GoogleMaps
from secret_example import GOOGLE_DIRECTION_API
try:
from HTMLParser import HTMLParser
except Impo... | Eulercoder/fabulous | fabulous/services/directions.py | Python | gpl-3.0 | 2,201 |
#
# 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 ... | thinker0/aurora | src/test/python/apache/aurora/executor/common/test_path_detector.py | Python | apache-2.0 | 2,572 |
__author__ = "James Baster (james@jarofgreen.co.uk)"
__copyright__ = "(C) 2009 James Baster. GNU GPL 3."
from django.forms.widgets import Widget
from django.utils.safestring import mark_safe
from django.forms.util import flatatt
from django.utils.encoding import StrAndUnicode, force_unicode
from itertools import chai... | jarofgreen/MyJobSeek | myjobapps/widgetneworexisting.py | Python | gpl-3.0 | 2,400 |
import numpy as np
scores = np.array([0,1])
nScores = len(scores)
nClasses = 2
inputFile = "./data/crowdlabels_table_mixed.csv"
tableFormat = True
outputFile = "./data/test.out"
confMatFile = "./data/test_ibcc.mat"
goldFile = "./data/goldmat_mixed.csv"
nu0 = np.array([50,50])
alpha0 = np.array([[2, 1], [1, 2]])
| CitizenScienceInAstronomyWorkshop/pyIBCC | python/tests/config/table_shortgoldmat.py | Python | mit | 313 |
# -*- coding: utf-8 -*-
#
# commandify documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are co... | markmuetz/commandify | docs/conf.py | Python | mit | 8,399 |
# -*- coding: UTF-8 -*-
"""
Django settings for archer project.
Generated by 'django-admin startproject' using Django 1.8.17.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/s... | jly8866/archer | archer/settings.py | Python | apache-2.0 | 10,140 |
"""
Include the sensor modules that you have created here.
Kervi will load the sensors that are imported here.
"""
#from . import my_sensor
from . import system_sensors
| kervi/can-bot | app/sensors/__init__.py | Python | mit | 176 |
# // license
# Copyright 2016, Free Software Foundation.
#
# This file is part of Solent.
#
# Solent is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
... | solent-eng/solent | solent/draft/gollop_box.py | Python | lgpl-3.0 | 3,595 |
#!/usr/bin/env python -u
import sys
from argparse import ArgumentParser
import time
import json
import yaml
import os
import requests
try:
import boto.ec2
import boto.sqs
from boto.vpc import VPCConnection
from boto.exception import NoAuthHandlerFound, EC2ResponseError
from boto.sqs.message import R... | lgfa29/configuration | util/vpc-tools/abbey.py | Python | agpl-3.0 | 28,957 |
"""
Mypy plugin to aid with typechecking code that uses Crochet.
"""
import typing
from typing import Callable, Optional
from mypy.plugin import FunctionContext, Plugin # pylint: disable=no-name-in-module
from mypy.types import CallableType, Type, get_proper_type # pylint: disable=no-name-in-module
def plugin(_ve... | itamarst/crochet | crochet/mypy.py | Python | mit | 1,759 |
#!/usr/bin/env python3
import json
from ..basics.elements import *
from ..utils.utils import *
class Element:
def __init__(self, xml_element):
self.element = {}
for elem in Elements:
if elem not in (Elements.Type, Elements.Text):
self.element[elem.name] = get_element_... | RafaAguilar/archi2mongodb | archimate2mongodb/pkg/elements/element.py | Python | mit | 1,195 |
# Copyright 2016-2017 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | openstack/tempest | tempest/api/compute/servers/test_novnc.py | Python | apache-2.0 | 10,583 |
import picamera
import socket
import struct
import time
import io
class ClienteColector(object):
# Se define el constructor de la clase ClienteColector, que recibe
# los siguientes parametros:
# * resolucion: es una tupla que contiene la resolucion de la
# camara en pixeles.
# * tiempo_captu... | MiguelGarciaAlcala/VehiculoAutonomoRC | VA_GECPC/CODIGO_PROYECTO/Algoritmo de Recoleccion/Python/ClienteColector.py | Python | gpl-3.0 | 3,988 |
# 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 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | hahaps/openstack-project-generator | template/<project_name>/api/__init__.py | Python | apache-2.0 | 1,063 |
from mpf.system.modes import Mode
class Rescue(Mode):
def mode_init(self):
pass
def mode_stop(self):
self.machine.events.post('return_to_mission_control') | GabeKnuth/STTNG | modes/rescue/code/rescue.py | Python | mit | 189 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Carlos Cesar Caballero Diaz <ccesar@linuxmail.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... | cccaballero/services-manager | services-manager.py | Python | gpl-3.0 | 5,938 |
from Root.src import application
import unittest
class test11(unittest.TestCase):
def test_one(self):
self.assertEqual(application.foo(),1)
if __name__ == '__main__':
unittest.main()
| codeboardio/mantra | test/test_resources/python-unittest/py_error_one_file_manyErrors/Root/test/test11.py | Python | mit | 188 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Sequential simulation:
Make plot to show difference between observations and predicted values
"""
import SequentialSimulation_results as seqsim
import matplotlib.pyplot as plt
nobs = len(seqsim.obs)
obs = seqsim.obs
pred_f = seqsim.pred_f_central
fig1 = plt.figure... | OpenDA-Association/OpenDA | model_dflowfm_blackbox/tests/estuary_kalman_FMSuite2019.01/plot_sequential.py | Python | lgpl-3.0 | 906 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides input and output from the CSSR file format.
"""
import re
from monty.io import zopen
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
__author... | gVallverdu/pymatgen | pymatgen/io/cssr.py | Python | mit | 3,006 |
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.db.models import Q
from .models import Resource
def index(request):
latest_resources_list = Resource.objects.order_by('-id')[:5]
context = {'latest_resources_list': latest_resources_list,}
return ren... | evildmp/django-curated-resources | curated_resources/views.py | Python | bsd-2-clause | 2,752 |
'''
Created on 16 Sep 2017
@author: Mathias Bucher
'''
from Tkinter import Frame
from VStyles import rootColor, getFrame, getButtonEntry
from model.ModelEntry import ModelEntry
class VOverview(Frame):
'''
classdocs
'''
name = "Overview"
def __init__(self, parent, log, actions):
'''
... | maeddlae/keepit | src/view/VOverview.py | Python | mit | 1,608 |
# -*- coding: utf-8 -*-
# Flask License
#
# Copyright © 2010 by the Pallets team.
#
# Some rights reserved.
# Redistribution and use in source and binary forms of the software as well as
# documentation, with or without modification, are permitted provided that the
# following conditions are met:
#
# Redistributions ... | janeczku/calibre-web | cps/redirect.py | Python | gpl-3.0 | 2,375 |
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Denis Egnemann <denis.engemann@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
# Adam Li <adam2392@gmail.com>
# ... | bloyl/mne-python | mne/datasets/utils.py | Python | bsd-3-clause | 21,557 |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
Python Console for QGIS
-------------------
begin : 2012-09-10
copyright : (C) 2012 by Salvatore Larosa
email : lrssvtml (at) gmail (dot) com
***... | ghtmtt/QGIS | python/console/console.py | Python | gpl-2.0 | 36,846 |
import csv
import heapq
# csvfile1 = file('V2.0resize.csv','rb')
# csvfile2 = file('V2.0motion20_30_len_pred.csv','rb')
# csvfile3 = file('V2.0motion40_30_len_pred.csv','rb')
# csvfile4 = file('V2.0motion60_30_len_pred.csv','rb')
csvfile1 = file('V2.0resize.csv','rb')
csvfile2 = file('V2.0motion20_15_pred.csv','rb')
c... | DaniellaAngel/MachineLearning | motion/merge_csv.py | Python | apache-2.0 | 975 |
#!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# 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 copyright
# notice, this list... | sfiera/googletest | test/gtest_help_test.py | Python | bsd-3-clause | 5,754 |
# -*- coding: utf-8 -*-
""" standard """
from random import randint
import re
""" custom """
from examples.working_init import *
from threatconnect.Config.ResourceType import ResourceType
#
# CHANGE FOR YOUR TESTING ENVIRONMENT
# - These incidents must be created before running this script
#
owner = 'Example Communi... | percipient/threatconnect-python | examples/commit/incidents_commit.py | Python | apache-2.0 | 8,526 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape, IGNORECASE
from ..scraper import _BasicScraper, _ParserScraper
... | webcomics/dosage | dosagelib/plugins/w.py | Python | mit | 7,981 |
#from http://stackoverflow.com/questions/20076030/lack-of-speedup-and-erroneous-results-with-openmp-and-cython/20183767#20183767
#pythran export summation(float32[][], float32[], float32[][])
#runas import numpy as np ; N=30 ; pos = np.arange(N*3., dtype=np.float32).reshape((N,3)) ; w = np.ones(N, dtype=np.float32) ; p... | artas360/pythran | pythran/tests/cases/sumarray3d.py | Python | bsd-3-clause | 1,367 |
import codecs
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
# Provided as an attribute, so you can append to these instead
# of r... | eldarion/django-coinbase | setup.py | Python | bsd-3-clause | 4,854 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Malcolm Ramsay <malramsay64@gmail.com>
#
# Distributed under terms of the MIT license.
"""Test function from the generation of figures."""
import math
import gsd.hoomd
from hypothesis import given
from hypothesis.strategies import f... | malramsay64/MD-Molecules-Hoomd | test/figures_test.py | Python | mit | 1,269 |
#
# This is a clone of libdrm/tests/modetest/modetest.c
#
# DRM based mode setting test program
# Copyright 2008 Tungsten Graphics
# Jakob Bornecrantz <jakob@tungstengraphics.com>
# Copyright 2008 Intel Corporation
# Jesse Barnes <jesse.barnes@intel.com>
import os, sys
import argparse
sys.path.insert(0, os.p... | notro/pydrm | utils/modetest.py | Python | mit | 15,613 |
#
# 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... | Acehaidrey/incubator-airflow | tests/providers/microsoft/azure/hooks/test_azure_cosmos.py | Python | apache-2.0 | 10,134 |
"""Tests for vumi.transports.irc.irc."""
from StringIO import StringIO
from twisted.internet.defer import (inlineCallbacks, returnValue,
DeferredQueue, Deferred)
from twisted.internet.protocol import FileWrapper
from vumi.tests.utils import LogCatcher
from vumi.transports.failures... | TouK/vumi | vumi/transports/irc/tests/test_irc.py | Python | bsd-3-clause | 17,711 |
# encoding: utf-8
# The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on ... | os2webscanner/os2webscanner | django-os2webscanner/os2webscanner/views/report_views.py | Python | mpl-2.0 | 9,704 |
#!/usr/bin/python
#
# bravialib - Will Cooke - Whizzy Labs - @8none1
# http://www.whizzy.org
# Copyright Will Cooke 2016. Released under the GPL.
#
#
# My attempt to talk to the Sony Bravia web API.
#
# This is designed to be used by a long running process
# So there is a potentially slow start-up time but then it ... | 8none1/bravialib | bravialib.py | Python | gpl-3.0 | 24,487 |
from PyQt5.QtCore import Qt, QModelIndex, QAbstractListModel, pyqtSignal
from urh.signalprocessing.Participant import Participant
from urh.simulator.SimulatorConfiguration import SimulatorConfiguration
class SimulatorParticipantListModel(QAbstractListModel):
participant_simulate_changed = pyqtSignal(Participant... | jopohl/urh | src/urh/models/SimulatorParticipantListModel.py | Python | gpl-3.0 | 1,580 |
import json
import os
import platform
import signal
import subprocess
import sys
from abc import ABCMeta, abstractmethod
import mozinfo
import mozleak
import mozversion
from mozprocess import ProcessHandler
from mozprofile import FirefoxProfile, Preferences
from mozrunner import FirefoxRunner
from mozrunner.utils impo... | asajeffrey/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py | Python | mpl-2.0 | 32,513 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for ssh/transport.py and the classes therein.
"""
import struct
try:
import pyasn1
except ImportError:
pyasn1 = None
try:
import Crypto.Cipher.DES3
except ImportError:
Crypto = None
if pyasn1 is not None and Crypto is... | ecolitan/fatics | venv/lib/python2.7/site-packages/twisted/conch/test/test_transport.py | Python | agpl-3.0 | 82,188 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | wubr2000/googleads-python-lib | examples/dfa/v1_20/add_advertiser_user_filter.py | Python | apache-2.0 | 2,962 |
# Setup for static-picture-publish.
from distutils.core import setup
# This version number must match the version number in VERSION.
_sppVersion = '0.1'
setup(name='static-picture-publish',
description="""Publish images.""",
long_description="""
Publish images.""",
author='Russell Steicke... | russells/static-picture-publish | setup.py | Python | gpl-2.0 | 1,416 |
import json
import os
import time
import hashlib
import inspect
import idc
import idautils
import idaapi
from idaapi import Form
from py2neo import authenticate, Graph, Node, Relationship
class ConnectionManagementForm(Form):
def __init__(self,manager):
self.manager = manager
self.conf = manager.get_config()
... | sam-b/ida-scripts | neo4ida/neo4ida.py | Python | unlicense | 11,112 |
import datetime
import threading
import time
import cherrypy
from cherrypy.lib import cptools, httputil
class Cache(object):
def get(self):
raise NotImplemented
def put(self, obj, size):
raise NotImplemented
def delete(self):
raise NotImplemented
... | imajes/Sick-Beard | cherrypy/lib/caching.py | Python | gpl-3.0 | 15,405 |
import kivy
kivy.require('1.9.1')
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty, ObjectProperty
class StatusBar(BoxLayout):
counter = NumericProperty(0)
previous_counter = 0
def on_counter(self,instnace,value):
if value == 0:
self.msg_label.text ... | pimier15/PyGUI | Kivy/Kivy/Bk_Interractive/My/C3/Dragging/statusbar.py | Python | mit | 613 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
class ... | xzturn/caffe2 | caffe2/python/operator_test/clip_tensor_op_test.py | Python | apache-2.0 | 2,109 |
from flask import Flask
from flask import request, render_template, jsonify
from src.common.NER_utils import transform_dataset_web
from src.CRF_NER.CRF_NER import parse_commands
import pycrfsuite
model = "1_nbr"
def init(filename = "model.txt"):
with open(filename) as f:
line = f.read()
tokens = ... | nguyeho7/CZ_NER | src/webservice/server.py | Python | mit | 1,188 |
# -*- coding: utf-8 -*-
# flake8: noqa
import datetime
import logging
import json
import os.path
import prison
import urllib.parse
from .util import EAException
from .util import lookup_es_key
from .util import ts_add
kibana_default_timedelta = datetime.timedelta(minutes=10)
kibana5_kibana6_versions = frozenset(['5.... | Yelp/elastalert | elastalert/kibana_discover.py | Python | apache-2.0 | 5,644 |
"""
(C) 2013 Humarobotics
Provides classes for quick threading of object methods
In your class, just add this line to the __init__:
self.post=Post(self)
You can now call any object methods with object.post.method(args)
The Thread object is returned.
"""
from threadi... | tavallaie/RoboDynamixel | dxl/post_threading.py | Python | mit | 2,176 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | elijah513/ice | allTests.py | Python | gpl-2.0 | 1,083 |
from netfields import InetAddressField, CidrAddressField
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from nodeshot.core.base.models import BaseAccessLevel
from ..managers import NetAccessLevelM... | sephiroth6/nodeshot | nodeshot/networking/net/models/ip.py | Python | gpl-3.0 | 2,430 |
import mysql.connector
class DB(object):
def __init__(self, settings):
self.conn = None
self.settings = settings
def get_db_connection(self):
if self.conn is None:
self.conn = mysql.connector.connect(
user=self.settings['db']['username'],
p... | amenezes/secureheaders | lib/database/db.py | Python | gpl-2.0 | 3,252 |
# -*- coding: utf-8 -*-
import functools
import re
from flask.ext import login
from flask.ext import oauth
from google.appengine.api import users
from google.appengine.ext import ndb
import flask
import config
import model
import util
from main import app
_signals = flask.signals.Namespace()
#####################... | jaja14/lab5 | main/auth.py | Python | mit | 10,147 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | nzlosh/st2 | st2common/st2common/constants/pack.py | Python | apache-2.0 | 2,612 |
'''Helper functions for rosenbrock optimization examples.'''
import climate
import downhill
import numpy as np
import theano
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
climate.enable_default_logging()
COLORS = ('#d62728 #1f77b4 #2ca02c #9467bd #ff7f0e '
'#e377c2 #8c564b #bcbd22 ... | masterkeywikz/seq2graph | src/downhill-0.2.2/examples/rosenbrock.py | Python | mit | 3,403 |
# -*- coding: utf-8 -*-
from docpool.api.testing import DOCPOOL_API_ACCEPTANCE_TESTING # noqa
from plone.app.testing import ROBOT_TEST_LEVEL
from plone.testing import layered
import os
import robotsuite
import unittest
def test_suite():
suite = unittest.TestSuite()
current_dir = os.path.abspath(os.path.dirn... | OpenBfS/dokpool-plone | Plone/src/docpool.api/src/docpool/api/tests/test_robot.py | Python | gpl-3.0 | 801 |
from pymongo import MongoClient
from bson.objectid import ObjectId
from twisted.trial.unittest import TestCase
from tests.utils import ObjectMaker
from vusion.component import DialogueWorkerPropertyHelper, PrintLogger
from vusion.persist import RequestManager, Request
from vusion.persist.action import OptinAction, F... | texttochange/vusion-backend | vusion/persist/request/tests/test_request_manager.py | Python | bsd-3-clause | 3,618 |
# -*- coding: utf-8 -*-
import datetime
from dateutil import relativedelta
from email.utils import formataddr, getaddresses
from email_utils import email_get
from openerp import api, fields, models, _
from openerp.exceptions import AccessError, ValidationError
from __builtin__ import False
TICKET_PRIORI... | sumihai-tekindo/helpdesk_sicepat | helpdesk_sicepat/models/helpdesk.py | Python | gpl-3.0 | 51,837 |
#!/usr/bin/python
import versioning_base
from pyspatialite import dbapi2
import psycopg2
import os
import shutil
test_data_dir = os.path.dirname(os.path.realpath(__file__))
tmp_dir = "/tmp"
# create the test database
os.system("dropdb epanet_test_db")
os.system("createdb epanet_test_db")
os.system("psql epanet_test_... | enricofer/qgis-versioning | test/issue437_test.py | Python | gpl-2.0 | 3,445 |
import os
import sys
import copy
import logging
from checker import *
from .ofp import register_ofp_creators
from .ofp import OfpBase
from .utils import get_attrs_without_len
# YAML:
# get_async_reply:
# packet_in_mask:
# - 0x0
# - 0x0
# port_status_mask:
# - 0x0
# - 0x0
# flow_removed_mask:
# ... | lagopus/lagopus | test/integration_test/tools/lib/ofp/ofp_get_async_reply.py | Python | apache-2.0 | 774 |
from flask import current_app, request, Response, get_flashed_messages
from flask.ext.login import current_user
class NotModified(Exception):
pass
def handle_not_modified(exc):
return Response(status=304)
def setup_caching():
request._http_cache = current_app.config.get('CACHE')
request._http_eta... | nathanhilbert/flaskboiler | flaskboiler/views/cache.py | Python | agpl-3.0 | 1,563 |
"""DEPRECATED UI FUNCTIONALITY"""
# """
# from nailgun import entities
# from robottelo import manifests
# from robottelo.api.utils import call_entity_method_with_timeout
# from robottelo.config import settings
# from robottelo.constants import (
# DISTRO_RHEL7,
# ENVIRONMENT,
# REAL_RHEL7_0_0_PACKAGE,
# ... | ldjebran/robottelo | tests/foreman/ui_deprecated/test_contentaccess.py | Python | gpl-3.0 | 15,538 |
#!/usr/bin/env python
"""
Listens to github hooks at /poetroid and runs literatti and sends results to s3
"""
from flask import Flask, request
import json
from s3 import build
import os
app = Flask(__name__)
@app.route('/poetroid',methods=['POST'])
def gh_hook():
# check request uri from github
os.system... | facjure/poetroid-prototype | scripts/ghhook.py | Python | epl-1.0 | 553 |
from prismriver.plugin.common import Plugin
from prismriver.struct import Song
class SnakiePlugin(Plugin):
ID = 'snakie'
def __init__(self, config):
super(SnakiePlugin, self).__init__('Snakie\'s Obsession', config)
def search_song(self, artist, title):
to_delete = ['.', ',', '!', '?', '(... | anlar/prismriver | prismriver/plugin/snakie.py | Python | mit | 1,536 |
#!/usr/bin/env python
import sys, getopt, requests, datetime, urllib, grequests
def call_reqs(i, len_all_urls, inner_urls, file_name):
reqs = [ua[0] for ua in inner_urls]
artists = [ua[1] for ua in inner_urls]
sys.stdout.write(datetime.datetime.now().strftime('%d-%m-%Y-%H:%M:%S') + ' - ' + str(i) + ... | tdopires/musicmap | scripts/query-artists-uris-parallel.py | Python | apache-2.0 | 2,575 |
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
from MOAL.helpers.display import print_h3
from MOAL.helpers.display import print_h4
from time... | christabor/MoAL | MOAL/computer_organization/data_types.py | Python | apache-2.0 | 5,327 |
#!/usr/bin/env python
#
# Copyright 2014 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.
"""Writes a build_config file.
The build_config file for a target is a json file containing information about
how to build that targ... | collinjackson/mojo | build/android/gyp/write_build_config.py | Python | bsd-3-clause | 13,804 |
"""IPython extension to reload modules before executing user code.
``autoreload`` reloads modules automatically before entering the execution of
code typed at the IPython prompt.
This makes for example the following workflow possible:
.. sourcecode:: ipython
In [1]: %load_ext autoreload
In [2]: %autoreload 2... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/IPython/extensions/autoreload.py | Python | mit | 17,198 |
test_sub_dir = "test_data/1019436/session_1"
def test_workflow_anatomical_reorient():
''' unit test for the anatomical reorient workflow BUILDER '''
import os
import commands
import pkg_resources as p
from qap.anatomical_preproc import run_anatomical_reorient
from qap.workflow_utils ... | wangkangcheng/ccc | qap/test_anatomical_preproc.py | Python | bsd-3-clause | 7,387 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import evennia.accounts.manager
import django.core.validators
class Migration(migrations.Migration):
dependencies = [("accounts", "0003_auto_20150209_2234")]
operations = [
migrations.DeleteModel(name="DefaultGuest"),
migrati... | jamesbeebop/evennia | evennia/accounts/migrations/0004_auto_20150403_2339.py | Python | bsd-3-clause | 2,157 |
# this is based in the audio recording example provided by omz (Ole Zorn)
from objc_util import *
import os
def main():
AVAudioSession = ObjCClass('AVAudioSession')
NSURL = ObjCClass('NSURL')
AVAudioRecorder = ObjCClass('AVAudioRecorder')
shared_session = AVAudioSession.sharedInstance()
category_set = shared_sess... | shaun-h/pythonista-objc-utils | Audio Recording.py | Python | mit | 1,104 |
"""
=========================
PLS Partial Least Squares
=========================
Simple usage of various PLS flavor:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivariate covarying two-dimensional datasets, X, and Y,
... | cdegroc/scikit-learn | examples/plot_pls.py | Python | bsd-3-clause | 4,317 |
from build_template import *
from optparse import OptionParser
import json
import os
def generate_enum_classfile(json_file, model):
filename = os.path.basename(json_file)
p = os.path.dirname(os.path.dirname(json_file))
enum_name = filename[:-5]
enum_file = os.path.join(p, enum_name + '.php')
print... | healerkx/AdminBuildr | scripts/build_enum.py | Python | apache-2.0 | 1,007 |
"""Runs the Treadmill container cleanup job.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import click
from treadmill import appenv
from treadmill import cleanup
from treadmill import cli
from treadmill import... | Morgan-Stanley/treadmill | lib/python/treadmill/sproc/cleanup.py | Python | apache-2.0 | 1,571 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
A Django management command class that handles locking so it doesn't
trigger multiple times when used inside of an ex... | ericawright/bedrock | bedrock/utils/management/cron_command.py | Python | mpl-2.0 | 1,525 |
# Copyright (c) 2016 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | Weil0ng/gem5 | src/python/m5/util/__init__.py | Python | bsd-3-clause | 7,742 |
"""
homeassistant.components.notify.free_mobile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free Mobile SMS platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.free_mobile/
"""
import logging
from homeassistant.component... | coteyr/home-assistant | homeassistant/components/notify/free_mobile.py | Python | mit | 1,859 |
dem_filename = '../data/ideal_flat.tif'
max_area= 9999999999999999**2 #Effectively unlimited upper area -- allow tolerance check to refine it further
max_tolerance = 5 # 5m max RMSE between triangle and underlying elevation set to -1 to skip tolerance checks
min_area = 5**2 #triangle area below which we will ... | Chrismarsh/mesher | examples/flat_stream/flat_stream.py | Python | gpl-3.0 | 515 |
from django.shortcuts import get_object_or_404
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import NotFound, ValidationError, PermissionDenied
from api.base.exceptions import Gone
from api.base import permissions as base_permissions
from api.base.views import JSONA... | chennan47/osf.io | api/comments/views.py | Python | apache-2.0 | 9,881 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(co... | agry/NGECore2 | scripts/mobiles/generic/faction/imperial/imp_stealth_operative.py | Python | lgpl-3.0 | 1,435 |
# coding: utf-8
#
# basiclib.py
#
# Author: Huang Anbu
# Date: 2017.3
#
# Description: Layer architecture
#
# - HiddenLayer
# - LogisticRegression: output layer
# - DropoutHiddenLayer: HiddenLayer with dropout
# - MLPDropout: multilayer perceptron with dropout
# - LeNetConvPoolLayer: modified from http://www.... | innovation-cat/DeepLearningBook | sentiment analysis/cnn_model.py | Python | mit | 5,410 |
from a10sdk.common.A10BaseClass import A10BaseClass
class AddressList(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param ipv4_address: {"type": "string", "description": "IP address", "format": "ipv4-address"}
:param ipv4_netmask: {"type": "string", "description":... | amwelch/a10sdk-python | a10sdk/core/interface/interface_loopback_ip.py | Python | apache-2.0 | 2,191 |
import requests
import re
import os
import win32com.client
import time
import sys
from html.parser import HTMLParser
#class to parse the torrent sites and retrieve magnet links
class MyHTMLParser(HTMLParser):
magnet = ""
urls = []
#function to retrieve magnet link by checking the a href tags
def hand... | hrishikeshsathe/py-auto-downloader | py_scheduler.py | Python | mit | 2,988 |
# 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py | Python | mit | 5,849 |
#!/usr/bin/env python
#coding=utf8
#负责模拟登陆
#
import pycurl
import StringIO
from urllib import urlencode
import get_login_code
def GetLoginInfo(post_data,cookie_file,proxy):
login_url = "http://www.bjguahao.gov.cn/comm/logon.php"
#cookie_file = './Cookie/cookie.txt'
ch = pycurl.Curl()
buffer_con = StringIO.StringI... | lichenhui/guahao | guahao_beijing/login.py | Python | apache-2.0 | 2,160 |
"""
Karl Persson, Mac OSX 10.8.4/Windows 8, Python 2.7.5, Pygame 1.9.2pre
Class handling menues and menu interactions
"""
import pygame
from pygame.locals import *
import PictureElement, TextElement
# Class handling all menu elements
class Menues():
def __init__(self, fileManager, levelManager, startLevel=0):
... | KPRSN/Pulse | Pulse/Menues.py | Python | mit | 7,244 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def get_ki2_list(parser):
parser.add_argument('-p', '--path_2chkifu',
default='~/data/shogi/2chkifu/',
help='2chkifu.zipを展開したディレクトリ')
args = parser.parse_args()
path_2chkifu = args.path_2chkifu
s... | tosh1ki/pyogi | doc/sample_code/get_ki2_list.py | Python | mit | 741 |
# Copyright 2015 Allen Institute for Brain Science
# This file is part of Allen SDK.
#
# Allen SDK 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.
#
# Allen SDK is distributed in the ... | wvangeit/AllenSDK | allensdk/api/queries/glif_api.py | Python | gpl-3.0 | 5,717 |
# -*- coding: utf-8 -*-
import inspect
db = inspect.getmodule(inspect.stack()[1][0]).db
class User(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(40), unique=True)
twitter_id = db.Column(db.String(255), unique=True)
authority = db.Column... | kwzrhouse/api.kwzrhouse.net | models.py | Python | mit | 2,803 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | XeCycle/indico | indico/MaKaC/webinterface/rh/lang.py | Python | gpl-3.0 | 1,152 |
'''
Created on 17 Aug 2017
Delete middle node: Implement an algorithm to delete a node in the middle,
(i.e. any node by the first and the last node, not exactly at the middle) of a singly linked list,
given only access to the node.
@author: igoroya
'''
from chapter2 import utils
def delete_node(node):
#idea is... | igoroya/igor-oya-solutions-cracking-coding-interview | crackingcointsolutions/chapter2/exercisethree.py | Python | mit | 794 |
from django.conf.urls import url, patterns
from django.views.generic import TemplateView
urlpatterns = patterns('librehatti.voucher.views',
url(r'^voucher_generate/','voucher_generate'),
url(r'^voucher_show/','voucher_show'),
url(r'^voucher_print/','voucher_print'),
)
| s-monisha/LibreHatti | src/librehatti/voucher/urls.py | Python | gpl-2.0 | 283 |
"""
CharacterDetector:
This class monitors the eve gamelog directory for new files,
as well as initializes PELD with the last day's worth of eve logs
and keeps track of what eve character belongs to which log.
When a new file enters the gamelog directory, CharacterDetector
either replace... | ArtificialQualia/PyEveLiveDPS | PyEveLiveDPS/logreader.py | Python | gpl-3.0 | 31,630 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | felipenaselva/felipe.repository | script.module.placenta/lib/resources/lib/sources/en/hdmega.py | Python | gpl-2.0 | 5,966 |
# Copyright (C) 2007-2012, Stefan Schwarzer <sschwarzer@sschwarzer.net>
# See the file LICENSE for licensing terms.
import ntpath
import os
import shutil
import StringIO
import sys
import unittest
import ftputil
from ftputil import ftp_sync
# Assume the test subdirectories are or will be in the current directory.
T... | rathodmartin/oc | tools/tst/ftputil-2.8/test/test_ftp_sync.py | Python | epl-1.0 | 3,655 |
from datetime import date, datetime
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.utils.decorators import method_decorator
from django.conf import settings
from income.forms import CuentasCobrarPromotorForm, CuentasC... | furthz/colegio | src/income/views.py | Python | mit | 42,291 |
from warnings import warn
from django.db import models
from avocado.core import utils
from modeltree.tree import trees
from django.db.models.query import QuerySet
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.utils.encoding import smart_unicode
AND = 'AND'
OR = 'OR'
BRANCH_KEYS = (... | murphyke/avocado | avocado/query/oldparsers/datacontext.py | Python | bsd-2-clause | 10,716 |
"""
Create some examples in the time domain.
Simulate and plot impulse behavior for Wave Field Synthesis.
"""
import numpy as np
import matplotlib.pyplot as plt
import sfs
# simulation parameters
grid = sfs.util.xyz_grid([-3, 3], [-3, 3], 0, spacing=0.01)
my_cmap = 'YlOrRd'
N = 56 # number of secondary sources
R =... | sfstoolbox/sfs-python | doc/examples/time_domain.py | Python | mit | 2,730 |
import copy
from . import functions, instance
from .self_constructor import SelfConstructor
JSON_TYPES = {str, int, float, type(None), bool}
class Type(SelfConstructor):
"""
Implements a simple class interface for trivially JSONable objects.
:Example:
>>> from jsonable import JSONable
>... | halfak/python-jsonable | jsonable/type.py | Python | mit | 4,811 |
from AccessControl import ClassSecurityInfo
from archetypes.querywidget.views import WidgetTraverse as _WidgetTraverse
from archetypes.querywidget.widget import QueryWidget as _QueryWidget
from bika.lims.querystring.querybuilder import QueryBuilder
from bika.lims.querystring.querybuilder import RegistryConfiguration
fr... | anneline/Bika-LIMS | bika/lims/browser/widgets/querywidget.py | Python | agpl-3.0 | 5,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.