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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Copyright 2016 Sébastien Maccagnoni
#
# This file is part of AwesomeShop.
#
# AwesomeShop is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3... | tiramiseb/awesomeshop | wsgi.py | Python | agpl-3.0 | 853 |
from slackclient import SlackClient
from matterhook import Webhook
from discord import (
Client as DiscordClient,
Intents as DiscordIntents,
Embed as DiscordEmbed,
)
from zou.app import config
import asyncio
def send_to_slack(app_token, userid, message):
client = SlackClient(token=app_token)
block... | cgwire/zou | zou/app/utils/chats.py | Python | agpl-3.0 | 2,279 |
## parts.py
##
## Objects which represent parts (e.g., activation function, weights, etc.) of a neural network. For
## constructing more complex neural networks
import tensorflow as tf
import numpy as np
# Constants for type of pooling layer to use
MAX_POOL = "MAX"
AVG_POOL = "AVG"
def weight_variable(shape, name=... | danathughes/AtariRL | models/parts.py | Python | mit | 33,275 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def test():
print "Hello,this is list operator class that prepare for snake's body."
class Node(object):
def __init__(self,x,y,p=0):
self.cur_x = x
self.cur_y = y
# self.cur_dir = dir
self.next = p
class LinkList(object):
def __in... | LHMike/RPi-snake | linkList.py | Python | apache-2.0 | 3,413 |
"""
srt.annotation module
Classes to support reading in tab-delimited annotation files,
e.g. biomart, gff, ...
"""
from srt.core import *
import sys, re, warnings
from exceptions import NotImplementedError
from srt.intervals import Interval,Intersector
from srt.useful import smartopen
def loadAnnotationList(file... | PapenfussLab/Srtools | srt/annotation.py | Python | artistic-2.0 | 10,820 |
from workflow_diagnostics import get_diagnostics_dict
from workflow_util import upload_to_s3
from sklearn import preprocessing
import cPickle as pickle
import pandas as pd
import os
def run_model(training, testing, features, outcome, clf,
clf_name, normalize=True, verbose=True):
# NOTE: You should set the clf se... | carlshan/ml_workflow | datascience_tools/modeling/workflow_model_setup.py | Python | mit | 2,346 |
"""
Objects which global optimization solvers.
"""
# pylint: disable=wildcard-import
from .bayesopt import *
from . import bayesopt
from . import functions
__all__ = []
__all__ += bayesopt.__all__
| jhartford/pybo | pybo/__init__.py | Python | bsd-2-clause | 200 |
from sklearn.naive_bayes import GaussianNB
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import BernoulliNB
from sklearn.cross_validation import train_test_split
from sklearn.metrics import mean_squared_error
from sklearn.metrics import classification_report
from sklearn.metrics import confusio... | behrtam/wine-quality-prediction | naive-red.py | Python | mit | 1,207 |
#!/bin/python3
"""Find-Digits.py: determine how many digits evenly divide N"""
__author__ = "Sunil"
__copyright__ = "Copyright 2015, hacker_rank Project"
__license__ = "MIT"
__version__ = "1.0.0"
__email__ = "sunhick@gmail.com"
if __name__ == '__main__':
testcases = int(input().strip())
for testcase in ran... | Sunhick/hacker_rank | Algorithms/Implementation/Find-Digits.py | Python | mit | 745 |
"""
Camera Motion Compensation
==========================
Generate a motion-stabilized video in which the camera motion is compensated.
Main function: `generate_stabilized_video`
"""
import sys
import os
import shutil
import tempfile
import subprocess
from glob import glob
import numpy as np
import cv2
import... | daien/camocomp | camocomp/motion_compensate.py | Python | bsd-3-clause | 13,563 |
# Copyright (c) 2013 OpenStack Foundation.
#
# 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... | projectcalico/calico-neutron | neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py | Python | apache-2.0 | 7,120 |
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2014, Hartmut Goebel <h.goebel@goebel-consult.de>
"""
Test cases for L{upnp.core.service}
"""
import time
try:
import unittest.mock as mock
except ImportError:
import mock
from twisted.tria... | coherence-project/Coherence | coherence/upnp/core/test/test_service.py | Python | mit | 15,115 |
#pylint: disable=W0102,C0103
import os
import threading
from traceback import print_exc
from BitTornado.Meta.BTTree import BTTree
from BitTornado.Meta.Info import MetaInfo
defaults = [
('announce_list', '',
'a list of announce URLs - explained below'),
('httpseeds', '',
'a list of http seed URL... | jakesyl/BitTornado | BitTornado/Application/makemetafile.py | Python | mit | 4,006 |
# -*- encoding: utf-8 -*-
#
# 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... | faizan-barmawer/openstack_ironic | ironic/tests/api/v1/test_nodes.py | Python | apache-2.0 | 56,300 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
from pisi.actionsapi import pisitools
from pisi.actionsapi import autotools
def setup():
... | vdemir/pisi_package | LXQT/base/libfm/actions.py | Python | gpl-3.0 | 1,034 |
from django.db import models
from Profiler.models import *
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
class NewsManager(models.Manager):
def addNews(self, request):
""" adds new news """
global obj
if "rollNo" in request.keys():
obj = Student.object... | IEEEDTU/CMS | NewsFeed/models/News.py | Python | mit | 3,319 |
import os, sys
dirname = os.path.dirname(__file__)
lib_path = os.path.join(dirname, "python_speech_features")
sys.path.append(lib_path)
import features as speechfeatures
import numpy as np
def filter(samplerate, signal, winlen=0.02, winstep=0.01,
nfilt=40, nfft=512, lowfreq=100, highfreq=5000, preemph=0.9... | twerkmeister/iLID | preprocessing/audio/melfilterbank.py | Python | mit | 1,553 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-04 14:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0004_auto_20160904_1214'),
]
operations = [
migrations.AlterField(
... | kushsharma/GotAPI | api/migrations/0005_auto_20160904_1934.py | Python | apache-2.0 | 462 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | Vagab0nd/SiCKRAGE | lib3/twilio/rest/notify/v1/service/binding.py | Python | gpl-3.0 | 18,216 |
#
# Author: Pearu Peterson, March 2002
#
# additions by Travis Oliphant, March 2002
# additions by Eric Jones, June 2002
# additions by Johannes Loehnert, June 2006
# additions by Bart Vandereycken, June 2006
# additions by Andrew D Straw, May 2007
# additions by Tiziano Zito, November 2008
#
# April 2010: Functio... | jrversteegh/softsailor | deps/scipy-0.10.0b2/scipy/linalg/decomp.py | Python | gpl-3.0 | 28,803 |
#
# 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... | eljefe6a/incubator-beam | sdks/python/apache_beam/runners/experimental/python_rpc_direct/server.py | Python | apache-2.0 | 3,835 |
# -*- coding: utf-8 -*-
import time
from toxicbuild.ui import settings
from behave import given, then, when
from tests.webui import take_screenshot
@take_screenshot
def logged_in_webui(context):
browser = context.browser
base_url = 'http://{}:{}/'.format(settings.TEST_WEB_HOST,
... | jucacrispim/toxicbuild | tests/webui/steps/base_steps.py | Python | agpl-3.0 | 1,816 |
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from UM.Backend.Backend import Backend, BackendState
from UM.Application import Application
from UM.Scene.SceneNode import SceneNode
from UM.Preferences import Preferences
from UM.Signal import Signal
from UM.Logger import ... | alephobjects/Cura2 | plugins/CuraEngineBackend/CuraEngineBackend.py | Python | lgpl-3.0 | 38,736 |
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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, me... | liuzz1983/open_vision | test/center_loss_test.py | Python | mit | 3,706 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/nns/resnet50.py | Python | bsd-3-clause | 3,367 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/eventhubs/__init__.py | Python | mit | 1,890 |
"""Config flow to configure flood monitoring gauges."""
from aioeafm import get_stations
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import DOMAIN
class UKFloodsFlowHandler(config_entries.ConfigFlow, domain=DO... | jawilson/home-assistant | homeassistant/components/eafm/config_flow.py | Python | apache-2.0 | 1,816 |
from __future__ import division
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import os
import sys
mydir = os.path.expanduser('~/GitHub/Micro-Encounter')
sys.path.append(mydir+'/tools')
mydir2 = os.path.expanduser("~/")
dat = pd.read_csv(mydir + '/results/simulated_data/SimData.csv')
dat = d... | LennonLab/Micro-Encounter | fig-scripts/OLD-fig-scripts/AggFig.py | Python | gpl-3.0 | 6,688 |
# -*- 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... | mizdebsk/pkgdb2 | tests/__init__.py | Python | gpl-2.0 | 23,339 |
# -*- coding: ISO-8859-1 -*-
#############################################
## (C)opyright by Dirk Holtwick, 2002-2007 ##
## All rights reserved ##
#############################################
__reversion__ = "$Revision: 20 $"
__author__ = "$Author: holtwick $"
__date__ = "$Date: 2007-10-09... | pombreda/xhtml2pdf | sx/pisa3/pisa_document.py | Python | gpl-2.0 | 6,471 |
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add django-extensions as app
"""
from .base import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
# S... | zee93/yt_lab | config/settings/local.py | Python | mit | 1,646 |
#!/usr/bin/env python
# vim: et ts=2 sw=2
from bam.app import App
from bam.handler import Handler
from bam.server import Server
| adammck/bam | bam/__init__.py | Python | mit | 129 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from django.contrib.sites.models import Site
from django.utils.translation import get_language
from cms.apphook_pool import apphook_pool
from cms.models.permissionmodels import ACCESS_DESCENDANTS
from cms.models.permissionmodels import ACCESS_PAGE_AND_DESCEN... | amaozhao/basecms | cms/menu.py | Python | mit | 18,035 |
import struct
import time
class system_profiler:
def __init__(self, x86_mem_pae, base_address):
self.x86_mem_pae = x86_mem_pae
self.base_address = base_address
def machine_info(self, sym_addr):
machine_info = self.x86_mem_pae.read(sym_addr+self.base_address, 40); # __DATA.__common _mac... | jevinskie/volafox | volafox/plugins/system_profiler.py | Python | gpl-2.0 | 2,335 |
from django.shortcuts import render
from django.contrib.auth.decorators import permission_required
from django.conf import settings
from django.template import RequestContext
from django.template.loader import render_to_string
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore.models import Page, PageRev... | suziesparkle/wagtail | wagtail/wagtailadmin/views/home.py | Python | bsd-3-clause | 2,933 |
import os
import unittest
import xml.etree.ElementTree
from conans.client.generators import VisualStudioLegacyGenerator
from conans.model.build_info import CppInfo
from conans.model.conan_file import ConanFile
from conans.model.env_info import EnvValues
from conans.model.ref import ConanFileReference
from conans.model... | memsharded/conan | conans/test/unittests/client/generators/visual_studio_legacy_test.py | Python | mit | 1,805 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Movie.studio'
db.alter_column(u'movie_library_movie', ... | atimothee/django-playground | django_playground/movie_library/migrations/0006_auto__chg_field_movie_studio.py | Python | bsd-3-clause | 4,380 |
"""
WSGI config for temperature project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... | smithdtyler/hautomation | server/temperature/temperature/wsgi.py | Python | gpl-2.0 | 1,144 |
def func(self):
import time
time.sleep(6)
return "VERSION"
| sahlinet/httptest | version.py | Python | mit | 71 |
#
# 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... | apache/incubator-airflow | tests/providers/microsoft/azure/operators/test_azure_container_instances.py | Python | apache-2.0 | 15,580 |
#!/usr/bin/env python
# coding: utf-8
"""
Read Employee data to return turnover information.
This is a example Python program to read and process XML files.
"""
class Employees:
""" Read Employee data to return turnover information. """
__version__ = '0.3.0'
def __init__(self, infile=None):
se... | frankhjung/python-xml | employees/employees.py | Python | gpl-3.0 | 2,544 |
# -*- coding: utf-8 -*-
#
# Copyright © 2017 Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""Tests for lineprofiler.py."""
# Standard library imports
import os
# Third party imports
from pytestqt import qtbot
from qtpy.QtCore import Qt
from spyder.utils.q... | spyder-ide/spyder.line_profiler | spyder_line_profiler/widgets/tests/test_lineprofiler.py | Python | mit | 2,287 |
#!/usr/bin/python
import subprocess
import signal
import os
splunk_home = os.environ['SPLUNK_HOME']
os.chdir(splunk_home + "/etc/apps/shuttl/bin")
start_shuttl_server = "exec $JAVA_HOME/bin/java -Djetty.home=. -Dsplunk.home=../../../../ -cp .:../lib/*:./* com.splunk.shuttl.server.ShuttlJettyServer"
process = subpro... | splunk/splunk-shuttl | package/bin/start.py | Python | apache-2.0 | 749 |
from __future__ import absolute_import
import operator
from jsonfield import JSONField
from django.db import models
from django.db.models import Q
from django.utils import timezone
from sentry.db.models import Model, sane_repr
from sentry.db.models.fields import FlexibleForeignKey
from sentry.ownership.grammar impo... | ifduyue/sentry | src/sentry/models/projectownership.py | Python | bsd-3-clause | 3,743 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | freedesktop-unofficial-mirror/gstreamer-sdk__cerbero | cerbero/commands/shell.py | Python | lgpl-2.1 | 1,684 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.utils import translation
import logging
class ForceLangMiddleware:
def process_request(self, request):
if not translation.LANGUAGE_SESSION_KEY in request.session \
or not request.session... | efornal/sdump | app/middleware.py | Python | gpl-3.0 | 627 |
from __future__ import absolute_import
from . import ws2_32
from . import oleaut32
'''
A small module for keeping a database of ordinal to symbol
mappings for DLLs which frequently get linked without symbolic
infoz.
'''
ords = {
b'ws2_32.dll':ws2_32.ord_names,
b'wsock32.dll':ws2_32.ord_names,
b'oleaut32.d... | pombredanne/pefile | ordlookup/__init__.py | Python | mit | 715 |
from django.db import models
import datetime
# Create your models here.
class AudioFile(models.Model):
# Titulo: string. No nulo
# Link permanente: string. No nulo
# Modo de compartir (público/privado): String
# URL de la imagen: string
# Descripcion: string
# Duracion: int
# Genero: string... | mpvillafranca/hear-cloud | apps/audio/models.py | Python | gpl-3.0 | 464 |
print "myscript" | thepian/thepian-pages | test/web/mymodule/myscript.py | Python | agpl-3.0 | 17 |
def foo(x):
pass
x = 42
y = 42
z = 42
foo(x, y, <caret>) | siosio/intellij-community | python/testData/multipleArgumentsCompletion/noExceptionIfMoreArgumentsThanParameters.py | Python | apache-2.0 | 61 |
from django.shortcuts import render
from db_storage.models import Image
from django.http import HttpResponse
from django.views.generic import View
# Create your views here.
class ImageView(View):
def get(self, request, file_name):
image = Image.objects.get(file_name=file_name)
return HttpResponse(i... | jskopek/frame | db_storage/views.py | Python | mit | 360 |
"""
Test displayed value of a vector variable while doing watchpoint operations
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestValueOfVectorVariableTestCase(TestB... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py | Python | bsd-3-clause | 1,625 |
#import factorial
#import square
x = int(raw_input("What is 'x'?\n"))
y = int(raw_input("What is y?\n"))
# question0 = str(raw_input("Define a y value? (y/n)\n"))
# if (question0 == "y","Y","yes","Yes"):
# y = int(raw_input("What will 'y' be?\n"))
# elif (y == "n","N","no","No"):
# question2 = str(raw_input("I... | chrisortman/CIS-121 | k0459866/Lessons/ex12.py | Python | mit | 2,216 |
__author__ = 'LLCoolDave'
# ToDo: Replace by proper unit tests, currently broken as it stands
import logging
from MafiaBot.MafiaBot import *
from sopel.tools import Identifier
log = logging.getLogger('MafiaBot')
log.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.F... | LLCoolDave/MafiaBot | MafiaBotTest.py | Python | mit | 5,747 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#/*
# * Copyright (с) 2011 XBMC-Russia, HD-lab Team, E-mail: dev@hd-lab.ru
# * Writer (C) 03/03/2011, Kostynoy S.A., E-mail: seppius2@gmail.com
# *
# * This Program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public Li... | sshnaidm/ru | plugin.audio.mp3tales.ru/default.py | Python | gpl-2.0 | 4,999 |
import unittest
import UniDomain.Classes as Classes
#---- unittest Test Classes below here
class TestConfig(unittest.TestCase):
"""Test Config Class"""
def test_Config(self):
"""Check if required config defaults are set"""
self.config = Classes.Config()
self.assertTrue('plugin_authen' ... | spahan/unixdmoain | lib/test/Classes.py | Python | bsd-3-clause | 1,575 |
#!/usr/bin/python
#----------------------------------------------------------------------
# For the shells csh, tcsh:
# ( setenv PYTHONPATH /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python ; ./globals.py <path> [<path> ...])
#
# For the shells sh, bash:
# PYTHONPATH=/Applications/X... | s20121035/rk3288_android5.1_repo | external/lldb/examples/python/globals.py | Python | gpl-3.0 | 4,206 |
from __future__ import print_function, division, absolute_import
import contextlib
import pickle
import warnings
import numpy as np
from sklearn.externals.joblib import load as jl_load
__all__ = ['printoptions', 'verbosedump', 'verboseload', 'dump', 'load']
warnings.warn("This module might be deprecated in favor of... | Eigenstate/msmbuilder | msmbuilder/utils/io.py | Python | lgpl-2.1 | 2,305 |
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = 'rvpsite.blog'
verbose_name = 'GERENCIAMENTO DO BLOG' | rpadilha/rvpsite | rvpsite/blog/apps.py | Python | agpl-3.0 | 133 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Generate simple languages JSON module.
LANGUAGES = {
"en": "English",
"de": "Deutsch",
"fr": "Français",
"zh-cn": "中文(简体)",
"zh-tw": "繁體中文",
"ko": "한국어",
"ja": "日本語",
"ru": "Русский",
"es": "Español",
"it": "Italiano",
}
import json
def main():
print """// This... | spreedbox-packaging/spreed-webrtc-debian | src/i18n/helpers/languages.py | Python | agpl-3.0 | 517 |
#!/usr/bin/env python
import btrsync
import cProfile
import pstats
#cProfile.run("btrsync.hash_dir()","fooprof")
#p = pstats.Stats('fooprof')
#p.sort_stats("cum")
#p.print_stats()
print btrsync.hash_dir()
| RobinMorisset/Btrsync | test_sha1.py | Python | gpl-3.0 | 208 |
# StackOverflow. Non-core, *rolls eyes*.
import sys
import tty
import termios
def getch():
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(fd)
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
| pbl64k/icfpc2015 | getch.py | Python | bsd-2-clause | 316 |
"""Library to parse Heroes of the Storm replays."""
| HoTSStuff/replaylib | replaylib/__init__.py | Python | apache-2.0 | 52 |
import time
import numpy as np
import scipy.ndimage
from desiutil.log import get_logger
from desispec.qproc.qframe import QFrame
def qproc_sky_subtraction(qframe,return_skymodel=False) :
"""
Fast sky subtraction directly applied to the input qframe.
Args:
qframe : DESI QFrame object
Opt... | desihub/desispec | py/desispec/qproc/qsky.py | Python | bsd-3-clause | 4,559 |
RECORDS_RATE_LIMIT = "15/m" # This rate was arbitrarily chosen due to a lack of data. It may need to be changed later.
class UserCreditPathwayStatus:
"""Allowed values for UserCreditPathway.status"""
SENT = "sent"
| edx/credentials | credentials/apps/records/constants.py | Python | agpl-3.0 | 227 |
"""
Bounce a ball on the screen, using gravity.
"""
import arcade
# --- Set up the constants
# Size of the screen
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
# Size of the circle.
CIRCLE_RADIUS = 20
# How strong the gravity is.
GRAVITY_CONSTANT = 0.3
# Percent of velocity maintained on a bounce.
BOUNCINESS = 0.9
def... | mikemhenry/arcade | examples/bouncing_ball.py | Python | mit | 2,607 |
"""
This class is defined to override standard pickle functionality
The goals of it follow:
-Serialize lambdas and nested functions to compiled byte code
-Deal with main module correctly
-Deal with other non-serializable objects
It does not include an unpickler, as standard python unpickling suffices.
This module wa... | TobyRoseman/SFrame | oss_src/unity/python/sframe/util/cloudpickle.py | Python | bsd-3-clause | 28,239 |
import json
import urllib
from collections import OrderedDict
from datetime import datetime
from django.conf import settings
from django.core.cache import cache
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _lazy
import commonware.log
from elasticsearch_dsl import Search
from el... | ingenioustechie/zamboni | mkt/reviewers/utils.py | Python | bsd-3-clause | 33,546 |
from bottle import template, route, run, request
from imp import load_source
from argparse import ArgumentParser
from os.path import basename, splitext
from subprocess import check_output
import os
class ScriptRender(object):
"""Render a script as an HTML page."""
def __init__(self, script):
self.script = scrip... | alixedi/recline | recline.py | Python | mit | 3,765 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... | odoousers2014/odoo-addons-supplier_price | product_supplier_price_validity/tests/__init__.py | Python | agpl-3.0 | 820 |
# vim: et:sta:bs=2:sw=4:
from mirte.core import Module
from joyce.base import JoyceChannel
from joyce.comet import CometJoyceClient
class MirrorChannelClass(JoyceChannel):
def __init__(self, server, *args, **kwargs):
super(MirrorChannelClass, self).__init__(*args, **kwargs)
self.server = server
... | bwesterb/tkbd | src/mirror.py | Python | agpl-3.0 | 2,060 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the Corba configuration page.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import pyqtSlot
from E5Gui.E5Completers import E5FileCompleter
from E5Gui import E5FileDialog
from .... | davy39/eric | Preferences/ConfigurationPages/CorbaPage.py | Python | gpl-3.0 | 1,837 |
#!/usr/bin/env python
import IPython
import sys
import numpy as np
import scipy.sparse as sp
from collections import Counter
import itertools
import time
import struct
try:
import numexpr as ne
have_numexpr = True
except ImportError:
have_numexpr = False
MAX_BIGRAM = 2**16
f = open(sys.argv[2])
ulong_siz... | KernelAnalysisPlatform/kvalgrind | scripts/nearest_bigram_js.py | Python | gpl-3.0 | 3,814 |
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
from datetime import date
# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_t... | TwilioDevEd/api-snippets | rest/notification/list-get-example-3/list-get-example-3.7.x.py | Python | mit | 655 |
#!/usr/bin/env python
import urlparse
import urllib2
import BaseHTTPServer
import unittest
import hashlib
from test import test_support
mimetools = test_support.import_module('mimetools', deprecated=True)
threading = test_support.import_module('threading')
# Loopback http server infrastructure
class LoopbackHttpSe... | ianyh/heroku-buildpack-python-opencv | vendor/.heroku/lib/python2.7/test/test_urllib2_localnet.py | Python | mit | 20,012 |
from model.group import Group
from model.contact import Contact
def test_group_list(app, db):
ui_list = app.group.get_group_list()
def clean(group):
return Group(id=group.id, name=group.name.strip())
db_list = map(clean, db.get_group_list())
assert sorted(ui_list, key=Group.id_or_max) == sorted... | goeliv/python_training | test/test_db_matches_ui.py | Python | apache-2.0 | 707 |
#!/usr/bin/env python
import sys
import os
import parser
import subprocess
if "VIRTUAL_ENV" not in os.environ:
sys.stderr.write("$VIRTUAL_ENV not found.\n\n")
parser.print_usage()
sys.exit(-1)
virtualenv = os.environ["VIRTUAL_ENV"]
file_path = os.path.dirname(__file__)
subprocess.call(["pip", "install", "-... | frog32/morgainemoviedb | bootstrap.py | Python | agpl-3.0 | 411 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-07-26 00:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recipe', '0007_auto_20170723_2046'),
('ingredient', '... | RyanNoelk/OpenEats | api/v1/ingredient/migrations/0005_auto_20170725_1950.py | Python | mit | 1,312 |
"""
:mod:`pyffi.formats.tri` --- TRI (.tri)
=======================================
A .tri file contains facial expression data, that is, morphs for dynamic
expressions such as smile, frown, and so on.
Implementation
--------------
.. autoclass:: TriFormat
:show-inheritance:
:members:
Regression tests
-------... | griest024/PokyrimTools | pyffi-develop/pyffi/formats/tri/__init__.py | Python | mit | 14,754 |
__author__ = "root"
__prog__ = ""
import sys, math
def main():
t = int(sys.stdin.readline())
for i in xrange(t):
n = sys.stdin.readline().strip()
if __name__ == "__main__":
main()
| d3vas3m/TemplateGenerator | templates/template.py | Python | gpl-2.0 | 204 |
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS 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; either version 2 of the
## License, or (... | pombredanne/invenio-old | modules/webstat/lib/webstat_webinterface.py | Python | gpl-2.0 | 13,467 |
# Copyright (c) 2011, Yeiniel Suarez Sosa.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condi... | yeiniel/aurora | aurora/webcomponents/views.py | Python | bsd-3-clause | 4,110 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# ... | Endika/bank-statement-import | account_bank_statement_import_camt/__openerp__.py | Python | agpl-3.0 | 1,334 |
#! /usr/bin/python
# -*- python -*-
import avro.io
import avro.datafile
import sys
import glob
try:
import json
except ImportError:
import simplejson as json
for f in sys.argv[1:]:
for d in avro.datafile.DataFileReader(file(f), avro.io.DatumReader()):
print json.dumps(d)
| tomslabs/avro-utils | src/main/scripts/dumpAvroFile.py | Python | apache-2.0 | 294 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Copyright 2011 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 requir... | mahadi123/hello-world | lib/google_login2.py | Python | apache-2.0 | 9,643 |
from flask import Flask, request, jsonify, abort
import os
import requests
app = Flask(__name__)
app.debug = os.getenv('DEBUG', '') == 'True'
def access_token():
return os.getenv('ACCESS_TOKEN', '')
def check_user_id(user_id):
if user_id not in os.getenv('USER_IDS', ''):
return abort(403)
def check_user_nam... | cyrilkyburz/bhwi_proxy | bhwi_proxy.py | Python | mit | 1,516 |
"""Known metrics decoder"""
import logging
logger = logging.getLogger(__name__)
class MetricsDecoder(object):
def __init__(self):
"""
translates telegraf metric names into common Monitoring metric names
translates `uncommon` names to `custom:%s`s
"""
self.known_metrics =... | nnugumanov/yandex-tank | yandextank/plugins/Telegraf/decoder.py | Python | lgpl-2.1 | 2,675 |
# [h] copy glyphs to mask
import hTools2.dialogs.glyphs.mask
reload(hTools2.dialogs.glyphs.mask)
hTools2.dialogs.glyphs.mask.maskDialog()
| gferreira/hTools2_extension | hTools2.roboFontExt/lib/Scripts/selected glyphs/layers/mask.py | Python | bsd-3-clause | 140 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/main/mixins/cloneable.py | Python | gpl-3.0 | 692 |
from fabric.context_managers import settings, hide
from fabric.operations import run
import paramiko
# machine absraction
class Machine(object):
def __init__(self, node):
self.node = node
self.public_ip = node.ip
self.ssh_port = node.ssh_port
self.splunk_username = node.splunk_user... | markshao/paladin | orchestration/machine.py | Python | mit | 1,297 |
"""Inference/predict code for simple_sequence dataset
model must be trained before inference,
train_simple_sequence.py must be executed beforehand.
"""
from __future__ import print_function
import argparse
import os
import sys
import matplotlib
import numpy as np
matplotlib.use('Agg')
import matplotlib.pyplot as p... | corochann/deep-learning-tutorial-with-chainer | src/05_ptb_rnn/ptb/predict_ptb.py | Python | mit | 3,356 |
from matplotlib import pyplot as plt
import numpy as np
def stock_loss(true_return, yhat, alpha=100.):
if true_return * yhat < 0:
# opposite signs, not good
return alpha * yhat ** 2 - np.sign(true_return) * yhat \
+ abs(true_return)
else:
return abs(true_return - yhat)
de... | noelevans/sandpit | bayesian_methods_for_hackers/stock_loss_function_example_ch05.py | Python | mit | 1,024 |
def extractCandleinthetombWordpressCom(item):
'''
Parser for 'candleinthetomb.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractCandleinthetombWordpressCom.py | Python | bsd-3-clause | 570 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | levenlabs/ansible | lib/ansible/playbook/helpers.py | Python | gpl-3.0 | 12,947 |
#!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
from __future__ import absolute_import
import unittest
from svtplay_dl.service.oppetarkiv import OppetArkiv
from svtplay_dl.se... | olof/svtplay-dl | lib/svtplay_dl/service/tests/oppetarkiv.py | Python | mit | 591 |
from lxml.builder import E
class ErrorValueCalculator(object):
element_name='ErrorValueCalculator'
def to_xml(self):
if isinstance(self, MPIErrorValueCalculator):
type_xml = E(self.element_name + 'Type', 'MPI')
elif isinstance(self, RMSErrorValueCalculator):
type_... | wvangeit/NeuroFitter | python/libneurofitterml/error_value_calculator.py | Python | gpl-2.0 | 8,632 |
from .intensity_family import IntensityFamily
from . import viboud_chowell
from .viboud_chowell import ViboudChowellFamily
from . import gaussian
from .gaussian import GaussianFamily
from . import soft_laplace
from .soft_laplace import SoftLaplaceFamily
from .high_level import *
from . import constants
from . import ... | HopkinsIDD/EpiForecastStatMech | epi_forecast_stat_mech/__init__.py | Python | apache-2.0 | 375 |
"""
Return list of messages given a datetime (empty is now) : [ (title, message), ]
Load, unload and reload messages give their name
"""
import yaml
import glob
import os.path
from datetime import datetime
from collections import OrderedDict
from messageApp.messages import Messages
class MessageApp():
def __init__(se... | arnaudcordier/estcequecestbientot | messageApp/messageApp.py | Python | mit | 2,610 |
#coding=utf-8
from uliweb import expose, functions
@expose('/admin/models')
class AdminModelsView(object):
def __begin__(self):
functions.require_login()
def __init__(self):
from uliweb import settings
self.models = []
for k in settings.ADMIN_MODELS.models:
... | uliwebext/uliweb-peafowl | uliweb_peafowl/admin_models/views_models.py | Python | bsd-2-clause | 5,641 |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# File: parser.py
#
# By Maxime Brodat <maxime.brodat@fouss.fr>
#
# Created: 17/04/2016 by Fouss
"""Parser for the transshipment solver project"""
from ag41_transshipment.solver import get_platform_list
import networkx as nx
import math
class Parser(object):
"""Parser ... | MrFouss/Ubiquitous-Shipping | ag41_transshipment/parser.py | Python | gpl-3.0 | 5,074 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.