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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2016 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | crisely09/horton | horton/meanfield/occ.py | Python | gpl-3.0 | 8,958 | 0.001786 |
import os
import sys
sys.path.insert(0, "../../util/python")
import Cons
import Conf
def Load():
_LoadLogs()
sys.exit(0)
_WritePlotData()
_cass = None
_mutants = None
class LogEntry(object):
# simulation_time_dur_ms simulated_time OpW_per_sec running_behind_cnt read_latency_ms read_cnt
# ... | hobinyoon/apache-cassandra-2.2.3-src | mtdb/process-log/calc-latency-multiple-runs/Latency.py | Python | apache-2.0 | 6,312 | 0.029943 |
# -*- coding: utf-8 -*-
import zmq
import random
import time
def run():
context = zmq.Context()
sender = context.socket(zmq.PUSH)
sender.bind('tcp://*:5557')
sink = context.socket(zmq.PUSH)
sink.connect('tcp://localhost:5558')
print 'Press Enter when the workers are ready: '
_ = raw... | disenone/zsync | test/parallel_task/ventilator.py | Python | mit | 694 | 0.005764 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.discover.models import DiscoverSavedQuery
from sentry.testutils import APITestCase, SnubaTestCase
from sentry.testutils.helpers.datetime import before_now
class DiscoverSavedQueryBase(APITestCase, SnubaTestCase):
def... | beeftornado/sentry | tests/snuba/api/endpoints/test_discover_saved_queries.py | Python | bsd-3-clause | 18,996 | 0.001263 |
import pprint
from crashsimilarity.downloader import SocorroDownloader
import argparse
import sys
from crashsimilarity.models.gensim_model_wrapper import Doc2vecModelWrapper
from crashsimilarity.models.similarity.doc2vec_similarity import Doc2VecSimilarity
from crashsimilarity.models.wmd_calculator import WMDCalculat... | KirillTim/crashsimilarity | crashsimilarity/cli/signatures_similarity.py | Python | mpl-2.0 | 1,820 | 0.002747 |
#! /usr/bin/env python
"""
author @irisdianauy
The script converts a multi-genbank file into
a single bed file.
Feature: Specify features to extract (allows all).
"""
import pandas as pd
from os import path
from sys import argv, exit
from Bio import SeqIO
def get_id(ofeat):
sid = (ofeat.qualifiers.get("db_xr... | irisdianauy/bioscripts | gbk_to_bed.py | Python | gpl-2.0 | 1,705 | 0 |
# coding=utf-8
__author__ = 'dimv36'
from flask_login import AnonymousUserMixin, LoginManager
from webtests.models import User
# Модуль инициализации менеджера входа пользователей
login_manager = LoginManager()
class AnonymousUser(AnonymousUserMixin):
id = None
login_manager.anonymous_user = AnonymousUser
log... | dimV36/webtests | webtests/auth.py | Python | gpl-2.0 | 486 | 0 |
# -*- coding: utf-8 -*-
from mocks import Xbmc, Xbmcplugin, Xbmcgui, Xbmcaddon
import swefilmer
import sys
import urllib
ACTION_NEW = 'new'
ACTION_TOP = 'top'
ACTION_FAVORITES = 'favorites'
ACTION_CATEGORIES = 'categories'
ACTION_CATEGORY = 'category'
ACTION_SEARCH = 'search'
ACTION_VIDEO = 'video'
ACTION_NEXT_PAGE = ... | Fjobbe/xbmc-swefilmer | navigation.py | Python | gpl-3.0 | 9,678 | 0.000723 |
from sqlalchemy import Column, String
from FooBaseH import FooBaseH
class FooBaseH2(FooBaseH):
name2 = Column(String)
__mapper_args__ = {
'polymorphic_identity': "2"
}
| aitgon/wopmars | wopmars/tests/resource/model/FooBaseH2.py | Python | mit | 192 | 0 |
import setuptools
version = '1.8.0'
setuptools.setup(
name='six',
version=version,
url='https://pypi.python.org/packages/source/s/six/six-%s.tar.gz' % version,
license='MIT License',
author='Benjamin Peterson',
author_email='benjamin@python.org'
)
| Scalr/packages | pkgs/six/setup.py | Python | apache-2.0 | 274 | 0.00365 |
"""
tnetstring: data serialization using typed netstrings
======================================================
This is a custom Python 3 implementation of tnetstrings.
Compared to other implementations, the main difference
is that this implementation supports a custom unicode datatype.
An ordinary tnetstring is a ... | dufferzafar/mitmproxy | mitmproxy/contrib/tnetstring.py | Python | mit | 8,799 | 0.000909 |
#!/usr/bin/env python
class Solution:
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
i, j = 0, len(height)-1
l, r = height[i], height[j]
maxArea = (j - i) * min(l, r)
while j > i:
if l < r:
while hei... | eroicaleo/LearningPython | interview/leet/011_Container_With_Most_Water.py | Python | mit | 845 | 0.027219 |
# -*- coding: utf-8 -*
from test import DjangoTestCase
class AuthorsSpec(DjangoTestCase):
def test_success(self):
"""
Anyone should be able to view the authors page
"""
response = self.http_get(u"/authors")
assert response is not None
assert response.ok is True, r... | kaeawc/django-auth-example | test/controllers/info/test_authors.py | Python | mit | 425 | 0 |
from wutu.compiler.common import create_stream
from wutu.compiler.service import create_service_js
from wutu.compiler.controller import create_controller_js
from wutu.util import *
def handle_creation(module, stream):
create_service_js(stream, module)
create_controller_js(stream, module)
def main():
mod... | zaibacu/wutu | wutu/bench/compiler_bench.py | Python | mit | 535 | 0.001869 |
# Copyright (c) 2014 Mirantis 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, so... | japaniel/CloudFerry | cloudferrylib/os/actions/deploy_snapshots.py | Python | apache-2.0 | 4,490 | 0 |
"""
LibNix
Copyright (C) 2017 Mark Biciunas
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 th... | mbiciunas/libnix | src/libnix/config/script/run_script.py | Python | gpl-3.0 | 1,491 | 0 |
from django.core.management.base import BaseCommand, CommandError
from mangaki.models import Work, Rating
from django.db import connection
from django.db.models import Count
from collections import Counter
import sys
class Command(BaseCommand):
args = ''
help = 'Lookup some work'
def handle(self, *args, ... | RaitoBezarius/mangaki | mangaki/mangaki/management/commands/lookup.py | Python | agpl-3.0 | 616 | 0.001623 |
"""
WSGI config for pventa 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | vpadillar/pventa | pventa/wsgi.py | Python | mit | 389 | 0 |
"""The tests for the Tasmota binary sensor platform."""
import copy
from datetime import timedelta
import json
from unittest.mock import patch
from hatasmota.utils import (
get_topic_stat_result,
get_topic_stat_status,
get_topic_tele_sensor,
get_topic_tele_will,
)
from homeassistant.components import ... | jawilson/home-assistant | tests/components/tasmota/test_binary_sensor.py | Python | apache-2.0 | 13,393 | 0.000971 |
# Copyright (C) 2010, 2011 Linaro
#
# Author: James Westby <james.westby@linaro.org>
#
# This file is part of Linaro Image Tools.
#
# Linaro Image Tools 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 v... | tobetter/linaro-image-tools_packaging | linaro_image_tools/testing.py | Python | gpl-3.0 | 2,121 | 0 |
from __future__ import absolute_import, division, print_function
import dask
from dask.async import (start_state_from_dask, get_sync, finish_task, sortkey,
remote_exception)
from dask.order import order
from dask.utils_test import GetFunctionTestMixin, inc, add
fib_dask = {'f0': 0, 'f1': 1, ... | jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/dask/tests/test_async.py | Python | mit | 6,053 | 0.00033 |
import os, sys
import config
def notify_user(msg):
sys.stderr.write(msg+'\n')
raw_input('Press enter to exit ')
sys.exit(1)
def run_cmd(cmd):
if os.system(cmd) != 0:
notify_user('Command "%s" failed!'%cmd)
def run_cmds(*cmds):
for cmd in cmds:
run_cmd(cmd)
if config.current != config.pro... | JustinTulloss/harmonize.fm | uploader/publish_win.py | Python | mit | 800 | 0.025 |
# -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Teon Brooks <teon.brooks@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD (3-clause)
from collections import Counter, OrderedDict
im... | rkmaddox/mne-python | mne/io/meas_info.py | Python | bsd-3-clause | 97,239 | 0 |
"""Initialazation "db" sqlalchemy object."""
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
| Wasper256/evo-departments | extentions.py | Python | gpl-3.0 | 103 | 0 |
from setuptools import setup, find_packages
setup(name='netdisco',
version='0.9.2',
description='Discover devices on your local network',
url='https://github.com/home-assistant/netdisco',
author='Paulus Schoutsen',
author_email='Paulus@PaulusSchoutsen.nl',
license='Apache License 2.... | brburns/netdisco | setup.py | Python | apache-2.0 | 513 | 0 |
# -*- coding: utf-8 -*-
#
# tree.py
#
# (c) D.C.-G. 2014
#
# Tree widget for albow
#
from albow.widget import Widget
from albow.menu import Menu
from albow.fields import IntField, FloatField, TextFieldWrapped
from albow.controls import CheckBox, AttrRef, Label, Button
from albow.dialogs import ask, alert, input_text_bu... | violine1101/MCEdit-Unified | albow/tree.py | Python | isc | 20,371 | 0.004124 |
# Copyright (c) 2013 Mirantis Inc.
# Copyright (c) 2015-2017 Red Hat
#
# 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 a... | sileht/gnocchi | gnocchi/cli/manage.py | Python | apache-2.0 | 3,776 | 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
# ... | ozamiatin/oslo.messaging | oslo_messaging/tests/functional/test_functional.py | Python | apache-2.0 | 13,879 | 0 |
klein = raw_input()
gross = raw_input()
zahl = []
if gross[0] == '0':
zahl.append((1,0))
else:
zahl.append((0,1))
for i in range(1,len(gross)):
if gross[i] == '0':
zahl.append((zahl[i - 1][0] + 1, zahl[i - 1][1]))
else:
zahl.append((zahl[i - 1][0], zahl[i - 1][1] + 1))
plus = 0
for i in range(len(klein)):... | clarammdantas/Online-Jugde-Problems | online_judge_solutions/python.py | Python | mit | 531 | 0.037665 |
# -*- encoding: utf-8 -*-
import yaml
import sys
import os
import json
import sqlite3
from .exceptions import *
class DataList(object):
__data_list = None
def __init__(self, _path="", _list_file=""):
self.__data_list = list()
self.path = _path
self.listfile = _list_file
s... | TheTimeTunnel/scout-camp | PROJECT/src/scoutcamp/database.py | Python | gpl-3.0 | 7,206 | 0.005291 |
# -*- coding: utf-8 -*-
{
"name": "Sale Order Line Edit",
"summary": "Edit Sale Order Form",
"version": "9.0.0.1.1",
"category": "Sales",
"website": "http://www.toyo-kiki.co.jp",
"author": "ichi",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale",
],
"data": [
"views/... | ichi23de5/ichi_Repo | sale_order_line_edit/__openerp__.py | Python | gpl-3.0 | 342 | 0.04386 |
#!/bin/env python
from CoaSim import *
cm = CustomMarker(0.1)
assert cm.position == 0.1
class MyMarker(CustomMarker):
def __init__(self,pos):
CustomMarker.__init__(self,pos)
def defaultValue(self):
return 1
def mutate(self, parentAllele, edgeLength):
return parentAllele+1
mm = My... | mailund/CoaSim | Python/customMarkerTest.py | Python | gpl-2.0 | 2,572 | 0.018663 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/api/openstack/compute/plugins/v3/block_device_mapping_v1.py | Python | gpl-2.0 | 2,738 | 0 |
#!/usr/bin/env python
"""
"""
import vtk
def view_frog(fileName, tissues):
colors = vtk.vtkNamedColors()
tissueMap = CreateTissueMap()
colorLut = CreateFrogLut()
# Setup render window, renderer, and interactor.
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWind... | lorensen/VTKExamples | src/Python/Visualization/ViewFrog.py | Python | apache-2.0 | 5,808 | 0.001722 |
#!/usr/bin/env vpython3
# Copyright 2021 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.
"""Tests for local_device_gtest_test_run."""
# pylint: disable=protected-access
import os
import tempfile
import unittest
from pyl... | nwjs/chromium.src | build/android/pylib/local/device/local_device_gtest_run_test.py | Python | bsd-3-clause | 2,907 | 0.005504 |
"""ThreatConnect TI Campaign"""
# standard library
from typing import TYPE_CHECKING
# first-party
from tcex.api.tc.v2.threat_intelligence.mappings.group.group import Group
if TYPE_CHECKING:
# first-party
from tcex.api.tc.v2.threat_intelligence.threat_intelligence import ThreatIntelligence
class Campaign(Gro... | ThreatConnect-Inc/tcex | tcex/api/tc/v2/threat_intelligence/mappings/group/group_types/campaign.py | Python | apache-2.0 | 1,625 | 0.004308 |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | estnltk/suffix-lemmatizer | bootstrap.py | Python | gpl-2.0 | 7,459 | 0.00067 |
# pylint: disable=arguments-differ
# pylint: disable=too-many-lines
import datetime
import itertools
import json
import logging
import re
from uuid import uuid4
from random import SystemRandom
from string import digits, ascii_lowercase, ascii_uppercase
from ckeditor.fields import RichTextField
from django.contrib im... | reyiyo/eventoL | eventol/manager/models.py | Python | gpl-3.0 | 40,847 | 0.001689 |
from __future__ import absolute_import
from django import forms
from django.db import IntegrityError, transaction
from django.http import HttpResponse
from django.views.generic import View
from django.template.loader import render_to_string
from django.utils import timezone
from django.utils.safestring import mark_saf... | mitsuhiko/sentry | src/sentry/web/frontend/error_page_embed.py | Python | bsd-3-clause | 5,673 | 0.001234 |
from functools import partial
import time
from typing import List
from flask import Blueprint, Response, render_template, current_app, request
from core.job.helpers import expand_nodelist
from core.job.models import Job
from application.helpers import requires_auth
from core.monitoring.models import SENSOR_CLASS_MAP
... | srcc-msu/job_statistics | modules/job_analyzer/controllers.py | Python | mit | 1,969 | 0.028441 |
'''
Check for primality for both decimal inputs and binary inputs
'''
lst = [2, 4, 6, 7, 9, 13, 17, 99, 127, 139]
print lst
prime = []
def is_composite(n) :
for i in range(2, n/2 + 1) :
if n % i == 0 :
return True
return False
for n in lst :
if is_composite(n) :
continue
e... | srinivasanmit/all-in-all | puzzles/isprime.py | Python | gpl-3.0 | 548 | 0.018248 |
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 | 0.003898 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
usage: zerows [-h]
"""
__author__ = "Sebastian Łach"
__copyright__ = "Copyright 2015, Sebastian Łach"
__credits__ = ["Sebastian Łach", ]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "Sebastian Łach"
__email__ = "root@slach.eu"
from json import loads
fro... | sebastianlach/zerows | zerows/__init__.py | Python | mit | 2,638 | 0.002658 |
import unittest
import mock
import logging
import datetime
import time
import esgfpid.rabbit.asynchronous
from esgfpid.rabbit.asynchronous.exceptions import OperationNotAllowed
LOGGER = logging.getLogger(__name__)
LOGGER.addHandler(logging.NullHandler())
# Test resources:
from resources.TESTVALUES import *
import res... | IS-ENES-Data/esgf-pid | tests/testcases/rabbit/asyn/rabbit_asynchronous_tests.py | Python | apache-2.0 | 18,090 | 0.006578 |
#python
import k3d
k3d.check_node_environment(context, "MeshSourceScript")
# Construct a cube mesh primitive ...
cubes = context.output.primitives().create("cube")
matrices = cubes.topology().create("matrices", "k3d::matrix4")
materials = cubes.topology().create("materials", "k3d::imaterial*")
uniform = cubes.attribu... | barche/k3d | share/k3d/scripts/MeshSourceScript/cubes.py | Python | gpl-2.0 | 771 | 0.001297 |
import os.path
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth import get_user_model
from avatar.settings import AVATAR_DEFAULT_URL, AVATAR_MAX_AVATARS_PER_USER
from avatar.util import get_primary_avatar
from avatar.models import... | bhermansyah/DRR-datacenter | avatar/tests.py | Python | gpl-3.0 | 5,578 | 0.004661 |
# -*- coding: utf-8 -*-
#
# 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
#... | adamhaney/airflow | airflow/contrib/operators/jenkins_job_trigger_operator.py | Python | apache-2.0 | 11,480 | 0.001394 |
#!/usr/bin/env python2
# SIMPLE UDP CLIENT
import socket
host = '127.0.0.1'
port = 80
# create socket obj
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# send data
client.sendto("AAABBBCCC", (host, port))
# receive data
data, addr = client.recvfrom(4096)
print data
| dminca/python-sandbox | udp_client.py | Python | gpl-3.0 | 285 | 0.003509 |
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or Organization ("Licensee") accessing and
# otherwise using this software ("Python") in source or binary form and
# its ass... | kvar/ansible | lib/ansible/utils/unsafe_proxy.py | Python | gpl-3.0 | 4,891 | 0.001022 |
from settings import *
PROJECT = 'drawquest'
CANVAS_SUB_SITE = '/admin/'
if PRODUCTION:
DOMAIN = "example.com"
SELF_PORT = 9000
SELF = 'localhost:9000'
UGC_HOST = 'i.canvasugc.com'
FACEBOOK_APP_ACCESS_TOKEN = "REDACTED"
FACEBOOK_APP_ID = "REDACTED"
FACEBOOK_APP_SECRET = "REDACTED"
FAC... | canvasnetworks/canvas | website/settings_drawquest.py | Python | bsd-3-clause | 8,754 | 0.001714 |
# Addierer mit += 1
# Eingaben erhalten
a = input("Dies ist ein Addierer!\nGeben Sie a ein: ")
b = input("Geben Sie b ein: ")
# Zeichenketten in Zahlen umwandeln
a = int(a)
b = int(b)
# neue Variable verwenden, Eingaben nicht verändern
result = a
i = 0
if b > 0: # wenn b größer Null
while i < b: ... | Informatik-AG-KGN-2016/Dokumente | 2016-11-28/aufgabe-addierer.py | Python | gpl-3.0 | 587 | 0.001712 |
from Config import Config
from Distro import Distro
| maier/repo-mirror-mgr | Mirror/__init__.py | Python | mit | 52 | 0 |
from django.contrib.admin import site, ModelAdmin
from site_tracking.models import VerificationCode, TrackingCode
class VerificationCodeAdmin(ModelAdmin):
list_display = ('site', 'verification_type', 'code',)
list_editable = ('code',)
site.register(VerificationCode, VerificationCodeAdmin)
class Tracking... | wlashell/lyrical_page | site_tracking/admin.py | Python | apache-2.0 | 493 | 0.014199 |
# All the constants
# Get keys
import config
# All the Base Endpoints
STAGING_URL_HOST = 'test.deliver.opinioapp.com'
PRODUCTION_URL_HOST = 'deliver.opinioapp.com'
ACCESS_KEY = config.ACCESS_KEY
SECRET_KEY = config.SECRET_KEY
# Api Endpoints
API_BASE_ENDPOINT = '/api'
API_VERSION = 'v1'
API_ENDPOINT = API_BASE_ENDP... | anistark/opiniohll | OpinioDelivery/constants.py | Python | mit | 522 | 0.001916 |
import markupsafe
from os.path import basename
from website import settings
def serialize_addon_config(config, user):
lookup = config.template_lookup
user_addon = user.get_addon(config.short_name)
ret = {
'addon_short_name': config.short_name,
'addon_full_name': config.full_name,
... | erinspace/osf.io | addons/base/utils.py | Python | apache-2.0 | 2,446 | 0.006132 |
from polyphony import testbench
class C:
def __init__(self):
self.v1 = 0
self.v2 = 0
def set_v(self, i, v):
if i == 0:
pass
elif i == 1:
self.v1 = v
elif i == 2:
self.v2 = v
else:
return
def if23():
c = C()
... | ktok07b6/polyphony | tests/if/if23.py | Python | mit | 439 | 0 |
import logging
from abc import ABCMeta, abstractmethod
from collections import deque
from typing import List, Union, Iterable, Sequence
log = logging.getLogger(__name__)
class NoSensorsFoundException(RuntimeError):
pass
class Controller(metaclass=ABCMeta):
@abstractmethod
def run(self):
raise N... | vrga/pyFanController | pyfc/common.py | Python | mit | 4,243 | 0.001414 |
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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, ... | beetbox/beets | beets/dbcore/query.py | Python | mit | 29,107 | 0 |
# -*- coding: utf-8 -*-
""" Sahana Eden Document Library
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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 wi... | anubhav929/eden | modules/eden/doc.py | Python | mit | 14,543 | 0.010314 |
# Grayson Gatti (gtg8cd) AND Austin Sullivan (acs3ss)
# CS 1110 - Spring 2017
# Monday, May 1st 2017
import pygame
import gamebox
import random
import math
# this code uses stop_loop to exit ticks() function. Then changes level, resets the screen, etc before re-entering ticks
def tick(keys):
global l... | acs3ss/austinsullivan.github.io | files/Gamebox/game.py | Python | unlicense | 28,200 | 0.002163 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layout_page', '0007_auto_20170509_1148'),
]
operations = [
migrations.AddField(
model_name='layoutpage',
... | ic-labs/django-icekit | icekit/page_types/layout_page/migrations/0008_auto_20170518_1629.py | Python | mit | 686 | 0.002915 |
#!/usr/bin/env python
# -*- coding:utf8 -*-
from setuptools import setup
import picuplib
setup(
name = 'picuplib',
packages = ['picuplib'],
version = picuplib.__version__,
description = 'Picflash upload library',
author = 'Arvedui',
author_email = 'arvedui@posteo.de',
url =... | Arvedui/picuplib | setup.py | Python | lgpl-2.1 | 950 | 0.015789 |
'''Barst FTDI Wrapper
=====================
'''
from pybarst.ftdi import FTDIChannel
from pybarst.ftdi.switch import SerializerSettings, PinSettings
from pybarst.ftdi.adc import ADCSettings
from kivy.properties import NumericProperty, DictProperty, StringProperty, \
ListProperty, ObjectProperty, BooleanPro... | matham/cplcom | cplcom/moa/device/ftdi.py | Python | mit | 21,337 | 0.000047 |
from __future__ import unicode_literals
import re
import unicodedata
from gzip import GzipFile
from io import BytesIO
from django.utils.encoding import force_text
from django.utils.functional import allow_lazy, SimpleLazyObject
from django.utils import six
from django.utils.six.moves import html_entities
from django.... | deployed/django | django/utils/text.py | Python | bsd-3-clause | 14,829 | 0.001416 |
import unittest
from tingbot.button import Button
class ButtonTestCase(unittest.TestCase):
def setUp(self):
self.button = Button()
def assertActions(self, action_types):
self.assertEqual(action_types, [a.type for a in self.button.actions])
def testPress(self):
self.button.add_eve... | furbrain/tingbot-python | tests/button_test.py | Python | bsd-2-clause | 1,851 | 0.002161 |
class Solution:
def reverseWords(self, s) :
print 1 / 0
tks = s.split(' ');
tks = filter(None, tks)
tks.reverse();
return ' '.join(tks).strip()
test = ["the sky is blue", " a b "]
sol = Solution();
for t in test :
print sol.reverseWords(t)
| yelu/leetcode | ReverseWords.py | Python | gpl-2.0 | 295 | 0.020339 |
from DBLayout.DBConnection import DBConnection, mysql
from EntitiesLayout.FacebookPostControl import FacebookPostControl
__author__ = 'David'
class FacebookPostControlDB:
def __init__(self):
self.db = DBConnection()
print('Create object to access table user in DB.')
def insertPostControl(sel... | idcodeoverflow/SocialNetworkAnalyzer | DBLayout/FacebookPostControlDB.py | Python | mit | 3,492 | 0.002864 |
# django-salesforce
#
# by Phil Christensen
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your applicatio... | django-salesforce/django-salesforce | salesforce/testrunner/example/tests.py | Python | mit | 363 | 0 |
import pymongo
def connect ():
'''
Create the connection to the MongoDB and create 3 collections needed
'''
try:
# Create the connection to the local host
conn = pymongo.MongoClient()
print 'MongoDB Connection Successful'
except pymongo.errors.ConnectionFailure, err:
... | Macemann/Georgetown-Capstone | app/db/connect.py | Python | mit | 493 | 0.008114 |
from django.db import models
# Create your models here.
from core.models import BillingSchedule
from core.models import Bill
from core.models import Account
from core.models import FileRepo
from core.models import Config
from core.models import Task | tombs/Water-Billing-System | waterbilling/tasks/models.py | Python | agpl-3.0 | 250 | 0.004 |
#Copyright 2016 Tim Wentlau.
#Distributed under the MIT License. See LICENSE in root of project.
"""
A dashboard is the main ui component in a kervi application.
"""
_DASHBOARDS = []
from kervi.core.utility.component import KerviComponent
import kervi.spine as spine
class DashboardPanelGroup(object):
r"""
... | kervi/kervi | kervi-core/kervi/dashboards/__init__.py | Python | mit | 9,756 | 0.004818 |
#!/usr/bin/python3
#
# Checks that the upstream DNS has been set correctly and that
# TLS certificates have been signed, etc., and if not tells the user
# what to do next.
import sys, os, os.path, re, subprocess, datetime, multiprocessing.pool
import dns.reversename, dns.resolver
import dateutil.parser, dateutil.tz
i... | nstanke/mailinabox | management/status_checks.py | Python | cc0-1.0 | 41,760 | 0.024315 |
# coding=utf-8
from HTMLParser import HTMLParser
# Class for stripping HTML from text.
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
# Replaces HTML entities with actual characters.
... | strugee/pumptweet | pumptweet/MLStripper.py | Python | mit | 831 | 0.038882 |
# coding: utf-8
from orgprobe.result import Result
import logging
def test_unicode():
title = u"Some text here with a \u00a3 sign"
r = Result('ok', 200, title=title)
assert isinstance(title, unicode)
assert r.title == "Some text here with a £ sign"
assert isinstance(r.title, str)
assert str(... | openrightsgroup/OrgProbe | test/test_result.py | Python | gpl-3.0 | 936 | 0.004296 |
import sys
#sys.path.append("")
from PySide import QtCore, QtGui
import FreeCADGui
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent = None):
super(MainWindow, self).__init__(parent)
from PySide import QtNetwork
# Webkit is used to create icons from SVG files. This could cause... | bblacey/FreeCAD-MacOS-CI | src/Tools/embedded/PySide/mainwindow2.py | Python | lgpl-2.1 | 1,203 | 0.012469 |
# Dungeon.py
# builds a random dungeon of size MxN
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))+'/../')
from bearlibterminal import terminal as term
from copy import deepcopy
from random import choice, randint, shuffle
from collections import namedtuple
from tools import bresenhams... | whitegreyblack/Spaceship | spaceship/classes/dungeon.py | Python | mit | 25,031 | 0.004115 |
import theano
import theano.tensor as T
from theano.sandbox.cuda.basic_ops import (as_cuda_ndarray_variable,
host_from_gpu,
gpu_contiguous, HostFromGpu,
gpu_alloc_empty)
from theano.sandbox.... | yilei0620/3D_Conditional_Gan | lib/ops.py | Python | mit | 4,533 | 0.015442 |
# -*- coding: latin-1 -*-
#retriever
"""Retriever script for direct download of vertnet-amphibians data"""
import os
from builtins import str
from pkg_resources import parse_version
from retriever.lib.models import Table
from retriever.lib.templates import Script
try:
from retriever.lib.defaults import VERSION
... | henrykironde/deletedret | scripts/vertnet_amphibians.py | Python | mit | 10,575 | 0.000567 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | TakayukiSakai/tensorflow | tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py | Python | apache-2.0 | 5,029 | 0.000994 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | Juniper/nova | nova/tests/unit/virt/xenapi/test_vm_utils.py | Python | apache-2.0 | 98,282 | 0.000824 |
from rest_framework import status
from rest_framework.authtoken.models import Token
from django.utils.translation import ugettext_lazy as _
from rest_framework.test import APITestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from drfpasswordless.settings import api_settings, DEFAUL... | aaronn/django-rest-framework-passwordless | tests/test_verification.py | Python | mit | 8,084 | 0.002474 |
import sys
import unittest
from unittest import mock
import luigi
import luigi_slack.api
from luigi_slack.api import SlackBot
from luigi_slack.api import notify
from luigi_slack.events import *
class TestSlackBot(unittest.TestCase):
def setUp(self):
self.patcher = mock.patch('luigi_slack.api.SlackAPI')
... | bonzanini/luigi-slack | tests/test_api.py | Python | mit | 5,897 | 0.001696 |
# -*- coding: utf-8 -*-
# store User and Token tables in the memory
DATABASES = {
'default': {
'backend': 'aiorest_ws.db.backends.sqlite3',
'name': ':memory:'
}
}
| Relrin/aiorest-ws | examples/auth_token/settings.py | Python | bsd-3-clause | 187 | 0 |
from django.test import TestCase
from django.views.generic import TemplateView
from django.contrib.contenttypes.models import ContentType
from jsonattrs import models, mixins
from . import factories
class XLangLabelsTest(TestCase):
def test_dict(self):
res = mixins.template_xlang_labels({'en': 'Field 1'... | Cadasta/django-jsonattrs | tests/test_mixins.py | Python | agpl-3.0 | 6,431 | 0 |
# -*- coding: utf-8 -*-
"""
twython.streaming.types
~~~~~~~~~~~~~~~~~~~~~~~
This module contains classes and methods for :class:`TwythonStreamer` to use.
"""
class TwythonStreamerTypes(object):
"""Class for different stream endpoints
Not all streaming endpoints have nested endpoints.
User Streams and S... | dakiri/splunk-app-twitter | twitter2/bin/twython/streaming/types.py | Python | apache-2.0 | 2,822 | 0.002126 |
#This line asks the user to input an integer that will be recorded as my age
my_age = input("Enter your age:")
#This line asks the user to input an integer that will be recorded as days_in_a_year
days_in_a_year = input("How many days are in a year?")
#This line states how many hours are in a day
hours_in_a_day = 24
#Th... | chrisortman/CIS-121 | k0458928/assignment04.py | Python | mit | 914 | 0.014223 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2006 Donald N. Allingham
#
# 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 t... | arunkgupta/gramps | gramps/gen/datehandler/_date_es.py | Python | gpl-2.0 | 6,538 | 0.017781 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 14. 先頭からN行を出力
import sys
if len(sys.argv) != 3:
print("Usage: python {} filename [num]".format(sys.argv[0]))
sys.exit()
with open(sys.argv[1]) as f:
print("".join(f.readlines()[:int(sys.argv[2])]))
| jtwp470/my-programming-learning-book | nlp100/python/14.py | Python | unlicense | 278 | 0 |
import Queue
import copy
laby = []
spots = []
def isInt(c):
try:
int(c)
return True
except:
return False
def shortestPath(map, start, dest):
height = len(map[0])
width = len(map)
dist = [[-1 for y in range(height)] for x in range(width)]
prev = [[None for y in range(height)] for x in range... | tbjoern/adventofcode | Twentyfour/script.py | Python | mit | 2,404 | 0.037022 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# 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 ... | tomkralidis/geonode | geonode/messaging/consumer.py | Python | gpl-3.0 | 9,159 | 0.001201 |
#!/usr/bin/env python
#
# This file contains utilities for understanding dependencies between python
# source files and tests.
#
# Utils are assumed to be used from top level ray/ folder, since that is how
# our tests are defined today.
#
# Example usage:
# To find all circular dependencies under ray/python/:
# ... | ray-project/ray | ci/travis/py_dep_analysis.py | Python | apache-2.0 | 11,800 | 0.000508 |
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | flexiant/xen | tools/python/xen/util/xmlrpcclient.py | Python | gpl-2.0 | 4,533 | 0.001985 |
#!/usr/bin/env python3
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free S... | nirbheek/cerbero | cerbero/tools/osxrelocator.py | Python | lgpl-2.1 | 5,546 | 0.000721 |
from PIL import Image, ImageDraw, ImageFont
class Image_unread_message:
def open(self,path):
self.im=Image.open(path)
return True
def __init__(self):
self.fnt=None
self.im=None
def setFont(self,font_path,size):
self.fnt=ImageFont.truetype(font_path,size)
return True
def draw_text(self,position,str,col... | snailwalker/python | burness/0000/test.py | Python | mit | 607 | 0.07084 |
# Copyright 2018 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 re
import subprocess
import sys
import six
_RE_INFO_USER_EMAIL = r'Logged in as (?P<email>\S+)\.$'
class AuthorizationError(Exception):
pass
d... | scheib/chromium | tools/perf/core/services/luci_auth.py | Python | bsd-3-clause | 1,316 | 0.009878 |
"""Python 2.x/3.x compatibility tools"""
import sys
__all__ = ['geterror', 'long_', 'xrange_', 'ord_', 'unichr_',
'unicode_', 'raw_input_', 'as_bytes', 'as_unicode']
def geterror ():
return sys.exc_info()[1]
try:
long_ = long
except NameError:
long_ = int
try:
xrange_ = xrange
except Nam... | GertBurger/pygame_cffi | pygame/compat.py | Python | lgpl-2.1 | 2,767 | 0.004698 |
# -*- coding: utf-8 -*-
import sys
import os.path
import subprocess
import json
import string
import tempfile
import shutil
import threading
import exceptions
import errno
from collections import defaultdict
from xml.etree import ElementTree
import nixops.statefile
import nixops.backends
import nixops.logger
import ni... | beni55/nixops | nixops/deployment.py | Python | lgpl-3.0 | 46,436 | 0.004427 |
import DistributedLawnDecor
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.ShowBase import *
import GardenGlobals
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.toontowngui import TTDialog
from toontown.toonbase import TTLocalizer
from pand... | ksmit799/Toontown-Source | toontown/estate/DistributedStatuary.py | Python | mit | 5,336 | 0.002436 |
"""Mongodb implementations of repository sessions."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods allow... | birdland/dlkit-doc | dlkit/mongo/repository/sessions.py | Python | mit | 237,798 | 0.001409 |
"""Errors
This module implements a set of standard HTTP Errors.
"""
import json
import traceback
try:
from html import escape
except ImportError:
from cgi import escape # Deprecated since version 3.2
try:
from urllib.parse import urljoin as _urljoin
except ImportError:
from urlparse import urljoin a... | nizox/circuits | circuits/web/errors.py | Python | mit | 7,638 | 0.000262 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.