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 |
|---|---|---|---|---|---|
def main(request, response):
_URL = request.url
_CSP = "default-src " + \
_URL[:_URL.index('/csp') + 1] + \
" http://www.tizen.com; style-src 'unsafe-inline'"
_CSSURL = _URL[:_URL.index('/csp') + 1] + "csp/support/w3c/CanvasTest.ttf"
print _CSSURL
response.headers.set("Content-Secur... | kaixinjxq/web-testing-service | wts/tests/csp/csp_default-src_cross-origin_multi_font_allowed_one-manual.py | Python | bsd-3-clause | 2,633 |
# -*- coding: utf-8 -*-
'''
https://geekytheory.com/tutorial-raspberry-pi-gpio-parte-1-control-de-un-led/
https://geekytheory.com/tutorial-raspberry-pi-gpio-parte-2-control-de-leds-con-python/
INSTALAR LIBRERIA GPIO:
sudo apt-get install python-dev python-rpì.gpio
En el terminal/consola linux, escribir:
'''
import ti... | chemabc/raspPi_IED_example | simpleGpioLed.py | Python | gpl-2.0 | 810 |
#!/usr/bin/env python
# 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) any later version.
#
# Ansible is distr... | Slezhuk/ansible | contrib/inventory/vbox.py | Python | gpl-3.0 | 3,284 |
from __future__ import absolute_import
__all__ = ("User",)
from sentry.interfaces.base import Interface
from sentry.utils.json import prune_empty_keys
from sentry.interfaces.geo import Geo
from sentry.web.helpers import render_to_string
class User(Interface):
"""
An interface which describes the authentica... | mvaled/sentry | src/sentry/interfaces/user.py | Python | bsd-3-clause | 2,732 |
def eyeslooking(data):
for y in range(0, 5):
if (data == "can i have your attention"):
i01.mouth.speak("ok you have my attention")
stopit()
if (data == "inmoov"):
stopit()
x = (random.randint(1, 6))
if x == 1:
i01.head.eyeX.moveTo(80)
... | MyRobotLab/pyrobotlab | home/hairygael/GESTURES/eyeslooking.py | Python | apache-2.0 | 579 |
import os
import smtplib
from email.mime.text import MIMEText
DEFAULT_SUBJECT_PREFIX = "[SEND] "
def send(fname, conf):
contents = open(fname).read()
msg = MIMEText(contents)
msg['Subject'] = DEFAULT_SUBJECT_PREFIX + os.path.basename(fname) + "..."
msg['From'] = conf['from']
msg['To'] = conf['to']... | buckhx/send | send/agent/semail.py | Python | apache-2.0 | 658 |
import sys
import time
import numpy as np
def get_minibatches(data, minibatch_size, shuffle=True):
"""
Iterates through the provided data one minibatch at at time. You can use this function to
iterate through data in minibatches as follows:
for inputs_minibatch in get_minibatches(inputs, minibatc... | AppleFairy/CS224n-Natural-Language-Processing-with-Deep-Learning | assignment/assignment2/utils/general_utils.py | Python | mit | 6,295 |
"""
boxhandle
"""
from __future__ import absolute_import, division, print_function
import logging
from PySide import QtCore
import numpy
from mcedit2.rendering.scenegraph import scenenode
from mcedit2.rendering.selection import SelectionBoxNode, SelectionFaceNode, boxFaceUnderCursor
from mceditlib import faces
fr... | vorburger/mcedit2 | src/mcedit2/handles/boxhandle.py | Python | bsd-3-clause | 6,320 |
import rospy
class Config:
DEFAULT_RESOLUTION = 4000.0
DEFAULT_COUNTS_RPM = 542.29383
DEFAULT_COUNTS_REVS = 16.15444
DEFAULT_COUNTS_SEC = 4069.0
DEFAULT_GEAR_RATIO = 26.25
DEFAULT_WHEEL_DIAMETER = 0.305
DEFAULT_ROBOT_WIDTH = 0.53
DEFAULT_NB_MOTORS = 2
DEFAULT_MAX_SPEED = 3.0
D... | clubcapra/Ibex | src/roboteq_motor/scripts/includes/config.py | Python | gpl-3.0 | 6,953 |
# -*- coding: utf-8 -*-
"""
Tests parsers ability to read and parse non-local files
and hence require a network connection to be read.
"""
import logging
import pytest
import numpy as np
import pandas.util.testing as tm
import pandas.util._test_decorators as td
from pandas import DataFrame
from pandas.io.parsers imp... | louispotok/pandas | pandas/tests/io/parser/test_network.py | Python | bsd-3-clause | 7,972 |
#!/usr/local/bin/python
import sys
import socket
class MsgSender(object):
def __init__(self,port=9999,remoteip=''):
self.port=port
self.remoteip=remoteip
def send(self,strinfo):
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
try:
sock.connect((self.remoteip,sel... | thuleqaid/boost_study | syslogd/install/udp_test.py | Python | mit | 643 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | lib/spack/spack/package.py | Python | lgpl-2.1 | 80,322 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | huiyiqun/check_mk | doc/treasures/Event_Console/snmptd_mkevent.py | Python | gpl-2.0 | 2,674 |
#!/usr/bin/env python
import yaml
import pwd
import sys
import subprocess
import json
import os
__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "anoopalias01@gmail.com"
installation_path = "/opt/nDeploy" # Absolute Installation Path
if __name__ == "__main_... | AnoopAlias/XtendWeb | scripts/hhvm_ghost_hunter.py | Python | gpl-3.0 | 3,290 |
import psqlgraph
from psqlgraph import Node, Edge, create_all, ext
from gdcdatamodel import models
def truncate(engine, namespace=None):
"""
Remove data from existing tables
"""
abstract_node = psqlgraph.Node
abstract_edge = psqlgraph.Edge
if namespace:
abstract_node = ext.get_abstrac... | NCI-GDC/gdcdatamodel | test/helpers.py | Python | apache-2.0 | 1,910 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# 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 Li... | archf/ansible | lib/ansible/modules/network/vyos/vyos_interface.py | Python | gpl-3.0 | 13,569 |
#!/usr/bin/python
# 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) any later version.
#
# Ansible is distributed... | Inspq/ansible | lib/ansible/modules/cloud/amazon/ecs_service_facts.py | Python | gpl-3.0 | 9,122 |
from corehq.apps.sms.api import send_sms_to_verified_number
from corehq.util.translation import localize
from django.utils.translation import ugettext as _
class KeywordHandler(object):
def __init__(self, user, domain, args, verified_contact, msg):
self.user = user
self.domain = domain
se... | puttarajubr/commcare-hq | custom/ilsgateway/tanzania/handlers/keyword.py | Python | bsd-3-clause | 786 |
#!/usr/bin/env python
#------------------------------------------------------------------------------
# Copyright 2015 Esri
# 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.apac... | Esri/ops-server-config | Publish/Server/RepairMosaicDatasets.py | Python | apache-2.0 | 5,979 |
#!/usr/bin/env python
from .error import FLVError
from .compat import is_py2
from .tag import Header, Tag
class FLV(object):
def __init__(self, fd=None, strict=False):
self.fd = fd
self.header = Header.deserialize(self.fd)
self.strict = strict
def __iter__(self):
return self
... | back-to/streamlink | src/streamlink/packages/flashmedia/flv.py | Python | bsd-2-clause | 569 |
# 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 (t... | apache/incubator-allura | Allura/allura/scripts/update_checkout_url.py | Python | apache-2.0 | 2,016 |
#!/usr/bin/env python
import unittest
import sys
from test_backends import get_suite as get_backend_suite
from test_gpx import get_suite as get_gpx_suite
def all_tests():
# Test if BeautifulSoup is installed, since the microformat
# parser relies on it.
try:
from BeautifulSoup import BeautifulSoup
... | rimbalinux/LMD3 | geopy/tests/run_tests.py | Python | bsd-3-clause | 747 |
__author__ = 'Richard Lincoln, r.w.lincoln@gmail.com'
""" This example demonstrates how to compute Nash equilibria. """
import numpy
from scipy.io import mmwrite
from pyreto import SmartMarket, DISCRIMINATIVE
from pyreto.discrete import MarketEnvironment, ProfitTask
from common import setup_logging, get_case6ww
s... | rwl/pylon | examples/pyreto/thesis/nash.py | Python | apache-2.0 | 2,816 |
import re
from selenium import webdriver
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time
import os
import urllib.request
from urllib.request import FancyURLopener
from bs4 import BeautifulSoup
import argparse
parser = argpa... | n0x5/scripts | _test_generic_img_scraper.py | Python | gpl-2.0 | 1,417 |
from datetime import datetime, timedelta, tzinfo
import unittest
import pytz
import re
#noinspection PyUnresolvedReferences
from nose.tools import assert_equal, assert_raises # you need it for tests in form of continuations
import six
from flask_restful import inputs
def test_reverse_rfc822_datetime():
dates =... | flask-restful/flask-restful | tests/test_inputs.py | Python | bsd-3-clause | 12,433 |
# -*- coding: utf-8 -*-
'''
Test template inheritance
'''
# Pyhaa - Templating system for Python 3
# Copyright (c) 2011 Tomasz Kowalczyk
# Contact e-mail: code@fluxid.pl
#
# This library is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published ... | fluxid/pyhaa | tests/test_inheritance.py | Python | lgpl-3.0 | 2,425 |
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from menpo.transform.piecewiseaffine import PiecewiseAffineTransform, \
DiscreteAffinePWATransform
from menpo.shape import PointCloud, TriMesh
src_points = np.array([[0, 0], [1, 0], [0, 1], [1, 1]])
tgt_points = np.array([[0, 0], [2, 0], [0... | karla3jo/menpo-old | menpo/transform/test/piecewiseaffine_test.py | Python | bsd-3-clause | 853 |
import collections
import copy
import random
import numpy as np
class SequenceData(object):
"""
Represents a data set of sequences of words with labels
The sequences can be partially labeled
The data be loaded from a text file or a list
"""
def __init__(self, given_data, pos_tag):
# ... | NER-master-thesis/baseline | SequenceData_minitagger.py | Python | gpl-3.0 | 13,261 |
input = """
a(X,Y) :- c(X,R,S), d(S,T,Y), not na(X,Y).
na(X,Y) :- c(X,R,S), d(S,T,Y), not a(X,Y).
c(z,r,a).
c(z,s,a).
d(a,r,y).
d(a,s,y).
"""
output = """
a(X,Y) :- c(X,R,S), d(S,T,Y), not na(X,Y).
na(X,Y) :- c(X,R,S), d(S,T,Y), not a(X,Y).
c(z,r,a).
c(z,s,a).
d(a,r,y).
d(a,s,y).
"""
| veltri/DLV2 | tests/parser/rewriting.projection.10.test.py | Python | apache-2.0 | 313 |
# Jacqueline Kory Westlund
# July 2016
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Personal Robots Group
#
# 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 ... | personal-robots/sar_social_stories | src/ss_db_manager.py | Python | mit | 23,004 |
#!/usr/bin/python
# -*- 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 3 of the License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f44.py | Python | mit | 3,313 |
# -*- coding: utf-8 -*-
__author__ = 'rcj1492'
__created__ = '2016.03'
'''
when module is called directly as script.
'''
from .cli import cli
cli()
| collectiveacuity/pocketLab | pocketlab/__main__.py | Python | mit | 160 |
from django.conf.urls import url
from yell import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^testing/$', views.testing, name='testing'),
url(r'^results/$', views.restaurants, name='restaurants'),
url(r'^api/... | andrewjton/SHOUT | app/shout/yell/urls.py | Python | mit | 435 |
'''Tests for helpers_views'''
from mysite import settings
from mysite.helpers.db_access import DBAccess
from mysite.helpers import testhelpers as th
from heatmap.helpers.table_view import (TableForm, QueryForm)
from heatmap.helpers import test_helpers_views as thv
from django.test import TestCase # Provides mocks for... | ScienceStacks/JViz | mysite/heatmap/helpers/test_table_view.py | Python | apache-2.0 | 2,324 |
#########################################################################################
#
# Copyright (C) 2011-2013 Ravi Malik
#
# 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 versi... | ravimalik20/OpenPyCalc | calc.py | Python | gpl-2.0 | 5,067 |
# coding: utf-8
from __future__ import unicode_literals
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.extractor import (
gen_extractors,
)
class TestNetRc(unittest.TestCase):
def test_netrc_present(self):
for ie ... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/test/test_netrc.py | Python | unlicense | 635 |
# Copyright (c) 2017 Huawei Technologies Co., Ltd.
# 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
#
# ... | bswartz/manila | manila/policies/__init__.py | Python | apache-2.0 | 2,834 |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
from __future__ import unicode_literals
import functools
import re
im... | ytjiang/django | django/core/urlresolvers.py | Python | bsd-3-clause | 25,815 |
# Copyright 2017 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... | Xeralux/tensorflow | tensorflow/contrib/bayesflow/python/kernel_tests/hmc_test.py | Python | apache-2.0 | 29,032 |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... | USGSDenverPychron/pychron | pychron/pyscripts/commands/bakeout.py | Python | apache-2.0 | 2,952 |
class BankAccount:
def __init__(self,initial_balance):
self._balance = initial_balance
self._fees = 0
def deposit(self,amount):
self._balance += amount
def withdraw(self,amount):
if self._balance < amount:
self._balance -= 5.00
self._fees += 5.00
... | mr-ice/pipython | InteractiveProgramming/quiz6a-7.py | Python | mit | 1,531 |
from ecl.test import ExtendedTestCase
from tests.gui.ertshell.ert_shell_test_context import ErtShellTestContext
class ErtShellPlotSettingsTest(ExtendedTestCase):
def checkStringProperties(self, shell, command, testFunction, allow_multiple_arguments=True):
self.assertTrue(shell.invokeCommand(command))
... | pgdr/ert | python/tests/gui/ertshell/test_ertshell_plot_settings.py | Python | gpl-3.0 | 3,284 |
import time
def main(request, response):
head = b"""<script>
let navigationTiming = performance.getEntriesByType('navigation')[0];
let originalResponseEnd = navigationTiming.responseEnd;
let originalDuration = navigationTiming.duration;
function checkResponseEnd() {
let responseEndDuringLo... | chromium/chromium | third_party/blink/web_tests/external/wpt/navigation-timing/resources/respond_slowly.py | Python | bsd-3-clause | 1,119 |
from time import sleep
import codecs
Runtime.createAndStart("chatBot", "ProgramAB") # On lance la gestion des chatBots
sleep (1)
chatBot.startSession( "default", "wikiAuto") # On demarre une session chatbot wikiAuto avec utilisateur par defaut
wdf = Runtime.createAndStart("wikiDataFetcher", "WikiDataFetcher") # WikiDat... | MyRobotLab/pyrobotlab | home/beetlejuice/wikiauto.py | Python | apache-2.0 | 2,281 |
# -*- coding: utf-8 -*-
'''
filename:rtcp.py
@desc:
利用python的socket端口转发,用于远程维护
如果连接不到远程,会sleep 36s,最多尝试200(即两小时)
@usage:
./rtcp.py stream1 stream2
stream为:l:port或c:host:port
l:port表示监听指定的本地端口
c:host:port表示监听远程指定的端口
@author: watercloud, zd, hysia
@date: 2009-7
使用场景:
一:
A服务器在内网,公网无法直接访问这台服务器,但是A服务器可以联网访问公网的B服务器(假设IP为... | hysia/awsome-collections | python/rtcp.py | Python | cc0-1.0 | 4,783 |
"""Test case implementation"""
import collections
import sys
import functools
import difflib
import pprint
import re
import warnings
from . import result
from .util import (
strclass, safe_repr, unorderable_list_difference,
_count_diff_all_purpose, _count_diff_hashable
)
__unittest = True
DIFF_OMITTED = (... | microdee/IronHydra | src/IronHydra/Lib/unittest/case.py | Python | mit | 42,078 |
import os
import json
import pandas as pd
from common_methods.time_format_conversions import convert_video_time_string_to_seconds
from experiment_handler.time_synchronisation import convert_timestamps
def read_experiment_phases(experiment_path):
"""
Reads CSV file with phases of the experiment given in the ma... | phev8/dataset_tools | experiment_handler/label_data_reader.py | Python | mit | 5,798 |
#! /usr/bin/env python
"""Installation script for bzr.
Run it with
'./setup.py install', or
'./setup.py --help' for more options
"""
import os
import os.path
import sys
import copy
import glob
if sys.version_info < (2, 6):
sys.stderr.write("[ERROR] Not a supported Python version. Need 2.6+\n")
sys.exit(1)
... | stewartsmith/bzr | setup.py | Python | gpl-2.0 | 30,298 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
def execute(filters=None):
columns, data = [], []
data = frappe.db.sql(""" select
si.name AS sales_invoice,
... | rohitwaghchaure/New_Theme_Erp | erpnext/accounts/report/booked_orders/booked_orders.py | Python | agpl-3.0 | 1,624 |
from django.db import models
# Create your models here.
class HostUserApplication(models.Model):
ip_address = models.GenericIPAddressField()
date = models.DateTimeField(auto_now_add=True)
username = models.CharField(max_length=50)
jira = models.CharField(max_length=50)
| colinleefish/theotherbarn | jira/models.py | Python | mit | 289 |
from flask import Response
from flask.views import View
from urllib2 import urlopen
from gpv import utils
class CompanyDirectory(View):
def dispatch_request(self, kompania):
api_base_url = utils.get_api_url()
url = "%s/kompania/%s" % (api_base_url, kompania)
result = urlopen(url).read()
... | opendatakosovo/municipality-procurement-visualizer | gpv/views/json/company_dir_json.py | Python | gpl-2.0 | 450 |
#just an empty module, that is used for determining path | DeepSOIC/Lattice | latticeDummy.py | Python | lgpl-2.1 | 56 |
"""
Django settings for maas_reservation_system project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings... | greenstatic/maas-reservation-system | maas_reservation_system/maas_reservation_system/settings.py | Python | mit | 7,606 |
#
# 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 | airflow/utils/log/cloudwatch_task_handler.py | Python | apache-2.0 | 1,177 |
"""Tools to convert a SAM file to and from a Postgresql database. Mostly to
demonstrate how sam.Alignment inheritance works
"""
from srtools import Alignment
from srtools.sam import Read
import postgresql
class PostgresAlignment(Alignment):
"""An illumina alignment using data stored as a postgres database. The d... | ahammel/srtools | srtools/postgres.py | Python | bsd-3-clause | 3,529 |
from woodcut.project import Project
from optparse import OptionParser
import pkg_resources
version = pkg_resources.require("woodcut")[0].version
import logging
FORMAT = '%(relativeCreated)8.2fms %(message)s'
logging.basicConfig(level=logging.DEBUG, format=FORMAT)
def main():
usage = "usage: %prog [options] com... | lukecyca/woodcut | woodcut/__init__.py | Python | mit | 1,276 |
import unittest
from smallibs.genlex.matchers import *
from smallibs.genlex.stream import *
from smallibs.genlex.lexer import *
class TestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_should_have_an_int(self):
stream = Stream("123 soleil")
... | d-plaindoux/suitcase.py | src/test/python/suites/smallibs/genlex/lexers.py | Python | lgpl-2.1 | 1,690 |
import file_io as io
authors = ['paul', 'peter']
def set_dir(author):
if author == 'paul':
infolder = "../../data/output/paul_freq_par"
outfolder = "../../data/output/paul_R_par/"
infiles = io.get_infiles(infolder)
if author == 'peter':
infolder = "../../data/output/peter_freq... | klingtnet/dh-project-ws14 | src/absolute_freq/generate_letter_batch.py | Python | mit | 929 |
from . import nvpy
nvpy.main()
| n8henrie/nvpy | nvpy/__main__.py | Python | bsd-3-clause | 32 |
import pygame
import random
pygame.display.set_caption("Multi Bingo")
screen = pygame.display.set_mode((0,0))
screen.fill([0,0,0])
pygame.mouse.set_visible(False)
meter = pygame.image.load('graphics/assets/register_cover.png').convert()
magic_screen = pygame.image.load('circus_queen/assets/magic_screen.png').convert... | bingopodcast/bingos | bingo_emulator/graphics/circus_queen.py | Python | gpl-3.0 | 41,963 |
from flask import Blueprint, session, jsonify
from lexos.helpers import constants as constants
from lexos.managers import session_manager as session_manager
from lexos.models.similarity_query_model import SimilarityModel
from lexos.views.base import render
similarity_query_blueprint = Blueprint("similarity-query", __n... | WheatonCS/Lexos | lexos/views/similarity_query.py | Python | mit | 1,236 |
#!/usr/bin/env python3
__author__ = 'fki'
from distutils.core import setup
setup(name='Policy Compass Services',
version='0.1',
description='Policy Compass Services',
author='Fabian Kirstein',
author_email='fabian.kirstein@fokus.fraunhofer.de',
url='https://github.com/policycompass/poli... | almey/policycompass-services | setup.py | Python | agpl-3.0 | 362 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# This file is part of solus-sc
#
# Copyright © 2013-2018 Ikey Doherty <ikey@solus-project.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... | solus-project/evolve-sc | solus_sc/details.py | Python | gpl-2.0 | 25,457 |
# Copyright 2015 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... | frreiss/tensorflow-fred | tensorflow/python/ops/nn_ops.py | Python | apache-2.0 | 252,704 |
import sys
from passerine.db.entity import entity
from passerine.db.manager import ManagerFactory
@entity
class Player(object):
def __init__(self, name, level, team=None):
self.name = name
self.level = level
self.team = None
def __repr__(self):
attrs = {
'name': ... | shiroyuki/passerine | experimental.py | Python | mit | 3,020 |
import operator
from functools import reduce
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django... | swappsco/django-qa | qa/views.py | Python | mit | 17,264 |
# based on http://protips.readthedocs.io/link-roles.html
from __future__ import print_function
from __future__ import unicode_literals
import re
import os
from docutils import nodes
from local_util import run_cmd_get_output
def get_github_rev():
path = run_cmd_get_output('git rev-parse --short HEAD')
tag = r... | krzychb/rtd-test-bed | docs/link-roles.py | Python | apache-2.0 | 2,958 |
# coding: utf-8
'''
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 1 ** 4 + 6 ** 4 + 3 ** 4 + 4 ** 4
8208 = 8 ** 4 + 2 ** 4 + 0 ** 4 + 8 ** 4
9474 = 9 ** 4 + 4 ** 4 + 7 ** 4 + 4 ** 4
As 1 = 1 ** 4 is not a sum it is not included.
The sum of these nu... | adrienbrunet/EulerProject | problem_030.py | Python | gpl-2.0 | 863 |
import itertools
def replace69(l):
for (i,item) in enumerate(l):
if item in [6,9]: l[i] = -1
return l
sqrs = []
for i in xrange(1,10):
sqr = [(i*i)/10, (i*i)%10]
sqrs.append(replace69(sqr))
combos = []
for c in itertools.combinations(xrange(10),6):
combos.append(replace69(list(c)))
... | shashankp/projecteuler | 90.py | Python | mit | 668 |
from ..core.shared_functions import test_kwarg
def evaluate_reaction_pvalues(the_network, expression_dict, **kwargs):
""" pvalues for gene changes are combined
to get reaction level changes
this function inspired by penalty evaluation in gim3e:
Schmidt, B. J., Ebrahim, A., Metz, T. O., Adkins, J. N., ... | hostviralnetworks/nampy | nampy/multipartiteanalysis/reporterfeatures.py | Python | gpl-3.0 | 22,510 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.heat_recovery import HeatExchangerAirToAirFlatPlate
log = logging.getLogger(__name__)
class TestHeatExchangerAirToAirFlatPlate(unittest.TestCase):
def setUp(self):
... | rbuffat/pyidf | tests/test_heatexchangerairtoairflatplate.py | Python | apache-2.0 | 5,009 |
"""Config flow to configure the Netgear integration."""
from urllib.parse import urlparse
from pynetgear import DEFAULT_HOST, DEFAULT_PORT, DEFAULT_USER
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import ssdp
from homeassistant.const import (
CONF_HOST,
CONF... | Danielhiversen/home-assistant | homeassistant/components/netgear/config_flow.py | Python | apache-2.0 | 6,113 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL8236520494.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL8236520494 | MODEL8236520494/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/env python
# $Id: throttled_ftpd.py 1174 2013-02-19 11:25:49Z g.rodola $
# pyftpdlib is released under the MIT license, reproduced below:
# ======================================================================
# Copyright (C) 2007-2013 Giampaolo Rodola' <g.rodola@gmail.com>
#
# A... | mollstam/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/pyftpdlib-1.3.0/demo/throttled_ftpd.py | Python | mit | 2,369 |
from tests import BaseTestCase
from mock import MagicMock, ANY
import redash.tasks.alerts
from redash.tasks.alerts import (
check_alerts_for_query,
notify_subscriptions,
should_notify,
)
from redash.models import Alert
class TestCheckAlertsForQuery(BaseTestCase):
def test_notifies_subscribers_when_sh... | getredash/redash | tests/tasks/test_alerts.py | Python | bsd-2-clause | 1,844 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from .data_l... | vied12/superdesk | server/apps/common/models/io/base_proxy.py | Python | agpl-3.0 | 1,976 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
INSTALLED_HANDLERS = None
EXCLUDED_HANDLERS = ['what']
| dimagi/rapidsms-contrib-apps-dev | handlers/settings.py | Python | bsd-3-clause | 107 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 vers... | markovmodel/PyEMMA | pyemma/util/numeric.py | Python | lgpl-3.0 | 1,772 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$'... | kinkerl/eukalypse_now | src/eukalypse_now/urls.py | Python | bsd-3-clause | 1,348 |
import sys
from json import loads as JSONLoad;
def GeoCode(address):
from urllib2 import urlopen as UrlOpen;
from urllib import quote as Quote;
###
# Encode query string into URL
###
url = 'https://maps.googleapis.com/maps/api/geocode/json?address={}&sensor=false&key=********'.format(Quote(addr... | SummerZheng/iRun_YN | app/static/py/GeoCode.py | Python | mit | 1,176 |
# Copyright (c) Jeroen Van Steirteghem
# See LICENSE
from twisted.conch.ssh import channel, connection, forwarding, keys, transport, userauth
from twisted.internet import defer, interfaces, protocol
from zope.interface import implements
import twunnel.logger
import twunnel.proxy_server
class SSHChannel(channel.SSHCha... | jvansteirteghem/twunnel | twunnel/local_proxy_server__ssh.py | Python | mit | 10,221 |
default_app_config = 'example.apps.ExampleConfig'
| philippbosch/django-geoposition | example/__init__.py | Python | mit | 50 |
# -*- coding: utf-8 -*-
import uuid
from .model import Node, PrivateLink
from framework.mongo.utils import from_mongo
from modularodm import Q
from modularodm.exceptions import ValidationValueError
from website.exceptions import NodeStateError
from website.util.sanitize import strip_html
def show_diff(seqm):
"""U... | brandonPurvis/osf.io | website/project/__init__.py | Python | apache-2.0 | 4,026 |
from django.db.models.query import QuerySet
from django.db.models.sql.constants import ORDER_PATTERN
from sqlalchemy.orm import attributes
from sqlalchemy.orm.query import _ColumnEntity
from sqlalchemy.sql import operators
from django_sqlalchemy.models import query_utils as utils
from django.db.models.query_utils im... | brosner/django-sqlalchemy | django_sqlalchemy/models/query.py | Python | bsd-3-clause | 14,796 |
from datetime import datetime, timedelta
from discord.ext import commands
from .utils import utils
import traceback
import asyncio
import discord
import pytz
loop_list = {}
class Remind(commands.Cog): #This is to remind user about task they set.
def __init__(self,bot):
self.bot = bot
self.redis = ... | Maverun/Nurevam | Bot/cogs/remind.py | Python | mit | 14,685 |
# $Id: 200_codec_speex_8000.py 2063 2008-06-26 18:52:16Z nanang $
#
from inc_cfg import *
ADD_PARAM = ""
if (HAS_SND_DEV == 0):
ADD_PARAM += "--null-audio"
# Call with Speex/8000 codec
test_param = TestParam(
"PESQ codec Speex NB",
[
InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec speex/8000 --c... | kaaustubh/pjsip | tests/pjsua/scripts-pesq/200_codec_speex_8000.py | Python | gpl-2.0 | 537 |
# -*- coding: utf-8 -*-
from django.db import models
from smart_selects.db_fields import ChainedForeignKey, ChainedManyToManyField, GroupedForeignKey
class Continent(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return "%s" % self.name
class Country(models.Model):
co... | johtso/django-smart-selects | test_app/models.py | Python | bsd-3-clause | 2,886 |
from main_mob_class import *
# beasts
# ghosts
# elements
# eidolons
# fey
class Monster(Mob):
"""Base monster class"""
def __init__(self, name, vitality, strength, agility, defense, intelligence, spirit, magic_points):
super().__init__(name, vitality, strength, agility, defense, intelligence, spi... | adam-23/solar_legacy | class/monster_classes.py | Python | gpl-3.0 | 2,460 |
# Copyright 2013 dotCloud 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 t... | rastaman/docker-py | docker/utils/utils.py | Python | apache-2.0 | 23,239 |
# Organic Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for organic solar cells.
# Copyright (C) 2012 Roderick C. I. MacKenzie
#
# roderick.mackenzie@nottingham.ac.uk
# www.opvdm.com
# Room B86 Coates, University Park, Nottingham, NG7 2RD, UK
#
# This program is free softwar... | roderickmackenzie/opvdm | gui/notice.py | Python | gpl-2.0 | 1,173 |
class ${name}:
def __init__(self,\
%for c,val in const.items():
${c}=${val}${'' if loop.last else ', '}\
%endfor
):
self.limit = ${limit}
% for c in const.keys():
self.${c} = ${c}
% endfor
def dfun(self,state_variables, *args, **kwargs):
<%
sv_csl = ", ".join(s... | the-virtual-brain/tvb-hpc | phase_plane_interactive/template.py | Python | apache-2.0 | 642 |
#!/usr/bin/env python
'''
Generate valid and invalid base58 address and private key test vectors.
Usage:
gen_base58_test_vectors.py valid 50 > ../../src/test/data/base58_keys_valid.json
gen_base58_test_vectors.py invalid 50 > ../../src/test/data/base58_keys_invalid.json
'''
# 2012 Wladimir J. van der Laan
# R... | LIMXTEC/DMDv3 | contrib/testgen/gen_base58_test_vectors.py | Python | mit | 4,344 |
# coding=utf-8
"""Radiance gendaymtx Parameters."""
from ...honeybee.radiance.parameters.gendaymtx import GendaymtxParameters
| antonszilasi/honeybeex | honeybeex/radiance/parameters/gendaymtx.py | Python | gpl-3.0 | 126 |
import logging
import datetime
from assigner.config import requires_config
from assigner.backends.gitlab import GitlabRepo
help = "Interactively initialize a new configuration"
logger = logging.getLogger(__name__)
def prompt(explanation, default=None):
prompt_string = ""
if default is not None:
pro... | redkyn/assigner | assigner/commands/init.py | Python | mit | 2,178 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_logs_api.py | Python | apache-2.0 | 964 |
import sys
import os
import time
base = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0,base)
import polyglotdb.io as pgio
from polyglotdb.io.parsers import FilenameSpeakerParser
from polyglotdb import CorpusContext
path_to_gp = r'D:\Data\GP_aligned\TH'
graph_db = {'host':'localhost',... | samihuc/PolyglotDB | examples/globalphone_loading.py | Python | mit | 1,179 |
# Wrapper for loading templates from storage of some sort (e.g. filesystem, database).
#
# This uses the TEMPLATE_LOADERS setting, which is a list of loaders to use.
# Each loader is expected to have this interface:
#
# callable(name, dirs=[])
#
# name is the template name.
# dirs is an optional list of directories ... | tjsavage/sfcsdatabase | django/template/loader.py | Python | bsd-3-clause | 8,033 |
#!/usr/bin/python3
class File():
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key]) | Hixon10/simple-rest-yandex-disk-client | src/File.py | Python | mit | 138 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_ephemeral_container.py | Python | apache-2.0 | 33,442 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import shlex
import sys
class Env(object):
... | nodakai/watchman | build/fbcode_builder/getdeps/envfuncs.py | Python | apache-2.0 | 6,250 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.