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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# created by chris@drumminhands.com
# modified by varunmehta
# see instructions at http://www.drumminhands.com/2014/06/15/raspberry-pi-photo-booth/
import atexit
import glob
import logging
import math
import os
import subprocess
import sys
import time
import traceback
from time import sleep
impo... | varunmehta/photobooth | photobooth.py | Python | mit | 12,204 | 0.002786 |
from serial_settings import SerialSettings
class AbstractStream(object):
def __init__(self, config, name):
"""
:type name: str
"""
self.config = config
self.name = name
def open(self):
raise NotImplementedError
def close(self):
raise... | ThomasGerstenberg/serial_monitor | stream/__init__.py | Python | bsd-3-clause | 551 | 0 |
#!/usr/bin/env python
"""
Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile
Read the given picklefile as a series of key/value pairs and write to a new
database. If the database already exists, any contents are deleted. The
optional flags indicate the type of the output database:
-a - open ... | google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pickle2db.py | Python | apache-2.0 | 4,089 | 0.000734 |
# Import time (for delay) library (for SmartHome api) and GPIO (for raspberry pi gpio)
from library import SmartHomeApi
import RPi.GPIO as GPIO
import time
from datetime import datetime
# 7 -> LED
# Create the client with pre-existing credentials
api = SmartHomeApi("http://localhost:5000/api/0.1", id=10, api_key="ap... | How2Compute/SmartHome | cli/demo2.py | Python | mit | 1,643 | 0.008521 |
# coding=UTF-8
"""
tests for overrides
"""
import datetime
import mock
import pytz
from nose.plugins.attrib import attr
from ccx_keys.locator import CCXLocator
from courseware.courses import get_course_by_id
from courseware.field_overrides import OverrideFieldData
from courseware.testutils import FieldOverrideTestMixi... | shabab12/edx-platform | lms/djangoapps/ccx/tests/test_overrides.py | Python | agpl-3.0 | 7,563 | 0.001587 |
"""
Pynt is a Python client that wraps the Open Beer Database API.
Questions, comments? m@h0ke.com
"""
__author__ = "Matthew Hokanson <m@h0ke.com>"
__version__ = "0.2.0"
from beer import Beer
from brewery import Brewery
from request import Request
from settings import Settings
| h0ke/pynt | pynt/pynt.py | Python | mit | 290 | 0 |
import click
import os
import os.path
import ntpath
import serial
import sys
import prosflasher.ports
import prosflasher.upload
import prosconfig
from proscli.utils import default_cfg, AliasGroup
from proscli.utils import get_version
@click.group(cls=AliasGroup)
def flasher_cli():
pass
@flashe... | purduesigbots/purdueros-cli | proscli/flasher.py | Python | bsd-3-clause | 8,643 | 0.003934 |
"""
Segregation of pymongo functions from the data modeling mechanisms for split modulestore.
"""
import datetime
import logging
import math
import re
import zlib
from contextlib import contextmanager
from time import time
import pymongo
import pytz
import six
from six.moves import cPickle as pickle
from contracts i... | stvstnfrd/edx-platform | common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py | Python | agpl-3.0 | 23,649 | 0.002241 |
from models import *
donation = Donation()
donor = Donor()
donor.first_name = "FirstName"
donor.last_name = "LastName"
print(donor)
| kylebegovich/ICIdo | mainsite/temp.py | Python | mit | 138 | 0.007246 |
import Orange
import logging
import random
from discretization import *
from FeatureSelector import *
from utils import *
from sklearn import svm
from sklearn import cross_validation
from sklearn.metrics import f1_score, precision_recall_fscore_support
from sklearn.feature_extraction import DictVectorizer
import numpy ... | Sh1n/AML-ALL-classifier | main.py | Python | gpl-2.0 | 5,647 | 0.015583 |
#
# __init__.py
#
# Copyright (C) 2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Module for board specific settings
#
import importlib
import re
import pkgutil
from kano.logging import logger
from kano.utils.hardware import RPI_1_CPU_PROFILE, get_board_property, \
get_r... | KanoComputing/kano-settings | kano_settings/system/boards/__init__.py | Python | gpl-2.0 | 1,199 | 0 |
import mock
from pantsmud.driver import hook
from spacegame.core import hook_types
from spacegame.universe.star_system import StarSystem
from spacegame.universe.universe import Universe
from tests.unit.util import UnitTestCase
class StarSystemUnitTestCase(UnitTestCase):
def setUp(self):
UnitTestCase.setUp... | ecdavis/spacegame | tests/unit/test_star_system.py | Python | apache-2.0 | 3,976 | 0.002012 |
# -*- coding: utf8 -*-
class Mv:
def command(self):
self.config = {
"command": {
"mv": {
"function": self.mvScreams,
"usage": "mv <user>",
"help": "Le clavier y colle!"
}
}}
return self.config
def mvScreams(se... | Morphux/IRC-Bot | modules/mv/mv.py | Python | gpl-2.0 | 1,360 | 0.001472 |
#!/usr/bin/env python3
#
# Copyright 2013 The Flutter 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 argparse
import zipfile
import os
import sys
def _zip_dir(path, zip_file, prefix):
path = path.rstrip('/\\')
for root, d... | jamesr/sky_engine | build/zip.py | Python | bsd-3-clause | 1,167 | 0.011997 |
class Solution(object):
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
is_modified = False
for i in xrange(len(nums) - 1):
if nums[i] > nums[i+1]:
if is_modified:
return False
... | Chasego/cod | leetcode/665-Non-decreasing-Array/NonDecreasingArr.py | Python | mit | 567 | 0.001764 |
from setuptools import setup ; setup()
| karpierz/libpcap | setup.py | Python | bsd-3-clause | 39 | 0.051282 |
#!/usr/bin/env python
"""
Prototype to DOT (Graphviz) converter by Dario Gomez
Table format from django-extensions
"""
from protoExt.utils.utilsBase import Enum, getClassName
from protoExt.utils.utilsConvert import slugify2
class GraphModel():
def __init__(self):
self.tblStyle = False
... | DarioGT/docker-carra | src/prototype/actions/graphModel.py | Python | mit | 8,442 | 0.014215 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import unittest
from bs4 import BeautifulSoup
from compute.code import CodeExtractor
logging.basicConfig(level=logging.INFO, format="%(message)s")
class ExtractCodeTest(unittest.TestCase):
def setUp(self):
... | andrewhead/Package-Qualifiers | tests/compute/test_compute_code.py | Python | mit | 4,317 | 0.001853 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-19 00:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20160218_2359'),
]
operations = [... | Golker/wttd | eventex/core/migrations/0003_contact.py | Python | mit | 822 | 0.00365 |
import unittest
import sys
import os
sys.path.append(os.environ.get("PROJECT_ROOT_DIRECTORY", "."))
from moduledependency.tokeniser import Token, Tokeniser
class TestToken(unittest.TestCase):
def test_construction(self):#
# Test with invalid token type
with self.assertRaises(ValueError):
Token(... | DonaldWhyte/module-dependency | tests/test_tokeniser.py | Python | mit | 6,029 | 0.026373 |
import logging
import os
import json
import shutil
import sys
import datetime
import csv, math
from tld import get_tld
from collections import OrderedDict
from utils import Util
from components.data.data import Data
from components.iana.iana_transform import IanaTransform
from components.nc.network_context import Net... | kpeiruza/incubator-spot | spot-oa/oa/dns/dns_oa.py | Python | apache-2.0 | 17,663 | 0.018174 |
# encoding: utf-8
"""
IMPORTANT - COLOUR SUPPORT IS CURRENTLY EXTREMELY EXPERIMENTAL. THE API MAY CHANGE, AND NO DEFAULT
WIDGETS CURRENTLY TAKE ADVANTAGE OF THEME SUPPORT AT ALL.
"""
import curses
from . import global_options
def disable_color():
global_options.DISABLE_ALL_COLORS = True
def enable_color():
... | tescalada/npyscreen-restructure | npyscreen/ThemeManagers.py | Python | bsd-2-clause | 4,810 | 0.005821 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('naf_autoticket', '0023_hostdevice_hostlocation'),
]
operations = [
migrations.CreateModel(
name='AlertCorrelatio... | kevinnguyeneng/django-uwsgi-nginx | app/naf_autoticket/migrations/0024_alertcorrelationweight.py | Python | gpl-3.0 | 1,043 | 0.002876 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pythymio
import random
from gardenworld import *
init('info2_1')
with pythymio.thymio(["acc"],[]) as Thym:
state = dict([])
state["time"] = 0
state["delay"] = 10
def dispatch(evtid, evt_name, evt_args):
# https://www.thymio.org/en:thymioapi pr... | pierreboudes/pyThymio | garden_real.py | Python | lgpl-3.0 | 1,328 | 0.003765 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Week 2: Project 1: Download and print json from reddit's main page.
This file contains methods to download and parse Reddit.com's main page.
One could do this hourly to sample reddit activity, and plot it over some metric.
hmmm....
CHANGELOG
version 1.1. Fixed bug ... | oxfordinternetinstitute/scriptingcourse | Lecture 2/PR_printRedditJson1.1.py | Python | gpl-3.0 | 3,376 | 0.039396 |
# encoding: utf-8
import os
def emulator_rom_launch_command(emulator, rom):
"""Generates a command string that will launch `rom` with `emulator` (using
the format provided by the user). The return value of this function should
be suitable to use as the `Exe` field of a Steam shortcut"""
# Normalizing the stri... | scottrice/Ice | ice/emulators.py | Python | mit | 1,887 | 0.015898 |
# CVS conversion code inspired by hg-cvs-import and git-cvsimport
import os, locale, re, socket
from cStringIO import StringIO
from mercurial import util
from common import NoRepo, commit, converter_source, checktool
class convert_cvs(converter_source):
def __init__(self, ui, path, rev=None):
super(conve... | carlgao/lenga | images/lenny64-peon/usr/share/python-support/mercurial-common/hgext/convert/cvs.py | Python | mit | 11,997 | 0.001584 |
#!/usr/bin/env python
##\author Dominik Kirchner
##\brief Publishes diagnostic messages for diagnostic aggregator unit test
from debian.changelog import keyvalue
PKG = 'rosha_repair_executor'
import roslib; roslib.load_manifest(PKG)
import rospy
from time import sleep
#from diagnostic_msgs.msg import DiagnosticA... | cott81/rosha | rosha/rosha_repair_executor/test/repair_action_RedundantLoc.py | Python | lgpl-3.0 | 905 | 0.01989 |
# -- coding: utf-8 --
# ===========================================================================
# eXe
# Copyright 2012, Pedro Peña Pérez, Open Phoenix IT
#
# 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 Softwar... | exelearning/iteexe | exe/export/cmdlineexporter.py | Python | gpl-2.0 | 6,556 | 0.002289 |
#!/usr/bin/python
#Pyxis and Original Sipie: Sirius Command Line Player
#Copyright (C) Corey Ling, Eli Criffield
#
#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, ... | ebruck/pyxis | pyxis/Player.py | Python | gpl-2.0 | 1,159 | 0.014668 |
from plata.payment.modules import cod
from django.shortcuts import redirect
from feincms.content.application.models import app_reverse
class CodPaymentProcessor(cod.PaymentProcessor):
def redirect(self, url_name):
return redirect(app_reverse(url_name,
'simpleshop.urls')) | sbaechler/simpleshop | simpleshop/payment_modules.py | Python | bsd-3-clause | 320 | 0.00625 |
#!/bin/python3
def aVeryBigSum(n, ar):
return sum(ar)
n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
result = aVeryBigSum(n, ar)
print(result)
| sazzadBuet08/programming-contest | hackar_rank/infolytx_mock_hackar_rank/ABigSum.py | Python | apache-2.0 | 176 | 0 |
## mostly copied from: http://norvig.com/spell-correct.html
import sys, random
import re, collections, time
TXT_FILE='';
BUF_DIR='';
NWORDS=None;
def words(text): return re.findall('[a-z]+', text)
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
r... | xulesc/spellchecker | impl1.py | Python | gpl-3.0 | 1,898 | 0.029505 |
# -*- coding: utf-8 -*-
import time
import re
from cStringIO import StringIO
from Sycamore import wikiutil
from Sycamore import config
from Sycamore import wikidb
from Sycamore import user
from Sycamore.Page import Page
def execute(macro, args, formatter=None):
if not formatter:
formatter = macro.format... | rtucker/sycamore | Sycamore/macro/allusers.py | Python | gpl-2.0 | 12,303 | 0.003658 |
from __future__ import print_function, division, unicode_literals
from pprint import pprint
from itertools import groupby
from functools import wraps
from collections import namedtuple, deque
# OrderedDict was added in 2.7. ibm6 still uses python2.6
try:
from collections import OrderedDict
except ImportError:
... | jmbeuken/abinit | tests/pymods/memprof.py | Python | gpl-3.0 | 12,121 | 0.00693 |
from datetime import datetime
from csv import DictReader
from django.core.management.base import BaseCommand, CommandError
from property.models import Property, Owner, MailingAddress, Assessment, Building, Sale
class Command(BaseCommand):
help = 'Imports property from CSV file'
def add_arguments(self, parser)... | Code4Maine/suum | suum/apps/property/management/commands/import_property_csv.py | Python | bsd-3-clause | 2,559 | 0.010942 |
import urllib2
import re
JIRA_URL='https://bugreports.qt-project.org/browse'
class JIRA:
__instance__ = None
# Helper class
class Bug:
CREATOR = 'QTCREATORBUG'
SIMULATOR = 'QTSIM'
SDK = 'QTSDK'
QT = 'QTBUG'
QT_QUICKCOMPONENTS = 'QTCOMPONENTS'
# constructor of ... | hdweiss/qt-creator-visualizer | tests/system/shared/workarounds.py | Python | lgpl-2.1 | 9,260 | 0.005508 |
from decimal import Decimal
from unittest import TestCase
from StringIO import StringIO
import simplejson as json
class TestDecimal(TestCase):
NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500"
def dumps(self, obj, **kw):
sio = StringIO()
json.dump(obj, sio, **kw)
res = json.... | geary/claslite | web/app/lib/simplejson/tests/test_decimal.py | Python | unlicense | 1,752 | 0.002854 |
"""OriginalityReports API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class OriginalityReportsAPI(BaseCanvasAPI):
"""OriginalityReports... | tylerclair/py3canvas | py3canvas/apis/originality_reports.py | Python | mit | 24,351 | 0.001766 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 23 2017 at 14:20
@author: Mathias Aschwanden (mathias.aschwanden@gmail.com)
Makes various Variables available to the user.
IMPORTANT: All data has been included without warranty, express or implied.
References:
Molar Masses : From Wikipedia.org
"""
from . impor... | maschwanden/boxsimu | boxsimu/builtins.py | Python | mit | 834 | 0.002398 |
# This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use local.py
import dj_database_url
from funfactory.settings_base import *
# Django Settings
##############################################################################
# Note: be sure not ... | jgmize/nucleus | nucleus/settings/base.py | Python | bsd-3-clause | 4,534 | 0.000221 |
from makerUtilities import writeFile
from makerUtilities import readFile
import os
def scaffold(systemDir, defaultTheme):
return (
"""<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src='file://"""
+ os.path.join(systemDir, "jquery.min.js")
+ """'></script... | geraldspreer/the-maker | makerTemplateViewBuilder.py | Python | gpl-3.0 | 7,622 | 0.009315 |
import re
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy.sql.sqltypes import DateTime
from alembic import autogenerate
from alembic.migration import MigrationContext
from alembic.testing import eq_... | sqlalchemy/alembic | tests/test_autogen_composition.py | Python | mit | 16,541 | 0 |
"""
base 36 encoding/decoding taken from wikipedia sample code
http://en.wikipedia.org/wiki/Base_36#Python_Conversion_Code
"""
def encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"""Converts an integer to a base36 string."""
if not isinstance(number, (int, long)):
raise TypeError('num... | dkm/skylines | skylines/lib/base36.py | Python | agpl-3.0 | 746 | 0 |
from django.contrib import admin
from helpcenter import models
class ArticleAdmin(admin.ModelAdmin):
""" Admin for the Article model """
date_hierarchy = 'time_published'
fieldsets = (
(None, {
'fields': ('category', 'title', 'body')
}),
('Publishing Options', {
... | smalls12/django_helpcenter | helpcenter/admin.py | Python | mit | 883 | 0 |
# Copyright (C) 2013 Bernd Feige
# This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING).
"""
Presentation utilities.
"""
from . import trgfile
class PresLog(object):
# Basic log file reading.
def __init__(self,logfile,part='events'):
'''part can be 'events' or 'trials' for the first or sec... | berndf/avg_q | python/avg_q/Presentation.py | Python | gpl-3.0 | 3,161 | 0.043341 |
"""empty message
Revision ID: c626e32ddcc
Revises: None
Create Date: 2016-01-23 14:47:09.205628
"""
# revision identifiers, used by Alembic.
revision = 'c626e32ddcc'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... | athkishore/vgr | migrations/versions/c626e32ddcc_.py | Python | mit | 2,615 | 0.01262 |
'''
Compute Hilbert Class Polynomials
'''
from mpmath import *
import mpmath
round = lambda x: mpmath.floor(x + 0.5)
def hilbert(d):
'''
Compute Hilbert Class Polynomial.
Follows pseudo code from Algorithm 7.5.8
Args:
d: fundamental discriminant
Returns:
Hilbert class number, Hil... | root-z/ECPP | hilbert.py | Python | gpl-2.0 | 4,207 | 0.002377 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_custom_forms_async.py | Python | mit | 6,386 | 0.004071 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('comercial', '0053_auto_20151118_1323'),
]
operations = [
migrations.AddField(
model_name='tipodeproposta',
... | dudanogueira/microerp | microerp/comercial/migrations/0054_tipodeproposta_tipo_contrato_mapeado.py | Python | lgpl-3.0 | 472 | 0.002119 |
from lokp.models import DBSession
from lokp.protocols.activity_protocol import ActivityProtocol
from lokp.review.review import BaseReview
class ActivityReview(BaseReview):
def __init__(self, request):
super(ActivityReview, self).__init__(request)
self.protocol = ActivityProtocol(DBSession)
| CDE-UNIBE/lokp | lokp/review/activities.py | Python | gpl-3.0 | 314 | 0 |
from sys import stdin
import signal
# for i in xrange(1,10):
# print "Stuff", i
# print stdin.readline()
import os
pid = int(stdin.readline().strip())
print pid
os.kill(pid, signal.SIGINT) | sbarton272/StreetPong | IPC/printer.py | Python | apache-2.0 | 195 | 0.005128 |
#
# Test database for rsvndump
# written by Jonas Gehring
#
import os
import test_api
def info():
return "Add after delete test"
def setup(step, log):
if step == 0:
os.mkdir("dir1")
f = open("dir1/file1","wb")
print >>f, "hello1"
print >>f, "hello2"
f = open("dir1/file2","wb")
print >>f, "hello3"
... | jgehring/rsvndump | tests/db/tests/delete_add.py | Python | gpl-3.0 | 1,440 | 0.046528 |
#!/usr/bin/env python
# coding: utf-8
from setuptools import setup, find_packages
from b2tob3 import VERSION
with open('README.rst') as f:
README = f.read()
with open('LICENSE') as f:
LICENSE = f.read()
setup(
name='b2tob3',
version=VERSION,
packages=find_packages(),
long_description=README,... | metrey/b2tob3 | setup.py | Python | mit | 935 | 0.001071 |
from utils.edit_configs import get_json
class Logger:
config = get_json('server_configs')
log_config = {}
_instances = {}
@staticmethod
def get_singleton(client):
if client.shard_id not in Logger._instances:
Logger._instances[client.shard_id] = Logger()
return Logger.... | initzx/aobot | utils/logger.py | Python | gpl-3.0 | 3,201 | 0.002812 |
"""
This package is a set of utilities and methods for building mime messages.
"""
import uuid
from flanker import _email
from flanker.mime import DecodingError
from flanker.mime.message import ContentType, scanner
from flanker.mime.message.headers import WithParams
from flanker.mime.message.headers.parametrized impo... | mailgun/flanker | flanker/mime/create.py | Python | apache-2.0 | 2,803 | 0 |
from django.conf.urls.defaults import *
urlpatterns = patterns('japos.dashboards.views',
(r'^$', 'index')
) | jyr/japos | dashboards/urls.py | Python | gpl-2.0 | 112 | 0.017857 |
quicksort(A, lo, hi):
if lo < hi:
p := partition(A, lo, hi)
quicksort(A, lo, p - 1)
quicksort(A, p + 1, hi)
| Chasego/codi | util/basic/quicksort.py | Python | mit | 120 | 0.008333 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Common functions
import os, sys
lib_path = os.path.abspath( os.path.join( '..', '..', 'lib' ) )
sys.path.append(lib_path)
from commons import *
from overpasser import *
from routing import *
from feriados import *
from make_json import *
def lower_capitalized(input):
o... | Skippern/PDF-scraper-Lorenzutti | creators/seletivo/common.py | Python | gpl-3.0 | 1,983 | 0.013138 |
'''
This case can not execute parallelly.
This case will calculate max available VMs base on 1 host available disk space.
The it will try to create all VMs at the same time to see if zstack could
handle it.
@author: Youyk
'''
import os
import sys
import threading
import time
import random
import zst... | zstackorg/zstack-woodpecker | integrationtest/vm/virt_plus/other/test_parallel_crt_vm_to_use_all_disk.py | Python | apache-2.0 | 5,980 | 0.009532 |
# Copyright (c) 2017 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.Application import Application
from UM.Message import Message
from UM.Version import Version
from UM.Logger import Logger
from UM.Job import Job
import urllib.request
import platform
import json
import codecs
f... | thopiekar/Uranium | plugins/UpdateChecker/UpdateCheckerJob.py | Python | lgpl-3.0 | 4,818 | 0.009755 |
f_source = open('../talker/workfile', 'w')
f_gold = open('../listener/workfile', 'w')
for i in range(100000):
f_source.write('0123456789abcdef')
f_gold.write('0123456789abcdef')
| ncos/hometasks | Lunev/programming/star_1/stable/tests/file_generator.py | Python | mit | 193 | 0.010363 |
from django.contrib import admin
from . import models
| sachinkum/Bal-Aveksha | WebServer/Authentications/admin.py | Python | gpl-3.0 | 54 | 0 |
from test_support import verbose, TestFailed
if verbose:
print "Testing whether compiler catches assignment to __debug__"
try:
compile('__debug__ = 1', '?', 'single')
except SyntaxError:
pass
import __builtin__
prev = __builtin__.__debug__
setattr(__builtin__, '__debug__', 'sure')
setattr(__... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/test/test_compile.py | Python | gpl-3.0 | 3,243 | 0.005242 |
# Run with nosetests tests/test_slave_cli.py
import debile.slave.cli as slave
def test_parse_args():
args = slave.parse_args(['--auth', 'simple', '--config', \
'/etc/debile/slave.yaml', '-s', '-d'])
assert args.auth_method == 'simple'
assert args.config == '/etc/debile/slave.yaml'
assert ... | lucaskanashiro/debile | tests/test_slave_cli.py | Python | mit | 370 | 0.010811 |
# -*- encoding: utf-8 -*-
"""Implements different locators for UI"""
from selenium.webdriver.common.by import By
from .model import LocatorDict
NAVBAR_PATH = (
'//div[contains(@class,"navbar-inner") and '
'not(contains(@style, "display"))]'
)
MENU_CONTAINER_PATH = NAVBAR_PATH + '//ul[@id="menu"]'
ADM_MENU_CO... | elyezer/robottelo | robottelo/ui/locators/menu.py | Python | gpl-3.0 | 10,740 | 0 |
"""
Public exercise API.
"""
from twisted.protocols import amp
from txampext.errors import Error
class UnknownExercise(Error):
"""The exercise was not recognized.
"""
class GetExercises(amp.Command):
"""
Gets the identifiers and titles of some exercises.
"""
arguments = [
(b"solved... | crypto101/clarent | clarent/exercise.py | Python | isc | 1,105 | 0.002715 |
from django.db.models.fields import Field
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.constants import GIS_LOOKUPS
from django.contrib.gis.db.models.lookups import GISLookup
from ... | lecaoquochung/ddnb.django | django/contrib/gis/db/models/fields.py | Python | bsd-3-clause | 12,573 | 0.000954 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | jjshoe/ansible-modules-core | cloud/vmware/vsphere_guest.py | Python | gpl-3.0 | 65,239 | 0.001456 |
#!/usr/bin/env python
# Copyright 2015 Luminal, 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 o... | 3stack-software/credsmash | credsmash/__init__.py | Python | apache-2.0 | 686 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of pywebmachine released under the MIT license.
# See the NOTICE for more information.
class Resource(object):
def __init__(self, req, rsp):
pass
def allowed_methods(self, req, rsp):
return ["GET", "HEAD"]
def allow_missing_post(self, req, r... | benoitc/pywebmachine | pywebmachine/resource.py | Python | mit | 3,011 | 0.004982 |
# -*- coding: utf-8 -*-
#
# RedPipe documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 19 13:22:45 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.
#
# A... | 72squared/redpipe | docs/conf.py | Python | mit | 5,400 | 0 |
#!/usr/bin/env python3
__all__ = [
'get_client', 'Client', 'ThriftServer', 'Struct', 'BadEnum', 'Error',
'ApplicationError', 'TransportError', 'SSLPolicy',
]
try:
from thrift.py3.client import get_client, Client
except ImportError:
__all__.remove('Client')
__all__.remove('get_client')
try:
fro... | SergeyMakarenko/fbthrift | thrift/lib/py3/__init__.py | Python | apache-2.0 | 800 | 0 |
#!/usr/local/bin/python3 -u
"""
Author: Oliver Ratzesberger <https://github.com/fxstein>
Copyright: Copyright (C) 2016 Oliver Ratzesberger
License: Apache License, Version 2.0
"""
# Make sure we have access to SentientHome commons
import os
import sys
try:
sys.path.append(os.path.dirname(os.pat... | fxstein/SentientHome | rules/plugin.rules.py | Python | apache-2.0 | 3,196 | 0.000626 |
#!/usr/bin/env python2
##
## We define Instrution as two types "Computing instruction" and "Control Transfer instruction"
## for computing instruction
## "NAME" : [ Operand_Number , [ Formula_that_modify_reg ], [ FLAG_reg_modified]]
## for control transfter instruciton
## "NAME" : [ Operand_Number , [ Formula_tha... | XiaofanZhang/ROPgadget | ropgadget/ropparse/arch/parserx86.py | Python | gpl-2.0 | 17,183 | 0.013967 |
from typing_extensions import Protocol
# noinspection PyPropertyDefinition
class UserLike(Protocol):
@property
def is_active(self) -> bool: ...
@property
def is_authenticated(self) -> bool: ...
@property
def is_anonymous(self) -> bool: ...
| MarauderXtreme/sipa | sipa/backends/types.py | Python | mit | 268 | 0 |
import re
from threading import Thread
import time
from django.core.management.base import BaseCommand
import requests
from mittab.apps.tab.models import Round, TabSettings
from mittab.apps.tab.management.commands import utils
class Command(BaseCommand):
help = "Load test the tournament, connecting via localhos... | jolynch/mit-tab | mittab/apps/tab/management/commands/load_test.py | Python | mit | 4,345 | 0.001611 |
#!/usr/bin/env python
import json
import requests
from requests.auth import HTTPBasicAuth
import urlparse
import time
class PEACInfo:
def __init__(self, url, method):
self.url = url
self.method = method
self.headers = {
'accept': 'application/json',
'Content-Type': '... | OSUrobotics/peac_bridge | src/peac_bridge/peac_client.py | Python | bsd-3-clause | 3,420 | 0.003509 |
from abc import abstractmethod, ABCMeta
import numpy as np
from lolopy.loloserver import get_java_gateway
from lolopy.utils import send_feature_array, send_1D_array
from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin, is_regressor
from sklearn.exceptions import NotFittedError
__all__ = ['RandomFor... | CitrineInformatics/lolo | python/lolopy/learners.py | Python | apache-2.0 | 23,987 | 0.004586 |
"""Time offset classes for use with cftime.datetime objects"""
# The offset classes and mechanisms for generating time ranges defined in
# this module were copied/adapted from those defined in pandas. See in
# particular the objects and methods defined in pandas.tseries.offsets
# and pandas.core.indexes.datetimes.
# ... | shoyer/xarray | xarray/coding/cftime_offsets.py | Python | apache-2.0 | 35,760 | 0.001091 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsMapLayer
.. note:: 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.
"""
__auth... | stevenmizuno/QGIS | tests/src/python/test_qgsmaplayer.py | Python | gpl-2.0 | 4,223 | 0.000474 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | sfriesel/suds | suds/sax/parser.py | Python | lgpl-3.0 | 4,378 | 0.000228 |
# -*- coding: utf-8 -*-
from model.group import Group
def test_add_group(app):
old_groups = app.group.get_group_list()
group = Group(name="hjhj", header="jhjh", footer="jhjjhhj")
app.group.create(group)
new_groups = app.group.get_group_list()
assert len(old_groups) + 1 == len(new_groups)
old_... | alenasf/Pythontest | test/test_add_group.py | Python | apache-2.0 | 813 | 0.00492 |
#!/usr/bin/python
import random
import math
import bisect
############################Zipf Generater################################
# The library of numpy.random.zipf or scipy.stats.zipf only work when
# alph > 1
class ZipfGenerator:
def __init__(self, n, alpha):
# Calculate Zeta values from 1 to n:
... | fengz10/ICN_SCM | Zipf.py | Python | gpl-2.0 | 821 | 0.015834 |
#条件过滤的要点是综合语句的构造。利用 if 剔除掉非字符串的元素。e.g:而列表生成式则可以用一行语句代替循环生成上面的list:
#>>> [x * x for x in range(1, 11)]
#[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
def toUppers(L):
return [x.upper() for x in L if isinstance(x,str)]
print (toUppers(['Hello', 'world', 101]))
| quietcoolwu/learn-python3-master | imooc/10_3.py | Python | gpl-2.0 | 365 | 0.023166 |
import logging
import os
import sys
import threading
from queue import Empty, Queue
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtCore import QMutex
from PyQt5.QtCore import QThread
from PyQt5.QtCore import QEvent
from PyQt5.QtWidgets import QTex... | CenterForOpenScience/osf-sync | osfsync/gui/qt/tray.py | Python | lgpl-3.0 | 9,674 | 0.001654 |
# coding=UTF-8
import pandas as pd
import numpy as np
import pickle
from axiomatic.base import AxiomSystem, MinMaxAxiom, MaxAxiom, MinAxiom, ChangeAxiom, IntegralAxiom
from axiomatic.base import RelativeChangeAxiom, FirstDiffAxiom, SecondDiffAxiom, TrainingPipeline
from axiomatic.axiom_training_stage import Frequency... | victorshch/axiomatic | integration_test_frequecy_axioms.py | Python | gpl-3.0 | 1,653 | 0.005445 |
"""Support for binary sensor using RPi GPIO."""
import logging
import voluptuous as vol
import requests
from homeassistant.const import CONF_HOST
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
import homeassistant.helpers.config_validation as cv
from . import (CONF_BO... | aequitas/home-assistant | homeassistant/components/remote_rpi_gpio/binary_sensor.py | Python | apache-2.0 | 3,259 | 0 |
# Python - 2.7.6
to_freud = lambda sentence: ' '.join(['sex'] * len(sentence.split(' ')))
| RevansChen/online-judge | Codewars/8kyu/freudian-translator/Python/solution1.py | Python | mit | 91 | 0.010989 |
'''tzinfo timezone information for Asia/Ashkhabad.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Ashkhabad(DstTzInfo):
'''Asia/Ashkhabad timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Ashkhabad'
... | newvem/pytz | pytz/zoneinfo/Asia/Ashkhabad.py | Python | mit | 1,535 | 0.160261 |
from django.conf.urls.defaults import *
urlpatterns = patterns('contrib.karma.views',
(r'^$', 'index'),
(r'index', 'index'),
)
| danigm/sweetter | sweetter/contrib/karma/urls.py | Python | agpl-3.0 | 136 | 0.007353 |
import sys
import os
import traceback
from django import db
sys.path.append('/root/wisely/wisely_project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'wisely_project.settings.production'
from django.db.models import F, Q
from django.utils import timezone
from users.tasks import get_coursera_courses, get_edx_courses, ge... | TejasM/wisely | wisely_project/get_courses_file.py | Python | mit | 1,721 | 0.004648 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('playbook', '0003_auto_20151028_1735'),
]
operations = [
migrations.AddField(
model_name='playbookrunhistory',
... | cycloidio/cyclosible | cyclosible/playbook/migrations/0004_playbookrunhistory_log_url.py | Python | gpl-3.0 | 441 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .util import Specification
from . import compat
class Field(Specification):
"""
Field object for adding fields to a resource schema... | tryggvib/datapackage | datapackage/schema.py | Python | gpl-3.0 | 11,045 | 0.000181 |
# -*- coding: utf-8 -*-
#
# exercise 5: more variables and printing
#
# string formating
name = 'Zed A. Shaw'
ages = 35 # not a lie
height = 74 # inched
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Let's talk about %s." % name
print "He's %d inched tall." % height
print "He's %d pounds hea... | zstang/learning-python-the-hard-way | ex5.py | Python | mit | 635 | 0.009449 |
# 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
# d... | sileht/python-gnocchiclient | gnocchiclient/tests/functional/test_benchmark.py | Python | apache-2.0 | 4,537 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# GNU GENERAL PUBLIC LICENSE
# Version 3, 29 June 2007
#
# Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
# Everyone is permitted to copy and distribute verbatim copies
# of this license document, but chang... | quentinbodinier/custom_gnuradio_blocks | python/qa_test_interp.py | Python | gpl-3.0 | 36,971 | 0.003489 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Scikit learn interface for :class:`~gensim.models.hdpmodel.HdpModel`.
Follows scikit-learn API conventions to facilitate using gensi... | midnightradio/gensim | gensim/sklearn_api/hdp.py | Python | gpl-3.0 | 8,719 | 0.004358 |
"""
Support for Yamaha Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.yamaha/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_... | betrisey/home-assistant | homeassistant/components/media_player/yamaha.py | Python | mit | 7,019 | 0 |
import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEY... | nishimotz/NVDARemote | addon/globalPlugins/remoteClient/input.py | Python | gpl-2.0 | 3,588 | 0.032609 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.