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 |
|---|---|---|---|---|---|
from flask import Flask, redirect, session, url_for
from datetime import timedelta
import sys
import config
import client
app = Flask(__name__)
@app.route("/")
def index():
redirect_uri = url_for('callback', _external=True)
code = client.get_request_token(config.oauth_request_url, config.consumer_key, redirec... | tzetze/pocket-counter | src/app.py | Python | mit | 1,312 |
import threading
import functools
# Lock for the preventing multiple compiler execution
class _CompilerLock(object):
def __init__(self):
self._lock = threading.RLock()
def acquire(self):
self._lock.acquire()
def release(self):
self._lock.release()
def __enter__(self):
... | sklam/numba | numba/core/compiler_lock.py | Python | bsd-2-clause | 1,401 |
# -*- coding: utf-8 -*-
# Author: Milan Nikolic <gen2brain@gmail.com>
# Contributor: Shawn Wilson of Alpha Griffin <shawn@lannocc.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 ve... | AlphaGriffin/mupen64plus-ui-python | src/m64py/frontend/worker.py | Python | gpl-3.0 | 13,559 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.transla... | shoopio/shoop | shuup/admin/modules/contact_group_price_display/__init__.py | Python | agpl-3.0 | 1,579 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_association.py | Python | mit | 1,304 |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
clean_podcast_url,
int_or_none,
try_get,
urlencode_postdata,
)
class GooglePodcastsBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://podcasts\.google\.com/feed/... | rg3/youtube-dl | youtube_dl/extractor/googlepodcasts.py | Python | unlicense | 3,412 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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... | summermk/dragonfly | dragonfly/language/__init__.py | Python | lgpl-3.0 | 957 |
# Jose Guvenilir
# guvenj
# lab 1 checkpoint 3
jupDiam = 88846.0
jupToSun = 483632000.0
earthDiam = 7926.0
earthToSun = 92957100.0
speedOfLight = 186000
jupEarthSunRatio = jupToSun / earthToSun
jupEarthVolumeRatio = ((jupDiam / 2) ** 3) / ((earthDiam / 2) ** 3)
minsToEarth = (earthToSun / speedOfLight) / 60
secsToEar... | guvjose/ComputerScience1 | Labs/Lab_1/lab1_part3.py | Python | mit | 793 |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def minDepth(self, root):
if root == None:
return 0
... | happylixue/LeetCodeSol | problems/minimum-depth-of-binary-tree/sol.py | Python | mit | 870 |
"""
Example of a scatter plot
"""
# set up some data to plot
from Numeric import *
import random
x = arange(30, typecode=Float)
y = arange(30, typecode=Float)
# make the data a bit more scatter-like by using random numbers
random.seed()
for i in range(len(x)):
x[i] = random.random()
y[i] = random.random()
... | paultcochrane/pyvisi | examples/renderers/gnuplot/scatterPlot.py | Python | gpl-2.0 | 806 |
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
# G... | gnu-sandhi/sandhi | modules/gr36/gr-wxgui/grc/panel.py | Python | gpl-3.0 | 1,645 |
#!/usr/bin/env python
# sample module
from jira.client import JIRA
def main():
jira = JIRA()
JIRA(options={'server': 'http://localhost:8100'})
projects = jira.projects()
print projects
for project in projects:
print project.key
# Standard boilerplate to call the main() function.
if __nam... | selvait90/jira-automation | sample.py | Python | gpl-3.0 | 349 |
from os.path import expanduser
import logging
# GENERAL SETTINGS
APP_NAME = 'hostinguard'
DUMMY_EP = ''
# LOGGING
LOGGING_LEVEL = logging.DEBUG
LOGGING_FILENAME = APP_NAME + '.log'
# CLIENT SPECIFIC SETTINGS
CLIENT_NAME = APP_NAME + '_client'
POLL_REFRESH_FREQ = 30
TIMEOUT_OFFSET = 2
RETRY_OFFSET = 0
RETRY_POWER = 2... | mirkochip/hostinguard | src/common/settings/config.example.py | Python | gpl-3.0 | 757 |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetCharactersCharacterIdWallets200Ok(object):
"""
... | minlexx/pyevemon | esi_client/models/get_characters_character_id_wallets_200_ok.py | Python | gpl-3.0 | 3,859 |
'''
en este archivo se almacenaran todas las caracteristicas de la pantalla, como los colores ancho y alto
'''
ANCHO=600
ALTO=600
BLANCO=(255,255,255)
NEGRO=(0,0,0)
ROJO=(255,0,0)
AZUL=(0,0,255)
VERDE=(0,255,0)
| Jofemago/Computacion-Grafica | Disparos/TareaDisparos/configuraciones.py | Python | mit | 212 |
from project.settings.base import * # noqa
import dj_database_url
import os
DEBUG = False
TEMPLATE_DEBUG = False
SECRET_KEY = os.getenv("SECRET_KEY")
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'h... | fmondaini/catalog | project/settings/qa.py | Python | gpl-2.0 | 593 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CheckCheat',
fields=[
('id', models.AutoField(v... | io07/BOJ-V4 | cheat/migrations/0001_initial.py | Python | mit | 426 |
__author__ = 'bakl'
from .string_misc import cache_load, cache_save
from .string_misc import pd2np, np2tex
from .reader_table import read_obs_table_header, read_table_header_float, curves2table, table2curves
from .math import log_interp1d
| baklanovp/pystella | pystella/util/__init__.py | Python | mit | 241 |
#!/usr/bin/env python3
import os
import sys
import shutil
from appextractor import get_app_ids_from_play_store_url
from appextractor import play_store_topselling_free_url
from appextractor import download_app
from appextractor import categories
import csv
import statistics
import matplotlib.pyplot as plot
# pip instal... | natanieljr/droidmate | project/scripts/whierarchychecker.py | Python | gpl-3.0 | 8,167 |
from functools import partial
from django.contrib import messages as django_messages
from django.template import loader
from django.utils import safestring
import jinja2
from rest_framework.request import Request
"""
This file was created because AMO wants to have multi-line messages including a
title and some con... | lavish205/olympia | src/olympia/amo/messages.py | Python | bsd-3-clause | 2,880 |
#This file is part of REXT
#updater.py - script that handles updating of REXT and it's components
#Author: Ján Trenčanský
#License: GNU GPL v3
import subprocess
import time
import re
import os
import interface.utils
import core.globals
from interface.messages import print_blue
#Pull REXT from git repo
def update_re... | bmaia/rext | core/updater.py | Python | gpl-3.0 | 3,055 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.course_list, name='list'),
url(r'(?P<course_pk>\d+)/(?P<step_pk>\d+)/$', views.step_detail, name='step'),
url(r'(?P<pk>\d+)/$', views.course_detail, name='detail'),
] | nirajkvinit/python3-study | django-basic/learning_site/courses/urls.py | Python | mit | 257 |
import cv2
import numpy as np
if __name__ == "__main__":
cap = cv2.VideoCapture(0)
i = 0
counter = 0
while True:
if cap.grab():
flag, frame = cap.retrieve()
if not flag:
continue
else:
counter += 1
print(counter... | fest-research/deep-coin-demo | fujitsu/data_management/data_generator.py | Python | apache-2.0 | 909 |
# This file is part of Spacetime.
#
# Copyright 2010-2014 Leiden University.
# Written by Sander Roobol.
#
# Spacetime 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 ... | Onderwaater/spacetime | lib/spacetime/modules/generic/__init__.py | Python | gpl-2.0 | 810 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
from scipy.stats import truncnorm
from time import sleep
def generate_group_membership_probabilities(num_hosts, mean, std_dev, avg_group_size = 0):
a , b = a, b = (0 - mean) / std_dev, (1 - mean) / std_dev
midpoint_ab = (b + a) / 2
scale = 1 / (b - a)
... | alexcraig/GroupFlow | groupflow_scripts/rv_test.py | Python | apache-2.0 | 971 |
#!/usr/bin/python
# Copyright (C) 2006 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a full list
# of copyright holders.
#
# Prof. C Pain
# Applied Modelling and Computation Group
# Department of Earth Science and Engineering
# Imperial College... | rjferrier/fluidity | tools/optimality.py | Python | lgpl-2.1 | 32,527 |
#!/usr/bin/python
import re
import copy
from subprocess import Popen, check_output, PIPE, CalledProcessError
from time import sleep
from datetime import datetime
from pprint import pprint
class Scenario:
""" Holds a scenario data
Most scenario related methods are global and not in this class to make scenario wri... | peckpeck/rudder-tests | scenario/lib.py | Python | gpl-3.0 | 5,718 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_parameters_py3.py | Python | mit | 2,590 |
""" DIRAC Notification Client class encapsulates the methods exposed
by the Notification service.
"""
__RCSID__ = "$Id$"
from DIRAC import gLogger, S_ERROR
from DIRAC.Core.Base.Client import Client
from DIRAC.Core.Utilities.Mail import Mail
class NotificationClient(Client):
def __init__(self, **kwargs):
... | andresailer/DIRAC | FrameworkSystem/Client/NotificationClient.py | Python | gpl-3.0 | 4,414 |
# Change the following to True to get a much more comprehensive set of tests
# to run, albeit, which take considerably longer.
full_tests = False
def test(fmt, *args):
print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
test("{}-{}", 1, [4, 5])
test("{0}-{1}", 1, [4, 5])
test("{1}-{0}", 1, [4, 5])
test("... | eblot/micropython | tests/basics/string-format.py | Python | mit | 3,043 |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
MoleculeType entity classes.
"""
from everest.entities.base import Entity
from everest.entities.utils import slug_from_string
__docformat__ = "reStructured... | helixyte/TheLMA | thelma/entities/moleculetype.py | Python | mit | 2,617 |
""" ControlDemo Example
"""
from pyjamas.ui import RootPanel, Label
from pyjamas.Controls import VerticalDemoSlider2
class ControlDemo:
def onModuleLoad(self):
b = VerticalDemoSlider2(0, 100)
RootPanel().add(b)
b.setWidth("20px")
b.setHeight("100px")
b.addControlValueListe... | minghuascode/pyj | doc/controls02/ControlDemo.py | Python | apache-2.0 | 534 |
from paypalrestsdk import Authorization, ResourceNotFound
import logging
logging.basicConfig(level=logging.INFO)
try:
authorization = Authorization.find("99M58264FG144833V")
print("Got Authorization details for Authorization[%s]"%(authorization.id))
except ResourceNotFound as error:
print("Authorization Not Fou... | stafur/pyTRUST | paypal-rest-api-sdk-python/samples/authorization/find.py | Python | apache-2.0 | 325 |
import numpy as np
from sklearn.svm import LinearSVC
from sklearn.cross_validation import train_test_split
from sklearn.datasets import load_boston
#crime_data = np.loadtxt("data/crime_data.csv", delimiter=",")
#crime_target = np.loadtxt("data/crime_target.csv")
#crime_data_train, crime_data_test, crime_target_train,... | alanplotko/Cryme | learn.py | Python | mit | 630 |
import sys
import numpy as np
class ChromStats(object):
def __init__(self):
self.n = 0
self.n_nan = 0
self.sum = 0
self.min = None
self.max = None
def mean(self):
"""Calculates mean of sites that are not nan
on this chromsome"""
n = self.n - s... | smozaffari/WASP | CHT/chromstat.py | Python | apache-2.0 | 4,398 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import numpy as np
import pandas as pd
import scipy.integrate as integrate
import math
from IPython.display import display
from IPython.core.display import HTML
import thesis_functions.utilities
from thesis_functions.initial_conditions import initial_... | aerosara/thesis | notebooks/thesis_functions/major_simulation_components.py | Python | mit | 35,972 |
## $id: webstatadmin.py,v 1.28 2007/04/01 23:46:46 tibor exp $
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2010, 2011 CERN.
##
## Invenio 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; ... | lnielsen/invenio | invenio/legacy/webstat/admin.py | Python | gpl-2.0 | 10,387 |
from django import template
register = template.Library()
@register.filter
def get(dictionary, key):
return dictionary[key] | szgut/www24 | site/score/templatetags/get_item.py | Python | gpl-2.0 | 129 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Outlook Windows Registry plugins."""
import unittest
# pylint: disable=unused-import
from plaso.formatters import winreg as winreg_formatter
from plaso.parsers.winreg_plugins import outlook
from tests.parsers.winreg_plugins import test_lib
from tests.winregi... | jorik041/plaso | tests/parsers/winreg_plugins/outlook.py | Python | apache-2.0 | 3,175 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
#... | Codefans-fan/odoo | setup/package.py | Python | agpl-3.0 | 21,531 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.conf.urls.defaults import *
import questions.views as views
urlpatterns = patterns('',
# mini dashboard for this app
url(r'^questions$',
views.dashboard,
name="questions-home"),
# view all questions and recent activ... | pivotaccess2007/RapidSMS-Rwanda | apps/questions/urls.py | Python | lgpl-3.0 | 1,445 |
import xmpp
import urllib, urllib2
import xmlrpclib
from sso.services import BaseService
from django.conf import settings
class JabberService(BaseService):
settings = { 'require_user': True,
'require_password': True,
'provide_login': False,
'use_auth_username': ... | nikdoof/test-auth | app/sso/services/jabber/__init__.py | Python | bsd-3-clause | 7,262 |
# -*- coding: UTF-8 -*-
# date time
import time;
ticks = time.time();
print 'timeStamp(Millisecond) is -->>', ticks;
print;
localTime = time.localtime(time.time());
print 'localTime is -->>', localTime;
print;
formatDateTime = time.asctime(time.localtime(time.time()));
print 'formatDateTime is -->>', formatDateTime... | xiaoyong0312/Python-dev | Python2.x/Python2.x-0-basic/013_1.1_dateTime.py | Python | mit | 329 |
"""
Custom exceptions for the MicroMasters app
"""
from django.core.exceptions import ImproperlyConfigured
class PossiblyImproperlyConfigured(ImproperlyConfigured):
"""
Custom exception to be raised when the improper configuration is not certain
"""
| mitodl/micromasters | micromasters/exceptions.py | Python | bsd-3-clause | 265 |
import os, sys
x = input("Enter a number: ")
y = 10
while True and y > -1:
if (x)/(2^y) > 1:
y -= 1
print "1"
else:
y -= 1
pass
print "0"
| defunSM/code | pro2/binary_converter.py | Python | mit | 173 |
# 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 u... | dmlc/tvm | python/tvm/topi/scan.py | Python | apache-2.0 | 8,064 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/windows/win_xml.py | Python | gpl-3.0 | 2,841 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-pubsub | samples/generated_samples/pubsub_v1_generated_subscriber_list_snapshots_sync.py | Python | apache-2.0 | 1,465 |
"""
Provides general utility functions
"""
import advcubit.common_module as _common
import advcubit.system_module as _system
def roundTuple(baseTuple, prec=2, tupleType=tuple):
""" Round a tuple
:param baseTuple: input tuple
:param prec: number of digits
:param tupleType: type of final tuple
:re... | hr87/advcubit | advcubit/function_module.py | Python | lgpl-2.1 | 8,092 |
import subprocess
import urllib
# This web application gets launched by firstrun-init
# The form in settings.html posts to /action/set_password
# This application then launches firstrun.sh with the given parameters
def check_instance_id(pwd):
iid = urllib.request.urlopen('http://169.254.169.254/latest/meta-data/in... | rethinkdb/rethinkdb | packaging/ami/build-ami-files/firstrun_web.py | Python | apache-2.0 | 1,606 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
import json
voc = []
with open('./csv/HSK Official With Definitions 2012 L1.tsv', 'rb') as csvfile:
csvRows = csv.reader(csvfile, delimiter='\t')
next(csvRows)
for csvRow in csvRows:
voc.append({
"chinese": csvRow[0],
"pinyin": csvRow[3],
"english": ... | mmewen/UTSEUS-DataScience | Course_02/01_HSK_to_json.py | Python | mit | 420 |
# coding: utf-8
# %load_ext autoreload
# %autoreload 2
import random
import sys
import data
import jieba
import color
import time
from knowledge import *
import sys
import manager as dbman
import numpy
class VoiceInterface :
def __init__(self) :
self.msg_queue = list()
def hear_display(self, message):
retur... | strin/yaotalk | dialogue.py | Python | gpl-3.0 | 5,291 |
#!/usr/bin/env python
import requests
import re
import sys
def most_common(lst):
return max(set(lst), key=lst.count)
args = sys.argv
args[0] = ''
keyword = "%20".join(args)
url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" + keyword + "%20kvk&as_nlo=10000000&as_nhi=99999999"
r = requests.ge... | landgenoot/kvk-finder | kvk-finder.py | Python | apache-2.0 | 563 |
from cStringIO import StringIO
import os
import sys
import pytest
from infrared.main import main as ir_main
from tests.test_plugins import SAMPLE_PLUGINS_DIR
from tests.test_plugins import get_plugin_spec_flatten_dict
from tests.test_plugins import plugins_conf_fixture # noqa
from tests.test_plugins import plugin_ma... | okolisny/InfraRed | tests/test_help_screen.py | Python | apache-2.0 | 2,088 |
# -*- coding: utf-8 *-*
# Copyright (c) 2013 Tisserant Pierre
#
# This file is part of Dragon dice simulator.
#
# Dragon dice simulator 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 ve... | TheLazyHase/dragon_dice_simulator | business/army/roll/maneuver_avoidance.py | Python | gpl-3.0 | 1,084 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apach... | twitter/heron | heron/tools/tracker/src/python/query_operators.py | Python | apache-2.0 | 20,310 |
import itertools
import os
import os.path as osp
import chainer
import numpy as np
import scipy.misc
from sklearn.model_selection import train_test_split
from base import APC2016DatasetBase
def ids_from_scene_dir(scene_dir, empty_scene_dir):
for i_frame in itertools.count():
empty_file = osp.join(
... | wkentaro/fcn | examples/apc2016/datasets/mit_benchmark.py | Python | mit | 3,797 |
# author: by Ronald Haentjens Dekker (created 4 August 2014)
class AStar(object):
def heuristic(self, node):
raise NotImplementedError
def create_childnodes(self, node):
raise NotImplementedError
def search(self, start, control_table):
# TODO: should become pr... | rhdekker/collatex | collatex-pythonport/collatex/astar.py | Python | gpl-3.0 | 2,031 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/clif | examples/inheritance/python/hidden_base_test.py | Python | apache-2.0 | 892 |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.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, copy, modi... | marshall/pynaries | boto/mturk/connection.py | Python | apache-2.0 | 20,736 |
'''
adaboost.MM implementation.
'''
import numpy as np
import sys
import os
import tempfile
import commands
import itertools
from weak_learnerMM import weak_learner
import argparse
import pylab as plt
class adaboostMM:
def __init__(self, rounds = 5):
self.T = rounds
self.wlearner = []
... | vmr2117/nnet | src/adaboost/ada1.py | Python | gpl-2.0 | 7,976 |
from oscar.core.loading import is_model_registered
from oscar.apps.voucher.abstract_models import (
AbstractVoucher, AbstractVoucherApplication)
__all__ = []
if not is_model_registered('voucher', 'Voucher'):
class Voucher(AbstractVoucher):
pass
__all__.append('Voucher')
if not is_model_registe... | pasqualguerrero/django-oscar | src/oscar/apps/voucher/models.py | Python | bsd-3-clause | 471 |
#! /usr/bin/env python3
# This script is for running peru directly from the repo, mainly for
# development. This isn't what gets installed when you install peru. That would
# be a script generated by setup.py, which calls peru.main.main().
import os
import sys
repo_root = os.path.dirname(os.path.realpath(__file__))
... | buildinspace/peru | peru.py | Python | mit | 411 |
#-*- coding: utf-8 -*-
'''
python-libtorrent for Kodi (script.module.libtorrent)
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
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 t... | kreatorkodi/repository.torrentbr | script.module.libtorrent/python_libtorrent/python_libtorrent/functions.py | Python | gpl-2.0 | 5,395 |
# Created By: Virgil Dupras
# Created On: 2010-09-11
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-... | fokusov/moneyguru | core/gui/entry_table_base.py | Python | gpl-3.0 | 15,063 |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | YuepengGuo/backtrader | docs/pandas-datafeed/pfeed.py | Python | gpl-3.0 | 5,281 |
# -*- coding: utf-8 -
#
# This file is part of socketpool.
# See the NOTICE for more information.
import socket
import time
import random
from socketpool import util
class Connector(object):
def matches(self, **match_options):
raise NotImplementedError()
def is_connected(self):
raise NotImpl... | mgedmin/socketpool | socketpool/conn.py | Python | mit | 3,385 |
import logging
log = logging.getLogger('fabric.fabalicious.docker')
from base import BaseMethod
from fabric.api import *
from fabric.network import *
from fabric.context_managers import settings as _settings
from fabric.context_managers import env
from lib import configuration
import copy
from lib.utils import validat... | factorial-io/fabalicious | lib/methods/docker.py | Python | mit | 11,026 |
from noise import snoise2
import numpy as np
from random import randint as rai
from itertools import product
import time
#Property class that assigns an object containing the attributes of the coordinates
class Property:
def __init__(self, loc_type, x, y, number):
self.type = loc_type
self.l... | Porter97/ABM | Modeltest2.py | Python | gpl-3.0 | 4,015 |
from dateutil.relativedelta import relativedelta
from django.core.exceptions import ObjectDoesNotExist
from django.test import TestCase
from django.test.utils import tag, override_settings
from edc_base.utils import get_utcnow
from edc_base.tests import SiteTestCaseMixin
from ..exceptions import RegisteredSubjectError... | botswana-harvard/edc-registration | edc_registration/tests/test_registration.py | Python | gpl-2.0 | 5,375 |
from numpy import *
from numpy.random import randint
from scipy import *
import matplotlib.pyplot as plt
import neuroTools as tech
from matplotlib import rcParams, text
#--------------------------------------Plotting Options--------------------------------------------
params = {'backend': 'ps',
'axes.labels... | mac389/brainpy | examples/a_2.py | Python | gpl-3.0 | 2,546 |
import aputime
| mavjs/APUTimeTable | apu/__init__.py | Python | gpl-3.0 | 15 |
"""
Axilent Client functionality for Dox.
"""
from sharrock.client import HttpClient, ResourceClient, ServiceException
from dox.config import get_cfg
from dox.utils import slugify
def _get_resource(app,resource,library=True):
"""
Gets a resource client.
"""
cfg = get_cfg()
apikey_setting = 'library... | Axilent/Dox | dox/client.py | Python | bsd-3-clause | 2,050 |
import pytest
from mitmproxy.net.http.http2 import parse_headers
class TestHttp2ParseHeaders:
def test_relative(self):
h = dict([
(':authority', "127.0.0.1:1234"),
(':method', 'GET'),
(':scheme', 'https'),
(':path', '/'),
])
first_line_form... | mosajjal/mitmproxy | test/mitmproxy/net/http/http2/test_utils.py | Python | mit | 2,044 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 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... | eicher31/compassion-modules | crm_compassion/models/event_compassion.py | Python | agpl-3.0 | 23,954 |
import logging
from pylons import request, response, session, tmpl_context as c
from zkpylons.lib.helpers import redirect_to
from pylons.decorators import validate
from pylons.decorators.rest import dispatch_on
from formencode import validators, htmlfill
from formencode.variabledecode import NestedVariables
from zkp... | noisymime/zookeepr | zkpylons/controllers/rego_note.py | Python | gpl-2.0 | 3,852 |
""" Serializers suitable for transports which support multiple fields per message
These serializers handle moving data to/from a dictionary
format. The format looks like this::
# Message metadata first. Each value is implicitly a utf8 string
id: 'ZOCTLh1CEeimW3gxwcOTbg=='
api_name: 'my_company.auth'
p... | adamcharnock/lightbus | lightbus/serializers/by_field.py | Python | apache-2.0 | 2,390 |
# -*- coding: utf-8 -*-
# LICENSE: MIT
__version__ = '0.1.0'
from .base import Model
from . import models
from . import planners
from . import irl
from . import domains
from . import utils
from . import representation
__all__ = [
'Model',
'models',
'planners',
'irl',
'domains',
'utils',
... | makokal/funzo | funzo/__init__.py | Python | mit | 341 |
# -*- coding: utf-8 -*-
""" Httplib2 threaded cookie layer
This class extends httplib2, adding support for:
- Cookies, guarded for cross-site redirects
- Thread safe ConnectionPool and LockableCookieJar classes
- HttpProcessor thread class
- HttpRequest object
"""
# (C) 2007 Pywikipedia bot team, 20... | azatoth/pywikipedia | pywikibot/comms/threadedhttp.py | Python | mit | 16,973 |
#!/usr/bin/python
import socket
tcd_keys = {
'KEY_UP' : 'UP',
'KEY_DOWN' : 'DOWN',
'KEY_LEFT' : 'LEFT',
'KEY_RIGHT' : 'RIGHT',
'SELECT' : 'SELECT',
't' : 'TIVO'
}
def sendtcd(host, key):
port = 31339
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.connect((h... | wushujames/tivo-macro-recorder | tivo_playback_keystrokes.py | Python | apache-2.0 | 803 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2012 Martin Hammerschmied
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 wit... | kolomanschaft/updatejunkie | test/testadstore.py | Python | mit | 2,711 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from weckan import wsgihelpers, conf, contexts, auth
log = logging.getLogger(__name__)
@wsgihelpers.wsgify
def to_home(request):
return wsgihelpers.redirect(contexts.Ctx(request), location='/')
@wsgihelpers.wsgify
def to_login(req... | etalab/weckan | weckan/controllers/redirect.py | Python | agpl-3.0 | 1,814 |
import json
import subprocess
from flask import Response, request
def call_command(cmd, verbose=False):
if verbose:
print cmd
subprocess.call(cmd)
def json_requested():
"""Check if json is the preferred output format for the request."""
best = request.accept_mimetypes.best_match(
['... | rehandalal/buchner | buchner/helpers.py | Python | bsd-3-clause | 940 |
# Generated by Django 2.2.16 on 2021-03-21 09:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0063_product_product_survey'),
]
operations = [
migrations.AddField(
model_name='product',
name='pinned... | flavoi/diventi | diventi/products/migrations/0064_product_pinned.py | Python | apache-2.0 | 417 |
import errno
import os
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key
from django.db.models.signals import post_delete, post_save, pre_save
from django.dispatch import receiver
from .cachi... | DMOJ/site | judge/signals.py | Python | agpl-3.0 | 6,052 |
# Copyright (c) 2016 Uber Technologies, 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, modify, merge, publ... | guillermo-sentinella/jaeger-client-python | jaeger_client/config.py | Python | mit | 10,557 |
# Copyright 2016 Red Hat, 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 by... | cisco-openstack/tempest | tempest/lib/services/volume/v2/capabilities_client.py | Python | apache-2.0 | 886 |
'''
Created on 18-04-2013
@author: citan
'''
import pygame
import os.path
import os
import sys
from pimonitor.PM import PM
from pimonitor.PMUtils import PMUtils
class PMScreen(object):
'''
classdocs
'''
LOG_FPS_EVENT = pygame.USEREVENT + 1
LOG_STATS_EVENT = LOG_FPS_EVENT + 1
ONE_SEC_EVENT = LOG_STATS_EVENT + ... | PiMonitor/PiMonitor | pimonitor/ui/PMScreen.py | Python | gpl-2.0 | 5,807 |
# 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.
"""Generates java source files from a mojom.Module."""
import argparse
import ast
import contextlib
import os
import re
import shutil
import tempfile
import... | Workday/OpenFrame | mojo/public/tools/bindings/generators/mojom_java_generator.py | Python | bsd-3-clause | 19,507 |
# Copyright 2013 Red Hat, Inc.
#
# 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 ... | txomon/vdsm | lib/vdsm/tool/configurator.py | Python | gpl-2.0 | 9,591 |
"""Support for Fast.com internet speed testing sensor."""
from __future__ import annotations
from typing import Any
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DATA_RATE_MEGABITS_PER_SECOND
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.d... | sander76/home-assistant | homeassistant/components/fastdotcom/sensor.py | Python | apache-2.0 | 2,204 |
# -*- coding: UTF-8 -*-
## Copyright 2011,2013 Luc Saffre
## This file is part of the Lino project.
## Lino is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your opt... | MaxTyutyunnikov/lino | lino/modlib/cal/management/commands/watch_calendars.py | Python | gpl-3.0 | 12,355 |
db_password = '***'
db_address = 'htmldp.com'
db_login = 'tournaments'
db_database = 'tournaments'
server_hostname = 'localhost'
server_port = 27911
server_logfile = '../pball/qconsole27911.log'
server_rconpassword = '***'
server_id = 0
league_type = 1
league_max_wrong_rounds = 3
| mRokita/DPLeague | config.py | Python | gpl-2.0 | 293 |
# Standard library imports
import unittest
# Local imports
from qtconsole.ansi_code_processor import AnsiCodeProcessor
class TestAnsiCodeProcessor(unittest.TestCase):
def setUp(self):
self.processor = AnsiCodeProcessor()
def test_clear(self):
""" Do control sequences for clearing the consol... | bgris/ODL_bgris | lib/python3.5/site-packages/qtconsole/tests/test_ansi_code_processor.py | Python | gpl-3.0 | 6,970 |
from thefuck.specific.npm import npm_available
from thefuck.utils import replace_argument, for_app, eager, get_closest
from thefuck.specific.sudo import sudo_support
enabled_by_default = npm_available
def _get_wrong_command(script_parts):
commands = [part for part in script_parts[1:] if not part.startswith('-')]... | mlk/thefuck | thefuck/rules/npm_wrong_command.py | Python | mit | 1,290 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 23 19:08:08 2015
@author: Wasit
"""
import os
from flask import Flask, request, redirect, url_for
from werkzeug import secure_filename
UPLOAD_FOLDER = 'static'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
app = Flask(__name__)
app.config['UPLOAD... | wasit7/tutorials | flask/tu/10_upload_file.py | Python | mit | 1,205 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed... | fedora-infra/pkgdb2 | pkgdb2/ui/packages.py | Python | gpl-2.0 | 49,567 |
##
# Ultrasonic library for MicroPython's pyboard.
# Compatible with HC-SR04 and SRF04.
#
# Copyright 2014 - Sergio Conde Gómez <skgsergio@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 Founda... | mithru/MicroPython-Examples | 08.Sensors/HC-SR04/ultrasonic.py | Python | mit | 2,250 |
# -*- coding: utf-8 -*-
#
# genologics-sql documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 27 15:17:17 2016.
#
# 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... | Galithil/genologics_sql | doc/source/conf.py | Python | mit | 9,443 |
# 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 th... | mtreinish/stestr | stestr/test_processor.py | Python | apache-2.0 | 11,305 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.