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 |
|---|---|---|---|---|---|
# Pi-Slide timelapse controller for Raspberry Pi
# This must run as root (sudo python pislide.py) due to framebuffer, etc.
#
# http://www.adafruit.com/products/998 (Raspberry Pi Model B)
# http://www.adafruit.com/products/1601 (PiTFT Mini Kit)
#
# Prerequisite tutorials: aside from the basic Raspbian setup and PiTFT s... | dcreith/PiSlide | pislide.py | Python | bsd-2-clause | 39,380 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | sileht/deb-openstack-nova | nova/tests/utils.py | Python | apache-2.0 | 3,064 |
# Copyright (C) 2009-2012 Chris Ball <cjb@laptop.org>
# W. Trevor King <wking@drexel.edu>
#
# This file is part of Bugs Everywhere.
#
# Bugs Everywhere is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Softwa... | ned14/Bugs-Everywhere-for-BEurtle | libbe/storage/base.py | Python | gpl-2.0 | 40,563 |
# coding: utf-8
#
# IL-2 FB Events Parser documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 22 10:43:38 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | IL2HorusTeam/il2fb-events-parser | docs/conf.py | Python | lgpl-3.0 | 8,504 |
import os
import errno
import sys
import logging
import collections
import shutil
import hashlib
from time import time
from datetime import datetime
from math import floor
from pkg_resources import Requirement, resource_filename, require
import yaml
try: # py3
from shlex import quote
except ImportError: # py2
... | turbulent/dockwrkr | dockwrkr/utils.py | Python | apache-2.0 | 5,344 |
import os.path
import shutil
import sys
import tarfile
import tempfile
import traceback
import urllib2
import webbrowser
try:
import simplejson as json
except ImportError:
import ioJSON
import pprint
import StringIO
from ConfigParser import SafeConfigParser
from argparse import ArgumentParser
from subprocess i... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/plugin.py | Python | mit | 38,855 |
# -*- coding:utf-8 -*-
from owlmixin import OwlMixin, TOption
from owlmixin.owlcollections import TList
from jumeaux.logger import Logger
from jumeaux.addons.reqs2reqs import Reqs2ReqsExecutor
from jumeaux.utils import when_optional_filter, jinja2_format, get_jinja2_format_error
from jumeaux.domain.config.vo import C... | tadashi-aikawa/gemini | jumeaux/addons/reqs2reqs/rename.py | Python | mit | 2,176 |
from flask import render_template
from app.comments.models import Comment
from app.pages.models import Page
from app.tags.models import Tag
from . import dashboard
@dashboard.route('/')
def index():
return render_template('dashboard/index.html',
title="Dashboard",
... | kuujakke/kolbe | app/dashboard/views.py | Python | gpl-3.0 | 495 |
"""prefix_provider
Revision ID: f8013173ef21
Revises: 9227d42a8935
Create Date: 2017-08-27 14:12:28.917330
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f8013173ef21"
down_revision = "9227d42a8935"
branch_labels = ()
depends_on = None
def upgrade():
# ... | getsentry/zeus | zeus/migrations/f8013173ef21_prefix_provider.py | Python | apache-2.0 | 871 |
'''
Created on 15 sept. 2017
@author: s047432
'''
import datetime
import time
import logging
from django.shortcuts import get_object_or_404
from rest_framework import mixins, generics, permissions
from rest_framework.exceptions import ValidationError
from variableServer.models import Variable, TestEnvir... | bhecquet/seleniumRobot-server | variableServer/views/apiView.py | Python | apache-2.0 | 12,975 |
"""Takes care of sqlite interactions with the database."""
import sqlite3
from os.path import isfile
class nNoteCore(object):
"""List and interaction with databases"""
#change to NoteCore when fully transitioned
def __init__(self):
#possible list of dbs
self.dbs = {}
self.default= ... | Ghalko/noteTaker | lib/notetaker/ncore.py | Python | mit | 18,023 |
""" Defines the PlotAxis class, and associated validator and UI.
"""
from __future__ import with_statement
# Major library import
from numpy import array, around, absolute, cos, dot, float64, inf, pi, \
sqrt, sin, transpose
# Enthought Library imports
from enable.api import ColorTrait, LineStyle
fr... | tommy-u/chaco | chaco/axis.py | Python | bsd-3-clause | 29,941 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# drawElements Quality Program utilities
# --------------------------------------
#
# Copyright 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | chadversary/deqp | scripts/check_build_sanity.py | Python | apache-2.0 | 7,391 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'findinfiles.ui'
#
# Created: Sat Feb 7 12:16:06 2015
# by: PyQt5 UI code generator 5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_FindInFiles(object):
def setupUi(... | maciekswat/Twedit | ui_findinfiles.py | Python | gpl-3.0 | 24,014 |
from rest_framework import mixins, viewsets
from rest_framework.response import Response
from assets.models import get_place_options
class PlaceOptionsViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
def list(self, request, *args, **kwargs):
return Response(get_place_options())
| jourdanrodrigues/controk-webservice | controk_webservice/assets/views.py | Python | mit | 302 |
# for python 3
# You'll need to customize this according to your needs. Proper orientation of
# the kinect is vital; if participants are able to maintain their head or wrists
# continuously inside the word rects, they will repeatedly trigger the collision
# detection
from pykinect2 import PyKinectV2
from pykinect2.PyKi... | jgerschler/ESL-Games | Kinect/Sentence Builder/Deprecated/SentenceBuilderFullScreen.py | Python | mit | 10,652 |
#!/usr/bin/env python3
import os
import sys
src_dir = os.path.abspath('src/')
sys.path.append(src_dir)
sys.ps1 = ''
sys.ps2 = ''
import id003
import termutils as t
import time
import logging
import configparser
import threading
import serial.tools.list_ports
from serial.serialutil import SerialException
from colle... | Kopachris/py-id003 | protocol_analyzer.py | Python | bsd-3-clause | 17,902 |
""" Admin configuration for core models. """
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from course_discovery.apps.core.forms import UserThrottleRateForm
from course_discovery.apps.core.models import Currency, Partner, Sales... | edx/course-discovery | course_discovery/apps/core/admin.py | Python | agpl-3.0 | 3,020 |
from __future__ import print_function, absolute_import, division, unicode_literals
import os
import math
def createJobscript(wall_time=None, nodes=None, cores=None, job_class=None, island_count=None,
initial_dir='~', job_name="waLBerla", energy_tag="",
exe_name=None, parameter... | lssfau/walberla | python/waLBerla/tools/jobscripts/supermuc.py | Python | gpl-3.0 | 3,543 |
from lan_ast import *
precedence = (
('left', 'PLUS', 'MINUS'),
('left', 'TIMES', 'DIVIDE'),
)
def p_first(p):
""" first : top_level
"""
p[0] = FileAST([]) if p[1] is None else FileAST(p[1])
def p_top_level(p):
""" top_level : top_level comment
| top_level function_declaration
| to... | dikujepsen/OpenTran | v2.0/framework/lan/lan_parser.py | Python | mit | 5,443 |
import tensorflow as tf
"""tf.range(start, limit=None, delta=1, dtype=None, name='range')
功能:生成一个序列值,从start开始,每次递增delta,直到不超过limit的值结束。
输入:start:起始值;
limit:限制值,不能超过;
delta:步长。"""
a = tf.range(1, 10, 3)
sess = tf.Session()
print(sess.run(a))
sess.close()
# a==>[1 4 7]
| Asurada2015/TFAPI_translation | constant_op/tf_range.py | Python | apache-2.0 | 381 |
class Card:
pass
class Property(Card):
pass
class PhysicalObject:
pass
class PlayerObject:
pass
| martinmch/MonopoPy | sortMe.py | Python | mit | 115 |
from datetime import date
from mock import patch
from nose.tools import eq_
from kitsune.sumo import googleanalytics
from kitsune.sumo.tests import TestCase
from kitsune.wiki.tests import document, revision
class GoogleAnalyticsTests(TestCase):
"""Tests for the Google Analytics API helper."""
@patch.object... | dbbhattacharya/kitsune | kitsune/sumo/tests/test_googleanalytics.py | Python | bsd-3-clause | 15,153 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2016 CERN.
#
# CERN Analysis Preservation Framework 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... | Kjili/analysis-preservation.cern.ch | cap/modules/records/minters.py | Python | gpl-2.0 | 1,503 |
# -*- coding: utf-8 -*-
# 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/.
import os
import waffle
from django.http import HttpResponse
from django.test.client import Requ... | jpetto/bedrock | bedrock/firefox/tests/test_base.py | Python | mpl-2.0 | 19,403 |
import datetime
from tests.base import ApiDBTestCase
from zou.app.services import persons_service
class PersonDepartmentTestCase(ApiDBTestCase):
def setUp(self):
super(PersonDepartmentTestCase, self).setUp()
self.person = self.generate_fixture_person().serialize()
self.department = self.... | cgwire/zou | tests/persons/test_department.py | Python | agpl-3.0 | 1,171 |
#!/usr/bin/python
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
# Copyright 2004-2008 eXe Project, http://eXeLearning.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU G... | pedropena/iteexe | exe/application.py | Python | gpl-2.0 | 11,244 |
from __future__ import print_function
"""
DICT OF ITEMS IN CONFIG WHICH AFFECT THIS KODI SETTING
kodi_setting_id: {
KODI_ITEM:
{
config_get_patterns: [ LIST OF DICTS WITH AN IDENTIFY REGEX AND AN EXTRACT REGEX
IDENTIFY REGEX'S ARE THERE TO SPECIFICALLY FIN... | samnazarko/osmc | package/mediacenter-addon-osmc/src/script.module.osmcsetting.pi/resources/lib/OSMC_REparser.py | Python | gpl-2.0 | 39,768 |
#-------------------------------------------------------------------------------
# Name: Functions.py
#
# Author: uo258425
#
# Created: 10/11/2016
# Copyright: (c) uo258425 2016
#-------------------------------------------------------------------------------
def read_integer(minlimit, maxlimit):
... | Manri98/Computer-Engineering | Computer-basics/Functions/Functions01.py | Python | gpl-3.0 | 1,316 |
from django.test import SimpleTestCase
from unittest import mock
from zeusci.zeus.api.serializers import BuildDetailSerializer
from zeusci.zeus.models import Build
from zeusci.zeus.models import Buildset
from zeusci.zeus.models import Project
def serialize(build):
request = mock.Mock()
# pass request as we us... | lukaszb/zeusci | zeusci/zeus/tests/test_api_serializers.py | Python | mit | 862 |
class Solution:
def maxProfit(self, prices, fee):
dp = [[-prices[0]], [0]]
for i in range(1, len(prices)):
dp[0].append(max(dp[0][i-1], dp[1][i-1]-prices[i]))
dp[1].append(max(dp[0][i-1]+prices[i]-fee, dp[1][i-1]))
return dp[1][-1]
print(Solution().maxProfit([1, 3, 2,... | zuun77/givemegoogletshirts | leetcode/python/714_best-time-to-buy-and-sell-stock-with-transaction-fee.py | Python | apache-2.0 | 335 |
# accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify'
#DOMAIN = 'localhost'
#DOMAIN = 'http://hotzenplot... | thomec/tango | accounts/authentication.py | Python | gpl-2.0 | 1,296 |
import os, sys, glob
import argparse
import string
import numpy as np
from astropy.io import fits
from scipy import signal
from pyraf import iraf
from iraf import pysalt
from specrectify import specrectify
from saltobslog import obslog
from imred import imred
from autoarclens import auto_arc_lens
from combine_dith... | crawfordsm/zSALT | zsalt/reducelens.py | Python | bsd-3-clause | 3,547 |
#
# 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... | mbroadst/debian-qpid-cpp-old | proton-c/bindings/python/proton.py | Python | apache-2.0 | 99,303 |
import sys
sys.path = ['../src/'] + sys.path
import unittest
from mlab.mlabwrap import MatlabReleaseNotFound
class TestMlabUnix(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_version_discovery(self):
import mlab
instances = mlab.releases.Matl... | codypiersall/mlab | tests/test_mlab_on_unix.py | Python | mit | 753 |
#
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
"""load the EBNF grammar and convert to regular BNF"""
import Parser
import EBNFLex... | drewcsillag/skunkweb | pylibs/pargen/EBNFParse.py | Python | gpl-2.0 | 11,937 |
# Copyright (C) 2016, 2017 Allen Li
#
# 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 w... | darkfeline/mir.anidb | mir/anidb/api.py | Python | apache-2.0 | 1,828 |
"""
Extract bash templates that are semantically equivalent from a parallel corpus.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os, sys
if sys.version_info > (3, 0):
from six.moves import xrange
from bashlint import d... | TellinaTool/awesome_nmt | bashlint/rewrites.py | Python | gpl-3.0 | 2,295 |
#!/usr/bin/python
"""
Interactive shell for the papi client.
:Copyright:
Copyright 2014 Lastline, Inc. All Rights Reserved.
Created on: Apr 1, 2014 by Paolo Milani
"""
import argparse
import ConfigParser
import os.path
import logging
import IPython
from papi_client import papi_client
from papi_client impo... | YmonOy/lastline_api | examples/scripts/papi_shell.py | Python | apache-2.0 | 2,816 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for Perspective Broker module.
TODO: update protocol level tests to use new connection API, leaving
only specific tests for old API.
"""
# issue1195 TODOs: replace pump.pump() with something involving Deferreds.
# Clean up w... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/test/test_pb.py | Python | bsd-3-clause | 60,401 |
#!/usr/bin/env python
import dbapi20
import dbapi20_tpc
from test_connection import skip_if_tpc_disabled
from testutils import unittest, decorate_all_tests
import psycopg2
import tests
class Psycopg2Tests(dbapi20.DatabaseAPI20Test):
driver = psycopg2
connect_args = ()
connect_kw_args = {'dsn': tests.dsn}
... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/psycopg2/tests/test_psycopg2_dbapi20.py | Python | epl-1.0 | 920 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
"""create and manipulate C data types in Python"""
import os as _os
import sys as _sys
__version__ = '1.1.0'
from _ctypes import Union, S... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/ctypes/__init__.py | Python | unlicense | 15,119 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Thomas Moore (@tmmruk)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
from __future__ import (absolute_import, ... | thaim/ansible | lib/ansible/modules/windows/win_netbios.py | Python | mit | 2,309 |
# 45のプログラムを改変し,述語と格パターンに続けて項(述語に係っている文節そのもの)をタブ区切り形式で出力せよ.
# 45の仕様に加えて,以下の仕様を満たすようにせよ.
#
# - 項は述語に係っている文節の単語列とする(末尾の助詞を取り除く必要はない)
# - 述語に係る文節が複数あるときは,助詞と同一の基準・順序でスペース区切りで並べる
import ex041
def main():
sentences = ex041.generate_chunks_whole_sentence()
for sentence in sentences:
for chunk in sentence:
... | yusekiya/nlp100_2015 | Ch5/ex046.py | Python | gpl-3.0 | 1,274 |
#! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2013 Percona LLC and/or its affiliates
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | percona/debian-percona-xtradb-cluster-5.6 | plugin/percona-pam-for-mysql/test/dbqp/percona_tests/percona_pam/pam_mapping_test.py | Python | gpl-2.0 | 4,685 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | Jimmyhua94/MyoFlie | lib/cflib/bootloader/boottypes.py | Python | gpl-2.0 | 2,882 |
#!/usr/bin/env python
# coding=utf-8
"""440. GCD and Tiling
https://projecteuler.net/problem=440
We want to tile a board of length n and height 1 completely, with either 1 × 2
blocks or 1 × 1 blocks with a single decimal digit on top:
For example, here are some of the ways to tile a board of length n = 8:
Let T(n) ... | openqt/algorithms | projecteuler/pe440-gcd-and-tiling.py | Python | gpl-3.0 | 651 |
#!/usr/bin/env python
import re
letters = 'abcdefghijklmnopqrstuvwxyz'
with open("../input/11.txt") as fileobj:
password = fileobj.readline().strip()
print password
def rules(password):
rules = [ rule1, rule2, rule3 ]
if all(rule(password) for rule in rules):
return True
else:
return False
def rule1(passwo... | dsumike/adventofcode | python/11p2.py | Python | mit | 1,491 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apach... | sparkslabs/kamaelia_ | Sketches/AM/KPIPackage/Kamaelia/Community/AM/Kamaelia/KPIFramework/KPI/Server/DataTx.py | Python | apache-2.0 | 2,606 |
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2013 xarvh
# Copyright (c) 2013 roger
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 dequis
# Copyright (c) 2015 Dario Giovannetti
# Copyright (c) 2015 Alexander Lozovskoy
#
# Permission is hereby g... | nxnfufunezn/qtile | libqtile/group.py | Python | mit | 15,212 |
from style import StyleDescriptor
from elements import Element
from .point import Point
series_styles = [
StyleDescriptor("color" , False),
StyleDescriptor("shape" , False),
StyleDescriptor("line-width", False)
]
class Series(Element):
### Initialization
def __init__(self, parent, clas... | deffi/zofoplot | src/elements/series.py | Python | agpl-3.0 | 613 |
from .users import (
Users,
User,
)
__all__ = [
"ChatUser",
"Chat",
]
class ChatUser(User):
def __init__(self, model, name):
super().__init__(model)
self.name = name
@property
def profile(self):
profile = super().profile
profile.name = self.name
... | Evgenus/revigred-server | revigred/model/chat.py | Python | bsd-3-clause | 885 |
## Copyright 2005-2006 Luc Saffre
## This file is part of the Lino project.
## Lino 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 versio... | MaxTyutyunnikov/lino | obsolete/src/lino/forms/gui.py | Python | gpl-3.0 | 5,491 |
"""
Tests specific to the collections module.
"""
from nose.tools import assert_equal
import numpy as np
from numpy.testing import assert_array_equal
import matplotlib.pyplot as plt
import matplotlib.collections as mcollections
import matplotlib.transforms as mtransforms
from matplotlib.collections import EventCollec... | cactusbin/nyt | matplotlib/lib/matplotlib/tests/test_collections.py | Python | unlicense | 13,719 |
# -*- coding: utf-8 -*-
"""Load collections and determine the order."""
import json
import magic
import mimetypes
import os
import structlog
import webtest
from base64 import b64encode
from dcicutils.misc_utils import ignored
from PIL import Image
from pkg_resources import resource_filename
from pyramid.paster import... | 4dn-dcic/fourfront | src/encoded/loadxl.py | Python | mit | 23,730 |
try:
import importlib
except ImportError:
from django.utils import importlib
def get_directupload_backend():
from directupload.app_settings import DIRECT_UPLOAD_BACKEND
module_name, class_name = DIRECT_UPLOAD_BACKEND.rsplit('.', 1)
module = importlib.import_module(module_name)
return getattr(mo... | cuker/django-directupload | directupload/backends/__init__.py | Python | bsd-3-clause | 339 |
#!/usr/bin/python
# coding=utf-8
"""
百度云推送服务端SDK Python版本
@version 1.0.0
"""
import time
import urllib
import hashlib
try:
# ujson is faster than normal json
from ujson import dumps
except ImportError:
from json import dumps
import requests
class BaiduPushError(Exception):
pass
class BaiduPush... | quatanium/python-baidu-push-server | baidupush/baidupush.py | Python | mit | 13,212 |
import fileinput
from collections import namedtuple
HexChar = namedtuple('HexChar', ['ones', 'tens', 'teens'])
HEX_CHARS = {
'0': HexChar('bitey', 'zero', None),
'1': HexChar('one', 'ten', 'eleven'),
'2': HexChar('two', 'twenty', 'twelve'),
'3': HexChar('three', 'thirty', 'thirteen'),
'4': HexChar... | iKevinY/DailyProgrammer | pronouncing-hex/pronouncing_hex.py | Python | mit | 1,499 |
# $Id: 150_srtp_1_0.py 369517 2012-07-01 17:28:57Z file $
#
from inc_cfg import *
test_param = TestParam(
"Callee=optional SRTP, caller=no SRTP",
[
InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
InstanceParam("caller", "--null-audio --max-calls=1")
]
)
| fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-call/150_srtp_1_0.py | Python | gpl-2.0 | 305 |
import scipy.io
from sklearn.cross_validation import KFold
from skfeature.function.wrapper import svm_backward
from sklearn import svm
from sklearn.metrics import accuracy_score
def main():
# load data
mat = scipy.io.loadmat('../data/COIL20.mat')
X = mat['X'] # data
X = X.astype(float)
y = mat[... | jundongl/scikit-feast | skfeature/example/test_svm_backward.py | Python | gpl-2.0 | 1,405 |
from cuboid.graph import get_bricks_matching
from blocks.bricks import Linear, Rectifier
from cuboid.bricks import DefaultsSequence, Dropout
from blocks.model import Model
import theano.tensor as T
def test_get_bricks_matching():
seq = DefaultsSequence(input_dim=9, lists=[
Linear(output_dim=10),
Dr... | lukemetz/cuboid | tests/test_graph.py | Python | mit | 785 |
#lets me use argv
#from sys import argv
#assigns arguments to argv
#script, user_name = argv
#uses the arguments to say something
#print "Hi %s, I'm the %s script." % (user_name, script)
#does some math
math = 10*525343424+646436453534+4
#tells you the results of the math
print "MATH %d" % math
#does more math, say... | chrisortman/CIS-121 | k0799343/assignment02.py | Python | mit | 1,056 |
import codecs
import sys
import setuptools
def read_requirements_file(req_name):
requirements = []
try:
with codecs.open(req_name, encoding='utf-8') as req_file:
for req_line in req_file:
if '#' in req_line:
req_line = req_line[0:req_line.find('#')].str... | sprockets/sprockets.mixins.json_error | setup.py | Python | bsd-3-clause | 2,486 |
"""***************************************************************************
* Title : Regular Expression Introduction Challenges
* URL : https://www.hackerrank.com/domains/regex/re-introduction
* Date : 2017 & 2018
* Author: Atiq Rahman
* Comp : N/A
* Status: Accepted
* Notes : Some easy regular expressio... | atiq-cs/Problem-Solving | general/hackerrank/regex/01_re-introduction.py | Python | gpl-3.0 | 1,745 |
from neo.io.basefromrawio import BaseFromRaw
from neo.rawio.plexonrawio import PlexonRawIO
class PlexonIO(PlexonRawIO, BaseFromRaw):
"""
Class for reading the old data format from Plexon
acquisition system (.plx)
Note that Plexon now use a new format PL2 which is NOT
supported by this IO.
Co... | samuelgarcia/python-neo | neo/io/plexonio.py | Python | bsd-3-clause | 594 |
#-*- coding: utf-8 -*-
import os
import shutil
from django.core.management.base import BaseCommand, CommandError
# CURRENT_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# BACKEND_DIR = os.path.abspath(os.path.join(CURRENT_DIR, os.pardir))
# APP_DIR = os.path.abspath(os.path.join(BACKEND_DIR, os.p... | Tooskich/python_core | rankings/management/commands/updateraces.py | Python | apache-2.0 | 1,785 |
# the 10001th prime
import math
def solve(n):
def is_prime(x):
s = math.floor(math.sqrt(x))
for i in primes:
if i > s:
break
if x % i == 0:
return False
return True
curr, counter = 2, 0
primes = []
while counter != n:
... | daicang/Euler | p7.py | Python | mit | 464 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""The super-group for the compute CLI."""
import argparse
import sys
from googlecloudsdk.calliope import actions
from googlecloudsdk.calliope import base
from googlecloudsdk.compute.lib import utils
from googlecloudsdk.core import log
from googlecloudsdk.core import p... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/__init__.py | Python | apache-2.0 | 2,083 |
from django.conf.urls.defaults import *
urlpatterns = patterns('project.views',
(r'^$', 'index'),
(r'^new/$', 'new'),
(r'^(?P<project_id>\d+)/$', 'detail'),
(r'^(?P<project_id>\d+)/edit/$', 'edit'),
(r'^(?P<project_id>\d+)/groups/', include('project.groups.urls')),
(r'^(?P<project_id>\d+)/contacts/', include('pr... | tjsavage/tmrwmedia | project/urls.py | Python | bsd-3-clause | 417 |
import pyconst
def test_get_version():
# (1, 0, 5)
version = pyconst.__version__
str_version = '.'.join(map(str, version))
assert pyconst.get_version() == str_version
| valdergallo/pyconst | tests/test_setup.py | Python | gpl-3.0 | 185 |
from gitcd.git.repository import Repository
class NullRepository(Repository):
def __init__(self):
self.directory = ""
def getCurrentBranch(self) -> None:
return None
| claudio-walser/gitcd | gitcd/git/nullRepository.py | Python | apache-2.0 | 194 |
from tensorflow.keras.applications.vgg16 import VGG16
import tensorflowjs as tfjs
model = VGG16(weights='imagenet')
tfjs.converters.save_keras_model(model, 'vgg16_tfjs')
| tensorflow/tfjs-examples | visualize-convnet/get_vgg16.py | Python | apache-2.0 | 172 |
#!/usr/bin/python
# encoding: UTF-8
import sys
import subprocess
if __name__ == '__main__':
args = sys.argv
if len(args) == 1:
print "usage: totalbrew brew"
sys.exit()
if args[1] == "brew":
command = ["brew"] + args[2:]
elif args[1] in ("cask"):
command = ["brew", "ca... | maru-n/totalbrew | lib/totalbrew.py | Python | mit | 594 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | chetan51/nupic.research | tests/unit/frameworks/dynamic_sparse/base_model_test.py | Python | gpl-3.0 | 2,392 |
# -*- coding: utf-8 -*-
# Copyright 2021 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... | GoogleChrome/chromium-dashboard | internals/fetchmetrics.py | Python | apache-2.0 | 9,692 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed in t... | Prashant-Surya/anitya | tests/test_backend_cpan.py | Python | gpl-2.0 | 3,426 |
from django.http import HttpResponseRedirect
from django.views.generic import ListView, DetailView
from django.shortcuts import render
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.contrib import messages
from girox.event.models import Event, Subscription
from girox.event.forms imp... | sandrofolk/girox | girox/event/views.py | Python | gpl-3.0 | 1,202 |
from django.apps import AppConfig
class MangacacheConfig(AppConfig):
name = 'mangacache'
| amywoodehy/rcbackend | rcbackend/mangacache/apps.py | Python | mit | 95 |
class Pysubs2Error(Exception):
"""Base class for pysubs2 exceptions."""
class UnknownFPSError(Pysubs2Error):
"""Framerate was not specified and couldn't be inferred otherwise."""
class UnknownFileExtensionError(Pysubs2Error):
"""File extension does not pertain to any known subtitle format."""
class Un... | tkarabela/pysubs2 | pysubs2/exceptions.py | Python | mit | 633 |
"""Affinity Propagation clustering algorithm."""
# Author: Alexandre Gramfort alexandre.gramfort@inria.fr
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
import numpy as np
import warnings
from ..exceptions import ConvergenceWarning
from ..base import BaseEstimator, ClusterMixin
from .... | bnaul/scikit-learn | sklearn/cluster/_affinity_propagation.py | Python | bsd-3-clause | 17,232 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '7sDream'
import json
from .common import *
class Question:
"""问题类,请使用``ZhihuClient.question``方法构造对象."""
@class_common_init(re_question_url)
def __init__(self, url, title=None, followers_num=None,
answer_num=None, session=No... | afternone/zhihu-py3 | zhihu/question.py | Python | mit | 8,842 |
#
# Copyright (c) 2012, 2013, 2014 Hewlett-Packard Development Company, L.P.
#
# 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 requi... | dguerri/git-upstream-old | git_upstream/commands/supersede.py | Python | apache-2.0 | 7,739 |
import hoomd
import pytest
@pytest.mark.gpu
def test_gpu_profile(device):
print(device)
with device.enable_profiling():
pass
def _assert_common_properties(dev,
notice_level,
msg_file,
num_cpu_threads=None):
... | joaander/hoomd-blue | hoomd/pytest/test_device.py | Python | bsd-3-clause | 3,291 |
from sorl.thumbnail.images import ImageFile
from django.core.urlresolvers import reverse
from django.conf import settings
from twistranet.twistapp.lib.log import *
@property
def absolute_url(self):
"""
return thumbnail absolute_url
"""
base_url = settings.BASE_URL
return '%s%s' %(base_url, self.sto... | numericube/twistranet | twistranet/core/patches/sort_thumbnail.py | Python | agpl-3.0 | 481 |
# 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/.
import re
from django.core.urlresolvers import NoReverseMatch
from django.db.models import Q
from django.utils.decorator... | CSCI-462-01-2017/bedrock | bedrock/security/views.py | Python | mpl-2.0 | 6,009 |
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.callback.default import (
CallbackModule as CallbackModule_default
)
from ansible import constants as C
"""Implementation of Custom Class that inherits the 'default' stdout_... | yudaykiran/openebs | e2e/ansible/plugins/callback/openebs.py | Python | apache-2.0 | 2,743 |
import os
from twilio.rest import Client
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID'] # Your Account SID from www.twilio.com/console
api_key = os.environ['TWILIO_API_KEY'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
api_... | TwilioDevEd/api-snippets | api-auth/api-auth.7.x.py | Python | mit | 720 |
#!/usr/bin/env python
# Copyright (c) 2014 Cisco Systems
# 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... | tigelane/web2aci | www/cgi-bin/aci-show-epgs.py | Python | gpl-2.0 | 2,154 |
from common import common
from provision import ssh
import inspect
import os
import json
import urlparse
import time
import logging
import shutil
logger=None
class commisionError(Exception):
def __init__(self, value):
self.value=value
def __str__(self):
return repr(self.value)
def _prep_com... | plasmixs/virtcluster | Host/provision/provision/vc_commision.py | Python | gpl-2.0 | 5,328 |
# -*- encoding: utf-8 -*-
from abjad.tools.topleveltools import attach
from abjad.tools.topleveltools import iterate
from abjad.tools.topleveltools import override
from abjad.tools.topleveltools import select
from abjad.tools.scoretools.Context import Context
class Score(Context):
r'''A score.
::
>>... | mscuthbert/abjad | abjad/tools/scoretools/Score.py | Python | gpl-3.0 | 4,908 |
"""
Routines to etermine the bond/angle/dihedral connectivity in a molecular graph.
"""
##############################################################################
# Imports
##############################################################################
import numpy as np
from scipy.spatial.distance import squarefo... | rmcgibbo/nebterpolator | nebterpolator/core/connectivity.py | Python | gpl-3.0 | 7,620 |
#!/usr/bin/env python
# Copyright 2013 NetApp
# 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
#
# Un... | bswartz/manila | manila/cmd/share.py | Python | apache-2.0 | 2,027 |
#!/usr/bin/python3
import time
from pynhost import utilities
from pynhost import grammarhandler
from pynhost import commands
from pynhost import config
from pynhost import engineio
from pynhost import history
from pynhost import constants
from pynhost.platforms import platformhandler
def main():
try:
cl_a... | evfredericksen/pynacea | pynhost/scripts/pynacea.py | Python | mit | 1,942 |
"""The tests for the demo calendar component."""
| fbradyirl/home-assistant | tests/components/demo/test_calendar.py | Python | apache-2.0 | 49 |
"""
Test that variables of floating point types are displayed correctly.
"""
from __future__ import print_function
import AbstractBase
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class DoubleTypesTestCase(AbstractBase.GenericTester)... | apple/swift-lldb | packages/Python/lldbsuite/test/types/TestDoubleTypes.py | Python | apache-2.0 | 765 |
#!/usr/bin/python
# makes .ogv of .dv files
# checks for existance, doesn't re-make the same one
# --rsync to upload to data center box
# use:
# dv2ogv.py 1234 - make thumb movies for episode# 1234
import os
import subprocess
from . import rax_uploader
from process import process
from main.models impor... | CarlFK/veyepar | dj/scripts/dv2ogv.py | Python | mit | 3,120 |
from django.core.exceptions import ImproperlyConfigured
from django_hosts.defaults import host, patterns
from django_hosts.resolvers import get_host_patterns
from .base import HostsTestCase
class PatternsTests(HostsTestCase):
def test_pattern(self):
host_patterns = patterns('',
host(r'api', ... | jezdez/django-hosts | tests/test_defaults.py | Python | bsd-3-clause | 3,037 |
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# ... | diogocs1/comps | web/addons/hr_payroll_account/__init__.py | Python | apache-2.0 | 1,116 |
# ====================================================================
# Copyright (c) 2013 Carnegie Mellon University. All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of... | robojamison/hello-git | lib/pocketsphinx/swig/python/test/decoder_test.py | Python | mit | 3,276 |
#-------------------------------------------------------------------------------
# This file is part of PyMad.
#
# Copyright (c) 2011, CERN. 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... | pymad/cpymad | src/cern/cpymad/madx.py | Python | apache-2.0 | 18,776 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.