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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-08 09:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Room',... | batebates/L3ProjetWeb | BDR/room/migrations/0001_initial.py | Python | mit | 544 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from __future__ import unicode_lit... | Liongold/crash | django/crashreport/processor/models.py | Python | mpl-2.0 | 9,729 |
from amqpstorm import management
if __name__ == '__main__':
# If using a self-signed certificate, change verify=True to point at your CA bundle.
# You can disable certificate verification for testing by passing in verify=False.
API = management.ManagementApi('https://rmq.amqpstorm.io:15671', 'guest',
... | eandersson/amqpstorm | examples/management/overview.py | Python | mit | 883 |
#!/usr/bin/env python3
import re, random, sqlite3
from os import path
from ..utilities import BasePlugin
from .markov import Markov
SQLITE_DATABASE = path.join(path.dirname(path.realpath(__file__)), "chains.db")
LOOKBEHIND_LENGTH = 2
def speak_db(db_connection, lookbehind_length, initial_state = ()):
# generate... | DanielHopper/botty-bot-bot-bot | src/plugins/generate_text/__init__.py | Python | mit | 3,146 |
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2016 Benedikt Schmitt
#
# 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... | benediktschmitt/py-jsonapi | jsonapi/asyncio/handler/related.py | Python | mit | 3,640 |
#!/usr/bin/env python
# Copyright 2015, Rackspace US, 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... | nrb/rpc-openstack | maas/testing/fake_hp_monitoring.py | Python | apache-2.0 | 940 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/base/api/viewsets.py | Python | agpl-3.0 | 7,937 |
# -*- coding: utf-8 -*-
from datetime import datetime
from .channel import Channel
import json, time, base64
def loggedIn(func):
def checkLogin(*args, **kwargs):
if args[0].isLogin:
return func(*args, **kwargs)
else:
args[0].callback.other('You want to call the function, yo... | fadhiilrachman/line-py | linepy/timeline.py | Python | bsd-3-clause | 10,410 |
from argon import rgba
from box import Box
blackish = rgba(0x00, 0x00, 0x00, 0x40)
whiteish = rgba(0xf6, 0xf3, 0xe8)
blueish = rgba(0x00, 0xf3, 0xe8, 0x80)
def clamp(low, high, value):
return min(high, max(low, value))
class Segment(object):
def __init__(self, width, text):
self.width = width
... | cheery/essence | richtext.py | Python | gpl-3.0 | 5,887 |
from tehbot.plugins import *
class DeathlistPlugin(StandardPlugin):
def execute(self, connection, event, extra, dbconn):
return "blanky"
register_plugin("deathlist", DeathlistPlugin())
| spaceone/tehbot | tehbot/plugins/deathlist/__init__.py | Python | mit | 199 |
# Copyright (c) 2015 Kevin Nygaard
# See LICENSE.txt for details.
"""A gui display of stroke suggestions """
import wx
import re
from wx.lib.utils import AdjustRectToScreen
PAT = re.compile(r'[-\'"\w]+|[^\w\s]')
TITLE = 'Plover: Suggestions Display'
ON_TOP_TEXT = "Always on top"
UI_BORDER = 4
MAX_STROKE_LINES = 38
L... | blockbomb/plover | plover/gui/suggestions.py | Python | gpl-2.0 | 8,019 |
#! /usr/bin/env python2
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
import sys
import khmer
def main():
files = sys.argv[2:]
... | kdmurray91/khmer | sandbox/fasta-to-abundance-hist.py | Python | bsd-3-clause | 703 |
"""Unit test for plugin manager.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import unittest
import mock
import pkg_resources
from treadmill import plugin_manager
# pylint: disable=protec... | Morgan-Stanley/treadmill | lib/python/treadmill/tests/plugin_manager_test.py | Python | apache-2.0 | 2,048 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''yans
Yet Another Network Simulator
Usage:
yans [-V] [-t --topo=<topo_path>] (up|stop|destroy)
yans [-V] [-t --topo=<topo_path>] console <node_name>
yans -h | --help
yans --version
Options:
-h --help Show this screen.
--version ... | kennethjiang/YANS | yans.py | Python | mit | 1,933 |
##############################################################################
# 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/resource.py | Python | lgpl-2.1 | 1,762 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | quattor/aquilon | lib/aquilon/worker/commands/show_role_role.py | Python | apache-2.0 | 1,061 |
#!/usr/bin/python
#
# just show env
#
# Tong Zhang <zhangt@frib.msu.edu>
# 2016-10-16 20:23:35 PM EDT
#
import numpy as np
import time
from flame import Machine
import matplotlib.pyplot as plt
lat_fid = open('../lattice/test_392.lat', 'r')
m = Machine(lat_fid)
s = m.allocState({})
r = m.propagate(s, 0, len(m), obse... | archman/genopt | contrib/show_env.py | Python | mit | 998 |
from django import forms
class CommentForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
name = forms.CharField(max_length=100)
| Lukasa/minimalog | posts/forms.py | Python | mit | 150 |
'''
Observer pattern lab
"Lab: Watching a File Change Size"
'''
import os
import time
class FileWatcher:
def __init__(self, path_of_file_to_watch):
self.path = path_of_file_to_watch
self.observers_for_channel = {
'increase': set(),
'decrease': set(),
}
s... | ketan-analytics/learnpython | Safaribookonline-Python/courseware-btb/solutions/py3/patterns/filewatch_extra.py | Python | gpl-2.0 | 1,637 |
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Filter import Filter
from PLC.Auth import Auth
from PLC.Persons import Persons
from PLC.Sites import Sites
from PLC.Nodes import Nodes
from PLC.Slices import Slices
from PLC.Keys import Keys
from PLC.Peers import Peers
from PLC.Faults imp... | dreibh/planetlab-lxc-plcapi | PLC/Methods/UnBindObjectFromPeer.py | Python | bsd-3-clause | 2,262 |
# Tai Sakuma <tai.sakuma@gmail.com>
import pytest
from alphatwirl.selection.factories.expand import expand_path_cfg
from alphatwirl.selection.factories.factory import FactoryDispatcher
from alphatwirl.selection.modules.LambdaStr import LambdaStr
from alphatwirl.selection.modules import All, Any, Not
##______________... | alphatwirl/alphatwirl | tests/unit/selection/factories/test_expand_path_cfg_alias.py | Python | bsd-3-clause | 7,417 |
from django.shortcuts import render, redirect
from users import forms
from django.contrib import auth
def signup(request):
errors = []
if request.method == 'POST':
form = forms.SignupForm(request.POST)
if form.is_valid():
username = form.cleaned_data['username']
email = ... | ananko/web_collections | users/views.py | Python | mit | 2,095 |
# Copyright 2013-2021 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 PyDendropy(PythonPackage):
"""DendroPy is a Python library for phylogenetic computing. It ... | LLNL/spack | var/spack/repos/builtin/packages/py-dendropy/package.py | Python | lgpl-2.1 | 960 |
"""Line-like geometrical entities.
Contains
========
LinearEntity3D
Line3D
Ray3D
Segment3D
"""
from __future__ import print_function, division
from sympy.core import S, Dummy, nan
from sympy.functions.elementary.trigonometric import acos
from sympy.simplify.simplify import simplify
from sympy.solvers import solve
fr... | sahilshekhawat/sympy | sympy/geometry/line3d.py | Python | bsd-3-clause | 40,855 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import functools
import tornado.web
import etc
__author__ = 'f0x11'
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
user_cookie = self.get_secure_cookie("user")
if user_cookie == etc.user_cookie:
return user_co... | f0x11/Merak | handlers/base.py | Python | mit | 578 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | geofront-eu/geocast_export | geocast_export.py | Python | gpl-3.0 | 17,459 |
import sys
from invoke import ctask as task
@task(help={
'module': "Just runs tests/STRING.py.",
'runner': "Use STRING to run tests instead of 'spec'.",
'opts': "Extra flags for the test runner",
'pty': "Whether to run tests under a pseudo-tty",
})
def test(c, module=None, runner=None, opts=None, pty... | singingwolfboy/invocations | invocations/testing.py | Python | bsd-2-clause | 1,547 |
import sys
import math
# region Classes
class FrequencyChart(object):
def __init__(self, args):
self.groups = [FrequencyGroup(r) for r in args]
def mean(self):
def top_func(group):
return group.frequency * group.midpoint()
top = sum(top_func(g) for g in self.groups)
... | Chronotron/chaos-beast | MA120/statistics/statistical_functions.py | Python | mit | 4,050 |
import os
from pathlib import Path
from sys import platform as _platform
def main():
print('Platform: {}'.format(_platform))
if _platform == "linux":
music_folder = "/home/harish/Dropbox/Music"
elif _platform == "win32":
music_folder = "J:\Dropbox\Music"
else:
music_folder = "/... | harishdinne/mp3_watermark_remover | remove_m3u_files.py | Python | gpl-3.0 | 951 |
# coding: utf-8
from src.util import Observable
from wrapt import synchronized
import math
class Cell(Observable):
def __init__(self, row, col):
super(Cell, self).__init__()
self.values = [i+1 for i in range(9)]
self.is_solved = False
self.row = row
self.col = col
def __iter__(self):
... | h3ct0rjs/ProgrammingIVassignments | Lab5Sudoku/src/sudoku1.py | Python | mpl-2.0 | 3,142 |
# -*- encoding: utf-8 -*-
import sqlite3, sys
# Подготавливаем данные БД
alphabet=[chr(i) for i in xrange(97,123)]
# Создаем первую БД и заполняем ее данными
con=sqlite3.connect(':memory:')
cur=con.cursor()
cur.execute('create table test(s)')
cur.executemany('insert into test values (?)',alphabet)
con.commit()... | janusnic/21v-pyqt | unit_06/func7.py | Python | mit | 976 |
# ! /usr/bin/env python
# _*_ coding:utf-8 _*_
"""
@author = lucas.wang
@create_time = 2018-02-07
"""
# coding=utf-8
import requests
import time
from lxml import etree
import sys
sys.path.append(r'D:\CodeWorkspace\python\GeneralTools')
from Ip import Get_Proxies
headers = {
'User-Agent': 'Mozilla/5.0 (... | Lucas-Wong/ToolsProject | Crawler/zhibajie.py | Python | gpl-3.0 | 4,021 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "udbproject.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| BFriedland/UserDataBase | manage.py | Python | mit | 253 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | markflyhigh/incubator-beam | sdks/python/apache_beam/examples/complete/autocomplete_test.py | Python | apache-2.0 | 2,702 |
from setuptools import setup
setup(name='pre-commit-dummy-package', version='0.0.0')
| philipgian/pre-commit | pre_commit/resources/empty_template/setup.py | Python | mit | 87 |
# -*- coding: utf-8 -*-
"""
Toolbox for interstellar Reddening of models or dereddening of data, and
interstellar extinction laws.
Author: R. Lombaert
How does reddening in ComboCode work?
First and foremost, we define the interstellar extinction in the Johnson K band.
The magnitude of extinction, Ak, is derived ... | MarieVdS/ComboCode | cc/modeling/tools/Reddening.py | Python | gpl-3.0 | 9,079 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# aiorest documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 14 19:59:09 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
# auto... | aio-libs/aiorest | docs/conf.py | Python | mit | 8,190 |
from django.contrib import admin
from models import Perfil
# Register your models here.
admin.site.register(Perfil) | avaquero/socialFutbol | perfils/admin.py | Python | gpl-2.0 | 116 |
from time import sleep
from gui_version import App
from tests.gui.app_testing_bed import ComboApEnSampEnTestingBed
from tests.gui.common import check_report
def test_combo_apen_sampen_wo_windows(qtbot):
window = App()
qtbot.addWidget(window)
test_app = ComboApEnSampEnTestingBed(qtbot=qtbot, window=wind... | demid5111/approximate-enthropy | tests/gui/combo_apen_sampen_test_e2e.py | Python | mit | 1,363 |
#!/usr/bin/python
import sys, os, commands, time, re, copy
try:
from PyQt4 import QtCore, QtGui
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
except ImportError:
try:
from PySide import QtCore, QtGui
QtCore.QString = str
except ImportError:
raise ImportErro... | Chuban/moose | gui/utils/YamlData.py | Python | lgpl-2.1 | 1,666 |
#!/usr/bin/env python
#
#
# Copyright (C) Canonical, Inc 2012
# 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 i... | sconklin/nexus-tools | smb347.py | Python | gpl-3.0 | 4,154 |
#########
# Copyright (c) 2015 GigaSpaces Technologies 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
#
# Unless... | cloudify-cosmo/cloudify-agent | cloudify_agent/api/pm/systemd.py | Python | apache-2.0 | 3,410 |
from django.contrib import admin
from django.db import models
from mock import Mock
from django_browserid.admin import BrowserIDAdminSite
from django_browserid.tests import TestCase
class BrowserIDAdminSiteTests(TestCase):
def test_copy_registry(self):
"""
copy_registry should register the Model... | jicksy/oneanddone_test | vendor-local/lib/python/django_browserid/tests/test_admin.py | Python | mpl-2.0 | 1,750 |
##
# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
#
# 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... | msfrank/Higgins | higgins/http/dav/element/rfc3253.py | Python | lgpl-2.1 | 6,558 |
"""
Abstract class to regroup all common options from python payloads
"""
class PythonPayload:
def __init__(self):
self.language = "python"
self.extension = "py"
self.required_python_options = {
"COMPILE_TO_EXE" : ["Y", "Compile to an executable"],
... | Veil-Framework/Veil-Evasion | modules/common/pythonpayload.py | Python | gpl-3.0 | 858 |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.utils import six
from djblets.testing.decorators import add_fixtures
from djblets.webapi.errors import PERMISSION_DENIED
from djblets.webapi.testing.decorators import webapi_test_template
from reviewboard.webapi.resources ... | davidt/reviewboard | reviewboard/webapi/tests/test_review_group_user.py | Python | mit | 12,165 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | tensorflow/datasets | tensorflow_datasets/text/ag_news_subset_test.py | Python | apache-2.0 | 1,051 |
import numpy as np
from dashboard.bokeh.helper import get_palette
from bokeh.models import LinearColorMapper, ColorBar
from bokeh.models import HoverTool, PrintfTickFormatter, ColumnDataSource
from bokeh.plotting import Figure
class Patch:
def set_amp(self, z_value):
''' Setup for AMP plots
'''
... | desihub/qlf | backend/framework/qlf/dashboard/bokeh/plots/patch/main.py | Python | bsd-3-clause | 6,217 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2011 Aldo Cortesi
# Copyright (c) 2010 Philip Kranz
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2011 Paul Colomiets
# Copyright (c) 2011-2012 roger
# Copyright (c) 2011-2012, 2014 Tycho Andersen
# Copyright (c) 2012 Dustin Lacewell
# Copyright (c) 2012 Laurie Clark-... | ramnes/qtile | libqtile/widget/prompt.py | Python | mit | 28,153 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-12 10:55
from __future__ import unicode_literals
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
import taggit.managers
from django.conf import settings
from django.db import migrations, models
import wagtail... | hamsterbacke23/wagtail | wagtail/tests/testapp/migrations/0001_initial.py | Python | bsd-3-clause | 30,539 |
from glob import glob
import pandas
import numpy
import pickle
import os
import re
home = os.environ["HOME"]
base = "%s/DATA/PUBMED" %os.environ["SCRATCH"]
counts_folder = "%s/counts" %(base)
files = glob("%s/*.tsv" %counts_folder)
len(files)
#4660
# save a lookup to associate repos with pmids, if there are repeats
... | vsoch/repofish | analysis/methods/6.compile_count_extensions.py | Python | mit | 2,657 |
import turtle
# initialisation
turtle.mode("standard")
turtle.home()
turtle.showturtle()
turtle.speed(1)
turtle.pencolor("red")
turtle.pensize(2)
turtle.pendown()
# dessin du carré
side = 100
angle = 90
for i in range(4):
turtle.forward(side)
turtle.right(angle)
# finalisation
turtle.hideturtle()
turtle.do... | TGITS/programming-workouts | erri/python/lesson_48/one_square.py | Python | mit | 326 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | QiJune/Paddle | python/paddle/dataset/tests/flowers_test.py | Python | apache-2.0 | 1,707 |
from pyduino import *
import time
ard = Arduino('COM10')
pin = 11
#declare output pins as a list/tuple
ard.pinMode(pin, OUTPUT)
brightness = 0
fadeAmount = 5
while (True):
ard.analogWrite(pin, brightness)
brightness = brightness + fadeAmount
if (brightness == 0 or brightness == 255):
fadeAmount ... | tushutripathi/ardupy | Examples/fade.py | Python | mit | 334 |
"""
File: logging.py
Author: Ulf Krumnack
Email: krumnack@uni-osnabrueck.de
Github: https://github.com/krumnack
"""
# standard imports
from base import Runner
from toolbox import Toolbox
# Qt imports
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QPushButton, QSpinBox,
QVBoxLayo... | Petr-By/qtpyvis | qtgui/panels/advexample.py | Python | mit | 8,103 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2013 J.P. Krauss <jkrauss@asymworks.com>
#
# This file is part of duplicity.
#
# Duplicity 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;... | alanfranz/duplicity | duplicity/backends/_cf_pyrax.py | Python | gpl-2.0 | 8,617 |
# -*- coding: utf-8 -*-
import buy_order
import buy_receipt
import buy_adjust
import money
import vendor_goods
import partner
| luoguizhou/gooderp_addons | buy/models/__init__.py | Python | agpl-3.0 | 126 |
#!/usr/bin/env python2
# vim: expandtab:tabstop=4:shiftwidth=4
'''
docker container DNS tester
'''
# Adding the ignore because it does not like the naming of the script
# to be different than the class name
# pylint: disable=invalid-name
import time
import os
from docker import APIClient as DockerClient
from do... | blrm/openshift-tools | scripts/monitoring/cron-send-docker-dns-resolution.py | Python | apache-2.0 | 1,920 |
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'deeds/harvesterDeed')
object.setAttachment('ConstructorTemplate', 'object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_1.iff')
object.setAttachment('StructureTemplate', 'object/installation/mining_gas... | agry/NGECore2 | scripts/object/tangible/deed/harvester_deed/harvester_gas_deed.py | Python | lgpl-3.0 | 469 |
# Author: Konrad Lindenbach <klindenb@ualberta.ca>,
# Emmanuel Odeke <odeke@ualberta.ca>
# Copyright (c) 2014
# Table name strings
MESSAGE_TABLE_KEY = "Message"
RECEIPIENT_TABLE_KEY = "Receipient"
MESSAGE_MARKER_TABLE_KEY = "MessageMarker"
MAX_NAME_LENGTH = 60 # Arbitrary value
MAX_BODY_LENGTH = 200 # Arbitr... | odeke-em/restAssured | chatServer/chatServerConstants.py | Python | mit | 500 |
import kivy
kivy.require('1.1.3')
from kivy.properties import NumericProperty
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix... | nuigroup/kivy | examples/demo/showcase/main.py | Python | lgpl-3.0 | 9,118 |
'''
Created on 04.10.2012
@author: michi
'''
from PyQt4.QtCore import pyqtSignal
from ems.qt4.applicationservice import ApplicationService #@UnresolvedImport
class ModelUpdateService(ApplicationService):
objectIdsUpdated = pyqtSignal(str, list)
objectsUpdated = pyqtSignal(str)
modelUpdate... | mtils/ems | ems/qt4/services/modelupdate.py | Python | mit | 590 |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | calpeyser/google-cloud-python | runtimeconfig/setup.py | Python | apache-2.0 | 2,169 |
from file_transfer_helper import SendFileTest, ReceiveFileTest, \
exec_file_transfer_test
from config import JINGLE_FILE_TRANSFER_ENABLED
if not JINGLE_FILE_TRANSFER_ENABLED:
print "NOTE: built with --disable-file-transfer or --disable-voip"
raise SystemExit(77)
class ReceiveFileAndDisconnectTest(Recei... | Ziemin/telepathy-gabble | tests/twisted/jingle-share/test-receive-file-and-disconnect.py | Python | lgpl-2.1 | 638 |
def ExOh(str):
temp = list(str)
xcount = 0
ocount = 0
for c in temp:
if c == "x":
xcount += 1
if c == "o":
ocount += 1
if xcount == ocount:
print "true"
elif xcount != ocount:
print "false"
ExOh(raw_input()) | ohgodscience/Python | Exercises/ExOh.py | Python | gpl-2.0 | 230 |
# -*- coding: utf-8 -*-
"""Handlers for application signals."""
import six
from .models.terminal import clean_order
from .storage.strategies import SoftDeleteStrategy
# pylint: disable=unused-argument
def store_ssh_key(sender, command, instance):
"""Write private key to file."""
if not instance.private_key:
... | Crystalnix/serverauditor-sshconfig | termius/core/subscribers.py | Python | bsd-3-clause | 1,154 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
)
class DotsubIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dotsub\.com/view/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://dotsub.com/view/9c63db2a-fa95-4838-8e6e-13... | vinegret/youtube-dl | youtube_dl/extractor/dotsub.py | Python | unlicense | 3,079 |
import os
import tempfile
import unittest
import shutil
from unittest.mock import MagicMock
test_links = {
"direct": "https://i.imgur.com/AaLX1Wn.jpg",
"gfycat": "https://gfycat.com/QualifiedDefensiveAddax",
"imgur_link": "https://imgur.com/AaLX1Wn",
"imgur_album": "https://imgur.com/a/IEKXq",
"im... | SeriousBug/redditcurl | tests/test_base.py | Python | gpl-3.0 | 2,526 |
from .matrix import MatrixDistance
from .matrix_cosine import MatrixCosineDistance
__all__ = [MatrixCosineDistance, MatrixDistance]
| elezar/ann-fab | annfab/distances/__init__.py | Python | mit | 134 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, io
import sys, getopt
import random
from openpyxl import load_workbook
# input: words list
# output
# 1. random matrix view with colume and row parameter
#
#
def MatrixFromXLS(filepath, sel_sheets, river):
print filepath
wb = load_workbook(filen... | howmind/tools | WordsMatrix.py | Python | apache-2.0 | 3,621 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
from pytraits import extendable
# Let's start by creating a simple class with some values. It contains
# class variables and instance variables. Composed functions will have
# access to all these variables.
@extendable
class ExampleClass(object):
PUBLIC = 24
_HIDD... | justanr/py3traits | examples/function_is_composed_as_a_part_of_instance.py | Python | apache-2.0 | 1,697 |
from unexistent_import import * | siddhika1889/Pydev-Editor | tests/pysrc/extendable/recursion_on_non_existent/__init__.py | Python | epl-1.0 | 31 |
# -*- coding -*-
"""
Provides step definitions for beehive based on beehive4cmd.
REQUIRES:
* beehive4cmd.steplib.output steps (command output from beehive).
"""
from beehive import then
from beehive.runner_util import make_undefined_step_snippet
# ------------------------------------------------------------------... | vrutkovs/beehive | features/steps/beehive_undefined_steps.py | Python | bsd-2-clause | 3,408 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... | lowitty/selenium | libs/windows/paramiko/pkey.py | Python | mit | 13,953 |
#!/usr/bin/env python3
# Filename: paste
# Purpose: XmlRpc interface client to paste.debian.net
# Original code by: Copyright 2007-2011 Michael Gebetsroither <michael@mgeb.org>
# Author of this fork (AoF): Copyright 2016... | bvanrijn/debianpaste-clients | paste.py | Python | gpl-2.0 | 8,665 |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
gluon.rewrite parses incoming URLs and formats outgoing URLs for gluon.html.URL.
In addition, it rewrites both... | pouyana/teireader | webui/gluon/rewrite.py | Python | mit | 52,398 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 Tuukka Turto
#
# This file is part of satin-python.
#
# pyherc 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 ... | tuturto/satin-python | satin/label.py | Python | gpl-3.0 | 2,211 |
from filebeat import BaseTest
import gzip
import os
import time
import unittest
"""
Tests that YapdnsBeat shuts down cleanly.
"""
class Test(BaseTest):
def test_shutdown(self):
"""
Test starting and stopping YapdnsBeat under load.
"""
# Uncompress the nasa log file.
nasa_... | yapdns/yapdnsbeat | tests/system/test_shutdown.py | Python | mit | 1,098 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Course.short_description'
db.add_column(u'courses_course'... | HackBulgaria/Odin | courses/south_migrations/0007_auto__add_field_course_short_description.py | Python | agpl-3.0 | 1,858 |
#
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | shastah/spacewalk | backend/satellite_tools/disk_dumper/iss_ui.py | Python | gpl-2.0 | 5,523 |
from django.conf import settings
from django.utils.importlib import import_module
import mimetypes
PREPARE_UPLOAD_BACKEND = getattr(settings,
'PREPARE_UPLOAD_BACKEND',
'filetransfers.backends.default.prepare_upload')
SERVE_FILE_BACKEND = getattr(settings,
'SERVE_FILE_BACKEND',
'filetransfers.backends.d... | gquirozbogner/contentbox-master | third_party/filetransfers/api.py | Python | apache-2.0 | 1,615 |
#!/usr/bin/env python3
import os
from config import Dirs, Disks, Files, XAS99_CONFIG
from utils import (xas, xdm, sinc, error, clear_env, delfile, check_obj_code_eq, check_image_set_eq,
check_image_files_eq, read_stderr, get_source_markers, check_errors)
# Main test
def runtest():
"""check c... | endlos99/xdt99 | test/as-checkobj.py | Python | gpl-3.0 | 4,385 |
"""
Sponge Knowledge Base
gRPC demo - Counter - sender.
"""
from java.util.concurrent.atomic import AtomicLong
def onInit():
# Initialize a counter as a Sponge variable.
sponge.setVariable("counter", AtomicLong(1))
class CounterSender(Trigger):
def onConfigure(self):
self.withEvent("counterSender... | softelnet/sponge | sponge-app/sponge-app-demo-service/sponge/sponge_demo_events_counter_sender.py | Python | apache-2.0 | 769 |
#
# 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 ... | shahankhatch/aurora | src/main/python/apache/thermos/testing/runner.py | Python | apache-2.0 | 6,225 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_08_01/aio/operations/_express_route_ports_locations_operations.py | Python | mit | 7,901 |
#!/usr/bin/python
class Graph:
"""
Directed Graph class - containing vertices and edges
"""
DEFAULT_WEIGHT = 1
DIRECTED = True
def __init__(self, graph_dict=None):
"""initializes a graph object"""
if graph_dict is None:
graph_dict = {}
self.__graph_dist = ... | codervikash/algorithms | Python/Graphs/directional_graph.py | Python | mit | 4,051 |
from datetime import datetime
from itertools import imap
from bson import ObjectId
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.views.generic import TemplateView, FormView, ListView, RedirectView, View
from django.conf import settings
from django import http
from t... | fatiherikli/dbpatterns | web/dbpatterns/documents/views.py | Python | mit | 10,239 |
#!/usr/bin/env python
from outlawg import Outlawg
from fftool import PATH_PREFS_ROOT, __version__
from arg_parser import arg_parser
from firefox_download import download
from firefox_profile import create_mozprofile, clean_profiles
from firefox_run import launch_firefox
Log = Outlawg()
def main():
Log.header('F... | rpappalax/ff-tool | fftool/main.py | Python | mpl-2.0 | 1,468 |
import shelve
import time
from metrics import *
# little data set for testing
testdata_users = {'max':{'odin doma':3,'labirint straha':5,'detektiv':2,'komnata':4},
'dima':{'odin doma':5,'labirint straha':1,'detektiv':5},
'alex':{'odin doma':5,'pila':2,'komnata':3,'grabim bank':3,'labirin... | maximdanilchenko/fusionBasedRecSys | itembased_recommender_system.py | Python | mit | 12,406 |
#!/usr/bin/env python
# coding: utf-8
from unittest import TestLoader as BaseTestLoader, TestSuite
import sys
class TestLoader(BaseTestLoader):
def loadTestsFromName(self, name, module=None):
suite = TestSuite()
for test in findTests(name):
sys.path.insert(0, name) # python3 compatibility
suite.... | edgeware/mockito-python | mockito_util/test.py | Python | mit | 864 |
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import datetime as dt
from decimal import Decimal
from itertools import product, cycle
from flask import json
from evesrp import db
from evesrp.models import Request, ActionType
from evesrp.auth import P... | paxswill/evesrp | tests_python/views/requests/test_filters.py | Python | bsd-2-clause | 14,714 |
# -*- coding: utf-8 -*-
import json
from django.http import HttpResponse # , HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from common import utils, page
from www.misc.decorators import member_required
from www.tasks import async_clear_count_info_by_c... | lantianlz/qiexing | www/message/views.py | Python | gpl-2.0 | 4,024 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
class TestCourseTopic(unittest.TestCase):
pass
| frappe/erpnext | erpnext/education/doctype/course_topic/test_course_topic.py | Python | gpl-3.0 | 154 |
from drawable import Drawable
import pyglet
from pyglet.gl import *
class Sprite(Drawable):
def __init__(self, sx, sy, tint=[1,1,1,1]):
self.tint = tint
verts = [-sx,-sy, sx,-sy, sx,sy, -sx,sy]
texcoords0 = [0,0, 1,0, 1,1, 0,1]
indices = [0,1,2, 0,2,3]
self.vlist = pyglet.graphics.vertex_list_indexe... | swiftcoder/ashima-iv | src/sprite.py | Python | bsd-3-clause | 622 |
import argparse
import sys
import time
from typing import IO, Iterator
from conway.grid import BaseGrid
DEFAULT_TURNS = -1
DEFAULT_DELAY = 0.35
DEFAULT_SEP = "%"
DEFAULT_OUTFILE = sys.stdout
def run(
grid: BaseGrid,
turns: int = DEFAULT_TURNS,
delay: float = DEFAULT_DELAY,
sep: str = DEFAULT_SEP,
... | dustinrohde/python-conway | conway/__init__.py | Python | mit | 1,394 |
# encoding: utf-8
import numpy as np
import _remapping
import pyroms
def flood(varz, Bgrd, Bpos='t', irange=None, jrange=None, \
spval=-9.99e+33, dmax=0, cdepth=0, kk=0):
"""
var = flood(var, Bgrd)
optional switch:
- Bpos='t', 'u' specify the grid position where
... | dcherian/pyroms | pyroms_toolbox/pyroms_toolbox/BGrid_POP/flood.py | Python | bsd-3-clause | 3,221 |
from unittest import mock
from unittest.mock import MagicMock, Mock
import pytest
from PyQt5 import QtCore
from PyQt5.QtWidgets import QMessageBox
from .main import Pesel2PBNWindow
WYGENEROWANY_PESEL = '00891702980' # http://www.bogus.ovh.org/generatory/all.html
@pytest.fixture
def p2p_window(qtbot):
window =... | mpasternak/pesel2pbn | src/pesel2pbn/tests.py | Python | mit | 2,513 |
l = [4, 6, 8, 10, 5]
l = [i*i for i in l]
print l
| pybursa/homeworks | v_glushkova/hw2/1.py | Python | gpl-2.0 | 50 |
import unittest
import os
from maskgen import plugins, image_wrap
import numpy
import tempfile
class CV2ResizeByPercentTestCase(unittest.TestCase):
filesToKill = []
def setUp(self):
plugins.loadPlugins()
def test_snap(self):
img = numpy.zeros((500,540),dtype='uint8')
wrapper = im... | rwgdrummer/maskgen | tests/plugins/ResizeByPercentTest.py | Python | bsd-3-clause | 1,335 |
"""
homeassistant.components.zone
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows defintion of zones in Home Assistant.
zone:
name: School
latitude: 32.8773367
longitude: -117.2494053
# Optional radius in meters (default: 100)
radius: 250
# Optional icon to show instead of name
# See https://www.google.com/design/... | tomduijf/home-assistant | homeassistant/components/zone.py | Python | mit | 4,426 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.