code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from tpe_parking import ParkingLotInfoProvider
def main():
info_provider = ParkingLotInfoProvider()
#info_provider.update_db()
my_location = (25.041340, 121.611751)
parks = info_provider.find_parking_lot_by_coordinate(my_location, 1000)
parks = info_provider.find_parking_lot('信義區')
for park i... | shyboynccu/tpe_parking | example.py | Python | mit | 913 |
from .goods_insert import SellCreateView
from .goods_list import GoodsListView
from .goods_detail import GoodsDetailView
from .goods_modify import SellUpdateView
from .order_page import OrderPageView
from .order_check import OrderCheckView
from .order_complete import OrderCompleteView
from .attach_comment import Commen... | yevgnenll/but | but/trades/views/__init__.py | Python | mit | 367 |
class MiniMatch:
_defaults = dict(
follow_links=True,
list_directories=True
)
def __init__(self, *patterns, **kwargs):
self._patterns = patterns
self.__dict__.update(MiniMatch._defaults)
self.__dict__.update(kwargs)
| spiralx/py-minimatch | minimatch/match.py | Python | mit | 270 |
"""
@name: Modules/House/Security/login.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2019-2020 by D. Brian Kimmel
@note: Created on Jul 23, 2019
@license: MIT License
@summary: Handle logging in.
"""
# Import system type stuff
# Import PyMh files and modules.
from... | DBrianKimmel/PyHouse | Project/src/Modules/Core/Config/login.py | Python | mit | 1,248 |
# Copyright (c) 2013 Nicolas Dandrimont <nicolas.dandrimont@crans.org>
#
# 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,... | hcarvalhoalves/hy | hy/lex/exceptions.py | Python | mit | 1,352 |
old = '-1.py'
import os
os.remove(old)
data = 'old = \'' + str(int(old[:-3]) + 1) + '.py\'\n'
for line in file(str(int(old[:-3]) + 1) + '.py').readlines()[1:]:
data += line
file(str(int(old[:-3]) + 2) + '.py', 'w').write(data)
os.startfile(str(int(old[:-3]) + 2) + '.py')
| ActiveState/code | recipes/Python/440636_eight_most_annoying_lines_code_I_ever_did/recipe-440636.py | Python | mit | 276 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-06-25 17:50
from __future__ import unicode_literals
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependen... | thiagopena/djangoSIGE | djangosige/apps/financeiro/migrations/0001_initial.py | Python | mit | 6,744 |
#!/usr/bin/env python3
#Copyright (C) 2013 by Ngan Nguyen
# Copyright (C) 2012-2019 by UCSC Computational Genomics Lab
#
#Released under the MIT license, see LICENSE.txt
"""Snake tracks
"""
from optparse import OptionGroup
import re
def addSnakeOptions(parser):
group = parser.add_argument_group("SNAKE TRACKS", "... | glennhickey/hal | assemblyHub/snakeTrack.py | Python | mit | 1,869 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editorial', '0064_auto_20171202_2016'),
]
operations = [
migrations.RenameField(
model_name='assignment',
... | ProjectFacet/facet | project/editorial/migrations/0065_auto_20171202_2022.py | Python | mit | 402 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clients', '0010_auto_20151024_2343'),
]
operations = [
migrations.AddField(
model_name='client',
nam... | deafhhs/adapt | clients/migrations/0011_client_napis_id.py | Python | mit | 425 |
from django import forms
from django_filters.widgets import RangeWidget
class DropDownFilterWidget(forms.widgets.ChoiceWidget):
template_name = 'foirequest/widgets/dropdown_filter.html'
def __init__(self, *args, **kwargs):
self.get_url = kwargs.pop('get_url', None)
super().__init__(*args, **... | stefanw/froide | froide/foirequest/widgets.py | Python | mit | 1,895 |
from ..operations import Operations
from .migration import MigrationContext
from .. import util
class EnvironmentContext(util.ModuleClsProxy):
"""A configurational facade made available in an ``env.py`` script.
The :class:`.EnvironmentContext` acts as a *facade* to the more
nuts-and-bolts objects of :cl... | graingert/alembic | alembic/runtime/environment.py | Python | mit | 35,396 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe
def get_parent_doc(doc):
"""Returns document of `reference_doctype`, `reference_doctype`"""
if not hasattr(doc, "parent_doc"):
if doc.reference_doctype and doc.reference_name:
doc.parent_doc = fra... | mhbu50/frappe | frappe/core/utils.py | Python | mit | 2,081 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-08-16 21:29
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | nivbend/memoir | quotes/migrations/0002_mentions.py | Python | mit | 885 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
File name: myWirelessRouter.py
Author: xu42 <https://github.com/xu42>
Date created: 04/04/2016
Python Version: 3.5
监测某台无线设备是否接入路由器, 同时猜解当前任务
适用于 Mercury MW310R 型号的无线路由器
'''
import http.client
import base64
import re
import time
# 配置参数
# url: 路由器后台登陆地址
# port... | xu42/Python | myWirelessRouter/myWirelessRouter.py | Python | mit | 2,628 |
from django.urls import path
from . import views
urlpatterns = [
path('overview/', views.overview, name='overview'),
]
| mrts/foodbank-campaign | src/locations/urls.py | Python | mit | 125 |
from schedulerEdge import SchedulerEdge
import time
if __name__ == '__main__':
#scheduler = BackgroundScheduler()
#scheduler.add_job(tick, 'cron', second = '5,10',minute = '40' , id = "12")
#scheduler.start()
#while True:
# time.sleep(1)
test_sched = SchedulerEdge()
#test_sched.add_job(3... | hubertokf/lupsEdgeServer | projects/old_files/moduleOfRules/testesched.py | Python | mit | 613 |
import os.path
import sqlite3
from config import CONFIG
def init_db():
"""初始化数据库"""
f = os.path.exists(CONFIG['DB_FILE'])
if f:
print("数据库文件存在...")
with open(CONFIG['SQL_SCRIPT_FILE'], 'r', encoding='utf8') as f:
file_content = f.read()
con = sqlite3.connect(CONFIG['DB_FILE'])
... | zzir/white | init_db.py | Python | mit | 493 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/scons-time/mem/stage.py | Python | mit | 2,679 |
import sys
import os
import os.path
from jinja2 import Template
from configparser import ConfigParser
import io
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program> <deploy_cfg_template_file> <file_with_properties>")
print("Properties from <file_with_properties> will be applied... | briehl/narrative-test | scripts/prepare_deploy_cfg.py | Python | mit | 2,057 |
# -*- coding: utf-8 -*-
"""Objects representing WikidataQuery query syntax and API."""
#
# (C) Pywikibot team, 2013
#
# Distributed under the terms of the MIT license.
from __future__ import unicode_literals
import json
import sys
if sys.version_info[0] > 2:
from urllib.parse import quote
basestring = (str, )... | hperala/kontuwikibot | pywikibot/data/wikidataquery.py | Python | mit | 16,312 |
from typing import cast
from pytest import raises
from graphql import graphql_sync
from graphql.type import (
GraphQLArgument,
GraphQLBoolean,
GraphQLEnumType,
GraphQLEnumValue,
GraphQLField,
GraphQLFloat,
GraphQLID,
GraphQLInt,
GraphQLObjectType,
GraphQLSchema,
GraphQLStri... | graphql-python/graphql-core | tests/utilities/test_build_client_schema.py | Python | mit | 35,277 |
response.title = "Enter H4H"
response.subtitle = "Smart House4H Access Control"
response.meta.keywords = "arduino hacker space"
response.menu = [
(T('Gate'), False, URL('default','gate')),
(T('Door'), False, URL('default','door')),
(T('About'), False, URL('default','about')),
]
| house4hack/openSHAC | web2py_shac/applications/enter/models/menu.py | Python | mit | 282 |
# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
t = int(raw_input())
for i in range(t):
try:
x = re.compile(raw_input())
if x:
print True
except:
print False | ugaliguy/HackerRank | Python/Errors-and-Exceptions/incorrect-regex.py | Python | mit | 246 |
import Pyro4
import Pyro4.errors
from diffiehellman import DiffieHellman
dh = DiffieHellman(group=14)
with Pyro4.locateNS() as ns:
uri = ns.lookup("example.dh.secretstuff")
print(uri)
p = Pyro4.Proxy(uri)
try:
p.process("hey")
raise RuntimeError("this should not be reached")
except Pyro4.errors.Pyro... | irmen/Pyro4 | examples/diffie-hellman/client.py | Python | mit | 786 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
import frappe
import unittest
# test_records = frappe.get_test_records('OAuth Authorization Code')
class TestOAuthAuthorizationCode(unittest.TestCase):
pass
| mhbu50/frappe | frappe/integrations/doctype/oauth_authorization_code/test_oauth_authorization_code.py | Python | mit | 261 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from folium.plugins.marker_cluster import MarkerCluster
from folium.utilities import _validate_coordinates
from jinja2 import Template
class FastMarkerCluster(MarkerCluster):
"""
Add marker clusters to a map using in... | QuLogic/folium | folium/plugins/fast_marker_cluster.py | Python | mit | 3,213 |
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py | Python | mit | 6,678 |
# -*- coding: utf-8 -*-
# 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.
#
# This program is distributed in the hope... | Yukinoshita47/Yuki-Chan-The-Auto-Pentest | Module/dirsearch/lib/core/Path.py | Python | mit | 987 |
# mailstat.console
# Console utilities for mailstat
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Sun Dec 29 15:57:44 2013 -0600
#
# Copyright (C) 2013 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: console.py [] benjamin@bengfort.com $
"""
Console utilities for mailstat
"""
###... | bbengfort/email-analysis | mailstat/console.py | Python | mit | 2,516 |
import micropython
micropython.alloc_emergency_exception_buf(100)
import pyb
import micropython
class Heartbeat(object):
def __init__(self):
self.tick = 0
self.led = pyb.LED(4) # 4 = Blue
tim = pyb.Timer(4)
tim.init(freq=10)
tim.callback(self.heartbeat_cb)
def heart... | gregnordin/micropython_pyboard | 150729_pyboard_to_pyqtgraph/pyboard_code.py | Python | mit | 954 |
from . import server
import sys
server.main(*sys.argv) | TeamNext/qos.py | qos/__main__.py | Python | mit | 55 |
#!/usr/bin/env python2
"""Hacked-together development server for feedreader.
Runs the feedreader server under the /api prefix, serves URI not containing a
dot public/index.html, servers everything else to public.
"""
import logging
import tornado.ioloop
import tornado.web
from feedreader.config import ConnectionCon... | tdryer/feeder | run.py | Python | mit | 1,843 |
__author__ = 'heddevanderheide'
# Django specific
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url('', include('fabric_interface.urls'))
) | Hedde/fabric_interface | src/main/urls.py | Python | mit | 179 |
from random import randint
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models, connection
from django.db.models.aggregates import Avg, Max
from polymorphic.models import PolymorphicModel
from solo.models import SingletonModel
class Judge(PolymorphicModel):
n... | Kianoosh76/webelopers-scoreboard | jury/models.py | Python | mit | 3,183 |
import time
import json
import redis
import subprocess
from subprocess import Popen, check_output
import shlex
import os
from py_cf_new_py3.chain_flow_py3 import CF_Base_Interpreter
from redis_graph_py3 import farm_template_py3
class Process_Control(object ):
def __init__(self):
pass
de... | glenn-edgar/local_controller_3 | process_control_py3.py | Python | mit | 9,357 |
# Django settings for obi project.
from os.path import abspath, dirname
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
# Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'ENGINE': 'django.db.... | adityadharne/TestObento | obi/obi/settings.py | Python | mit | 6,014 |
from rest_framework import serializers
from rest_auth.serializers import UserDetailsSerializer
class UserSerializer(UserDetailsSerializer):
website = serializers.URLField(source="userprofile.website", allow_blank=True, required=False)
about = serializers.CharField(source="userprofile.about", allow_blank=True... | ZachLiuGIS/reactjs-auth-django-rest | django_backend/user_profile/serializers.py | Python | mit | 1,016 |
# -*- coding: utf-8 -*-
"""
flask_via.examples.basic
========================
A simple ``Flask-Via`` example Flask application.
"""
from flask import Flask
from flask.ext.via import Via
from flask.ext.via.routers.default import Functional
app = Flask(__name__)
def foo(bar=None):
return 'Functional Foo View!'... | thisissoon/Flask-Via | flask_via/examples/basic.py | Python | mit | 542 |
# -*- coding: utf-8 -*-
"""Functions for manipulating FGONG files. These are provided through
the **FGONG** object and a module function to read an **FGONG** object
from a file.
"""
import numpy as np
import warnings
from .adipls import fgong_to_amdl
from .constants import G_DEFAULT
from .utils import integrate, to... | warrickball/tomso | tomso/fgong.py | Python | mit | 22,737 |
"""Automatically format references in a LaTeX file."""
import argparse
from multiprocessing import Pool
from reference_utils import Reference, extract_bibtex_items
from latex_utils import read_latex_file, write_latex_file
class ReferenceFormatter:
def __init__(self, add_arxiv):
self.add_arxiv = add_arxi... | teunzwart/latex-production-tools | reference_formatter.py | Python | mit | 1,870 |
import sqlite3
import requests
from random import sample
import textwrap
from printer import ThermalPrinter
LINE_WIDTH = 32
potm = "http://creepypasta.wikia.com/api/v1/Articles/List?category=PotM&limit=1000"
spotlighted = "http://creepypasta.wikia.com/api/v1/Articles/List?category=Spotlighted_Pastas&limit=1000"
def g... | AngryLawyer/creepypasta-strainer | src_python/strainer.py | Python | mit | 2,457 |
# 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... | hkhpub/show_and_tell_korean | webdemo/webdemo/inference_wrapper.py | Python | mit | 1,658 |
# -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as test_command
class PyTest(test_command):
user_options = [
('pytest-args=', 'a', 'Arguments for pytest'),
]
def initialize_options(self):
test_command.initialize_opti... | sablet/algo_trade | setup.py | Python | mit | 985 |
import numpy as np
def random_flips(X):
"""
Take random x-y flips of images.
Input:
- X: (N, C, H, W) array of image data.
Output:
- An array of the same shape as X, containing a copy of the data in X,
but with half the examples flipped along the horizontal direction.
"""
N, C, H... | UltronAI/Deep-Learning | CS231n/reference/cnn_assignments-master/assignment3/cs231n/data_augmentation.py | Python | mit | 4,178 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-09-07 00:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payments', '0004_auto_20160904_0048'),
]
operations = [
migrations.AlterFiel... | CCrypto/ccvpn3 | payments/migrations/0005_auto_20160907_0018.py | Python | mit | 612 |
#!/usr/bin/python
import requests
import json
# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
user_title = form.getvalue('search_title')
print "Content-type: text/html\n\n";
# Setting attributes to send to Wik... | azimos/geddit | old/geddit-backend.py | Python | mit | 3,469 |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
os.system('make rst')
try:
readme = open('README.rst').read()
except FileNotFoundError:
readme = ""
setup(
name='leicaautomator',
version='0.0.2',
description='Automate scans on Leica SPX microscopes',
long_description=r... | arve0/leicaautomator | setup.py | Python | mit | 1,212 |
"""Forms of the aps_bom app."""
from csv import DictReader
from django import forms
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as __
from .models import BOM, BOMItem, CBOM, CBOMItem, EPN, IPN, Unit
class BaseUploadForm(forms.ModelForm):
csv_file = forms.FileField(... | bitmazk/django-aps-bom | aps_bom/forms.py | Python | mit | 6,549 |
# coding: utf-8
from django.db import models
from django.utils import timezone
from .cores import OssManager
_oss_manager = OssManager()
class StsToken(models.Model):
arn = models.CharField(max_length=500)
assumed_role_id = models.CharField(max_length=500)
access_key_id = models.CharField(max_length=50... | zhaowenxiang/chisch | oss/models.py | Python | mit | 677 |
"""Controller for rendering pod content."""
import datetime
import mimetypes
import os
import sys
import time
from grow.common import utils
from grow.documents import static_document
from grow.pods import errors
from grow.rendering import rendered_document
from grow.templates import doc_dependency
from grow.templates ... | grow/grow | grow/rendering/render_controller.py | Python | mit | 21,264 |
# Copyright (C) 2012 Andy Balaam and The Pepper Developers
# Released under the MIT License. See the file COPYING.txt for details.
from nose.tools import *
from libpepper import builtins
from libpepper.environment import PepEnvironment
from libpepper.vals.all_values import *
def PlusEquals_increases_int_value___te... | andybalaam/pepper | old/pepper1/src/test/evaluation/test_plusequals.py | Python | mit | 1,124 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
from clint.textui import prompt
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
import kolibri
from ...utils import db... | lyw07/kolibri | kolibri/core/deviceadmin/management/commands/dbrestore.py | Python | mit | 4,759 |
import pytest
from click.testing import CliRunner
import doitlive
@pytest.fixture(scope="session")
def runner():
doitlive.cli.TESTING = True
return CliRunner()
| sloria/doitlive | tests/conftest.py | Python | mit | 171 |
print ("Hello python world! My first python script!!")
print ("feeling excited!!") | balajithangamani/LearnPy | hello.py | Python | mit | 82 |
import asyncio
import signal
import configargparse
from structlog import get_logger
from alarme import Application
from alarme.scripts.common import init_logging, uncaught_exception, loop_uncaught_exception
def exit_handler(app, logger, sig):
logger.info('application_signal', name=sig.name, value=sig.value)
... | insolite/alarme | alarme/scripts/server.py | Python | mit | 1,452 |
"""
Last: 5069
Script with simple UI for creating gaplines data
Run: python WordClassDM.py --index 0
Controls:
setting gaplines - click and drag
saving gaplines - 's' key
reseting gaplines - 'r' key
skip to next img - 'n' key
delete last line - 'd' key
"""
import cv2
import os
import numpy as... | Breta01/handwriting-ocr | src/data/data_creation/WordClassDM.py | Python | mit | 6,492 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "treemap.hoverlabel"
_path_str = "treemap.hoverlabel.font"
_valid_props = {"color", "colorsrc",... | plotly/python-api | packages/python/plotly/plotly/graph_objs/treemap/hoverlabel/_font.py | Python | mit | 11,209 |
"""Transformation functions for expressions."""
from tt.expressions import BooleanExpression
from tt.transformations.utils import ensure_bexpr
def apply_de_morgans(expr):
"""Convert an expression to a form with De Morgan's Law applied.
:returns: A new expression object, transformed so that De Morgan's Law ... | welchbj/tt | tt/transformations/bexpr.py | Python | mit | 11,265 |
#!/usr/bin/python2.7
#-*- coding: utf-8 -*-
import numpy as np
import gl
def testkf(input1,Q,R):
print gl.X_i_1
print gl.P_i_1
#rang(1,N) do not contain N
K_i = gl.P_i_1 / (gl.P_i_1 + R)
X_i = gl.X_i_1 + K_i * (input1 - gl.X_i_1)
P_i = gl.P_i_1 - K_i * gl.P_i_1 + Q
#print (X[i])
#Upd... | zharuosi/2017 | pythonNRC/modules/testkf.py | Python | mit | 379 |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/arvind/clover_hack_day/er1_robot/src/er1_motor_driver/msg/Motors.msg"
services_str = "/home/arvind/clover_hack_day/er1_robot/src/er1_motor_driver/srv/AddTwoInts.srv"
pkg_name = "er1_motor_driver"
dependencies_str = "std_msgs"
langs = "gencpp;gen... | arvindpereira/clover_hack_day | er1_robot/build/er1_motor_driver/cmake/er1_motor_driver-genmsg-context.py | Python | mit | 677 |
from mimetypes import guess_type
def get_git_info():
"""
Parses the git info and returns a tuple containg the owner and repo
:deprecated:
:rtype: tuple
:return: (owner name, repo name)
"""
repo = ''
with open('.git/config') as f:
for line in f.readlines():
if 'url' ... | GrappigPanda/pygemony | pyg/utils.py | Python | mit | 811 |
import logging
logging.basicConfig(level=logging.DEBUG)
import nengo
import nengo_spinnaker
import numpy as np
def test_probe_ensemble_voltages():
with nengo.Network("Test Network") as network:
# Create an Ensemble with 2 neurons that have known gain and bias. The
# result is that we know how the... | project-rig/nengo_spinnaker | regression-tests/test_voltage_probing.py | Python | mit | 1,158 |
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from skTMVA import convert_bdt_sklearn_tmva
import cPickle
import numpy as np
from numpy.random import RandomState
RNG = RandomState(21)
# Construct an example dataset for binary classification
n_vars = 2
n_events = 100... | yuraic/koza4ok | examples/bdt_sklearn_to_tmva_AdaBoost.py | Python | mit | 1,493 |
import sys
script, encoding, error = sys.argv
def main(language_file, encoding, errors):
line = language_file.readline()
if line:
print_line(line, encoding, errors)
return main(language_file, encoding, errors)
def print_line(line, encoding, errors):
next_lang = line.strip()
raw_byte... | Herne/pythonplayground | lp3thw/ex23.py | Python | mit | 563 |
from cereal import car
from opendbc.can.packer import CANPacker
from selfdrive.car.mazda import mazdacan
from selfdrive.car.mazda.values import CarControllerParams, Buttons
from selfdrive.car import apply_std_steer_torque_limits
VisualAlert = car.CarControl.HUDControl.VisualAlert
class CarController():
def __init__... | commaai/openpilot | selfdrive/car/mazda/carcontroller.py | Python | mit | 3,112 |
import pprint
from cytoolz import (
assoc,
concatv,
partial,
pipe,
)
from semantic_version import (
Spec,
)
from eth_utils import (
add_0x_prefix,
to_dict,
to_tuple,
)
from solc import (
get_solc_version,
compile_standard,
)
from solc.exceptions import (
ContractsNotFound... | pipermerriam/populus | populus/compilation/backends/solc_standard_json.py | Python | mit | 6,140 |
import datetime
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from ..tasks import trigger_instance
from . import app_settings
from .enums import StateEnum
from .mod... | takeyourmeds/takeyourmeds-web | takeyourmeds/reminders/reminders_calls/views.py | Python | mit | 2,634 |
import imp
import os
tools = []
for name in os.listdir(os.path.dirname(__file__)):
if not name.startswith('_'): # _ in the front indicates that this tool is disabled
directory = os.path.join(os.path.dirname(__file__), name)
if os.path.isdir(directory):
file = os.path.join(directory, na... | nullzero/wpcgi | wpcgi/tools/__init__.py | Python | mit | 424 |
#!/usr/bin/env python
# Copyright (c) 2011, 2013 SEOmoz, Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, mo... | seomoz/s3po | setup.py | Python | mit | 2,278 |
from django.core.management import setup_environ
import settings
setup_environ(settings)
from apps.modules.tasks import update_data
update_data.delay()
| udbhav/eurorack-planner | scripts/update_data.py | Python | mit | 167 |
import numpy as np
import cv2
import matplotlib.image as mpimg
import pickle
from line import Line
from warp_transformer import WarpTransformer
from moviepy.editor import VideoFileClip
calibration_mtx_dist_filename = 'dist_pickle.p'
# load mtx, dist
dist_pickle = pickle.load(open(calibration_mtx_dist_filename, "rb" )... | mez/carnd | P4_advance_lane_finding/main.py | Python | mit | 9,709 |
from setuptools import setup, find_packages
setup(
name="Coinbox-mod-customer",
version="0.2",
packages=find_packages(),
zip_safe=True,
namespace_packages=['cbmod'],
include_package_data=True,
install_requires=[
'sqlalchemy>=0.7, <1.0',
'... | coinbox/coinbox-mod-customer | setup.py | Python | mit | 654 |
#!/usr/bin/env python
'''
Retrospectively updates older FFV1/DV packages in order to meet our current
packaging requirements. This should allow accession.py and makepbcore.py to run as
expected. This script should work on files created by:
makeffv1.py
dvsip.py
loopline.py
'''
import argparse
import sys
import shutil
im... | kieranjol/IFIscripts | loopline_repackage.py | Python | mit | 12,437 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-05 14:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('story', '0037_auto_20170405_1401'),
]
operations = [
migrations.AlterField(... | OrhanOdabasi/weirdbutreal | story/migrations/0038_auto_20170405_1404.py | Python | mit | 509 |
import string
import random
def random_secret(n=45):
chars = string.ascii_letters + string.digits
return ''.join(random.choice(chars) for _ in range(n))
| Wiredcraft/pipelines | pipelines/pipeline/utils.py | Python | mit | 162 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'Jayin Ton'
from flask import Flask, request, session, redirect, url_for
app = Flask(__name__)
host = '127.0.0.1'
port = 8000
# 使用session 必须设置secret_key
# set the secret key. keep this really secret:
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
@app.route('/... | jayinton/FlaskDemo | simple/sessionTest.py | Python | mit | 1,407 |
from flask_bcrypt import check_password_hash
from project.user.services.create_user_service import CreateUserService
from project.user.services.login_user_service import LoginUserService
from project.user.services.logout_user_service import LogoutUserService
from project.user.finders.user_finder import UserFinder
fro... | andreffs18/flask-template-project | project/user/handlers/user_handler.py | Python | mit | 1,551 |
# coding: utf-8
import copy
import json
import gzip
from cStringIO import StringIO
from datetime import datetime
import arrow
import iso8601
from dateutil import tz
import ML
from ML import operation
__author__ = 'czhou <czhou@ilegendsoft.com>'
def get_dumpable_types():
return (
operation.BaseOp,
... | MaxLeap/SDK-CloudCode-Python | ML/utils.py | Python | cc0-1.0 | 3,771 |
#!/usr/bin/python
import os
import time
import moveServo
import os.path
from multiprocessing import Process
my_dir = os.path.dirname(__file__)
def main():
moveServo.init_candy()
moveServo.move_servo_ext(0, 180, 25)
print "sleep 5"
# time.sleep(1)
moveServo.move_servo_ext(180, 90, 25)... | intelmakers/candy_machine | Python/test_servo.py | Python | cc0-1.0 | 625 |
from RebotConfig import RebotConfig
from Log import Log
from exchange.huobi.HuobiUtil import *
from exchange.huobi.HuobiService import *
import json
import time
import math
'''{1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year }'''
PERIOD2TYPE = {
1 : '1min',
5 : '5min',
15 : '15min',
... | WaitGodot/peatio-client-python | exchange/huobiEX.py | Python | cc0-1.0 | 15,480 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.scripts.tap2rpm}.
"""
import os
from twisted.trial.unittest import TestCase, SkipTest
from twisted.python import procutils
from twisted.python.failure import Failure
from twisted.internet import utils
from twisted.scripts i... | Kagami/kisa | lib/twisted/scripts/test/test_tap2rpm.py | Python | cc0-1.0 | 12,453 |
import FWCore.ParameterSet.Config as cms
from HeavyIonsAnalysis.JetAnalysis.jets.akPu4PFJetSequence_PbPb_mc_cff import *
#PU jets with 15 GeV threshold for subtraction
akPu4PFmatch15 = akPu4PFmatch.clone(src = cms.InputTag("akPu4PFJets15"))
akPu4PFparton15 = akPu4PFparton.clone(src = cms.InputTag("akPu4PFJets15"))
ak... | mverwe/JetRecoValidation | PuThresholdTuning/python/akPu4PFJetSequence15_cff.py | Python | cc0-1.0 | 1,371 |
import OOMP
newPart = OOMP.oompItem(9185)
newPart.addTag("oompType", "POTE")
newPart.addTag("oompSize", "07")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "O102")
newPart.addTag("oompIndex", "01")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_POTE_07_X_O102_01.py | Python | cc0-1.0 | 241 |
'''
This is an example how to use PyScanClient library to connect a scan server.
It assumes the server running on localhost at port 4810.
The scan server is a RESTful based web service, which was developed at SNS.
Its binary nightly build could be found at:
https://ics-web.sns.ornl.gov/css/nightly/
and source code is ... | PythonScanClient/PyScanClient | tutorial/1_start.py | Python | epl-1.0 | 787 |
#!/usr/bin/python
import spidev
import time
import datetime
import sys
import math
import struct
"""
================================================
ABElectronics IO Pi V2 32-Channel Port Expander
Version 1.0 Created 20/05/2014
Version 1.1 16/11/2014 updated code and functions to PEP8 format
Requires python smbus t... | moeskerv/ABElectronics_Python_Libraries | ExpanderPi/ABE_ExpanderPi.py | Python | gpl-2.0 | 22,720 |
import os
import csv
import sys
import re
import importlib
import networkx as nx
# settings
#curDir = 'E:/Copy/Coursera/Bioinformatics Algorithms (part-I)/MyPrograms/week6-python'
curDir = 'D:/Copy/Coursera/Bioinformatics Algorithms (part-I)/MyPrograms/week6-python'
inputFile = './data/6.local_alignment-2.txt'
#inputF... | alorchhota/bioinformatics-algorithms-1 | week6-Python/code/6.LocalAlignment.py | Python | gpl-2.0 | 3,114 |
# -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.pymongo import PyMongo
import config
from views import diary
def create_app(cfg):
app = Flask(__name__)
app.config.from_object(cfg)
return app
# Application creation.
app = create_app(config)
# Database configuration.
db = PyMongo()
# Bl... | GruPy-RN/agenda_flask | diary/__init__.py | Python | gpl-2.0 | 416 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys
def main():
args = parseArgs(sys.argv)
# get analogy files in the analogy directory
# http://stackoverflow.com/questions/3207219/how-to-list-all-files-of-a-directory-in-python
resultFns = [os.path.join(arg... | ppegusii/cs689-mini1 | src/evaluate.py | Python | gpl-2.0 | 2,517 |
import os
import sys
import unittest
from unittest.mock import patch, MagicMock
sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/'))
from katello.agent.pulp import libdnf
@unittest.skipIf('dnf' not in sys.modules, "Dnf not present")
class TestLibDnf(unittest.TestCase):
def test_package_update_on_a... | Katello/katello-agent | test/test_katello/test_agent/test_pulp/test_libdnf.py | Python | gpl-2.0 | 1,456 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib, urllib2
import xbmcplugin, xbmcaddon, xbmcgui, xbmc
import sys, os, re, json, base64, operator, datetime, time
from resources.local import *
pluginhandle = int(sys.argv[1])
addon = xbmcaddon.Addon()
settings = xbmcaddon.Addon( id = "plugin.video.tele.ml" )
doma... | idi2019/plugin.video.tele.ml | default.py | Python | gpl-2.0 | 9,683 |
from sdssgaussfitter import gaussfit
import numpy as np
import os,sys
from util import utils
from util.readDict import readDict
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def aperture(startpx,startpy,radius=7):
r = radius
length = 2*r
height = length
allx = xrange(startpx... | bmazin/ARCONS-pipeline | examples/Pal2012_landoltPhot/fitPsf.py | Python | gpl-2.0 | 8,372 |
#!/usr/bin/env python
#encoding: utf-8
# Martin Kersner, m.kersner@gmail.com
# 2016/03/17
from __future__ import print_function
import os
import sys
import glob,cv2
from PIL import Image as PILImage
import numpy as np
from utils import mat2png_hariharan,pascal_palette_invert
def main():
input_path, output_path = pr... | z01nl1o02/tests | voc/sbd_dataset/mat2png.py | Python | gpl-2.0 | 2,232 |
# -*- coding: utf-8 -*-
# Copyright(c) 2016-2020 Jonas Sjöberg <autonameow@jonasjberg.com>
# Source repository: https://github.com/jonasjberg/autonameow
#
# This file is part of autonameow.
#
# autonameow is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | jonasjberg/autonameow | autonameow/core/master_provider.py | Python | gpl-2.0 | 17,265 |
"""grace
Revision ID: 2bce3f42832
Revises: 100d29f9f7e
Create Date: 2015-08-19 13:48:08.511040
"""
# revision identifiers, used by Alembic.
revision = '2bce3f42832'
down_revision = '100d29f9f7e'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands a... | huangtao-sh/grace | grace/alembic/versions/2bce3f42832_grace.py | Python | gpl-2.0 | 649 |
# -*- coding: UTF-8 -*-
import eqq
import argparse
from eqq import EqqClient
class EqqMachine(object):
def __init__(self,uin,pwd):
self.eqq=EqqClient()
self.eqq.set_output()
self.uin=uin
self.pwd=pwd
self.eqq.set_account(uin,pwd)
self.eqq.login()
self.eqq... | evilbinary/eqq-python | eqq_machine.py | Python | gpl-2.0 | 1,306 |
'''
Created on Nov 13, 2013
@author: samriggs
CODE CHALLENGE: Solve the Minimum Skew Problem.
https://beta.stepic.org/Bioinformatics-Algorithms-2/Peculiar-Statistics-of-the-Forward-and-Reverse-Half-Strands-7/#step-6
'''
from bi_utils.helpers import sane_open
from cStringIO import StringIO
def min_skew(dataset=''):
... | samriggs/bioinf | Homeworks/bi-Python/chapter1/quiz6_solution.py | Python | gpl-2.0 | 1,112 |
#!/usr/bin/python
#GraphML-Topo-to-Mininet-Network-Generator
#
# This file parses Network Topologies in GraphML format from the Internet Topology Zoo.
# A python file for creating Mininet Topologies will be created as Output.
# Files have to be in the same directory.
#
# Arguments:
# -f [filename of Gra... | yossisolomon/assessing-mininet | parser/GraphML-Topo-to-Mininet-Network-Generator.py | Python | gpl-2.0 | 13,124 |
from django.conf.urls import url
from kraut_accounts import views
urlpatterns = [
url(r'^logout/$', views.accounts_logout, name='logout'),
url(r'^login/$', views.accounts_login, name='login'),
url(r'^changepw/$', views.accounts_change_password, name='changepw'),
]
| zeroq/kraut_salad | kraut_accounts/urls.py | Python | gpl-2.0 | 278 |
from PyQt4 import QtCore, uic
from PyQt4.QtGui import *
from subprocess import call
from grafo import Grafo
from uis.uiMainwindow import Ui_MainWindow
from sobre import SobreUi
import pdb
from resultado import Resultado
def debug_trace():
'''Set a tracepoint in the Python debugger that works with Qt'''
from P... | sollidsnake/grafo | mainwindow.py | Python | gpl-2.0 | 10,057 |