code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from io import BytesIO
from devtools_testutils.aio import recorded_by_proxy_async
from azure.core.exceptions import Servic... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_frc_identity_documents_async.py | Python | mit | 8,158 |
# Copyright (c) 2017 Michel Betancourt
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
"""Global constants
"""
import sys
import blessed
TERM = blessed.Terminal()
class Keyboard(object):
def __getattr__(self, name):
assert isinstance(name, str)
if name.... | Akhail/Tebless | tebless/utils/keyboard.py | Python | mit | 550 |
import serial
class Robot:
def __init__(self, port, baud_rate = 57600):
self.port = port
self.baud_rate = 57600 #Eventually this will be editable
self.conn = serial.Serial(self.port, baudrate=self.baud_rate, timeout=0.5)
#wrapper for serial send function
def send(self, num):
if self.conn:
self.conn.sen... | lugatuic/python-irobot-create | robot.py | Python | mit | 622 |
import csv
from collections import defaultdict
from django.core.management.base import BaseCommand, CommandError
import logging
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.WARN)
"""
This is a helper script that reads in a structured CSV file with
column names that match the databa... | Code4SA/wazimap-za | wazimap_za/management/commands/fields_add_to_100.py | Python | mit | 3,455 |
# -*- coding: utf-8 -*-
#
# fortran-linter documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 02:28:25 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... | uchchwhash/fortran-linter | docs/source/conf.py | Python | mit | 9,283 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/IEC61970/Dynamics/MetaBlockState.py | Python | mit | 2,325 |
import unittest
from grammaregex import match_tree, find_tokens, verify_pattern, PatternSyntaxException
import spacy
# _sentence will be used throughout the all tests as it is time-consuming to create it.
# The fact of time-consumption is also reason for keeping all tests in single module file
_sentence = None
def s... | krzysiekfonal/grammaregex | grammaregex/tests/tests.py | Python | mit | 4,970 |
"""Test client using asyncio."""
import asyncio
from leicacam.async_cam import AsyncCAM
async def run(loop):
"""Run client."""
cam = AsyncCAM(loop=loop)
await cam.connect()
print(cam.welcome_msg)
await cam.send(b"/cmd:deletelist")
print(await cam.receive())
await cam.send(b"/cmd:deletelis... | arve0/leicacam | async_client.py | Python | mit | 715 |
from setuptools import setup, find_packages
print(find_packages('src'))
setup(
name="Useles2s",
version='0.1',
author='Riccardo Cagnasso',
author_email="riccardo@phascode.org",
description='Useless is useless. Oh yeah, and parses bit and pieces' +
'of ELF and PE dynamic libraries',... | riccardocagnasso/useless | setup.py | Python | mit | 576 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# rancidcmd documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 2 13:16:39 2015.
#
# 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
# ... | mtoshi/rancidcmd | docs/source/conf.py | Python | mit | 11,597 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import uuid
from gratipay.models.team import Team as _Team
class Team(object):
"""A :py:class:`~gratipay.models.package.Package` can have a
:py:class:`~gratipay.models.team.Team` associated with it.
... | gratipay/gratipay.com | gratipay/models/package/team.py | Python | mit | 3,131 |
"""credit: http://www.emptypage.jp/notes/pyevent.en.html"""
__all__ = ['Event', ]
class Event(object):
def __init__(self, doc=None):
self.__doc__ = doc
def __get__(self, obj, objtype=None):
if obj is None:
return self
return EventHandler(self, obj)
def __set__(self,... | scheunemann/robotActionController | robotActionController/Processor/event.py | Python | mit | 1,561 |
import mahotas as mh
from sklearn import cross_validation
from sklearn.linear_model.logistic import LogisticRegression
import numpy as np
from glob import glob
from edginess import edginess_sobel
#basedir = 'simple-dataset'
basedir = 'simple-dataset/'
def features_for(im):
im = mh.imread(im,as_grey=True).astype(... | gtesei/fast-furious | dataset/images2/simple_classification.py | Python | mit | 1,266 |
import re
def trim_nonbreaking_whitespace(text):
"""Trims non-breaking whitespace from the end of each line in the given text.
Non-breaking whitespace refers to the markdown syntax of places two spaces at the end of a line to signify a break.
"""
pattern = re.compile(r'^.*\S $')
text = text.sp... | Brickstertwo/pretty-markdown | utils/whitespace_utils.py | Python | mit | 542 |
import sys
import os
import torch
import time
from engine import TetrisEngine
from dqn_agent import DQN, ReplayMemory, Transition
from torch.autograd import Variable
use_cuda = torch.cuda.is_available()
FloatTensor = torch.cuda.FloatTensor if use_cuda else torch.FloatTensor
LongTensor = torch.cuda.LongTensor if use_c... | jaybutera/tetrisRL | run_model.py | Python | mit | 1,627 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/link_token_account_filters.py | Python | mit | 7,714 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_eq... | Cocosoft/bitcoin | qa/rpc-tests/rpcnamedargs.py | Python | mit | 1,437 |
from panoramisk import utils
from panoramisk.exceptions import AGIException
def test_parse_agi_valid_result():
res = try_parse_agi_result('200 result=0')
assert res == {'msg': '', 'result': ('0', ''), 'status_code': 200}
res = try_parse_agi_result('200 result=1')
assert res == {'msg': '', 'result': (... | gawel/panoramisk | tests/test_utils.py | Python | mit | 1,276 |
import copy
import pylab
import random
import numpy as np
from environment import Env
from keras.layers import Dense
from keras.optimizers import Adam
from keras.models import Sequential
EPISODES = 1000
# 그리드월드 예제에서의 딥살사 에이전트
class DeepSARSAgent:
def __init__(self):
self.load_model = False
# 에이전트... | rlcode/reinforcement-learning-kr | 1-grid-world/6-deep-sarsa/deep_sarsa_agent.py | Python | mit | 4,030 |
'''
Setup script for FuzzyFileFinder.
'''
import setuptools
from fff import __project__, __version__, CLI
README = 'README.md'
setuptools.setup(name='fff',
version=__version__,
description='Fuzzy File Finder.',
url="https://github.com/jkloo/fff",
... | jkloo/fff | setup.py | Python | mit | 718 |
# -*- coding: utf-8 -*-
# @Author: twankim
# @Date: 2017-05-05 00:06:53
# @Last Modified by: twankim
# @Last Modified time: 2017-10-19 23:50:33
import numpy as np
from sklearn.datasets import make_blobs
class genData:
def __init__(self,n,m,k,min_gamma=1,max_gamma=1.25,std=1.0):
self.n = n
self... | twankim/weaksemi | gen_data.py | Python | mit | 3,619 |
#!/usr/bin/env python
def printlist(head):
print head.val
while head.next:
head = head.next
print head.val
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def removeNthFro... | zongtongyi/leetcode | 019_Remove_Nth_Node_From_End_of_List.py | Python | mit | 1,088 |
#from . import action
from . import glk
from . import message
from .debug import log
#from . import *
NOUN_TOKEN = 1
HELD_TOKEN = 2
MULTI_TOKEN = 3
MULTIHELD_TOKEN = 4
MULTIEXCEPT_TOKEN = 5
MULTIINSIDE_TOKEN = 6
TOPIC_TOKEN = 7
CREATURE_TOKEN = 8
def tokenise_string(string):
"Tran... | dcsch/pyif | pyif/parser.py | Python | mit | 3,790 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, "5d")
__title__ = "Elevator"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| oleiade/Elevator | elevator/__init__.py | Python | mit | 177 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
product = Table('product', pre_meta,
Column('id', INTEGER, primary_key=True, nullable=False),
Column('product_name', VARCHAR),
Column('bar_code', INTEGER),
Column('price', N... | dogsaur/SMS | db_repository/versions/007_migration.py | Python | mit | 1,457 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from paypal.pro.fields import CreditCardField, CreditCardExpiryField, CreditCardCVV2Field, CountryField
class PaymentForm(forms.Form):
"""Form used to process direct payments."""
firstname = forms.CharField(255, label="First Name... | bluestemscott/librarygadget | librarygadget/paypal/pro/forms.py | Python | mit | 1,840 |
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse
from restaurants.models import RestaurantLocation
class Item(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
restaurant = models.ForeignKey(RestaurantLocation)
name ... | madebydaniz/django1-11 | src/menus/models.py | Python | mit | 1,040 |
from django.contrib import admin
from suit.admin import SortableModelAdmin
from .models import (
Area, Project, Enrollment, Announcement, Module, Lesson, Material
)
class AreaAdmin(admin.ModelAdmin):
list_display = ['name', 'slug', 'created', 'modified']
search_fields = ['name']
prepopulated_fields... | gileno/sofia | sofia/apps/learn/admin.py | Python | mit | 2,179 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
PEM_FILE = os.path.join(jupyter_data_dir(), 'notebook.pem')
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.p... | midvalestudent/jupyter | docker/base/jupyter_notebook_config.py | Python | mit | 1,414 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... | Jonothompson/my-django-blog | mysite/settings.py | Python | mit | 2,696 |
from django.conf import settings
STATUS_DOWN = 'down'
STATUS_UP = 'up'
# Frequency with which checks will be made to the remote boxes (default is 10 min.)
REMOTE_CHECK_FREQUENCY = getattr(settings, 'RS_REMOTE_CHECK_FREQUENCY', 10 * 60 * 60)
DEFAULT_KEY_FILE = getattr(settings, 'RS_KEY_FILE', None)
DEFAULT_KNOWN_HOSTS... | cooncesean/remotestatus | build/lib/remotestatus/conf.py | Python | mit | 376 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Techies' Stasis Trap
:copyright: (c) 2014 Runzhou Li (Leo)
:license: The MIT License (MIT), see LICENSE for details.
"""
import sys
from logging import Handler, NOTSET
_ref_atributes = [
'%(levelname)s',
'%(name)s',
'%(pathname)s',
'%(module)s',
... | woozyking/techies | techies/stasistrap.py | Python | mit | 1,129 |
"""
Importer from EMSA file format
"""
# Standard library modules.
import datetime
# Third party modules.
import numpy as np
# Local modules.
from pyhmsa.fileformat.importer.importer import _Importer, _ImporterThread
from pyhmsa.fileformat.common.emsa import calculate_checksum
from pyhmsa.datafile import DataFile
f... | pyhmsa/pyhmsa | pyhmsa/fileformat/importer/emsa.py | Python | mit | 12,424 |
import json
import os
import time
from abc import ABC
import numpy as np
from tqdm import tqdm
from tensorflow import keras as tfk
from astroNN.config import MULTIPROCESS_FLAG
from astroNN.config import _astroNN_MODEL_NAME
from astroNN.datasets import H5Loader
from astroNN.models.base_master_nn import NeuralNetMaster
... | henrysky/astroNN | astroNN/models/base_vae.py | Python | mit | 27,356 |
""" Miscellaneous routines and constants.
"""
import logging, sys, traceback
import os.path
import astviewer.qtpy
import astviewer.qtpy._version as qtpy_version
from astviewer.version import DEBUGGING, PROGRAM_NAME, PROGRAM_VERSION, PYTHON_VERSION
from astviewer.qtpy import QtCore, QtWidgets
logger=logging.getLogger(... | titusjan/astviewer | astviewer/misc.py | Python | mit | 6,180 |
from pprint import pprint
from django.shortcuts import render
def index(request):
return render(request, 'itat/index.html')
| anselmobd/fo2 | src/itat/views/views.py | Python | mit | 131 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_3_preview/models/_models.py | Python | mit | 57,106 |
import numpy as np
from cs231n.layers import *
from cs231n.rnn_layers import *
class CaptioningRNN(object):
"""
A CaptioningRNN produces captions from image features using a recurrent
neural network.
The RNN receives input vectors of size D, has a vocab size of V, works on
sequences of length T, has an RN... | watsonyanghx/CS231n | assignment3/cs231n/classifiers/rnn.py | Python | mit | 13,249 |
from setuptools import setup
setup(name='wealthengine_python_sdk',
version='0.1',
description='A Python SDK for WealthEngine\'s Public API',
url='https://github.com/zackproser/wealthengine-python-sdk',
author='Zack Proser',
author_email='zackproser@gmail.com',
license='MIT',
packages='weal... | zackproser/WealthEngine-Python-SDK | wealthengine_python_sdk/setup.py | Python | mit | 361 |
from .mixins import *
from .flexi import *
class FlexiBulkModel(FlexiModel,EasyBulkModel,StockModelHelpers):
class Meta:
abstract = True
| ajparsons/useful_inkleby | useful_inkleby/useful_django/models/__init__.py | Python | mit | 162 |
__author__ = 'nb254'
import numpy as np
import pandas as pd
from sklearn import cluster
from sklearn.cluster import KMeans
from sklearn.neighbors import NearestNeighbors
from sklearn.neighbors import kneighbors_graph
import ClusteringPrediction as cp
import ClusteringSaveResults as csr
import DataPreprocessing as dp
... | Nik0l/UTemPro | ML/Clustering.py | Python | mit | 10,761 |
def test_connect(client, connect):
"""Connect client triggers client_connect"""
connect()
assert client.triggers['CLIENT_CONNECT'] == 1
def test_ping_pong(client, server, connect, flush):
connect()
server.write("PING :ping-message")
client.send("PONG")
# Protocol doesn't advance until loo... | numberoverzero/bottom | tests/integ/test_local.py | Python | mit | 546 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 11:09:48 2015
@author: joris.berkhout@quintel.com & chael.kruip@quintel.com
"""
#==============================================================================
# This script can be used to generate typical domestic hot water (DHW) profiles
# for a period of one year a... | quintel/etmoses | scripts/power_to_heat/p2h_profile_generator.py | Python | mit | 7,575 |
# -*- coding: utf-8 -*-
"""
Base Population Model to handle different type of models
"""
from __future__ import print_function
from __future__ import division
from builtins import range
from builtins import object
from past.utils import old_div
import os
import sys
import math
import random
import platform
import glo... | popdynamics/popdynamics | basepop.py | Python | mit | 40,337 |
import os, sys
sys.path.insert(0,os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib'))
appstats_CALC_RPC_COSTS = True
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
#app = recording.appstats_wsgi_middleware(app)
return app
| rcarmo/yaki-gae | appengine_config.py | Python | mit | 283 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://user:user@localhost/booklogue'
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db.repository')
| animesh21/booklogue | config.py | Python | mit | 204 |
# -*- coding: utf-8 -*-
import os
from fabric.api import *
from cabric.utils import (utils_baselib)
from cabric.cmd import (cmd_git, yum_install)
# @note if name start py, this is used to install tools
def py_python(tag='3.4.2', force=True, compatible=True, pypy='2.4'):
'''
install python. include python,... | zhwei/cabric | cabric/pythonic.py | Python | mit | 9,028 |
"""
Trends library module.
"""
import datetime
from lib import database as db
from lib.twitter_api import authentication
# Global object to be used as api connection. During execution of the insert
# function, this can be setup once with default app then reused later,
# to avoid time calling Twitter API. It can be l... | MichaelCurrin/twitterverse | app/lib/trends.py | Python | mit | 3,038 |
## Copyright (c) MediaArea.net SARL. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license that can
# be found in the License.html file in the root of the source tree.
##
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Python example
#
# To make thi... | pavel-pimenov/sandbox | mediainfo/MediaInfoLib/Source/Example/HowToUse_Dll3.py | Python | mit | 2,120 |
"""
Unbounded knapsack: *(http://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/DynProg/knapsack2.html
"""
class Item:
def __init__(self, value, weight):
"""Create item with given value and weight. """
self.value = value
self.weight = weight
def __str__(self):
r... | heineman/algorithms-nutshell-2ed | PythonCode/adk/knapsack.py | Python | mit | 4,073 |
from __future__ import division
import itertools as it
import numpy as np
import scipy.linalg as sl
import matplotlib.pyplot as plt
import csv
import sys
from zdict import zdict
# hbar^2/2m in eV-Ang^2
hb2m0 = 3.807
# hcR_infty (eV per Rydberg)
Ry = 13.60569253
def mag2(V):
""" Return the magnitude squared of a ... | gregvw/EPM-FCC-bulk | epm.py | Python | mit | 4,240 |
print(__doc__)
from time import time
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
from sklearn.preprocessing i... | georgetown-analytics/skidmarks | bin/cluster.py | Python | mit | 2,943 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'Jayin Ton'
from flask import Flask
app = Flask(__name__)
host = '127.0.0.1'
port = 8000
@app.route('/')
def index():
return 'welcome'
if __name__ == '__main__':
app.run(host=host, port=port, debug=True)
| jayinton/FlaskDemo | simple/index.py | Python | mit | 269 |
##################################################################
# Extract a dbtable for every instance of a value in a geo-file #
# Written by Thomas Fish #
# Released under the MIT License #
# ... | Guerillero/ArcExtractor | Extractor.py | Python | mit | 2,156 |
from datetime import datetime
from flask.ext.babel import lazy_gettext as _
from sqlalchemy import func, select
from sqlalchemy.ext.hybrid import hybrid_property
from ark import settings
from ark.exts import db, cache
from ark.ranking.models import GoalRankingBan
class Goal(db.Model):
__tablename__ = 'goal'
... | N402/NoahsArk | ark/goal/models.py | Python | mit | 6,393 |
# https://www.w3resource.com/python-exercises/
# 88. Given variables x=30 and y=20, write a Python program to print t "30+20=50"
def addvar(a, b):
print "%d + %d =%d" % (a,b, a+b)
x = 30
y = 20
addvar(x, y)
| dadavidson/Python_Lab | Python-w3resource/Python_Basic/ex88.py | Python | mit | 214 |
GitHubPackage ('mono', 'mono-addins', '0.6.2',
'adcd75bb47ffc1665c8c410f44dad3511dec0da0',
configure = './autogen.sh --prefix="%{prefix}"'
)
| BansheeMediaPlayer/bockbuild | packages/mono-addins.py | Python | mit | 144 |
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import json
import os
from sheetsite.site_queue import app
import smtplib
@app.task
def notify_one(email, subject, page, text):
print("send [%s] / %s / %s" % (email, subject, page))
server_ssl = smtplib.SMTP_SSL("smtp.gmail.... | paulfitz/sheetsite | sheetsite/tasks/notify.py | Python | mit | 2,767 |
''' Explains list comprehension which is much faster than looping through list '''
''' The general method is this ' mylist = [ SOME_EXPRESION_WITH_i for i in ITERABLE_LIST ] '
'''
# Loop (slow)
iterer = list(range(10))
double = list(range(10))
mylist = []
for i in iterer:
mylist.append(i+1)
print('Loop result',my... | mannion9/Intro-to-Python | ListComprehension.py | Python | mit | 430 |
import numpy as np
vec_bitstring_3 = np.vectorize(lambda x: np.binary_repr(x,width=3) )
def board_to_int(v):
t = vec_bitstring_3(v)
return int(''.join(np.apply_along_axis(lambda x: ''.join(x), 1,t)),2)
def int_to_board(i):
#i = '154444257952488798331863040'
s = bin(int(i))[2:].zfill(108)
v = n... | crhaithcock/RushHour | RushHourPy/numpy_utilities.py | Python | cc0-1.0 | 413 |
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
import re
import portage
from portage import os
from portage.dbapi.porttree import _parse_uri_map
from portage.dbapi.IndexedPortdb import IndexedPortdb
from portage.dbapi.... | ptisserand/portage | pym/_emerge/search.py | Python | gpl-2.0 | 13,055 |
import unittest
import zope.component
from zExceptions import Unauthorized
from Products.PloneTestCase import ptc
from Products.PloneTestCase.ptc import default_user
from pmr2.oauth.interfaces import ITokenManager, IConsumerManager
from pmr2.oauth.interfaces import IScopeManager
from pmr2.oauth.token import Token
fr... | PMR2/pmr2.oauth | pmr2/oauth/tests/test_form.py | Python | gpl-2.0 | 4,711 |
# -*- coding: utf-8 -*-
from pkg_resources import parse_requirements
class PkgResourceWrapper(object):
def __init__(self, req):
self.requirement = req
def url(self):
return "https://pypi.python.org/pypi/%s" % self.requirement.project_name
def __str__(self):
return str(self.requirement)
class PythonRequirem... | dziadu/gitbrowser | utils/deps.py | Python | gpl-2.0 | 435 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_geopunt4QgisGIPOD.ui'
#
# Created: Sun Mar 22 20:01:58 2015
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
... | geopunt/geopunt4qgis | ui_geopunt4QgisGIPOD.py | Python | gpl-2.0 | 11,908 |
from morsel.panda import *
from morsel.math import *
from morsel.nodes.facade import Mesh
from morsel.nodes.ode.joint import Joint
#-------------------------------------------------------------------------------
class AngularMotor(Joint):
USER = 0
EULER = 1
def __init__(self, axes = [[1, 0, 0], [0, 1, 0], [0... | kralf/morsel | python/lib/morsel/nodes/ode/joints/angular_motor.py | Python | gpl-2.0 | 7,677 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2015 CERN.
#
# INSPIRE 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... | Dziolas/inspire-next | inspire/dojson/utils.py | Python | gpl-2.0 | 3,011 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 3 as published by the Free
# Software Foundation.
#
# This program is... | UNINETT/nav | tests/unittests/smsd/dispatcher_test.py | Python | gpl-2.0 | 2,660 |
'''
PyDMET: a python implementation of density matrix embedding theory
Copyright (C) 2014, 2015 Sebastian Wouters
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 versio... | SebWouters/PyDMET | oldstuff/HubbardDMETshiwei.py | Python | gpl-2.0 | 12,673 |
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eDVBFrontendParameters, eDVBResourceManager, eTimer
class Tuner:
def __init__(self, frontend, ignore_rotor=False):
self.frontend = frontend
self.ignore_rotor = ignore_rotor
# transponder = (freque... | sklnet/openblackhole-enigma2 | lib/python/Components/TuneTest.py | Python | gpl-2.0 | 10,722 |
import gamePlay
from copy import deepcopy
def value(board):
value = 0
for row in board:
for elem in row:
if elem == "W":
value = value + 1
elif elem == "B":
value = value - 1
return value
def betterThan(val1, val2, color, reversed):
if color == "W":
retVal = val1 > val2
els... | OldPanda/B551 | hw4/simpleGreedy.py | Python | gpl-2.0 | 907 |
a = {i*i for i in (1,2)}
print(a) | pez2001/sVimPy | test_scripts/test53.py | Python | gpl-2.0 | 33 |
"""
Base class for any serializable list of things...
Copyright 2006, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.com>
This software may be freely redistributed under the terms of the GNU
general public license.
You should have received a copy of the GNU General Public License
along with this program; if not, write ... | brenton/cobbler | cobbler/collection.py | Python | gpl-2.0 | 13,191 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/or ... | syci/domsense-agilebg-addons | account_followup_choose_payment/__init__.py | Python | gpl-2.0 | 1,092 |
class PSFModel(object):
def __init__(self, scopeType, psfModel, xySpace, zSpace, emissionWavelength, numericalAperture, designImmersionOilRefractiveIndex, \
designSpecimenLayerRefractiveIndex, actualImmersionOilRefractiveIndex, \
actualSpecimenLayerRefractiveIndex, actualPointSourceDepthInSpecimenLayer, home... | bnorthan/projects | Scripts/Jython/Psfs/PSFModel.py | Python | gpl-2.0 | 1,817 |
# -*- coding: utf-8 -*-
"""Page model for Automation/Ansible/Repositories"""
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.exceptions import NoSuchElementException
from widgetastic.widget import Checkbox, Fillable, ParametrizedView, Text, View
from widgetastic_manageiq import... | anurag03/integration_tests | cfme/ansible/repositories.py | Python | gpl-2.0 | 13,574 |
from xml.etree import ElementTree as ET
def qn_tag(n, t):
return {
'ce': str(ET.QName('http://catchexception.org/xml-namespaces/ce', t)),
'sparkle': str(ET.QName('http://www.andymatuschak.org/xml-namespaces/sparkle', t))
}[n]
def create_channel(m):
if m['stable']:
return 'stable'
... | alesaccoia/chew-broadcaster | install-utils/release/osx/release_util.py | Python | gpl-2.0 | 13,845 |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... | derolf/Plex.ArgusTV.bundle | Contents/Libraries/Shared/mysql/connector/protocol.py | Python | gpl-2.0 | 25,785 |
#!/usr/bin/env python
import os
import sys
import unittest
import pysam
import sam_utils
class TestMISO(unittest.TestCase):
"""
Test MISO functionality.
"""
def setUp(self):
# Find out the current directory
self.miso_path = \
os.path.dirname(os.path.abspath(os.path.expandus... | Xinglab/rmats2sashimiplot | src/MISO/misopy/test_miso.py | Python | gpl-2.0 | 7,024 |
#!/usr/bin/env python3
# Copyright (C) 2019 C C Magnus Gustavsson
# Released under the GNU General Public License
"""Tic-tac-toe / noughts and crosses / Xs and Os using Pygame
Choose if each side is to be played by the computer or a human
"""
import pygame
import sys
from math import sqrt
from random import choic... | maggu/hack | tictactoe.py | Python | gpl-2.0 | 8,127 |
# -----------------------------------------------------------
# find number patterns in strings
#o
# (C) 2016 Frank Hofmann, Berlin, Germany
# Released under GNU Public License (GPL)
# email frank.hofmann@efho.de
# -----------------------------------------------------------
#
# use the regex module
import re
text1 = ... | hofmannedv/training-python | usecases/patterns-in-strings/pattern.py | Python | gpl-2.0 | 1,056 |
# -*- coding: utf-8 -*-
import itertools
import pythoncom
import win32com.client as com
__author__ = 'cvargasc'
# Una intersección es un SignalController, tiene carriles de entrada, salida, cruces y semáforos.
class Interseccion:
# ------------------------
# Constructor
# ------------------------
# In... | vargax/RAPfSC | RAPfSC/modelo.py | Python | gpl-2.0 | 12,512 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016 CERN.
#
# CERN Document Server 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 ... | drjova/cds-demosite | cds/modules/ffmpeg/ffmpeg.py | Python | gpl-2.0 | 3,735 |
from models import DBUse
test1 = DBUse()
test1.f_create(account="maomao@gmail.com", password="123321")
test1.f_create(account="hahaha@gmail.com", password="abcd")
user = test1.f_read(uid=2)
test1.f_update(user, account="amy111@gmail.com")
ul = test1.f_read()
for i in ul:
test1.f_delete(i)
test1.f_read()
| pythonistas-tw/academy | web-api/maomao/usecase.py | Python | gpl-2.0 | 313 |
# Playing Cards
# Demonstrates combining objects
class Card(object):
"""A playing card."""
RANKS = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]
SUITS = ["c", "d", "h", "s"]
def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
def __str__(self):
rep = self.rank + self.sui... | rob-nn/python | first_book/playing_cards.py | Python | gpl-2.0 | 1,659 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_import_data.ui'
#
# Created: Thu Nov 13 16:30:03 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fro... | olivierdalang/stdm | ui/ui_import_data.py | Python | gpl-2.0 | 14,198 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
#
# Copyright (c) 2008-2011 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... | jballanc/openmicroscopy | components/tools/OmeroWeb/omeroweb/webclient/forms.py | Python | gpl-2.0 | 111,021 |
import urllib2
def sumaDos():
print 10*20
def division(a,b):
result=a/b
print result
def cast():
i=10
f=10.5
int(10.6)
print "Funcion: "
def main():
sumaDos()
division(10, 20)
def cast():
lista=[1,2,3,"Hola",{"key1":"K","key2":"John"},(1,2,3)]
tupla=(1,2,3)
... | 28064212D/Prueba | Prueba.py | Python | gpl-2.0 | 1,593 |
if not (str(1.0) == "1"):
from boot import *
import tokenize,parse,encode
def _compile(s,fname):
tokens = tokenize.tokenize(s)
t = parse.parse(s,tokens)
r = encode.encode(fname,s,t)
return r
def _import(name):
if name in MODULES:
return MODULES[name]
py = name+".py"
tpc = name... | EcmaXp/PyCraft | misc/tinypy/tinypy/py2bc.py | Python | gpl-2.0 | 1,121 |
import numpy
from PIL import Image
import sys
#if len(sys.argv) != 3:
# sys.exit('usage: dice.py path_to_segmented_image path_to_ground_truth_image')
pairs = [['/home/ognawala/data/PatientMS-R/20140120T143753/20140120T143753_annotated_rf.png', '/home/ognawala/data/Patient-Mask/20140120T143753-mask.png'], ['/home/o... | saahil/MSSegmentation | dice.py | Python | gpl-2.0 | 1,199 |
#!/usr/bin/python
# statusbar.py
import sys
from PyQt4 import QtGui
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QMainWindow.__init__(self)
self.resize(250, 150)
self.setWindowTitle('statusbar')
self.statusBar().showMessage('Ready')
app = ... | buddyzhangrenze/i2c | python/project/buddy/statusbar.py | Python | gpl-2.0 | 403 |
from .utils.math import ceil_div
import numpy as np
import os
from hebel.optimizers import SGD
class CrossValidation(object):
def __init__(self, config, data):
self.n_folds = config['n_folds']
self.n_data = config['n_data']
self.validation_share = config['validation_share']
self.f... | wavelets/hebel | hebel/cross_validation.py | Python | gpl-2.0 | 3,733 |
# -*- coding: utf-8 -*-
#
# This file is part of the Christine project
#
# Copyright (c) 2006-2007 Marco Antonio Islas Cruz
#
# Christine 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... | markuz/Christine | libchristine/Share.py | Python | gpl-2.0 | 5,045 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id: pam.py 33793 2016-03-26 13:02:07Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: Test functioning of the PAM metadata support.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#... | nextgis-extra/tests | lib_gdal/gcore/pam.py | Python | gpl-2.0 | 18,275 |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class less(ShutItModule):
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/less')
shutit.send('cd /tmp/build/less')
shutit.send('wget -qO- http://www.greenwoodsoftware.com/less/less-458.tar.gz | tar -zxf -')
shutit.s... | ianmiell/shutit-distro | less/less.py | Python | gpl-2.0 | 877 |
__author__ = 'bromix'
import time
import urlparse
from resources.lib.kodion import simple_requests as requests
from resources.lib.youtube.youtube_exceptions import LoginException
class LoginClient(object):
CONFIGS = {
'youtube-tv': {
'system': 'All',
'key': 'AIzaSyAd-YEOqZz9nXVz... | AMOboxTV/AMOBox.LegoBuild | plugin.video.youtube/resources/lib/youtube/client/login_client.py | Python | gpl-2.0 | 12,698 |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from bebop_msgs/CommonAudioStateAudioStreamingRunning.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import std_msgs.msg
class CommonAudioStateAudioStreamingRunning(genp... | nicolasgallardo/TECHLAV_T1-6 | bebop_ws/devel/lib/python2.7/dist-packages/bebop_msgs/msg/_CommonAudioStateAudioStreamingRunning.py | Python | gpl-2.0 | 6,495 |
import os
import math
from datetime import datetime
def indexGenerator(articleList, paths, env, language, folder='',
article_per_page=3, future=False):
filenumber = 0
count = 0
# Counting the actual number of articles we are going to publish
# we have to do this in advance, otherw... | nbkr/blog3 | blogthree/util.py | Python | gpl-2.0 | 3,541 |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from edc_registration.models import RegisteredSubject
from .base_maternal_clinical_measurements import BaseMaternalClinicalMeasurements
class MaternalClinicalMeasurementsOne(BaseMaternalClinicalMeasurements):
h... | TshepangRas/tshilo-dikotla | td_maternal/models/maternal_clinical_measurements_one.py | Python | gpl-2.0 | 738 |
# external modules
import numpy as num
# ANUGA modules
import anuga.utilities.log as log
from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a, \
netcdf_float
from generic_asc2dem import generic_asc2dem
def generic_dem2pts(name_in, name_out=None... | mperignon/anuga-sedtransport | file_conversion/generic_dem2pts.py | Python | gpl-2.0 | 6,790 |
"""
components/tools/OmeroPy/scripts/omero/import_scripts/Populate_Plate_Roi.py
Uses the omero.util.populate_roi functionality to parse all the
measurement files attached to a plate, and generate server-side
rois.
params:
Plate_ID: id of the plate which should be parsed.
Copyright 2009 Glencoe Software, Inc. All... | joshmoore/openmicroscopy | components/tools/OmeroPy/scripts/omero/import_scripts/Populate_ROI.py | Python | gpl-2.0 | 1,244 |