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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# Author: Rob Sanderson (azaroth@liv.ac.uk)
# Distributed and Usable under the GPL
# Version: 1.7
# Most Recent Changes: contexts, new modifier style for 1.1
#
# With thanks to Adam from IndexData and Mike Taylor for their valuable input
from shlex import shlex
from xml.sax.saxutils import escape
... | audaciouscode/Books-Mac-OS-X | Versions/Books_3.0b6/OPAC SBN.plugin/Contents/Resources/PyZ3950/CQLParser.py | Python | mit | 33,090 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018, Eric Jacob <erjac77@gmail.com>
#
# 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/LICENS... | erjac77/ansible-module-f5bigip | library/f5bigip_ltm_profile_sip.py | Python | apache-2.0 | 8,676 |
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import os
import re
import types
import copy
import inspect
import traceback
import json
from os.path import e... | ujenmr/ansible | lib/ansible/module_utils/azure_rm_common.py | Python | gpl-3.0 | 55,428 |
from app import db
from app.models.base_model import BaseEntity
category_page = db.Table(
'category_page',
db.Column('category_id', db.Integer, db.ForeignKey('category.id')),
db.Column('page_id', db.Integer, db.ForeignKey('page.id'))
)
# relationship required for adjacency list (self referencial many to ... | viaict/viaduct | app/models/category.py | Python | mit | 1,395 |
# -*- coding: utf-8 -*-
s = raw_input("--> ")
print (s, type(s))
name = input("what's your name? Please include your name into quotes: ")
print ("nice to meet you " + name + "!")
age = raw_input("ur age?")
print ("so you are already " + str(age) + " years old, " + name + "!")
ur_diary = raw_input("Plase input you... | JeremiahZhang/pybeginner | _src/om2py0w/0wex0/input_test.py | Python | mit | 394 |
# Copyright 2017 The UAI-SDK Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | ucloud/uai-sdk | uai/api/check_uai_base_img_exist.py | Python | apache-2.0 | 1,875 |
from questionnaire.models import Questionnaire, Section
questionnaire1 = Questionnaire.objects.create(name="JRF 2011 Core English", description="From dropbox as given by Rouslan",
year=2011, finalized=True)
questionnaire2 = Questionnaire.objects.create(name="JRF 2010 Core ... | testvidya11/ejrf | questionnaire/fixtures/questionnaire/old_questionnaires.py | Python | bsd-3-clause | 1,566 |
from belief_propagation import \
tree_sum_product, tree_max_product, \
tree_max_sum, tree_network_map_assignment
from mplp import mplp
from mrf import Factor, Network
import uai
from ve import condition_eliminate, eliminate, \
greedy_ordering, min_fill
| blr246/mrf | mrf/__init__.py | Python | mit | 265 |
"""Methods that support running tests"""
import time
import collections
import multiprocessing
from alarmageddon.config import Config
from alarmageddon.reporter import Reporter
from alarmageddon.publishing import hipchat, pagerduty, graphite, junit
from alarmageddon.validations.validation import Priority
from alarmag... | curtisallen/Alarmageddon | alarmageddon/run.py | Python | apache-2.0 | 8,227 |
#! /usr/bin/env python3
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Command line... | brython-dev/brython | www/src/Lib/timeit.py | Python | bsd-3-clause | 13,495 |
# 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... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/ssd-tpuv3-8/code/ssd/model/tpu/models/experimental/show_and_tell/configuration.py | Python | apache-2.0 | 3,771 |
"""
Support for Xeoma Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.xeoma/
"""
import logging
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.const import (
CONF_HOST,... | jamespcole/home-assistant | homeassistant/components/xeoma/camera.py | Python | apache-2.0 | 3,817 |
from paddle.trainer_config_helpers import *
settings(learning_rate=1e-4, batch_size=1000)
din = data_layer(name='data', size=100)
label = data_layer(name='label', size=10)
outputs(hsigmoid(input=din, label=label, num_classes=10))
| emailweixu/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_hsigmoid.py | Python | apache-2.0 | 233 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring, long, unicode
import functools
from collections import Mapping
from datetime import datetime
from sqlalchemy import extract, func
fro... | gazpachoking/Flexget | flexget/utils/database.py | Python | mit | 7,455 |
''' Classes for read / write of matlab (TM) 5 files
The matfile specification last found here:
http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
(as of December 5 2008)
'''
from __future__ import division, print_function, absolute_import
'''
=================================
Note on f... | kmspriyatham/symath | scipy/scipy/io/matlab/mio5.py | Python | apache-2.0 | 31,810 |
# -*- coding: utf-8 -*-
from struct import unpack, calcsize
import datetime
import zlib
import tempfile
import os
def read_string(file):
"""
Считывает строковое значение из undeflated EFD файла.
:param file: Обрабатываемый файл
:type file: BufferedReader
:return: Строковое значение
:rtype: s... | Infactum/onec_dtools | onec_dtools/supply_reader.py | Python | mit | 4,752 |
import logging
import subprocess
log = logging.getLogger(__name__)
def run(command, stdin=None, cwd=None):
log.info('running: %s' % command)
p = subprocess.Popen(
command,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=cwd... | cablehead/bork | bork/shell.py | Python | mit | 1,142 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/fake/fakeprotocol.py | Python | gpl-3.0 | 2,441 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 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... | theochem/horton | horton/grid/ode2.py | Python | gpl-3.0 | 2,964 |
from .models import QueueItem
def enqueue(queue_type='s'):
item = QueueItem.objects.create(item_type=queue_type)
return item.id
def peek(queue_type,queue_id, upto_first_n=1):
# check if job_id is one of the first N items from the head of queue
top_items = QueueItem.objects.filter(item_type=queue_type)... | acil-bwh/SpearmintServer | SpearmintServer/api/queue.py | Python | mit | 523 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsdelimitedtextprovider_wanted.py
---------------------
Date : May 2013
Copyright : (C) 2013 by Chris Crook
Email : ccrook at linz dot govt dot nz
... | dgoedkoop/QGIS | tests/src/python/test_qgsdelimitedtextprovider_wanted.py | Python | gpl-2.0 | 73,128 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Matmoz (<http://www.matmoz.si/>)
# <info@matmoz.si>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General... | xpansa/pmis | project_wbs/model/form_button.py | Python | agpl-3.0 | 1,573 |
import turtle
t = turtle.Turtle()
t.color('purple')
t.forward(99)
| regnart-tech-club/programming-concepts | course-1:basic-building-blocks/subject-4:turtle/lesson-1:`import` statement.py | Python | apache-2.0 | 67 |
import json
import random
class Board:
def __init__(self):
self.n = 0 # number of nodes
# node data
self.siteids = []
self.s2n = {} # mapping from siteid to nodeid
self.xy = [] # list of (x, y) pairs
self.ismine = [] # list of True/False
self.mines = [] # li... | estansifer/icfpc2017 | src/board.py | Python | mit | 3,855 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LGBMClassifier" , "FourClass_100" , "mssql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_100/ws_FourClass_100_LGBMClassifier_mssql_code_gen.py | Python | bsd-3-clause | 142 |
# This file is part of Medieer.
#
# Medieer 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.
#
# Medieer is distri... | toddself/Medieer | src/core/__init__.py | Python | gpl-3.0 | 891 |
# -*- test-case-name: twisted.conch.test.test_recvline -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.conch.recvline} and fixtures for testing related
functionality.
"""
import sys, os
from twisted.conch.insults import insults
from twisted.conch import recvline
f... | mzdaniel/oh-mainline | vendor/packages/twisted/twisted/conch/test/test_recvline.py | Python | agpl-3.0 | 21,575 |
import random
import bisect
import numpy as np
from network_models import *
def generalize_three_pass(network_model, assign_nodes, overlay_communities, g_params, c_params):
G = network_model(g_params)
# print_seq_stats( '\t\t network_generated', G.deg)
return generalize_three_pass_network(G, assign_nodes,... | rabbanyk/FARZ | src/three_pass_benchmarks.py | Python | mit | 10,449 |
# Copyright (c) 2015 Intel Corporation
# Copyright (c) 2015 ISPRAS
#
# 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 app... | ekasitk/sahara | sahara/plugins/cdh/v5_4_0/versionhandler.py | Python | apache-2.0 | 4,577 |
from unittest import TestCase
from cloudshell.cp.vcenter.models.ActionResult import ActionResult
from cloudshell.cp.vcenter.models.ConnectionResult import ConnectionResult
from cloudshell.cp.vcenter.models.DriverResponse import DriverResponse, DriverResponseRoot
from cloudshell.cp.vcenter.common.utilites.command_resu... | QualiSystems/vCenterShell | package/cloudshell/tests/test_common/test_utilities/test_command_result.py | Python | apache-2.0 | 3,910 |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|-|S|p|y|.|c|o|.|u|k|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# wii_remote_1.py
# Connect a Nintendo Wii Remote via Bluetooth
# and read the button states in Python.
#
# Project URL :
# http://www.raspberrypi-spy.co.uk/?p=1101... | JohnOmernik/pimeup | wiiremote/wi1.py | Python | apache-2.0 | 2,351 |
"""Auxiliary classes and functions to support the model"""
from re import match
from .odata_object_base import Guid
from . import *
def get_object_class(odata_context, odata_type=None):
"""Returns class corresponding to the odata context and type specified by parameters.
:param odata_context: odata context.
... | elexpander/odataPyModel | input/extension.py | Python | mit | 3,538 |
# -*- coding: UTF-8 -*-
from datetime import datetime
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.mail import Mail
from flask.ext.login import LoginManager
from flask.ext.pagedown import PageDown
from c... | taogeT/flask_web_development_python3 | app/__init__.py | Python | gpl-3.0 | 1,190 |
# Copyright DataStax, 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, softwa... | thelastpickle/python-driver | tests/integration/standard/test_control_connection.py | Python | apache-2.0 | 3,777 |
from Query.Operator import Operator
class Select(Operator):
def __init__(self, subPlan, selectExpr, **kwargs):
super().__init__(**kwargs)
self.subPlan = subPlan
self.selectExpr = selectExpr
# Returns the output schema of this operator
def schema(self):
return self.subPlan.schema()
... | yliu120/dbsystem | HW3/dbsys-hw3/update/dbsys-hw3/Query/Operators/Select.py | Python | apache-2.0 | 2,892 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from pdf_crawler_test.urls import urlpatterns as pdf_crawler_test_urls
urlpatterns = [
url(r'^', include(pdf_crawler_test_urls, namespace='pdf_crawler_test')),
]
| pkeeper/pdf-crawler-test | tests/urls.py | Python | mit | 292 |
from __future__ import absolute_import
from .__main__ import app
__all__ = ['app']
| msabramo/tally | tally/web/__init__.py | Python | mit | 85 |
# # stdlib
# from typing import Any
# from typing import Dict
# from typing import Iterable
# from typing import List
# from typing import Tuple
# # third party
# import pytest
# # syft absolute
# from syft.core.smpc.store import CryptoStore
# from syft.core.smpc.store import register_primitive_store_add
# from syft.... | OpenMined/PySyft | tests/integration/smpc/store/crypto_store_test.py | Python | apache-2.0 | 1,613 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina and others.
# 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 t... | masayuko/nikola | nikola/plugins/template/jinja.py | Python | mit | 4,861 |
from datetime import datetime, timedelta
from random import random
import sha
from django.conf import settings
from django.db import models, IntegrityError
from django.template.loader import render_to_string
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from django.contrib.a... | davemerwin/blue-channel | external_apps/emailconfirmation/models.py | Python | bsd-3-clause | 4,360 |
import os
import socket
import subprocess
import sys
host = '127.0.0.1'
port = 443
def connect():
# Create socket & connect to server
global s
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error:
print "[-] Cannot create socket."
try:
s.connect((h... | Freshnuts/Multiprocessing-Practice | mp_client.py | Python | gpl-3.0 | 961 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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... | halfwit/qutebrowser | tests/unit/keyinput/test_modeman.py | Python | gpl-3.0 | 1,957 |
# Copyright 2018 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... | snnn/tensorflow | tensorflow/contrib/distribute/python/collective_all_reduce_strategy_test.py | Python | apache-2.0 | 12,633 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_... | thesgc/chembiohub_ws | cbh_core_model/migrations/0024_auto_20151203_1058.py | Python | gpl-3.0 | 2,359 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.dispatch import Signal
# triggered when a shop produc... | shoopio/shoop | shuup/core/catalog/signals.py | Python | agpl-3.0 | 407 |
import cv2
import io
import base64
import numpy as np
import pandas as pd
from subprocess import Popen, PIPE
class VideoAnalysis(object):
"""
TODO:
- Define common interfaces on similar functions
- Define what format video will come in as
- Probably want a preprocessed dataframe with image, time,... | pdxcycling/carv.io | video_analysis/code/video_analysis.py | Python | mit | 2,613 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
from sleekxmpp import Message
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.xmlstream.h... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/sleekxmpp/plugins/xep_0107/user_mood.py | Python | mit | 3,431 |
__all__ = ['newaxis', 'ndarray', 'flatiter', 'nditer', 'nested_iters', 'ufunc',
'arange', 'array', 'zeros', 'count_nonzero',
'empty', 'broadcast', 'dtype', 'fromstring', 'fromfile',
'frombuffer', 'int_asbuffer', 'where', 'argwhere', 'copyto',
'concatenate', 'fastCopyAndTransp... | mbalasso/mynumpy | numpy/core/numeric.py | Python | bsd-3-clause | 74,762 |
#https://code.djangoproject.com/wiki/CookBookSplitModelsToFiles
from .account import Account
from .transaction_type import Transaction_Type
from .transaction import Transaction
from .help_request import Help_Request
from .settingsgroups import SettingsUserGroups
| vinicius-alves/InternetBanking | app/models/data_models/__init__.py | Python | gpl-3.0 | 318 |
#!/bin/env python3
L_RANGE = 100
R_RANGE = 999
max_num = None
for num in range(L_RANGE, R_RANGE + 1):
for num2 in range(L_RANGE, R_RANGE + 1):
if str(num*num2) == str(num*num2)[::-1]:
if max_num is None or num*num2 > max_num:
print(str(num) + "x" + str(num2))
... | uskim/project-euler | 4/p4.py | Python | unlicense | 364 |
"""
send documents representing object data to elasticsearch for supported file extensions.
note: we truncate outbound documents to DOC_SIZE_LIMIT characters
(to bound memory pressure and request size to elastic)
a little knowledge on deletes and delete markers:
if bucket versioning is on:
- `aws s3api delete-obje... | quiltdata/quilt-compiler | lambdas/es/indexer/index.py | Python | apache-2.0 | 30,457 |
#!/usr/bin/env python
"""Wordnik.com's Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates."""
import sys
import os
import re
import urllib.request, u... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/ApiClient.py | Python | apache-2.0 | 11,500 |
# -*- coding:utf-8 -*-
#!/usr/bin/env python
#
# Author: promisejohn
# Email: promise.john@gmail.com
#
from flask import Flask, jsonify, abort, make_response, request, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__)
auth = HTTPBasicAuth()
tasks = [
{
'id': 1,
'title': ... | promisejohn/todo.flask | app/app.py | Python | apache-2.0 | 3,020 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | probcomp/bayeslite | setup.py | Python | apache-2.0 | 8,707 |
import numpy as np
import matplotlib.pyplot as plt
import sklearn
import sklearn.datasets
from init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation
from init_utils import update_parameters, predict, load_dataset, plot_decision_boundary, predict_dec
%matplotlib inline
plt.rcP... | jw2100/beginning.github.io | DeepLearning/wuenda/02_ImprovingDeepNeuralNetworksHyperparametertuningRegularization/week1-01-Initialization.py | Python | gpl-3.0 | 7,259 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... | alexandrul-ci/robotframework | src/robot/output/console/dotted.py | Python | apache-2.0 | 3,228 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.brain.delete.url.reaction import Reaction
class ReactionCopy(Reaction):
def __init__(self, *args, **kwargs):
"""docstring for __init__"""
super(ReactionCopy, self).__init__()
| vsilent/smarty-bot | core/brain/remove/url/reaction.py | Python | mit | 254 |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
from oscar.core.loading import get_class
Node = get_class('dashboard.nav', 'Node')
def get_nodes(user):
"""
Return the visible navigation nodes for the passed user
... | itbabu/django-oscar | src/oscar/apps/dashboard/menu.py | Python | bsd-3-clause | 1,921 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.testutil.pants_run_integration_test import PantsRunIntegrationTest
from pants.util.contextutil import temporary_dir
class BootstrapJvmToolsIntegrationTest(PantsRunIntegrationT... | tdyas/pants | tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py | Python | apache-2.0 | 1,477 |
#
# Copyright (C) 2009 Chris Newton <redshodan@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This pro... | redshodan/lazarus-ssh | tests/utils.py | Python | lgpl-2.1 | 5,573 |
# API for the TI eQEP hardware driver I wrote
# We need OS operations for this
import os
import select
class eQEP(object):
# Modes
MODE_ABSOLUTE = 0
MODE_RELATIVE = 1
# eQEP Controller Locations
eQEP0 = "/sys/devices/ocp.2/48300000.epwmss/48300180.eqep"
eQEP1 = "/sys/devices/ocp.2/4830200... | ValRose/Rose_Bone | PythonLibraries/eqep.py | Python | mit | 3,612 |
import json
import subprocess
import sys
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty # python 3.x
from cricket.events import EventSource
from cricket.model import TestMethod
from cricket.pipes import PipedTestResult, PipedTestRunner
de... | hashkat/hashkat | reproducers/cricket/executor.py | Python | gpl-3.0 | 10,708 |
import pkg_resources
try:
__version__ = pkg_resources.get_distribution("clarity_scripts").version
except pkg_resources.DistributionNotFound:
__version__ = ""
| EdinburghGenomics/clarity_scripts | EPPs/__init__.py | Python | mit | 167 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/chernomirdinmacuvele/Documents/workspace/PescArt2.0/UserInt/ui_Ficha_Recolha_Tab_Amostras.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtW... | InUrSys/PescArt2.0 | GeneratedFiles/ui_Ficha_Recolha_Tab_Amostras.py | Python | gpl-3.0 | 4,188 |
# -*- coding: utf-8 -*-
from mock import patch, MagicMock, Mock
from django.utils import six
from django.test import RequestFactory
import pytest
import nav.web.ldapauth
from nav.web import auth
LDAP_ACCOUNT = auth.Account(login='knight', ext_sync='ldap', password='shrubbery')
PLAIN_ACCOUNT = auth.Account(login='kni... | hmpf/nav | tests/unittests/general/webfront_test.py | Python | gpl-3.0 | 12,069 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
VERSION="0.1.9"
config = {
'name':'rosetta_sip_factory',
'version':VERSION,
'author':'Sean Mosely',
'author_email':'sean.mosely@gmail.com',
'packages':['rosetta_sip_factory',],
'description':'Python library for buildi... | NLNZDigitalPreservation/rosetta_sip_factory | setup.py | Python | mit | 614 |
#!/usr/bin/env python
#
# (C) 2005 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General Pub... | sparkslabs/kamaelia_ | Sketches/AM/KPIPackage/Kamaelia/Community/AM/Kamaelia/KPIFramework/Tools/createuser.py | Python | apache-2.0 | 1,450 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | duckback00/dxapikit | language_examples/auth.py | Python | apache-2.0 | 2,363 |
#
# Copyright 2013, Couchbase, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mnunberg/couchbase-python-client | couchbase/tests/cases/arithmetic_t.py | Python | apache-2.0 | 3,301 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | wfxiang08/Nuitka | nuitka/codegen/YieldCodes.py | Python | apache-2.0 | 2,878 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 The ungoogled-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.
"""
Module for the downloading, checking, and unpacking of necessary files into the source tree.... | Eloston/ungoogled-chromium | utils/downloads.py | Python | bsd-3-clause | 17,917 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
VetEpiGIS-Group
A QGIS plugin
Spatial functions for vet epidemiology
-------------------
begin : 2016-05-06
git sha : $Format:%H$
... | IZSVenezie/VetEpiGIS-Group | plugin/__init__.py | Python | gpl-3.0 | 1,137 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, 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 progra... | spbguru/repo1 | nupic/support/__init__.py | Python | gpl-3.0 | 27,136 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from odoo.tests.common import TransactionCase
from odoo.exceptions import AccessError
class TestEquipmentMulticompany(TransactionCase):
def test_00_equipment_multicompany_user(self):
"""Test C... | ddico/odoo | addons/maintenance/tests/test_maintenance_multicompany.py | Python | agpl-3.0 | 7,097 |
#!/usr/bin/python3
import os
import subprocess
import gettext
import pwd
from setproctitle import setproctitle
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("XApp", "1.0")
from gi.repository import Gtk, XApp
# i18n
gettext.install("cinnamon", "/usr/share/locale")
class MainWindow:
''' Create t... | glls/Cinnamon | files/usr/share/cinnamon/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py | Python | gpl-2.0 | 2,308 |
"""
Spherical Harmonic Coefficients classes
SHCoeffs : SHRealCoeffs, SHComplexCoeffs
"""
from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
from __future__ import print_function as _print_function
import numpy as _np
import matplotlib as _mpl
import mat... | ioshchepkov/SHTOOLS | pyshtools/shclasses/shcoeffsgrid.py | Python | bsd-3-clause | 118,730 |
#service.configuration
import yaml
class Configuration(object):
def __init__(self, file):
# self.log = log
self.configfile = yaml.load(open(file))
def get_logging(self):
return self.configfile['Logging']
def set_database_connection(self, connection):
connection.set_connec... | batoure/ScienceManager | App/service/configuration.py | Python | mit | 392 |
import sys
import shutil
import os
import stat
import re
import posixpath
import pkg_resources
import zipfile
import tarfile
import subprocess
import textwrap
from pip.exceptions import InstallationError, BadCommand, PipError
from pip.backwardcompat import(WindowsError, string_types, raw_input,
... | piyush82/icclab-rcb-web | virtualenv/lib/python2.7/site-packages/pip/util.py | Python | apache-2.0 | 22,686 |
"""
Add and create new modes for running courses on this particular LMS
"""
from django.db import models
from collections import namedtuple
from django.utils.translation import ugettext as _
Mode = namedtuple('Mode', ['slug', 'name', 'min_price', 'suggested_prices', 'currency'])
class CourseMode(models.Model):
"... | praveen-pal/edx-platform | common/djangoapps/course_modes/models.py | Python | agpl-3.0 | 2,735 |
# A Test Program for pipeTestService.py
#
# Install and start the Pipe Test service, then run this test
# either from the same machine, or from another using the "-s" param.
#
# Eg: pipeTestServiceClient.py -s server_name Hi There
# Should work.
from win32pipe import *
from win32file import *
from win32event import *
... | sserrot/champion_relationships | venv/Lib/site-packages/win32/Demos/service/pipeTestServiceClient.py | Python | mit | 4,134 |
import pymzn
import asyncio
from pymzn.aio import minizinc
async def main():
solns = await minizinc('async.mzn', all_solutions=True, keep_solutions=False)
while solns.status is not pymzn.Status.COMPLETE:
await asyncio.sleep(1)
for i, soln in enumerate(solns):
if i == 0:
... | paolodragone/PyMzn | examples/asyncronous/async_test.py | Python | mit | 357 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class SermonItem(scrapy.Item):
book = scrapy.Field()
title = scrapy.Field()
date_preached = scrapy.Field()
scripture = scrapy.Field()
... | psyonara/scrapgty | gty/gty/items.py | Python | mit | 369 |
# Generated by Django 1.11.18 on 2019-01-29 16:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_azure', '0005_ordering'),
]
operations = [
migrations.AlterField(
model_name='virtualmachine',
name='user_da... | opennode/nodeconductor-assembly-waldur | src/waldur_azure/migrations/0006_user_data.py | Python | mit | 547 |
# encoding: utf-8
# FastCGI-to-WSGI bridge for files/pipes transport (not socket)
#
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <allan@saddi.com>
# Copyright (c) 2011 Ruslan Keba <ruslan@helicontech.com>
# Copyright (c) 2012 Antoine Martin <antoine@openance.com>
# All rights reserved.
#
# Redistribution and use... | abide/django-windows-tools | django_windows_tools/management/commands/winfcgi.py | Python | bsd-2-clause | 36,737 |
from binding import *
from classes.Enum import *
def booleanDefinition(enum):
return "%s = %s" % (enumBID(enum), enum.value)
def booleanImportDefinition(api, enum):
qualifier = api + "::"
return "using %s%s;" % (qualifier, enumBID(enum))
def forwardBoolean(enum):
return "static const GLboolean ... | zesterer/nilts-oldish | extern-glbinding/codegeneration/scripts/gen_booleans.py | Python | gpl-2.0 | 2,482 |
from .context import revas
from revas import UnauthorizedToken
import os
import mock
import pytest
@pytest.fixture()
def assigner():
os.environ['UDACITY_AUTH_TOKEN'] = 'some auth token'
yield revas.Assigner()
@mock.patch('revas.reviewsapi.ReviewsAPI.certifications')
def test_retrieve_certifications_list(moc... | anapaulagomes/reviews-assigner | tests/test_assigner.py | Python | mit | 7,282 |
"""
FieldOverride that forces graded components to be only accessible to
students in the Unlocked Group of the ContentTypeGating partition.
"""
from __future__ import absolute_import
from django.conf import settings
from lms.djangoapps.courseware.field_overrides import FieldOverrideProvider
from openedx.features.cont... | ESOedX/edx-platform | openedx/features/content_type_gating/field_override.py | Python | agpl-3.0 | 3,469 |
__author__ = 'oskyar'
from TFG.apps.answer.forms import InlineAnswerFormSet, AnswerInline
from TFG.apps.topic.models import Topic, Subtopic
from TFG.apps.subject.models import Subject
from TFG.mixins import LoginRequiredMixin
from django.core.urlresolvers import reverse_lazy
from django.http import JsonResponse, HttpR... | oskyar/test-TFG | TFG/apps/search/views.py | Python | gpl-2.0 | 1,891 |
# Copyright (c) 2014-2021 Jan Kaliszewski (zuo) & others. All rights reserved.
#
# Licensed under the MIT License:
#
# 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, inclu... | zuo/unittest_expander | unittest_expander.py | Python | mit | 99,220 |
from django.conf import settings
settings.IMAGES_BACKEND = 'django_image.tests.backend.DummyBackend'
| adamcharnock/django-image | django_image/tests/__init__.py | Python | mit | 103 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import MySQLdb
# 打开数据库连接
db = MySQLdb.connect("localhost","root","root","stockanalyse" )
# 使用cursor()方法获取操作游标
cursor = db.cursor()
# 使用execute方法执行SQL语句
cursor.execute("SELECT VERSION()")
# 使用 fetchone() 方法获取一条数据库。
data = cursor.fetchone()
print "Database version : %s " %... | hecomlilong/basic | python/hello.py | Python | bsd-3-clause | 436 |
from ..errors import ErrorFolderNotFound, ErrorInvalidOperation, ErrorNoPublicFolderReplicaAvailable
from ..util import MNS, create_element
from .common import EWSAccountService, folder_ids_element, parse_folder_elem, shape_element
class GetFolder(EWSAccountService):
"""MSDN: https://docs.microsoft.com/en-us/exch... | ecederstrand/exchangelib | exchangelib/services/get_folder.py | Python | bsd-2-clause | 2,503 |
from django.contrib import admin
from django.urls import path
from .urls import urlpatterns
urlpatterns += [
path('admin/', admin.site.urls),
]
| Bouke/django-two-factor-auth | tests/urls_admin.py | Python | mit | 150 |
from touchworks.logger import Logger
import json
import uuid
import requests
import time
logger = Logger.get_logger(__name__)
class TouchWorksException(Exception):
pass
class TouchWorksErrorMessages(object):
GET_TOKEN_FAILED_ERROR = 'unable to acquire the token from web service'
MAGIC_JSON_FAILED = 'ma... | farshidce/touchworks-python | touchworks/api/http.py | Python | mit | 40,619 |
import os
import sys
import signal
import logging
import pytest
import latus.logger
import test_latus.tstutil
os.environ["PYTHONPATH"] = '.'
g_keep_running = True
def control_key_handler(signal, frame):
global g_keep_running
print('%s : ctrl-c detected - exiting' % __file__)
g_keep_running = False
... | latusrepo/latus | run_pytest_until_error.py | Python | gpl-3.0 | 1,334 |
#!/usr/bin/python
#
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
#
# 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/LICE... | objectsoul/ipaddr-py | ipaddr.py | Python | apache-2.0 | 61,896 |
"""
Notes:
- Brugia protein sequences: https://www.ncbi.nlm.nih.gov/bioproject/PRJNA10729
- wBm protein sequences: https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=292805
- BLASTP against Reference proteins (refseq protein) from Human, using BLOSUM45 matrix.
- BLASTP against nr proteins from O. volvulus and ... | dave-the-scientist/brugia_project | get_knockout_info.py | Python | gpl-3.0 | 20,007 |
import unittest
import cassandranames
from dnstypeconstants import *
# Running this *will destroy* data in Cassandra.
class TestCassandraNames(unittest.TestCase):
def setUp(self):
cassandranames.install_schema(drop_first=True, rf=1)
self.names = cassandranames.CassandraNames()
def test_names... | pantheon-systems/cassandra-dns | cassandranames-test.py | Python | mit | 3,496 |
# Legacy:
def save_to_disfeval_file(p, g, w, f, filename, incremental=False):
'''
INPUT:
p :: predictions
g :: groundtruth
w :: corresponding words
f :: original input gold standard file
OUTPUT:
filename :: name of the file where the predictions
are written. In right format for disf... | dsg-bielefeld/deep_disfluency | deep_disfluency/utils/accuracy.py | Python | mit | 2,054 |
from django import template
from django.utils.translation import ugettext_lazy as _
register = template.Library()
@register.filter
def percentage(value):
"""
Format value (which is a number) as percentage.
"""
return _('{value} %').format(value=100*value)
| Clarity-89/clarityv2 | src/clarityv2/utils/templatetags/math.py | Python | mit | 275 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.