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 |
|---|---|---|---|---|---|
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.abstract_variables.abstract_travel_time_variable import abstract_travel_time_variable
class travel_time_hbw_am_drive_alone_from_home_to_work_alt(abstract_travel_time_variable):
... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/household_x_zone/travel_time_hbw_am_drive_alone_from_home_to_work_alt.py | Python | gpl-2.0 | 2,397 |
from flask import Response
from flask.views import View
from bson import json_util
from mcp import mongo
class Map(View):
def dispatch_request(self, komuna, viti):
json = mongo.db.procurements.aggregate([
{
"$match": {
"komuna.slug": komuna,
... | opendatakosovo/municipality-procurement-api | mcp/views/map.py | Python | gpl-2.0 | 4,266 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py... | ecino/compassion-modules | sbc_compassion/migrations/10.0.1.2.0/post-migration.py | Python | agpl-3.0 | 1,522 |
"""
The NUM_CODE is length of authentication
"""
NUM_OF_CODE = 8
"""
The IP_PORT is for socket work fine!
"""
IP = '0.0.0.0'
PORT = 5555
IP_PORT = (IP, PORT)
"""
You should configure your data base here!
"""
DB_TYPE = 'mysql'
DB_HOST = 'localhost'
DB_USER = 'root'
DB_PASSWORD = 'tianxunceshi'
DB_PORT = 3306
DB_NAME ... | land-pack/jtt808 | conf/settings.py | Python | gpl-2.0 | 340 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Peiyong Jiang
作者: 姜培勇
jiangpeiyong@impcas.ac.cn
本文件解释:
"""
import numpy as np
from Input import *
numPart=np.int64(numPart)
def FieldAdd(exEx,exEy,exEz,exBx,exBy,exBz,inEx,inEy,inEz,inBx,inBy,inBz):
Ex=exEx+inEx
Ey=exEy+inEy
Ez=exEz+inEz
... | iABC2XYZ/abc | PIC5/Field.py | Python | gpl-3.0 | 1,737 |
#
# (c) Copyright 2012 Andreas Hausmann
# This file is part of TGSBot.
# Permission to copy or use is limited. Please see LICENSE for information.
#
"""Configuration stuff."""
ADMINISTRATORS = ('hannes', 'helena',)
COMMANDS = ('tell', 'shout', 'end', 'away', 'back', 'toggle', 'set', 'invite',)
MAX_MATCHLEN = 29
| Watzmann/TGSBot | operation/config.py | Python | gpl-3.0 | 314 |
from itertools import product, islice
from joblib import Parallel, delayed
import json
import requests
from requests.exceptions import ConnectionError, Timeout
from simplejson import JSONDecodeError
import string
CLIENT_ID = 'a48b4d0f6e0745e2ba68902a1f68f8d5'
URL = 'https://api.instagram.com/oembed/media/?url=http://i... | slyfocks/pigs | shortcodes.py | Python | apache-2.0 | 1,664 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para streamplay
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re
from core import jsunpack
from core import log... | Mzero2010/MaxZone | plugin.video.Mzero/servers/streamplay.py | Python | gpl-3.0 | 5,680 |
# coding: utf-8
import re
from sqlalchemy import bindparam
from sqlalchemy import Computed
from sqlalchemy import create_engine
from sqlalchemy import exc
from sqlalchemy import Float
from sqlalchemy import Integer
from sqlalchemy import literal_column
from sqlalchemy import outparam
from sqlalchemy import select
fro... | kawamon/hue | desktop/core/ext-py/SQLAlchemy-1.3.17/test/dialect/oracle/test_dialect.py | Python | apache-2.0 | 25,442 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Li... | DreamSourceLab/DSView | libsigrokdecode4DSL/decoders/lpc/__init__.py | Python | gpl-3.0 | 941 |
import os
print os.path.dirname(os.path.abspath(__file__)) | Art3mk4/python | process/pid.py | Python | gpl-3.0 | 58 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-05-19 13:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import mptt.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | JacekKarnasiewicz/HomePage | apps/tree_traversal/migrations/0001_initial.py | Python | mit | 1,734 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.infer.importance import psis_diagnostic
from pyro.infer.util import MultiFrameTensor
from tests.common ... | uber/pyro | tests/infer/test_util.py | Python | apache-2.0 | 2,397 |
#!/usr/bin/env python2
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# This document should comply with PEP-8 Style Guide
# Linter: pylint
"""
TensorFlow training executable for DIGITS
Defines the training procedure
Usage:
See the self-documenting flags below.
"""
from __future__ import absolute... | gheinrich/DIGITS-GAN | digits/tools/tensorflow/gan_grid.py | Python | bsd-3-clause | 34,529 |
__author__ = 'Antony Cherepanov'
def range_iteration():
print("\nrange_iteration")
rng = range(10)
print("When we call range() functions, we get object tht can iterate: " +
str(rng))
print("But it's not an iterator! Let's try:")
try:
next(rng)
print("Wow, ite... | iamantony/PythonNotes | src/operations/iteration.py | Python | mit | 1,628 |
import os
from xml.dom import minidom
import cgi
class UpnpContentFlags(object):
SENDER_PACED = 80000000
LSOP_TIME_BASED_SEEK_SUPPORTED = 40000000
LSOP_BYTE_BASED_SEEK_SUPPORTED = 20000000
PLAY_CONTAINER_SUPPORTED = 10000000
S0_INCREASING_SUPPORTED = 8000000
SN_INCREASIN... | lightscaletech/pulseaudio-streamer | pulseaudio_streamer/metadata.py | Python | gpl-3.0 | 2,402 |
event_object = {
'object' : {
# handle local file
'file' : {
'module' : 'object.file',
'distro' : None,
'reference' : {
'en' : '''
### Description
Trigger change on local file
### Parameters
* **`path`** (*required*): the path to the file
example:
/path/to/file
* **`action`** (*optional*)... | MadeiraCloud/OpsEvent | mod/event/object.py | Python | apache-2.0 | 658 |
"""Main CLI entry point for dustmaker utility scripts"""
import sys
from .cmd.main import main
sys.argv[0] = "dustmaker"
sys.exit(main())
| msg555/dustmaker | dustmaker/__main__.py | Python | apache-2.0 | 142 |
from flask import Blueprint, render_template, request, redirect, url_for, flash
from jade_ims.models import db, Customer
customer = Blueprint('customer', __name__)
@customer.route('/customer')
def list_user():
data = Customer.query.all()
return render_template('customer.html',
titl... | Xuanwo/jade-ims | jade_ims/views/customer.py | Python | mit | 1,403 |
import os
import sqlite3
import pandas as pd
import datetime
import numpy as np
import wget
def updateModisDB(filenames, cacheDir):
if len(filenames) > 0:
db_fn = os.path.join(cacheDir, "modis_db.db")
fn = filenames[0].split(os.sep)[-1]
product = fn.split('.')[0]
years = []
... | bucricket/projectMAS | pydisalexi/database_tools.py | Python | bsd-3-clause | 10,599 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Project Sales Accounting',
'version': '1.0',
'category': 'Services/account',
'summary': 'Project sales accounting',
'description': 'Bridge created to add the number of vendor bills linked ... | jeremiahyan/odoo | addons/sale_project_account/__manifest__.py | Python | gpl-3.0 | 553 |
#!/usr/bin/python
# vim: set fileencoding=utf8:
# GNU Solfege - free ear training software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2011 Tom Cato Amundsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | RannyeriDev/Solfege | solfege.py | Python | gpl-3.0 | 2,292 |
#!/usr/bin/python
import sys
import os
import re, shutil, tempfile
def execExitOnFail(cmd, message):
code = os.system(cmd);
if code:
fatalError(message);
def fatalError(message):
print message
sys.exit()
def sedCmd(pattern, repl, filename):
'''
Perform the pure-Python equivalent of i... | 3drepo/3drepobouncer | tools/release/git_release.py | Python | agpl-3.0 | 3,484 |
from rest_framework import serializers
from gameGap.models import Post, Comment
class PostSerializer(serializers.ModelSerializer):
class Meta:
model = Post
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment | chackett87/GameGap | gameGap/api/serializers/entry_serializer.py | Python | mit | 264 |
#!/usr/bin/env python
from time import sleep
import os
import RPi.GPIO as GPIO
import subprocess
import datetime
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN)
count = 0
up = False
down = False
command = ""
filename = ""
index = 0
camera_pause = "500"
def takepic(imageName):
print("picture")
command = "sudo ras... | sgonzalez/wsn-parking-project | sensor-pi/testimages.py | Python | gpl-2.0 | 764 |
from __future__ import unicode_literals
from __future__ import absolute_import
import six
class Container(object):
"""
Represents a Docker container, constructed from the output of
GET /containers/:id:/json.
"""
def __init__(self, client, dictionary, has_been_inspected=False):
self.client... | abesto/fig | compose/container.py | Python | apache-2.0 | 5,223 |
# Copyright 2018 NOKIA
#
# 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... | nuagenetworks/nuage-openstack-neutron | nuage_neutron/plugins/common/extensions/nuage_network.py | Python | apache-2.0 | 1,569 |
# Converted from Redshift.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Equals, GetAtt, If, Join, Output, Parameter, Ref, Template
from troposphere.redshift import AmazonRedshiftParameter, Cluster, ClusterParameterGroup
t = Template()
t.set_version(... | cloudtools/troposphere | examples/Redshift.py | Python | bsd-2-clause | 3,514 |
# --------------------------------------------------------
# quickmultiattributeedit_dialogs - Dialog classes for quickmultiattributeedit
#
# begin : 19 May 2011
# copyright : (c) 2011 by Marco Braida
# email : See marcobra.ubuntu@gmail.com
#
# QuickMultiAttributeE... | janhui/test_engine | release/QuickMultiAttributeEdit/quickmultiattributeedit_dialogs.py | Python | lgpl-2.1 | 10,033 |
# Note: Need both numeric and alpha numeric fillers. So filler=true is
# implemented internally as always='' (i.e., by adjusting and padding
# the empty string).
import datetime
class FieldBase (object):
def __init__ (self, pos, always=None, key=None, filler=False, name=None):
#assert sum (map(bool,(alway... | normalnorway/avtalegiro | fields.py | Python | gpl-3.0 | 2,174 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-28 06:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('monitor', '0016_updatelock'),
]
operations = [
... | achow101/forkmon | monitor/migrations/0017_auto_20170727_2318.py | Python | mit | 707 |
from django import http
from django.template import RequestContext, loader
from regulations.generator import api_reader
from regulations.generator.layers.utils import convert_to_python
from regulations.views import utils
class MissingContentException(Exception):
""" This is essentially a generic 404. """
def... | grapesmoker/regulations-site | regulations/views/error_handling.py | Python | cc0-1.0 | 2,765 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2021 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""Defines the :class:`Model` class.
See :ref:`dev.models`, :doc:`/dev/delete`, :doc:`/dev/disable`,
:doc:`/dev/hide`, :doc:`/dev/format`
"""
import logging ; logger = logging.... | lino-framework/lino | lino/core/model.py | Python | bsd-2-clause | 36,479 |
#
# 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... | brad-kaiser/spark | python/pyspark/ml/stat.py | Python | apache-2.0 | 6,473 |
from scapy.packet import *
from scapy.fields import *
from scapy.layers.l2 import *
class Uldp(Packet):
name = "uldp packet,from Length to end"
fields_desc = [ XShortField("len", 0x0022),
XShortField("uldpid", 0x0001),
XByteField("version",0x01),
XByteField("type",0x01),
... | mytliulei/boundless | docker/dockerfile/xfdsend/Dscapy/layers/uldp.py | Python | apache-2.0 | 768 |
#! /usr/bin/env python
"""
Simple logger object. Log level is integer for easy comparison.
"""
import sys
class Logger:
def __init__(self, log_level, prog_name):
self.log_level = log_level
self.prog_name = prog_name
self.filename = None
def prefix(self, msg):
if self.filename... | ajaybhatia/archlinux-dotfiles | Scripts/pythonscripts/logger.py | Python | mit | 915 |
"""Support for a Hue API to control Home Assistant."""
import logging
from aiohttp import web
from homeassistant import core
from homeassistant.components import (
climate, cover, fan, light, media_player, scene, script)
from homeassistant.components.climate.const import (
SERVICE_SET_TEMPERATURE, SUPPORT_TAR... | aequitas/home-assistant | homeassistant/components/emulated_hue/hue_api.py | Python | apache-2.0 | 20,285 |
#!usr/bin/env python
# *-* coding: utf-8 *-*
"""Doctstring"""
EMAIL = ()
def prepare_email(appointments):
"""Creating a new client using their email
Arg:
appointments(tuple): a tuple with client's name & appt time
Return:
client's info & appoitment time
Example:
>>>>>> prepa... | eliz79/is210-week-07-synthesizing | task_02.py | Python | mpl-2.0 | 742 |
import logging
import operator
import warnings
from haystack import connections, connection_router
from haystack.backends import SQ
from haystack.constants import REPR_OUTPUT_SIZE, ITERATOR_LOAD_PER_QUERY, DEFAULT_OPERATOR, DEFAULT_ALIAS
from haystack.exceptions import NotHandled
class SearchQuerySet(object):
"""... | agendaTCC/AgendaTCC | tccweb/apps/haystack/query.py | Python | gpl-2.0 | 24,783 |
__author__ = 'Narongdej'
from operator import itemgetter
import os, sys, hashlib, time, urllib, cStringIO
from PIL import Image
import vectorspace
class CaptchaDecoder:
def __init__(self):
self.v = vectorspace.VectorSpace()
iconset = [x[1] for x in os.walk("iconset")][0]
self.imageset =... | Zenyai/Simple-Captcha-Decoder | captchadecoder/captchadecoder.py | Python | mit | 5,071 |
"""
Clean up the website log table.
"""
# pylint: disable=C0301,C0103,W1201
from apiary.tasks import BaseApiaryTask
import logging
import datetime
LOGGER = logging.getLogger()
class DeleteWebsiteLogsTask(BaseApiaryTask):
"""Delete old entries from the bot_log."""
def run(self):
"""Execute the task.... | apexkid/Wikiapiary | apiary/tasks/bot/deletewebsitelogs.py | Python | gpl-2.0 | 837 |
from random import randint
import sys
def select(arr, order):
length = len(arr)
if length == 1:
return arr[0]
pivot_index = randint(0, length-1)
pivot = arr[pivot_index]
swap(arr, 0, pivot_index)
i = j = 1
while j < length:
if arr[j] < pivot:
swap(arr, j, i)
i += 1
j += 1
swap(arr, 0, i-1)
... | timpel/stanford-algs | random_selection/random_selection.py | Python | mit | 993 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... | ivmech/iviny-scope | lib/xlsxwriter/test/comparison/test_cond_format10.py | Python | gpl-3.0 | 2,154 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import time
from unittest import mock
from urllib.parse import urlparse
from azure.core.credentials import AccessToken
from azure.core.exceptions import ClientAuthentic... | Azure/azure-sdk-for-python | sdk/identity/azure-identity/tests/test_vscode_credential_async.py | Python | mit | 13,160 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Quang-Cuong Pham <cuong.pham@normalesup.org>
#
# 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/l... | Tastalian/avp-rrt-rss-2013 | vippy/MintimeTrajectory.py | Python | apache-2.0 | 11,341 |
import numpy as np
from numpy import all
from numpy.testing import assert_almost_equal
from nose.tools import ok_
from ..blas import *
def ndrange(shape, dtype=np.double, order='C'):
return np.arange(np.prod(shape), dtype=dtype).reshape(shape).copy(order)
def assert_dgemm(dgemm_func, A_order, B_order, C_order):
... | wavemoth/wavemoth | wavemoth/test/test_blas.py | Python | gpl-2.0 | 812 |
"""
This package contains the Biological Dataset Repository Django Web application.
The application is composed of the following modules:
admin: Defines the administrative representations of model classes defined
in the models subpackage.
urls: Specifies the URL structure for the application.
The ... | MikeWinter/bio-data-repository | bdr/__init__.py | Python | gpl-2.0 | 1,540 |
"""
blackjack problem with Monte Carlo prediction (policy evaluation)
Author: Wenbin Li
"""
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
import numpy.random as npr
import time
# generate samples for MC
# generate the card shown from the... | wenbinli/rl | blackjack_GUITest.py | Python | mit | 3,431 |
"""
Run with
-m filter_weather_data.start_filtering_pipe
if you want to see the demo.
"""
import os
import logging
from gather_weather_data.husconet import GermanWinterTime
from .filters import PROCESSED_DATA_DIR
from .filters import StationRepository
from .filters.preparation.average_husconet_radiation import ave... | 1kastner/analyse_weather_data | filter_weather_data/filtering_pipe.py | Python | agpl-3.0 | 10,950 |
# Gnu General Public License - see LICENSE.TXT
import xbmcgui
from .simple_logging import SimpleLogging
from .translation import string_load
log = SimpleLogging(__name__)
class ResumeDialog(xbmcgui.WindowXMLDialog):
resumePlay = -1
resumeTimeStamp = ""
def __init__(self, *args, **kwargs):
xbmc... | faush01/MBCon | resources/lib/resume_dialog.py | Python | gpl-2.0 | 1,059 |
from __future__ import (absolute_import, division, print_function)
import unittest
from testhelpers import WorkspaceCreationHelper
class SpectrumInfoTest(unittest.TestCase):
_ws = None
def setUp(self):
if self.__class__._ws is None:
self.__class__._ws = WorkspaceCreationHelper.create2DWo... | ScreamingUdder/mantid | Framework/PythonInterface/test/python/mantid/api/SpectrumInfoTest.py | Python | gpl-3.0 | 788 |
#! /usr/bin/env python
# libsocialweb - social data store
# Copyright (C) 2010 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This ... | lcp/libsocialweb | examples/monitor-online.py | Python | lgpl-2.1 | 1,295 |
import serial
from flask import Flask
from flask import jsonify
app = Flask(__name__)
@app.route("/")
def hello():
# Default returned when you load the url
return "pyRotatorServer!"
@app.route('/azimuth/<degrees>')
def post_azimuth(degrees):
# Create suitable string for GS232
az = "az" + str(degrees)... | magicbug/pyRotatorServer | rotator.py | Python | mit | 1,277 |
"""
mddns
MIT License. See LICENSE for more details.
Copyright (c) 2014, Jonathan Stoppani
"""
__version__ = '0.1.4'
__url__ = 'https://github.com/GaretJax/mddns'
| GaretJax/mddns | mddns/__init__.py | Python | mit | 165 |
# PARMEC test --> PRESCRIBE command test (velocity sweep)
from math import sin, cos, pi
matnum = MATERIAL (1E3, 1E9, 0.25)
nodes = [0, 0, 0,
1, 0, 0,
1, 1, 0,
0, 1, 0,
0, 0, 1,
1, 0, 1,
1, 1, 1,
0, 1, 1]
elements = [8, 0, 1, 2, 3, 4, 5, 6, 7, matnum]
colors = [1, 4, 0, 1, 2, 3, 2, 4, 4, 5, 6, 7... | tkoziara/parmec | tests/prescribe_vsweep.py | Python | mit | 1,385 |
# This file is part of stupid_python_tricks written by Duncan Townsend.
#
# stupid_python_tricks 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) an... | duncant/stupid_python_tricks | decorator_decorator.py | Python | lgpl-3.0 | 1,795 |
# Simple Leap motion program to track the position of your hand and move one servo
# import the libraries where the LeapMotionSDK is
import sys
sys.path.insert(0, "LeapLib/")
import Leap, thread, time
from Leap import CircleGesture, KeyTapGesture, ScreenTapGesture, SwipeGesture
from pyduino import *
class SampleList... | theown1/pyduino_leapmotion | my_first_leap.py | Python | gpl-2.0 | 3,933 |
# if your want moke the the database we create a python class object here
# we can fake the models by simpley writing python calls
# useing this we can change our serializers to models serializers and use Person
#object as models object.it's not a persistent data
class Person(object):
def __init__(self, username... | thisismsreddy/djangorestframework-best-practices | withoutmodelsapp/fake_model.py | Python | gpl-3.0 | 445 |
# 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 Hohqmesh(CMakePackage):
"""High Order mesh generator for Hexahedral and Quadrilateral mesh... | LLNL/spack | var/spack/repos/builtin/packages/hohqmesh/package.py | Python | lgpl-2.1 | 924 |
from flask_restful import Api, Resource
class ApiController(Api):
pass
class ApiCatchall(Resource):
def get(self, path):
return {"error": "Not Found"}, 404
post = get
put = get
delete = get
patch = get
| getsentry/freight | freight/api/controller.py | Python | apache-2.0 | 239 |
from tests.sampledata import SampleData
from treeherder.client.thclient import client
from treeherder.perf.models import (PerformanceSignature, PerformanceDatum)
from test_client_job_ingestion import do_post_collection
def test_post_talos_artifact(test_project, test_repository, result_set_stored,
... | moijes12/treeherder | tests/e2e/test_perf_ingestion.py | Python | mpl-2.0 | 1,657 |
from exoatlas.imports import *
from exoatlas.populations.downloaders import *
def test_exoplanets():
with mock.patch('builtins.input', return_value=""):
return exoplanets.get()
def test_composite():
with mock.patch('builtins.input', return_value=""):
return merged_exoplanets.get()
def test_te... | zkbt/exopop | exoatlas/tests/test_downloaders.py | Python | mit | 532 |
import os
import sys
from api_client.application_api import create_app, retire_app, add_assignments, edit_app_assignment
from api_client.application_extensive_search import search_application
from api_client.blob_api import chunk_upload
from config import config
import helper.helper_methods as helper
from Logs.log_con... | vmwaresamples/AirWatch-samples | Mobile apps CICD script/application_deployment.py | Python | bsd-3-clause | 13,198 |
from socketserver import BaseRequestHandler, TCPServer
class EchoHandler(BaseRequestHandler):
def handle(self):
print('Got connection from', self.client_address)
while True:
msg = self.request.recv(8192)
if not msg:
break
self.request.send(msg)
... | AtlantisFox/Green-Point-Challenge | python_cookbook/c11/02.py | Python | mit | 418 |
maxline = 10000 # from web-page
qurl = 'http://s.lab.naver.com/autospacing/?'
qvalues = { "query": "",
"result_type": "paragraph"
}
qheaders = {"Referer": qurl,
"User-Agent": "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"
}
import urllib, urllib2
import re
de... | Alwnikrotikz/epubia | naver_autospacing.py | Python | mit | 1,159 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['MovingAverage'] , ['Seasonal_Minute'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_MovingAverage_Seasonal_Minute_NoAR.py | Python | bsd-3-clause | 172 |
# vim: set fileencoding=utf-8 :
# Copyright (C) 2008 Insecure.Com LLC.
#
# Author(s): João Paulo de Souza Medeiros <ignotus21@gmail.com>
#
# 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... | chriskmanx/qmole | QMOLEDEV64/nmap-4.76/zenmap/radialnet/bestwidgets/comboboxes.py | Python | gpl-3.0 | 2,561 |
'''
Created on 14 Jun 2016
@author: gjermund.vingerhagen
'''
import numpy as np
import scipy.interpolate as intp
import linecache
import utmconverter as utm
def splitHead(inp):
return inp
def lineToArr(l1):
arra = np.array(np.fromstring(l1[144:1024],dtype=int,sep=' '))
for i in ran... | gjermv/potato | sccs/gpx/dtmdata.py | Python | gpl-2.0 | 6,663 |
import sys
def assert_supported_version(): # pragma: no cover
if (not sys.version_info > (3, 2) or
(sys.version_info[:2] == (3, 2) and
'__pypy__' not in sys.builtin_module_names)):
print("coala supports only pypy3 and python 3.3 or later.")
exit(4)
| SambitAcharya/coala | coalib/__init__.py | Python | agpl-3.0 | 297 |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.huobi import huobi
class huobipro(huobi):
def describe(self):
# self is an alias for backward-compatibility
... | ccxt/ccxt | python/ccxt/huobipro.py | Python | mit | 479 |
from db import Survey
s = Survey
class 'db.Survey'
u.query.all()
return render_template("index.html")
print(s)
u.query.filter(Survey.latitude=='Маша').first()
u.query.filter(Survey.longitude.like('М%')).all() | alex-i-git/LearnPython-Diploma-Project | site_with_map/importdb.py | Python | mit | 220 |
from django import template
from django.db.models import Count, Q
from django.utils.safestring import mark_safe
from django.utils.translation import get_language
from djangocms_blogpost.models import BlogPost
import datetime
register = template.Library()
@register.filter
def short_date(date):
try:
day... | philippze/djangocms-blogpost | djangocms_blogpost/templatetags/blog_tags.py | Python | mit | 956 |
# state estimation with poisson convex mixture model
from .clustering import kmeans_pp, poisson_cluster
from uncurl.nolips import nolips_update_w, objective, sparse_objective
from uncurl.nolips import sparse_nolips_update_w
# try to use parallel; otherwise
#from uncurl.nolips_parallel import sparse_nolips_update_w as ... | yjzhang/uncurl_python | uncurl/state_estimation.py | Python | mit | 18,843 |
# -*- coding: utf-8 -*-
from plone.server import BEHAVIOR_CACHE
from plone.server import configure
from plone.server.content import get_cached_factory
from plone.server.directives import merged_tagged_value_dict
from plone.server.directives import write_permission
from plone.server.events import notify
from plone.serve... | plone/plone.server | src/plone.server/plone/server/json/deserialize_content.py | Python | bsd-2-clause | 5,811 |
"""
GET /api/external_graders/:id
Verify the Participant's API key
USAGE:
$ python get_external_graders.py [auth_api_key] [participant_api_key]
"""
import sys
import requests
BASE_URL='https://crowdai-stg.herokuapp.com/api/external_graders/'
#BASE_URL='http://localhost:3000/api/external_graders/'
auth_api_key = str(s... | crowdAI/crowdai | scripts/api_tests/get_external_graders.py | Python | agpl-3.0 | 727 |
"""
Built-in, globally-available admin actions.
"""
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.utils import get_deleted_objects, model_ngettext
from django.core.exceptions import PermissionDenied
from django.db import router
from django.template.response impo... | denys-duchier/django | django/contrib/admin/actions.py | Python | bsd-3-clause | 3,255 |
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import mmcv
import numpy as np
import pytest
import torch
from mmcv.utils import build_from_cfg
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from mmdet.datasets.builder import PIPELINES
from .utils import create_random_... | open-mmlab/mmdetection | tests/test_data/test_pipelines/test_transform/test_transform.py | Python | apache-2.0 | 38,570 |
import os
import json
import time
import subprocess
import shlex
import psutil
import definitions
import importlib
from abc import ABCMeta, abstractmethod
from threading import Thread, Event
from collections import OrderedDict
from archiver.archiver import Archiver
class Collector(object):
__metaclass__ = ABCMeta
... | ARL-UTEP-OC/ecel | engine/collector.py | Python | gpl-3.0 | 15,021 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'kmol'
SITENAME = 'CD期末考週 網頁 (虎尾科大MDE)'
SITEURL = 'http://cdw18-40323132.rhcloud.com//static/'
# 不要用文章所在目錄作為類別
USE_FOLDER_AS_CATEGORY = False
#PATH = 'content'
#OUTPUT_PATH = 'output'
TIMEZONE = 'Asia/Taipei'
DEFAULT_... | 40323150/2016springcd_aG9 | static/pelicanconf.py | Python | agpl-3.0 | 2,157 |
import os
import sys
import platform
node = platform.node()
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
BASE_URL = 'http://127.0.0.1:8081'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': ... | ludoo/wpkit | attic/wpfrontman/settings.py | Python | bsd-3-clause | 2,158 |
# Copyright 2021 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, ... | google/jax-cfd | jax_cfd/base/pressure.py | Python | apache-2.0 | 3,942 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-LockWorkStation',
'Author': ['@harmj0y'],
'Description': ("Locks the workstation's display."),
'Background' : False,
'OutputE... | EmpireProject/Empire | lib/modules/powershell/management/lock.py | Python | bsd-3-clause | 3,239 |
from charm.toolbox.paddingschemes import PKCS7Padding
from charm.toolbox.securerandom import OpenSSLRand
from charm.core.crypto.cryptobase import MODE_CBC,AES,selectPRP
from hashlib import sha256 as sha2
import json
import hmac
from base64 import b64encode, b64decode
class MessageAuthenticator(object):
""" Abstrac... | JHUISI/charm | charm/toolbox/symcrypto.py | Python | lgpl-3.0 | 12,651 |
# Copyright 2013 Rackspace Hosting
# 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 require... | phenoxim/nova | nova/api/openstack/compute/instance_actions.py | Python | apache-2.0 | 7,568 |
from parsl.config import Config
from parsl.executors.threads import ThreadPoolExecutor
config = Config(
executors=[
ThreadPoolExecutor(
label='local_threads_checkpoint_task_exit',
)
],
checkpoint_mode='task_exit',
)
| swift-lang/swift-e-lab | parsl/configs/local_threads_checkpoint_task_exit.py | Python | apache-2.0 | 257 |
#!/usr/bin/env python
import os
import sys
from shutil import rmtree
from setuptools import setup, find_packages
from mezzanine import __version__ as version
exclude = ["mezzanine/project_template/dev.db",
"mezzanine/project_template/project_name/local_settings.py"]
if sys.argv == ["setup.py", "test"]:
... | wbtuomela/mezzanine | setup.py | Python | bsd-2-clause | 3,453 |
#!/bin/env python3
"""
Use only legal characters from files or current directory
"""
import sys
import os
import click
import string
import pathlib
# docopt(doc, argv=None, help=True, version=None, options_first=False))
@click.command("strip_filename.py")
@click.argument("filename", nargs=-1, required=False)
@click... | dgengtek/bash | filesystem/filename_canonize.py | Python | gpl-2.0 | 3,179 |
from datetime import datetime
import xml.etree.ElementTree as ET
import json
import re
from pyspark.sql.types import Row, StructType, StructField, IntegerType, StringType, TimestampType, DateType
from AbstractDF import AbstractDF, RDDBuilder
class Game(AbstractDF):
schema = StructType( sorted(
[
St... | dondrake/mlb_stats_spark | Game.py | Python | apache-2.0 | 7,134 |
# pylint: disable=consider-iterating-dictionary, missing-module-docstring
import json
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.... | eduNEXT/edunext-platform | lms/djangoapps/discussion/notification_prefs/tests.py | Python | agpl-3.0 | 9,839 |
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_b64decode,
compat_chr,
compat_ord,
compat_str,
compat_urllib_parse_unquote,
compat_zip
)
from ..utils import (
int_or_none,
parse_iso8601,
strip_or_non... | rg3/youtube-dl | youtube_dl/extractor/mixcloud.py | Python | unlicense | 11,661 |
import unittest
import BasicVmLifecycleTestBase
class testBasicVmLifecycle(BasicVmLifecycleTestBase.BasicVmLifecycleTestBase):
vmName = 'centos'
timeout = 10*60
def suite():
return unittest.TestLoader().loadTestsFromTestCase(testBasicVmLifecycle)
| StratusLab/use-cases | src/main/python/stratuslab_usecases/api/testBasicVmLifecycleCentOS.py | Python | apache-2.0 | 265 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | jairideout/qiime2 | qiime2/sdk/__init__.py | Python | bsd-3-clause | 766 |
import pytest
class TestZopfli:
@pytest.mark.complete("zopfli ")
def test_1(self, completion):
assert completion
@pytest.mark.complete("zopfli ~")
def test_2(self, completion):
assert completion
@pytest.mark.complete("zopfli -", require_cmd=True)
def test_3(self, completion):... | scop/bash-completion | test/t/test_zopfli.py | Python | gpl-2.0 | 347 |
"""Write code blocks for a DYMORE input file.
Usage
-----
start an IPython (qt)console with the pylab flag:
$ ipython qtconsole --pylab
or
$ ipython --pylab
Then, from the prompt, run this script:
|> %run write_DYMORE_input_file
Finally, open the newly created '*.dat' files, and manually copy the contents
i... | perryjohnson/biplaneblade | sandia_blade_lib/write_DYMORE_input_file.py | Python | gpl-3.0 | 2,618 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from .context import Context
class Ignore(Context):
"""Context which basically ignores all input.
"""
def __init__(self, maxCount=-1):
super().__init__(maxCount=maxCount)
def getContext(self, name):
"""Get sub-context
... | claashk/python-config | schema/old_context/ignore.py | Python | gpl-3.0 | 694 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | oberstet/txaio | test/util.py | Python | mit | 2,811 |
# -*- coding: utf-8 -*-
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render
__author__ = 'AlexStarov'
@staff_member_required
def admin_panel(request,
template_name=u'admin_panel.html', ):
return render(request=request,
temp... | AlexStarov/Shop | applications/adminSite/views.py | Python | apache-2.0 | 3,539 |
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.test import TestCase
from django.conf import settings
from django.contrib.auth.models import User
fro... | ngageoint/geoevents | geoevents/core/tests.py | Python | mit | 7,046 |
# coding=utf-8
"""Resources test.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = '... | sbenten/d3MapRenderer | test/test_resources.py | Python | mit | 1,038 |
import configuration
import csv
import matplotlib.pyplot as plt
import scipy.stats as stats
import numpy as np
def __read_table(name):
indexmap = {}
table = []
header = False
with open(configuration.path(name,'csv'), 'rb') as db_file:
dbreader = csv.reader(db_file, delimiter='\t')
for ... | jacksonicson/paper.IS2015 | control/Control/src/analytics/analytics_csv.py | Python | mit | 2,371 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.