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 |
|---|---|---|---|---|---|
import time
import sys
from itertools import count
# A script for testing ep
for i in count():
print(i)
sys.stdout.flush()
time.sleep(1)
| chriswatrous/scripts | bin/output.py | Python | mit | 151 |
try:
import cPickle as pickle
except ImportError:
import pickle
class Jugador():
def __init__(self,nombre):
self.nombre = nombre
def asignarPunteo(self,punteo):
self.punteo = punteo
def asignarTiempo(self,tiempo):
s... | hugoallan9/ProgramacionMatematica222017 | persistenciaSimple.py | Python | gpl-3.0 | 1,445 |
from allauth.account.forms import LoginForm, SignupForm
class CustomLoginForm(LoginForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["login"].label = "Username or email address"
# Remove the placeholder text, which just adds noise:
for field ... | DemocracyClub/yournextrepresentative | ynr/forms.py | Python | agpl-3.0 | 663 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | abhinavsingh/proxy.py | proxy/http/proxy/plugin.py | Python | bsd-3-clause | 6,380 |
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from appcore.conf import settings
def anonymous_required(function):
"""Redirect to user profile if user is already logged-in"""
def wrapper(*args, **kwargs):
if args[0].user.is_authenticated():
url ... | dlancer/django-appcore | appcore/views/decorators.py | Python | bsd-3-clause | 478 |
'''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | teamCarel/EyeTracker | src/shared_modules/offline_surface_tracker.py | Python | lgpl-3.0 | 25,788 |
import threading
import time
from rgbmatrix import graphics
from rgbmatrix import RGBMatrix
class Display(threading.Thread):
def __init__(self, weather, dimmer):
threading.Thread.__init__(self)
self.setDaemon(True)
self._weather = weather
self._dimmer = dimmer
# Configure... | jeffkub/led-wall-clock | display.py | Python | mit | 2,233 |
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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 app... | kdart/pycopia3 | core/pycopia/stringmatch.py | Python | apache-2.0 | 4,454 |
import time
import xbmc
import xbmcaddon
import denon
from datetime import datetime
from datetime import timedelta
__PLUGIN_ID__ = "plugin.audio.denon-dra-f109-remote"
settings = xbmcaddon.Addon(id=__PLUGIN_ID__);
addon_dir = xbmc.translatePath( settings.getAddonInfo('path') )
class XBMCPlayer(xbmc.Player):
__M... | Heckie75/kodi-addon-denon-dra-f109-remote | script.service.denon-dra-f109-remote/service.py | Python | mit | 4,998 |
import numpy as np
from numpy import linalg
EPS = 0.00000000000001
def normalize_to_range(array, lo, hi):
if hi <= lo:
raise ValueError('Range must be increasing but {} >= {}.'.format(
lo, hi))
min_val = array.min()
max_val = array.max()
scale = max_val - min_val if (min_val < ma... | keunhong/toolbox | toolbox/stats.py | Python | mit | 1,774 |
"""Pretty print an XML document.
LICENCE:
Copyright (c) 2008, Fredrik Ekholdt
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,
... | cboling/SDNdbg | docs/old-stuff/pydzcvr/pydzcvr/util/xmlpp.py | Python | apache-2.0 | 5,874 |
# Generated by Django 3.1.2 on 2020-11-10 11:51
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('emailtemplates', '0005_auto_20201110_1115'),
]
operations = [
migrations.AlterField(
model_name='em... | deployed/django-emailtemplates | emailtemplates/migrations/0006_auto_20201110_1151.py | Python | mit | 689 |
##
# Copyright 2009-2018 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | bartoldeman/easybuild-easyblocks | easybuild/easyblocks/g/gamess_us.py | Python | gpl-2.0 | 15,008 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
author: Kaio Cesar
Email: tecnico.kaio@gmail.com
Exercicio da Lista I exercícios 2
Escreva um programa que leia um valor em metros e o exiba convertido em milímetros
"""
metros=float(raw_input("Entre com o valor em metros? "))
print metros,"m equival... | kaiocesar/Listasexerciciosppz | lista_1/exercicio_2.py | Python | mit | 344 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Jiayi Li'
import time, hashlib, json, urllib
import requests
from flask import current_app, request
from bson.objectid import ObjectId
from app import db
def user_to_cookie(user, max_age=86400):
'''
return cookie from an user dict
'''
... | YuiJL/myweblog | www/app/utilities.py | Python | mit | 3,455 |
"""
tests.components.light.test_mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests mqtt light.
config for RGB Version with brightness:
light:
platform: mqtt
name: "Office Light RGB"
state_topic: "office/rgb1/light/status"
command_topic: "office/rgb1/light/switch"
brightness_state_topic: "office/rgb1/brightness/s... | badele/home-assistant | tests/components/light/test_mqtt.py | Python | mit | 5,134 |
import tilepaper.config
from nose.tools import eq_, raises
import tempfile
import yaml
class testConfig(object):
"""
Test configuration loading
"""
def test_load(self):
"""
Load a config file and ensure it's a dict
"""
config = tilepaper.config.load('./example-config.... | samarudge/tilepaper | tests/testConfig.py | Python | mit | 1,199 |
#!/usr/bin/env python
#
# 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
# "... | wangsheng1001/incubator-singa | examples/cifar10/download_data.py | Python | apache-2.0 | 2,286 |
# -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import zipfile
from django.conf import settings
from django.test.utils import override_settings
import mock
import pytest
import amo
import amo.tests
from files.utils import extract_xpi, parse_xpi
from lib.crypto import packaged, tasks
from versions.com... | Joergen/olympia | lib/crypto/tests.py | Python | bsd-3-clause | 23,709 |
#!/usr/bin/env python
import atexit
import os
import pwd
import shutil
import sys
import tempfile
import urllib2
from osc import conf, core
if sys.hexversion >= 0x2050000:
from xml.etree.cElementTree import ElementTree
else:
from cElementTree import ElementTree
apiserver = 'https://api.opensuse.org'
downloa... | merproject/open-build-service | dist/obs_mirror_project.py | Python | gpl-2.0 | 4,461 |
"""Serialization of geometries for use in pyIEM.plot mapping
We use a pickled protocol=2, which is compat binary.
"""
from pandas import read_sql
from pyiem.util import get_dbconnstr
PATH = "../src/pyiem/data/ramps/"
# Be annoying
print("Be sure to run this against Mesonet database and not laptop!")
def do(ramp):
... | akrherz/pyIEM | util/make_ramps.py | Python | mit | 848 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module define a WulffShape class to generate the Wulff shape from
a lattice, a list of indices and their corresponding surface energies,
and the total area and volume of the wulff shape,the weighted su... | dongsenfo/pymatgen | pymatgen/analysis/wulff.py | Python | mit | 22,528 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Alert',
fields=[
... | pentestfail/CAPCollector | core/migrations/0002_alert_areatemplate_messagetemplate.py | Python | bsd-3-clause | 2,548 |
#################################################################################
# The MIT License (MIT) #
# #
# Copyright (c) 2014 Intel Corporation ... | 01org/workflow-profiler | workflow_stats_parser/workflow_dictionaries.py | Python | mit | 2,946 |
"""
module:: data_mapper
:synopsis: Exceptions raised by data mapper.
moduleauthor:: Bernhard Hari <github@taschenwerkstatt.ch>
"""
class DataMapperError(Exception):
"""Error handling for data mappers.
"""
def __init__(self, message):
"""Data mapper error exception.
:... | lo100/MyRaspiHome | framework/data_mapper/exceptions.py | Python | mit | 481 |
# 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-iothubprovisioningservices/azure/mgmt/iothubprovisioningservices/models/verification_code_response.py | Python | mit | 1,795 |
import sys
class AutoIndent(object):
def __init__(self, stream):
self.stream = stream
self.offset = 0
self.frame_cache = {}
def indent_level(self):
i = 0
base = sys._getframe(2)
f = base.f_back
while f:
if id(f) in self.frame_cache:
... | ActiveState/code | recipes/Python/411791_Automatic_indentatioutput_based_frame/recipe-411791.py | Python | mit | 1,476 |
from __future__ import division, absolute_import, print_function
__all__ = ['logspace', 'linspace']
from . import numeric as _nx
from .numeric import result_type, NaN
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None):
"""
Return evenly spaced numbers over a specified interval.
... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/core/function_base.py | Python | bsd-2-clause | 6,518 |
#!/usr/bin/env python
#trapParallel_1.py
#example to run: mpiexec -n 4 python trapParallel_1.py 0.0 1.0 10000
# from http://materials.jeremybejarano.com/MPIwithPython/pointToPoint.html
import numpy
import sys
import time
from mpi4py import MPI
from mpi4py.MPI import ANY_SOURCE
start_time = time.time()
comm = MPI.COMM... | resbaz/hpc | trapezoids/trapParallel_1.py | Python | cc0-1.0 | 2,100 |
from pathlib import Path
import setuptools
import sys
py_min_version = (3, 7) # minimal supported python version
since_augur_version = (14, 0) # py_min_version is required since this augur version
if sys.version_info < py_min_version:
error = """
Beginning with augur {0}, Python {1} or above is required.
You... | nextstrain/augur | setup.py | Python | agpl-3.0 | 3,664 |
import dpkt
import socket
import logging
l = logging.getLogger("simuvex.s_pcap")
class PCAP(object):
def __init__(self,path, ip_port_tup, init=True):
self.path = path
self.packet_num = 0
self.pos = 0
self.in_streams = []
self.out_streams = []
#self.in_buf = ''
... | chubbymaggie/simuvex | simuvex/s_pcap.py | Python | bsd-2-clause | 2,173 |
#Copyright (C) 2015, Metehan Özbek
#
#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 program is distributed in the h... | mthnzbk/parcala5 | parcala5/kutuphane/hakkinda.py | Python | gpl-3.0 | 3,961 |
from commit import _get_service_file
import jsonschema
import subprocess
import fnmatch
import os
from fileio import dirio
from log import log
import glob
import tempfile
import stat
_action_schema = {
'type': 'object',
'properties': {
'commands': {
'description': 'commands to run',
... | gosquadron/squadron | squadron/service.py | Python | mit | 10,440 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2common/st2common/persistence/liveaction.py | Python | apache-2.0 | 1,501 |
##############################################################################
##############################################################################
# Example code for Newton type maximum likelihood parameter inference
# in ninlinear state space models using particle methods.
#
# Please cite:
#
# M. Kok, J. Da... | compops/newton-sysid2015 | samplingApproximation/state/smc.py | Python | gpl-3.0 | 2,926 |
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2012 The Chromium OS Authors.
#
import os.path
import gitutil
def DetectProject():
"""Autodetect the name of the current project.
This looks for signature files/directories that are unlikely to exist except
in the given project.
Returns:
T... | ev3dev/u-boot | tools/patman/project.py | Python | gpl-2.0 | 674 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (... | vponomaryov/manila | manila/db/sqlalchemy/models.py | Python | apache-2.0 | 46,473 |
import sys, os
class FastaTarget:
def __init__(self):
self.tid = ''
self.len = ''
self.offset = -1
self.blen = -1
self.llen = -1
class FastaIndex:
def __init__(self, fname=''):
self.f = open(fname, 'r')
self.ft = {}
for line in self.f.readlines(... | genome/dindel-tgi | python/utils/Fasta.py | Python | gpl-3.0 | 2,034 |
"""
GAVIP Example AVIS: Simple AVI
@req: SOW-FUN-010
@req: SOW-FUN-040
@req: SOW-FUN-046
@req: SOW-INT-001
@comp: AVI Web System
This is a simple example AVI which demonstrates usage of the GAVIP AVI framework
Here in views.py, you can define any type of functions to handle
HTTP requests. Any of these functions can... | parameterspace-ie/example-avis | samp_avi/views.py | Python | lgpl-3.0 | 2,936 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | NickDaly/GemRB-FixConfig-Branch | gemrb/GUIScripts/bg1/GUIOPT.py | Python | gpl-2.0 | 19,847 |
from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from cms.api import create_page
from cms.constants import PUBLISHER_STATE_DIRTY
from cms.models import Page
from cms.test_utils.project.extensionapp.models import MyPageExtension,... | SurfasJones/djcmsrc3 | venv/lib/python2.7/site-packages/cms/tests/extensions.py | Python | mit | 13,596 |
#!/usr/bin/env python
# Copyright 2013 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.
"""A script to find a recently-built Chrome, in the likely places.
This script is used for automated testing, don't trust it for anythi... | chromium/chromium | native_client_sdk/src/build_tools/find_chrome.py | Python | bsd-3-clause | 3,418 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
setup(
name= 'Gitopen',
version='1.2.1',
description="Open your git-remote url in your browser",
url='https://github.com/guinslym/gitopen',
author='Guinslym',
author_email='guinslym@gmail.com',
py_modules=... | guinslym/gitopen | setup.py | Python | gpl-2.0 | 1,102 |
from soap.common import base_dispatcher
from soap.semantics.functions import arith_eval, bool_eval
from soap.program.flow import CompositionalFlow, WhileFlow
class BaseState(base_dispatcher('visit')):
"""Base state for all program states."""
__slots__ = ()
@classmethod
def empty(cls):
return ... | admk/soap | soap/semantics/state/base.py | Python | mit | 2,662 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | EricSB/nupic | src/nupic/swarming/permutations_runner.py | Python | agpl-3.0 | 75,421 |
import os
import sys
import time
import requests
import numpy as np
from pprint import pprint
from datetime import datetime, timedelta
VERSION = '1.1'
URL = 'https://{subdomain}.manything.com/{request}'
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko)... | ajmendez/numerousobject | numerousobject/api.py | Python | gpl-2.0 | 15,021 |
# After 2.8
try:
from dpaste.settings.base import *
# 2.8 and before
except:
from dpaste.settings import *
import subprocess
nubis_project = subprocess.check_output('nubis-metadata NUBIS_PROJECT', shell=True).rstrip()
import imp
nubis = imp.load_source('nubis', '/etc/nubis-config/%s.sh' % (nubis_project))
DEBUG ... | tinnightcap/nubis-dpaste | nubis/files/local.py | Python | mpl-2.0 | 767 |
#!/usr/bin/python
# gridlayout2.py
import sys
from PyQt4 import QtGui
class GridLayout(QtGui.QWidget):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self)
self.setWindowTitle('Gridlayout')
title = QtGui.QLabel('Title')
author = QtGui.QLabel('Author')
review = QtG... | buddyzhangrenze/i2c | python/project/buddy/gridlayout2.py | Python | gpl-2.0 | 957 |
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
# Petr Viktorin <pviktori@redhat.com>
#
# Copyright (C) 2008-2012 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | cluck/freeipa | ipaserver/install/ipa_replica_prepare.py | Python | gpl-3.0 | 27,796 |
# Copyright 2017 Mycroft AI 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 writin... | aatchison/mycroft-core | mycroft/tts/mary_tts.py | Python | apache-2.0 | 1,968 |
from lambda_function import *
import logging
import sys
# logger setup - to include console:
# https://stackoverflow.com/questions/14058453/making-python-loggers-output-all-messages-to-stdout-in-addition-to-log/14058475
log = logging.getLogger()
log.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.set... | VolpeUSDOT/CV-PEP | lambda/cvp-qc/main.py | Python | mit | 881 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 Nicolas Wack <wackou@gmail.com>
# Copyright (c) 2013 Rémi Alvergnat <toilal.dev@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Le... | keen99/SickRage | lib/guessit/matcher.py | Python | gpl-3.0 | 12,107 |
# -*- coding: utf-8 -*-
# __init__.py
# Copyright (C) 2013 LEAP
#
# 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.
#
# Th... | kalikaneko/bitmask_client | src/leap/bitmask/__init__.py | Python | gpl-3.0 | 2,346 |
# getbinpkg.py -- Portage binary-package helper functions
# Copyright 2003-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.output import colorize
from portage.cache.mappings import slot_dict_class
from portage.localization import _
import portage
from portage impo... | Neuvoo/legacy-portage | pym/portage/getbinpkg.py | Python | gpl-2.0 | 23,311 |
# Copyright 2016 Google 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 applicable law or a... | skim1420/spinnaker | testing/citest/tests/google_http_lb_upsert_scenario.py | Python | apache-2.0 | 24,423 |
from torch import nn as nn
from torch.nn import functional as F
from rlkit.pythonplusplus import identity
from rlkit.torch import pytorch_util as ptu
from rlkit.torch.core import PyTorchModule
from rlkit.torch.networks import LayerNorm
class TwoHeadMlp(PyTorchModule):
def __init__(
self,
... | vitchyr/rlkit | rlkit/torch/networks/two_headed_mlp.py | Python | mit | 2,401 |
# Copyright 2015 Intel Corporation
#
# 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 wri... | IntelLabsEurope/infrastructure-repository | common/neo4j_resources.py | Python | apache-2.0 | 10,935 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Autor:Juan Pablo Orradre
Fecha ult. modificacion: 26/10/2015
Descripcion: Plugin de Nagios para monitorear el uso de memoria PGA por proceso en Oracle.
'''
import sys;
import paramiko;
def ayuda():
msg="check_uso_pga : Plugin de Nagios para monitorear el uso de me... | jporradre/Nagios | check_uso_pga.py | Python | gpl-3.0 | 1,658 |
from django import forms
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from .models import User
class UserCreationForm(forms.ModelForm):
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
password2 = forms.CharField(
label='Password confirmation', widget=forms... | kekivelez/DjangoSkeleton | tcshealth/users/forms.py | Python | gpl-2.0 | 1,472 |
import hashlib
from pwn import *
def remove_leading_zeros(txt):
if txt.startswith("00"):
return remove_leading_zeros(txt[2:])
return txt
md5_list = []
msg_list = []
dict_msg = []
with open("msg_responses", "r") as fin:
dat = fin.readlines()
for line in dat[::-1]:
line = line.strip()
... | Qwaz/solved-hacking-problem | HITCON/2016 Quals/Hackpad (unsolved)/solver.py | Python | gpl-2.0 | 1,696 |
from __future__ import division, print_function, unicode_literals
import os
dirs = ["../test",
"../utest",
"../cocos",
"../cocos/layer",
"../cocos/scenes",
"../cocos/actions",
"../samples",
"../samples/balldrive_toy_game",
"../samples/tetrico",
"... | vyscond/cocos | tools/check_py3_prefix.py | Python | bsd-3-clause | 1,042 |
#coding:utf-8
import redis
r = redis.Redis(host='127.0.0.1', port=6379)
r.set('name', 'qiye')
print r.get('name')
'''
pool = redis.ConnectionPool(host='127.0.0.1', port=6379)
r = redis.Redis(connection_pool=pool)
r.set('name', 'qiye')
print r.get('name')
''' | qiyeboy/SpiderBook | ch16/16.2.1.py | Python | mit | 261 |
#ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o #usuário.
altura = input("Digite a altura do quadrado em metros: ")
largura = input("Digite a largura do quadrado em metros: ")
a = altura * largura
p... | any1m1c/ipc20161 | lista1/ipc_lista1.07.py | Python | apache-2.0 | 388 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yeison/Documentos/python/developing/pinguino/pinguino-ide/qtgui/gide/bloques/widgets/control_slider.ui'
#
# Created: Fri Dec 19 15:43:21 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this fi... | PinguinoIDE/pinguino-multilanguage | files/gide/bloques/widgets/control_slider.py | Python | gpl-2.0 | 2,130 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Shadow(AutotoolsPackage):
"""Tools to help unprivileged users create uid and gid mappings ... | iulian787/spack | var/spack/repos/builtin/packages/shadow/package.py | Python | lgpl-2.1 | 752 |
import os
import pickle
train_dir = os.path.join(os.path.curdir, 'yelp')
data_dir = os.path.join(train_dir, 'data')
for dir in [train_dir, data_dir]:
if not os.path.exists(dir):
os.makedirs(dir)
trainset_fn = os.path.join(data_dir, 'train.dataset')
devset_fn = os.path.join(data_dir, 'dev.dataset')
testset_fn =... | ematvey/deep-text-classifier | yelp.py | Python | mit | 1,293 |
# -*- coding: utf-8 -*-
# Copyright (c) 2003 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to show the output of the svn diff command
process.
"""
from __future__ import unicode_literals
import os
import sys
import pysvn
from PyQt5.QtCore import QMutexLocker, QFileInfo, QDa... | paulmadore/Eric-IDE | 6-6.0.9/eric/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py | Python | gpl-3.0 | 17,686 |
# Copyright (c) Shopkick 2017
# See LICENSE for details.
"""
Executor
--------
Construct command-line lists.
:const:`NO_VALUE` -- indicate an option with no value (a boolean option)
"""
import functools
import six
import singledispatch
import attr
NO_VALUE = object()
@attr.s(frozen=True)
class Eq(object):
""... | shopkick/seashore | src/seashore/executor.py | Python | mit | 9,690 |
#!/usr/bin/python3
# coding=utf8
# Matrix and Cramer root-find algorithms
from copy import deepcopy
a = [[2., 5., 4.],
[1., 3., 2.],
[2., 10., 9.]]
b = [[30., 150., 110.],]
def multiply(a, b):
n = len(a); m = len(a[0]); k = len(b)
c = []
for i in range(n):
c.append([])
for s ... | alopatindev/math | systems/matrix_cramer.py | Python | gpl-3.0 | 1,940 |
"""
Demonstrate the use of h5py in SWMR mode to monitor the growth of a dataset
on notification of file modifications.
This demo uses pyinotify as a wrapper of Linux inotify.
https://pypi.python.org/pypi/pyinotify
Usage:
swmr_inotify_example.py [FILENAME [DATASETNAME]]
... | h5py/h5py | examples/swmr_inotify_example.py | Python | bsd-3-clause | 2,673 |
from __future__ import absolute_import
import sys
if sys.version_info <= (3,):
raise Exception("""
You are running Python {}.
This version of pmagpy is only compatible with Python 3.
Make sure you have pip >= 9.0 to avoid this kind of issue,
as well as setuptools >= 24.2:
$ pip install pip setuptools --upgrade
... | lfairchild/PmagPy | pmagpy/__init__.py | Python | bsd-3-clause | 973 |
"""
Support for Zwave cover components.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/cover.zwave/
"""
# Because we do not compile openzwave on CI
# pylint: disable=import-error
import logging
from homeassistant.components.cover import (
DOMAIN, SUPPOR... | miniconfig/home-assistant | homeassistant/components/cover/zwave.py | Python | mit | 4,834 |
# 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 | tests/python/topi/python/test_topi_conv3d_ncdhw.py | Python | apache-2.0 | 7,571 |
__author__ = 'jmad'
| mrjmad/robotswars | maingame/management/commands/__init__.py | Python | mit | 20 |
#!/usr/bin/python
# coding=utf-8
"""
Project MCM - Micro Content Management
SDOS - Secure Delete Object Store
Copyright (C) <2016> Tim Waizenegger, <University of Stuttgart>
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
import logging
... | timwaizenegger/osecm-sdos | mcm/sdos/swift/SwiftBackend.py | Python | mit | 5,398 |
"""
Functions which are used in assigning the I.C's to
the system.
"""
import arrayfire as af
import numpy as np
def initialize_f(q1, q2, v1, v2, v3, params):
m = params.mass
k = params.boltzmann_constant
n_b = params.density_background
T_b = params.temperature_background
v1_bulk_b =... | ShyamSS-95/Bolt | example_problems/nonrelativistic_boltzmann/linear_modes/linear_modes_euler/2D/sound_mode/input_files/initialize.py | Python | gpl-3.0 | 1,972 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-10 15:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Conver... | stadtgestalten/stadtgestalten | grouprise/features/conversations/migrations/0001_initial.py | Python | agpl-3.0 | 582 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from cms.utils import get_language_list
from django.contrib.sitemaps import Sitemap
from parler.utils.context import smart_override
from ..models import Post
from ..settings import get_setting
try:
from django.urls.e... | skirsdeda/djangocms-blog | djangocms_blog/sitemaps/__init__.py | Python | bsd-3-clause | 1,982 |
class CatchOutput(object):
def __init__(self, out, text):
self.__out = out
self.__text = text
def write(self, text):
if self.__text in text:
raise Exception, text
else:
return self.__out.write(text)
def __getattr__(self, name):
return getattr(self.__out, name)
if __name__ == '__main__':
import ... | onoga/toolib | toolib/dbg/CatchOutput.py | Python | gpl-2.0 | 398 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-28 21:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fichas', '0002_auto_20160628_2124'),
]
operations = [
migrations.RenameField(
... | reciproco/delma | fichas/migrations/0003_auto_20160628_2131.py | Python | mit | 426 |
#!/usr/bin/python
from liblo import *
import liblo
import gviz_api
import sys
import simplejson
from time import sleep
#WWW_PATH="/var/www/"
#WWW_PATH="/var/www/html/"
WWW_PATH="./"
#PORT=12345
PORT=4330 #FIXME: load port from json config file
#clean file at startup
f = open(WWW_PATH+"labellist.json", "w")
f.close(... | sonidosmutantes/osc-party | src/pyOSCmon.py | Python | agpl-3.0 | 2,815 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic.research | projects/capybara/sandbox/sklearn/base_example.py | Python | agpl-3.0 | 1,327 |
# flake8: noqa F401,F811
from gaphor import UML
from gaphor.core.modeling import Diagram
from gaphor.diagram.tests.fixtures import (
connect,
create,
diagram,
element_factory,
event_manager,
)
from gaphor.UML.classes import AssociationItem, ClassItem
from gaphor.UML.classes.associationpropertypages ... | amolenaar/gaphor | tests/test_composite_association.py | Python | lgpl-2.1 | 788 |
"""Route handlers for bottle-msgraph sample app.
Copyright 2017 by Doug Mahugh. All Rights Reserved.
Licensed under the MIT License."""
import json
import os
import platform
import shutil
import socket
import sys
try:
from pip._internal.operations import freeze
except ImportError:
from pip.operations import fr... | dmahugh/bottle-msgraph | routes.py | Python | mit | 7,678 |
import warnings
from numpy import sin, cos, exp, zeros, sum, float64
from spectralDNS import config, get_solver, solve
try:
import matplotlib.pyplot as plt
except ImportError:
warnings.warn("matplotlib not installed")
plt = None
def initialize(sol, U, U_hat, X, **context):
U[0] = sin(X[0])*cos(X[1])
... | mikaem/spectralDNS | tests/TG2D.py | Python | gpl-3.0 | 2,087 |
import pickle
import hashlib
import markdown
from markdown.extensions import Extension
from pgpdump.packet import SignaturePacket
from django.core.cache import cache
from django.db import connections, router
from django.http import HttpResponse
from django.utils.timezone import now
from django.template.defaultfilters... | archlinux/archweb | main/utils.py | Python | gpl-2.0 | 5,455 |
import sys
import os
from flask import render_template, make_response, request, Blueprint, redirect, url_for, flash
from sqlalchemy import select
from collections import defaultdict
from sqlalchemy.exc import OperationalError
from pywdbms.db.file import load_databases_from_file as load
from pywdbms.db.file import upda... | pikulak/pywdbms | api/app.py | Python | apache-2.0 | 16,191 |
"""
The Enrollment API Views should be simple, lean HTTP endpoints for API access. This should
consist primarily of authentication, request validation, and serialization.
"""
import logging
from course_modes.models import CourseMode
from django.db import transaction
from django.contrib.auth import get_user_model
from... | ahmedaljazzar/edx-platform | common/djangoapps/enrollment/views.py | Python | agpl-3.0 | 35,546 |
#!/usr/bin/env python2
from setuptools import setup
from setuptools import find_packages
setup(
name="rover",
version="0.1",
description="Algorithm for risk and sensor quality aware sensor" +
"coverage for quadrotors",
author="Alex Wallar",
author_email="wallarelvo@gmail.com",
packages=fin... | wallarelvo/rover | setup.py | Python | apache-2.0 | 501 |
from doctest import REPORT_NDIFF, ELLIPSIS
from sybil import Sybil
from sybil.parsers.doctest import DocTestParser, FIX_BYTE_UNICODE_REPR
from sybil.parsers.codeblock import CodeBlockParser
from sybil.parsers.capture import parse_captures
from testfixtures.sybil import FileParser
pytest_collect_file = Sybil(
pa... | nebulans/testfixtures | docs/conftest.py | Python | mit | 547 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-15 23:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AlterField(
... | destinityx2/Teammer | backend/migrations/0002_auto_20160515_2352.py | Python | gpl-3.0 | 448 |
from navmazing import NavigateToSibling
from widgetastic.utils import WaitFillViewStrategy
from widgetastic.widget import Checkbox
from widgetastic.widget import Select
from widgetastic.widget import View
from widgetastic_patternfly import Button
from cfme.base import Server
from cfme.common import BaseLoggedInPage
fr... | nachandr/cfme_tests | cfme/control/simulation.py | Python | gpl-2.0 | 1,775 |
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.core.cache import cache
import sys
def home(request):
return render_to_response('index.html', {})
def command(request):
try:
a = request.GET["a"]
if a == 'set':
res = cache._cache.set('welcome_msg', 'Hel... | Waterloo/memcachedcloud-django-sample | memcachedcloud_django_sample/views.py | Python | gpl-3.0 | 733 |
from .unittests import *
| Ecotrust/forestplanner | lot/trees/tests/__init__.py | Python | bsd-3-clause | 25 |
from flask import Flask
from flask.ext import restful
from flask.ext.restful import Api
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object('config')
#flask-sqlalchemy
db = SQLAlchemy(app)
#flask-restful
api = restful.Api(app)
@app.after_request
def after_request(response):
re... | davidadamojr/codescale | api/server.py | Python | mit | 570 |
from functools import reduce
class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
# special num : 0, 1
s = []
while n != 1:
n = reduce(lambda x, y: x + y,
map(lambda x: int(x)**2, list(str(n))))
... | mistwave/leetcode | Python3/no202_Happy_Number.py | Python | mit | 650 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import common
import SocketServer
import sys
class UDPEchoHandler(SocketServer.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except that
self.request consists of a pair of data and client socket, and since
there is no conne... | if1live/wireless-latency-benchmark | benchmark/udp_server.py | Python | mit | 877 |
from heapq import heappush, heappop
import numpy as np
from gtfspy.route_types import WALK
from .event import Event
class EventHeap:
"""
EventHeap represents a container for the event
heap to run time-dependent Dijkstra for public transport routing objects.
"""
def __init__(self, pd_df=None):
... | CxAalto/gtfspy | gtfspy/spreading/heap.py | Python | mit | 2,529 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | bzhou26/NRA-Crawler | selenium/webdriver/firefox/webdriver.py | Python | mit | 3,810 |
from flask.json import JSONEncoder
from datetime import datetime
class CustomJSONEncoder(JSONEncoder):
def default(self, obj):
try:
if isinstance(obj, datetime):
return obj.isoformat()
iterable = iter(obj)
except TypeError:
pass
else:
... | toadicus/KerbalStuff | KerbalStuff/custom_json.py | Python | mit | 396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.