text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
__author__ = 'mark'
"""
User Profile Extension based on One-to-One fields code in Django Docs here:
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/
"""
from django.db import models
from django.contrib.auth.models import User
from uuid import uuid4
class Member(models.Model):
user = models.OneToOneFi... | ekivemark/my_device | bbp/bbp/member/models.py | Python | apache-2.0 | 548 | 0.00365 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.pets.PetBase
from toontown.pets.PetConstants import AnimMoods
from toontown.pets import PetMood
class PetBase:
def getSetterName(self, valueName, prefix = 'set'):
return '%s%s%s' % (prefix, valueName[0].upper(), valueName[1:])
... | DedMemez/ODS-August-2017 | pets/PetBase.py | Python | apache-2.0 | 778 | 0.006427 |
#!/usr/bin/env python
import os
import numpy as np
from cereal import car
from common.numpy_fast import clip, interp
from common.realtime import sec_since_boot
from selfdrive.swaglog import cloudlog
from selfdrive.config import Conversions as CV
from selfdrive.controls.lib.drive_helpers import create_event, EventTypes ... | TheMutley/openpilot | selfdrive/car/honda/interface.py | Python | mit | 23,054 | 0.013794 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh
##
## This program is free ... | TrevorLowing/PyGames | pysollib/games/sanibel.py | Python | gpl-2.0 | 2,437 | 0.007386 |
import tty
import sys
import termios
fd = sys.stdin.fileno()
fdattrorig = termios.tcgetattr(fd)
try:
tty.setraw(fd)
done = False
while not done:
ch = sys.stdin.read(1)
sys.stdout.write('test: %s\r\n' % ord(ch))
if ord(ch) == 27:
ch = sys.stdin.read(1)
sys.st... | coreyabshire/marv | bin/experiments/key_test.py | Python | mit | 472 | 0.002119 |
from collections import namedtuple
class HitsChecker:
REJECTED = -1
AMBIGUOUS = -2
CIGAR_GOOD = 0
CIGAR_LESS_GOOD = 1
CIGAR_FAIL = 2
CIGAR_OP_MATCH = 0 # From pysam
CIGAR_OP_REF_INSERTION = 1 # From pysam
CIGAR_OP_REF_DELETION = 2 # From pysam
CIGAR_OP_REF_SKIP = 3 # From pys... | statbio/Sargasso | sargasso/filter/hits_checker.py | Python | mit | 8,017 | 0.000624 |
#!/usr/bin/env python3
import os
import shutil
import subprocess
import sys
if os.environ.get('DESTDIR'):
install_root = os.environ.get('DESTDIR') + os.path.abspath(sys.argv[1])
else:
install_root = sys.argv[1]
if not os.environ.get('DESTDIR'):
schemadir = os.path.join(install_root, 'glib-2.0', 'schemas')
pr... | GNOME/gnome-session | meson_post_install.py | Python | gpl-2.0 | 789 | 0.007605 |
####################################################################################################
#
# PySpice - A Spice Package for Python
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | thomaslima/PySpice | PySpice/Tools/File.py | Python | gpl-3.0 | 7,812 | 0.005248 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
"""
LANG_INFO is a dictionary structure to provide meta information about languages.
About name_local: capitalize it as if your language name was appearing
inside a sentence in your language.
The 'fallback' key can be used to specify a special ... | yephper/django | django/conf/locale/__init__.py | Python | bsd-3-clause | 12,721 | 0.000161 |
# Author: Seamus Wassman
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 you... | mcus/SickRage | sickbeard/providers/morethantv.py | Python | gpl-3.0 | 8,361 | 0.00311 |
import numpy
def doPCA(data, dim):
data = makeDataMatrix(data)
means = getMeanVector(data)
data = normalizeData(data, means)
cov = getCov(data)
eigvals, eigvecs = getEigs(cov)
principalComponents = sortEigs(eigvals, eigvecs)
return getDimensions(dim, principalComponents)
def getDimensions... | hakuliu/inf552 | hw3/pca.py | Python | apache-2.0 | 1,541 | 0.008436 |
from polybori import BooleSet, interpolate_smallest_lex
class PartialFunction(object):
"""docstring for PartialFunction"""
def __init__(self, zeros, ones):
super(PartialFunction, self).__init__()
self.zeros = zeros.set()
self.ones = ones.set()
def interpolate_smallest_lex(self):
... | ohanar/PolyBoRi | pyroot/polybori/partial.py | Python | gpl-2.0 | 1,509 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Example program to receive packets from the radio link
#
import virtGPIO as GPIO
from lib_nrf24 import NRF24
import time
pipes = [[0xe7, 0xe7, 0xe7, 0xe7, 0xe7], [0xc2, 0xc2, 0xc2, 0xc2, 0xc2]]
radio2 = NRF24(GPIO, GPIO.SpiDev())
radio2.begin(9, 7)
radio2.setRetries(1... | CarlosPena00/Mobbi | Rasp/nrf/lib_nrf24/example-nrf24-recv.py | Python | mit | 1,196 | 0.020067 |
#!/usr/bin/env python
import sys
import os
import tempfile
import glob
import filecmp
import time
from argparse import ArgumentParser
usage = "usage: %prog [options] program_to_test"
parser = ArgumentParser(description="""Testrunner for programming puzzles, runs a program against each
.in-file and checks the... | plilja/algolib | util/checksol.py | Python | apache-2.0 | 2,044 | 0.005382 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... | ylitormatech/terapialaskutus | config/urls.py | Python | bsd-3-clause | 1,837 | 0.003266 |
# -*- coding: utf-8 -*-
#
# davos documentation build configuration file, created by
# sphinx-quickstart on Sat Jul 29 08:01:32 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | linuxserver/davos | docs/source/conf.py | Python | mit | 5,191 | 0.000385 |
#!/usr/bin/env python
import os
import setuptools
def _clean_line(line):
line = line.strip()
line = line.split("#")[0]
line = line.strip()
return line
def read_requires(base):
path = os.path.join('tools', base)
requires = []
if not os.path.isfile(path):
return requires
with ... | JohnGarbutt/taskflow-1 | setup.py | Python | apache-2.0 | 1,467 | 0 |
def es_vocal(letra):
if letra in 'aeiou':
return True
else:
return False
def contar_vocales_y_consonantes(palabra):
cuenta_vocal = 0
cuenta_consonante = 0
for letra in palabra:
if es_vocal(letra):
cuenta_vocal += 1
else:
cuenta_consonante += 1
return (cuenta_vocal, cuenta_consonante)
palabra = raw... | csaldias/python-usm | Ejercicios progra.usm.cl/Parte 2/7- Procesamiento de Texto/vocales_consonantes.py | Python | mit | 466 | 0.032189 |
# Copyright 2019 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.
"""Logging-like module for creating artifacts.
In order to actually create artifacts, RegisterArtifactImplementation must be
called from somewhere with an a... | endlessm/chromium-browser | third_party/catapult/telemetry/telemetry/internal/results/artifact_logger.py | Python | bsd-3-clause | 2,300 | 0.004783 |
import atexit
connection = None
connection_function = None
reconnect_function = None
hooks = None
def set_connection_function(_connection_function):
global connection
global connection_function
connection_function = _connection_function
connection = connection_function()
def disconnect():
globa... | Dark-Bob/mro | mro/connection.py | Python | mit | 910 | 0.002198 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C)
# 2004-2011: Pexego Sistemas Informáticos. (http://pexego.es)
# 2013: Top Consultant Software Creations S.L.
# (http://www.topconsultant.es/)
# 2014: ... | Jortolsa/l10n-spain | l10n_es_aeat_mod349/wizard/export_mod349_to_boe.py | Python | agpl-3.0 | 13,634 | 0.000074 |
import unittest
import transaction
from pyramid import testing
from climasng.tests import ProseMakerTestCase
from climasng.parsing.prosemaker import ProseMaker
# ===================================================================
class TestProseMakerConditions(ProseMakerTestCase):
# ----------------------------... | DanielBaird/CliMAS-Next-Generation | climas-ng/climasng/tests/test_prosemaker_conditions_rangenum.py | Python | mit | 8,241 | 0.005096 |
from .clev import *
| infoscout/weighted-levenshtein | weighted_levenshtein/__init__.py | Python | mit | 20 | 0 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras.optimizers import SGD
from keras.optimizers import Adam
from keras.optimizers import adadelta
from keras.optimizers import rmsprop
from keras.layers import Layer
from keras import backend as K
K.set_... | AutonomyLab/deep_intent | code/autoencoder_model/scripts/config_nmta.py | Python | bsd-3-clause | 3,079 | 0.003573 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) conexus.at
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | diogocs1/comps | web/addons/l10n_at/account_wizard.py | Python | apache-2.0 | 1,234 | 0.009724 |
#! /usr/bin/env python
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <nils@we155.de>
# Copyright (C) Enrico Pozzobon <enricopozzobon@gmail.com>
# Copyright (C) Alexander Schroeder <alexander1.schroeder@st.othr.de>
# This program is published und... | mtury/scapy | scapy/contrib/isotp.py | Python | gpl-2.0 | 75,260 | 0 |
"""//***********************************************************************
* Exp6_LineFollowing_IRSensors -- RedBot Experiment 6
*
* This code reads the three line following sensors on A3, A6, and A7
* and prints them out to the Serial Monitor. Upload this example to your
* RedBot and open up the Serial Monitor ... | Rosebotics/pymata-aio | examples/sparkfun_redbot/sparkfun_experiments/Exp6_LineFollowing_IRSensors.py | Python | gpl-3.0 | 2,131 | 0.001877 |
from cavicapture import CaviCapture
from process import CaviProcess
import sys, os, getopt
import time, datetime
import numpy as np
import matplotlib.pyplot as plt
def main():
config_path = './config.ini' # default
try:
opts, args = getopt.getopt(sys.argv[1:], "c", ["config="])
except getopt.GetoptError:
... | OpenSourceOV/cavicapture | calibrate.py | Python | gpl-3.0 | 3,982 | 0.010296 |
# -*- coding:utf-8 -*-
import re
# Обработка телефонных номеров
phonePattern = re.compile(r'^(\d{3})\D*(\d{3})\D*(\d{4})\D*(\d*)$')
print phonePattern.search('80055512121234').groups()
# ('800', '555', '1212', '1234')
print phonePattern.search('800.555.1212 x1234').groups()
# ('800', '555', '1212', '1234')
print ph... | janusnic/21v-python | unit_13/re6.py | Python | mit | 469 | 0.013544 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool persistence.
By default, bitcoind will dump mempool on shutdown and
then reload it on sta... | tjps/bitcoin | test/functional/mempool_persist.py | Python | mit | 6,912 | 0.002604 |
#!/usr/bin/env python3
import os
print("root prints out directories only from what you specified")
print("dirs prints out sub-directories from root")
print("files prints out all files from root and directories")
print("*" * 20)
'''
for root, dirs, files in os.walk("/var/log"):
print('Root: '.format(root))
pr... | talapus/Ophidian | Academia/Filesystem/demo_os_walk.py | Python | bsd-3-clause | 483 | 0.00207 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2020 Didotech S.r.l. (<http://www.didotech.com/>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
#... | iw3hxn/LibrERP | purchase_discount_combined/__openerp__.py | Python | agpl-3.0 | 1,361 | 0 |
# -*- coding: utf-8 -*-
###############################################################################
# License, author and contributors information in: #
# __manifest__.py file at the root folder of this module. #
########################################################... | mohamedhagag/dvit-odoo | dvit_report_inventory_valuation_multi_uom/wizard/stock_quant_report.py | Python | agpl-3.0 | 6,534 | 0.004132 |
import sys
import os
import time
import resetMbed
import serialMonitor
# Program the mbed, restart it, launch a serial monitor to record streaming logs
def runMbedProgramWithLogging(argv):
for arg in argv:
if 'startup=1' in arg:
time.sleep(10)
# If a bin file was given as argument, program ... | tarquasso/softroboticfish6 | fish/pi/runMbedProgramWithLogging.py | Python | mit | 1,134 | 0.0097 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Workflow:
# 1. Check if the folder has been analysed before
# 1.1 Status: checked, converted, reported, compiled, emailed, running, error, completed
# 2. If the sequencer is NextSeq:
# 2.1 Run bcl2fastq to create the FASTQ files
# 2.1.1 Execution:
# nohup /us... | CEFAP-USP/fastqc-report | RunFastQC.py | Python | gpl-3.0 | 18,788 | 0.002715 |
from typing import Any, Sequence, Union
from dataclasses import dataclass
from . import RequestMsg, ReplyMsg, Message, SimpleMessage
from hedgehog.protocol.proto import ack_pb2
from hedgehog.utils import protobuf
__all__ = ['Acknowledgement']
# <GSL customizable: module-header>
from hedgehog.protocol.proto.ack_pb2 i... | PRIArobotics/HedgehogProtocol | hedgehog/protocol/messages/ack.py | Python | agpl-3.0 | 1,301 | 0.002306 |
# coding: utf-8
import pygame
import sys
from pygame.locals import *
from gui import *
from conexao import *
from jogador import *
from Queue import Queue
from threading import Thread
"""
Cliente
Tp de Redes - Truco
UFSJ
Carlos Magno
Lucas Geraldo
Requisitos:
*python 2.7
*pygame
Modulo Principal.
"""
class Princi... | Exterminus/Redes | Cliente/Cliente_Interface/cliente_gui.py | Python | mit | 18,741 | 0.001122 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import unittest
import openapi_client
from openapi_cl... | cliffano/swaggy-jenkins | clients/python-experimental/generated/test/test_blue_ocean_api.py | Python | mit | 4,757 | 0 |
"""Parse (absolute and relative) URLs.
urlparse module is based upon the following RFC specifications.
RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
and L. Masinter, January 2005.
RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
and L.Masinter, Decemb... | google/grumpy | third_party/stdlib/urlparse.py | Python | apache-2.0 | 19,619 | 0.001988 |
'''
Created on 21.03.2012
@author: michi
'''
from PyQt4.QtGui import QTableView
from ems.qt4.gui.mapper.base import BaseStrategy #@UnresolvedImport
from ems.xtype.base import DictType, ObjectInstanceType #@UnresolvedImport
from ems.qt4.gui.itemdelegate.xtypes.objectinstancetype import ObjectInstanceDelegate #@Unresol... | mtils/ems | ems/qt4/gui/mapper/strategies/dict_strategy.py | Python | mit | 857 | 0.016336 |
# -*-coding:UTF-8 -*
import os
import Auth.authentication as auth
import Auth.login as log
import Menu.barreOutils as barre
import Users.Model as U
import Projects.Model as P
#On appelle le module d'identification - Commenté pour les pahses de test d'autres modules
login = log.Login()
login.fenetre.mainloop()
#auth.... | Aveias/gestt | main.py | Python | gpl-3.0 | 1,104 | 0.009991 |
"""
policy.py
Janbaanz Launde
Apr 1, 2017
"""
class Policy(object):
"""Abstract class for all policies"""
name = 'POLICY'
def __init__(self, contexts):
self.contexts = contexts
def predict_arm(self, contexts=None):
raise NotImplementedError("You need to override this function in chil... | rakshify/News_Recommender | policy/policy.py | Python | mit | 472 | 0.004237 |
"""
Extensions called during training to generate samples and diagnostic plots and printouts.
"""
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import theano.tensor as T
import theano
from blocks.extensions import SimpleExtension
import viz
import sampler
clas... | JesseLivezey/Diffusion-Probabilistic-Models | extensions.py | Python | mit | 7,673 | 0.006907 |
import sys
import os
import glob
import inspect
import pylab as pl
from numpy import *
from scipy import optimize
import pickle
import time
import copy
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]) + "/templates")
if cmd_folder not in sys.path:
sys.path.in... | fedhere/SESNCfAlib | vaccaleibundgut.py | Python | mit | 4,704 | 0.00744 |
# 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 Openipmi(AutotoolsPackage):
"""The Open IPMI project aims to develop an open code base
... | iulian787/spack | var/spack/repos/builtin/packages/openipmi/package.py | Python | lgpl-2.1 | 1,087 | 0.00368 |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/bandits/policies/boltzmann_reward_prediction_policy.py | Python | apache-2.0 | 13,821 | 0.004197 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | Forage/Gramps | gramps/plugins/tool/desbrowser.py | Python | gpl-2.0 | 5,538 | 0.004514 |
import subprocess
from utlz import func_has_arg, namedtuple
CmdResult = namedtuple(
typename='CmdResult',
field_names=[
'exitcode',
'stdout', # type: bytes
'stderr', # type: bytes
'cmd',
'input',
],
lazy_vals={
'stdout_str': lambda self: self.stdout.d... | theno/utlz | utlz/cmd.py | Python | mit | 2,420 | 0 |
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import pytest
import radish.utils as utils
@pytest.mark.filterwarnings("ignore")
def test_getting_any_debugger():
"""When asking for a ... | radish-bdd/radish | tests/unit/test_utils.py | Python | mit | 1,022 | 0 |
#
# 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... | nathanielvarona/airflow | tests/providers/mongo/sensors/test_mongo.py | Python | apache-2.0 | 1,820 | 0.000549 |
# Copyright 2009 - 2014 Insight Centre for Data Analytics, UCC
UNSAT, SAT, UNKNOWN, LIMITOUT = 0, 1, 2, 3
LUBY, GEOMETRIC = 0, 1
MAXCOST = 100000000
from .solvers import available_solvers
import weakref
import exceptions
import datetime
import types
import sys
#SDG: extend recursive limit for predicate decomposition... | JElchison/Numberjack | Numberjack/__init__.py | Python | lgpl-2.1 | 148,044 | 0.002742 |
"""
ESSArch is an open source archiving and digital preservation system
ESSArch
Copyright (C) 2005-2019 ES Solutions AB
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... | ESSolutions/ESSArch_Core | ESSArch_Core/WorkflowEngine/migrations/0019_processstep_parent_step.py | Python | gpl-3.0 | 1,448 | 0.000691 |
import numpy as np
from random import randrange
def eval_numerical_gradient(f, x, verbose=True, h=0.00001):
'''
计算在x点,f的数值梯度的简单实现。
-f: 应该是一个只接受一个输入参数的函数
-x: 要评估梯度的点,是numpy的数组
'''
fx = f(x) # 获取源点函数值
grad = np.zeros_like(x)
it = np.nditer(x, flags=['multi_index'], op_flags=['readwrite']... | BoyuanYan/CIFAR-10 | cs231n/gradient_check.py | Python | apache-2.0 | 1,636 | 0.006541 |
# A basic web server using sockets
import socket
PORT = 8090
MAX_OPEN_REQUESTS = 5
def process_client(clientsocket):
print(clientsocket)
data = clientsocket.recv(1024)
print(data)
web_contents = "<h1>Received</h1>"
f = open("myhtml.html", "r")
web_contents = f.read()
f.close()
web_headers = "HTT... | acs-test/openfda | PER_2017-18/clientServer/P1/server_web.py | Python | apache-2.0 | 1,505 | 0.008638 |
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
L = [[a,b,c] for a in range(x+1) for b in range(y+1) for c in range(z+1)]
L = list(filter(lambda x : sum(x) != n, L))
print(L)
| kakaba2009/MachineLearning | python/src/algorithm/coding/basic/comprehension.py | Python | apache-2.0 | 240 | 0.0125 |
# -*- coding: utf-8 -*-
"""This directory is meant for special-purpose extensions to IPython.
This can include things which alter the syntax processing stage (see
PhysicalQ_Input for an example of how to do this).
Any file located here can be called with an 'execfile =' option as
execfile = Extensions/filename.py
... | mastizada/kuma | vendor/packages/ipython/IPython/Extensions/__init__.py | Python | mpl-2.0 | 429 | 0 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | Tehsmash/inspector-hooks | inspector_hooks/enroll_node_not_found.py | Python | apache-2.0 | 1,013 | 0 |
""" ToDo: document OpenStack driver on user level here.
"""
import json
from pebbles.services.openstack_service import OpenStackService
from pebbles.drivers.provisioning import base_driver
from pebbles.client import PBClient
from pebbles.models import Instance
from pebbles.utils import parse_ports_string
SLEEP_BETWEE... | CSC-IT-Center-for-Science/pouta-blueprints | pebbles/drivers/provisioning/openstack_driver.py | Python | mit | 6,069 | 0.002636 |
import sys
import petsc4py
petsc4py.init(sys.argv)
from ecoli_in_pipe import head_tail
# import numpy as np
# from scipy.interpolate import interp1d
# from petsc4py import PETSc
# from ecoli_in_pipe import single_ecoli, ecoliInPipe, head_tail, ecoli_U
# from codeStore import ecoli_common
#
#
# def call_head_tial(uz_f... | pcmagic/stokes_flow | ecoli_in_pipe/wrapper_head_tail.py | Python | mit | 1,450 | 0.001379 |
"""
WSGI config for cache_server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | DanBuchan/cache_server | blast_cache/wsgi.py | Python | gpl-2.0 | 400 | 0 |
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.http import *
from django.template import Template, Context
from django.shortcuts import render_to_response, redirect, render, RequestContext, HttpResponseRedirect
def login(request):
return ... | COMU/lazimlik | lazimlik/social_app/views.py | Python | gpl-2.0 | 568 | 0.019366 |
from tensorflow.keras.applications.vgg16 import VGG16
import tensorflowjs as tfjs
model = VGG16(weights='imagenet')
tfjs.converters.save_keras_model(model, 'vgg16_tfjs')
| tensorflow/tfjs-examples | visualize-convnet/get_vgg16.py | Python | apache-2.0 | 172 | 0 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
r"""Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwa... | jjgomera/pychemqt | lib/EoS/Cubic/SRK.py | Python | gpl-3.0 | 13,006 | 0.000385 |
import webapp2
class Pets(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello Pets!')
app = webapp2.WSGIApplication([('/', Pets)], debug=True)
| Trii/NoseGAE | examples/pets/pets.py | Python | bsd-2-clause | 239 | 0 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Time utilities.
In particular, routines to do basic arithmetic on numbers represented by two
doubles, using the procedure of Shewchuk, 1997, Discrete & Computational
Geometry 18(3):305-363 -- http://www.cs.berkeley.edu/~jrs/pape... | joergdietrich/astropy | astropy/time/utils.py | Python | bsd-3-clause | 3,571 | 0 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | bokeh/plotting/glyph_api.py | Python | bsd-3-clause | 25,080 | 0.001994 |
# coding=utf8
from __future__ import print_function
import re
import sys
import socket
from untwisted.mode import Mode
from untwisted.network import Work
from untwisted.event import DATA, BUFFER, FOUND, CLOSE, RECV_ERR
from untwisted.utils import std
from untwisted.utils.common import append, shrug
from untwisted.ma... | joodicator/PageBot | page/chess.py | Python | lgpl-3.0 | 2,574 | 0.007382 |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2014 Benjamin Peterson
#
# 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 with... | SimplyAutomationized/python-snap7 | snap7/six.py | Python | mit | 26,731 | 0.001459 |
#!/usr/bin/env python
from __future__ import print_function
import unittest
from forker import Request
import socket
import os
import sys
import re
_example_request = b"""GET /README.md?xyz HTTP/1.1
Host: localhost:8080
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:... | darinmcgill/forker | tests/TestRequest.py | Python | gpl-3.0 | 3,544 | 0.000282 |
from abc import ABCMeta
from copy import deepcopy
from enum import Enum
from itertools import product
from typing import List, Dict, Tuple, Optional
from rxncon.core.reaction import Reaction, OutputReaction
from rxncon.core.rxncon_system import RxnConSystem
from rxncon.core.spec import Spec
from rxncon.core.state impo... | rxncon/rxncon | rxncon/simulation/boolean/boolean_model.py | Python | lgpl-3.0 | 35,991 | 0.005057 |
"""PLoS-API-harvester
=================
<p>To run "harvester.py" please follow the instructions:</p>
<ol>
<li>Create an account on <a href="http://register.plos.org/ambra-registration/register.action">PLOS API</a></li>
<li>Sign in <a href="http://alm.plos.org/">here</a> and click on your account name. Retrieve your A... | jeffreyliu3230/scrapi | scrapi/harvesters/plos.py | Python | apache-2.0 | 3,868 | 0.002068 |
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from oauth_access.access import OAuthAccess
from oauth_access.exceptions import MissingToken
def oauth_login(request, service,
redirect_field_name="next", redirect_to_sessio... | DraXus/andaluciapeople | oauth_access/views.py | Python | agpl-3.0 | 1,715 | 0.004665 |
# Copyright (c) 2012 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.
import os
import socket
import subprocess
import sys
import urlparse
from telemetry import util
class TemporaryHTTPServer(object):
def __init__(self, ... | nacl-webkit/chrome_deps | tools/telemetry/telemetry/temporary_http_server.py | Python | bsd-3-clause | 1,660 | 0.010843 |
# coding: utf-8
from __future__ import unicode_literals
"""
This module provides utility classes for io operations.
"""
__author__ = "Shyue Ping Ong, Rickard Armiento, Anubhav Jain, G Matteo, Ioannis Petousis"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping On... | ctoher/pymatgen | pymatgen/util/io_utils.py | Python | mit | 2,727 | 0.000367 |
import pygame
from pygame.locals import *
import constants as c
class Enemy:
def __init__(self, x, y, health, movement_pattern, direction, img):
self.x = x
self.y = y
self.health = health
self.movement_pattern = movement_pattern
self.direction = direction
... | naomi-/exploration | Enemy.py | Python | mit | 1,023 | 0 |
# -*- coding: utf-8 -*-
# Tests for the contrib/localflavor/ CZ Form Fields
tests = r"""
# CZPostalCodeField #########################################################
>>> from django.contrib.localflavor.cz.forms import CZPostalCodeField
>>> f = CZPostalCodeField()
>>> f.clean('84545x')
Traceback (most recent call las... | Smarsh/django | tests/regressiontests/forms/localflavor/cz.py | Python | bsd-3-clause | 4,319 | 0.001158 |
'''
Often used utility functions
Copyright 2020 by Massimo Del Fedele
'''
import sys
import uno
from com.sun.star.beans import PropertyValue
from datetime import date
import calendar
import PyPDF2
'''
ALCUNE COSE UTILI
La finestra che contiene il documento (o componente) corrente:
desktop.CurrentFrame.Container... | giuserpe/leeno | src/Ultimus.oxt/python/pythonpath/LeenoUtils.py | Python | lgpl-2.1 | 7,316 | 0.002873 |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# 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 applicab... | TrimBiggs/calico | calico/test/test_calcollections.py | Python | apache-2.0 | 5,048 | 0 |
# -*- coding: iso-8859-5 -*-
# Ʋ³´µ¶
class DummyƲ³´µ¶(object):
def Print(self):
print ('Ʋ³´µ¶')
DummyƲ³´µ¶().Print()
| fabioz/PyDev.Debugger | tests_python/resources/_pydev_coverage_cyrillic_encoding_py3.py | Python | epl-1.0 | 135 | 0.014815 |
# Copyright 2020 The SQLFlow 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 applicable law o... | sql-machine-learning/sqlflow | python/runtime/dbapi/pyalisa/task.py | Python | apache-2.0 | 3,699 | 0 |
#!/usr/bin/python2.6
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | google/pymql | test/type_link_test.py | Python | apache-2.0 | 36,235 | 0.001711 |
class Solution(object):
def search(self, grid, x, y, s):
if grid[x][y] == '0' or (x, y) in s:
return s
s.add((x, y))
if x - 1 >= 0:
s = self.search(grid, x - 1, y, s)
if x + 1 < len(grid):
s = self.search(grid, x + 1, y, s)
if y - 1 >= 0:
... | zeyuanxy/leet-code | vol4/number-of-islands/number-of-islands.py | Python | mit | 851 | 0.00235 |
import thread_pool
from tornado.testing import AsyncTestCase
from unittest import TestCase
import time, socket
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
from functools import partial
class ThreadPoolTestCase(AsyncTestCase):
def tearDown(self):
thread_pool.thread_pool = thread... | bobpoekert/tornado-threadpool | tests.py | Python | mit | 2,117 | 0.001417 |
# file openpyxl/workbook.py
# Copyright (c) 2010-2011 openpyxl
#
# 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, ... | Jian-Zhan/customarrayformatter | openpyxl/workbook.py | Python | mit | 8,298 | 0.000603 |
# 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... | mambocab/cassandra | pylib/cqlshlib/cql3handling.py | Python | apache-2.0 | 55,793 | 0.001667 |
# django-drf imports
from rest_framework import serializers
# app level imports
from .models import Player, Team
class PlayerSerializer(serializers.ModelSerializer):
class Meta:
model = Player
fields = (
'id', 'name', 'rating', 'teams',
'install_ts', 'update_ts'
)... | manjitkumar/drf-url-filters | example_app/serializers.py | Python | mit | 525 | 0 |
# coding=utf-8
import unittest
"""3. Longest Substring Without Repeating Characters
https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
Given a string, find the length of the **longest substring** without repeating
characters.
**Examples:**
Given `"abcabcbb"`, the answer is `"a... | openqt/algorithms | leetcode/python/ac/lc003-longest-substring-without-repeating-characters.py | Python | gpl-3.0 | 1,545 | 0.000647 |
import unittest
from b.grammar import Parser
class ParserTests(unittest.TestCase):
def test_parse(self):
p = Parser()
p.parse('123 "things"')
raise NotImplementedError
| blake-sheridan/py | test/test_grammar.py | Python | apache-2.0 | 200 | 0.005 |
from my.models import QueDoidura
# Opcional. Retorna quantas migracoes devem ser rodadas por task (default = 1000)
MIGRATIONS_PER_TASK = 2
# Descricao amigavel dessa alteracao no banco
DESCRIPTION = 'multiplica por 2'
def get_query():
""" Retorna um objeto query das coisas que precisam ser migradas """
retur... | qmagico/gae-migrations | tests/my/migrations_pau_na_migration/migration_paunamigration_0001.py | Python | mit | 414 | 0.007246 |
import datetime
import logging
from decimal import Decimal
from django.db import transaction
from django.http import HttpResponse
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
from openpyxl.styles import Font
from .models import Transaction, LineItem, Layout, PosPayment, Item, Location, TWO... | ianastewart/cwltc-admin | pos/services.py | Python | mit | 8,750 | 0.002058 |
# Copyright (c) 2012 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.
"""Chromium presubmit script for src/net.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit ... | 7kbird/chrome | net/PRESUBMIT.py | Python | bsd-3-clause | 1,034 | 0.005803 |
# -*- coding: utf-8 -*-
#
# JKal-Filter documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 24 16:56:49 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | jepio/JKalFilter | docs/conf.py | Python | gpl-2.0 | 8,011 | 0.00699 |
# pylint: disable=arguments-differ
""" Models for the shopping cart and assorted purchase types """
from collections import namedtuple
from datetime import datetime
from datetime import timedelta
from decimal import Decimal
import json
import analytics
from io import BytesIO
from django.db.models import Q, F
import py... | caesar2164/edx-platform | lms/djangoapps/shoppingcart/models.py | Python | agpl-3.0 | 91,861 | 0.003103 |
#!/usr/bin/env python
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/li... | sparkslabs/kamaelia | Sketches/RJL/bittorrent/BitTorrent/bittorrent-console.py | Python | apache-2.0 | 7,540 | 0.00809 |
from ml_buff.database import session_scope
from ml_buff.models import feature, feature_value, input_data, base_feature_record
from ml_buff.helpers.feature_value_helper import FeatureValueHelper
class TestFeature1(base_feature_record.BaseFeatureRecord):
def calculate(self, input_data):
return [1]
class Tes... | tinenbruno/ml-buff | tests/helpers/feature_value_helper_test.py | Python | mit | 2,534 | 0.007103 |
"""
QUESTION:
You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You are
given a 2D grid of values 0, 1 or 2, where:
Each 0 marks an empty land which you can pass by freely.
Each 1 marks a building which you cannot pass through.
Each 2 marks an obstacle which you... | tktrungna/leetcode | Python/shortest-distance-from-all-buildings.py | Python | mit | 2,335 | 0.0197 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | bjolivot/ansible | lib/ansible/module_utils/sros.py | Python | gpl-3.0 | 4,609 | 0.004339 |
# USAGE
# python motion_detector.py
# python motion_detector.py --video videos/example_01.mp4
# import the necessary packages
import argparse
import datetime
import imutils
import time
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video", he... | SahSih/ARStreaming360Display | RealTimeVideoStitch/motion_detector.py | Python | mit | 2,815 | 0.019893 |
# $Id: 150_srtp_1_1.py 369517 2012-07-01 17:28:57Z file $
#
from inc_cfg import *
test_param = TestParam(
"Callee=optional SRTP, caller=optional SRTP",
[
InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
InstanceParam("caller", "--null-audio --use-srtp=1 --srtp-secure=0 --ma... | fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-call/150_srtp_1_1.py | Python | gpl-2.0 | 340 | 0.023529 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('corpus', '0004_auto_20140923_1501'),
]
operations = [
migrations.RenameField(
model_name='labeledrelationevidenc... | mrshu/iepy | iepy/webui/corpus/migrations/0005_auto_20140923_1502.py | Python | bsd-3-clause | 412 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.