repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
JoshMayberry/Numerical_Methods | Bisection/bisection plotable 2.py | import math
from equations import *
from my_functions import *
import numpy as np
def function(fn,x):
x = [x]
fx = fn(x)
return fx
def bip(fn,xaxis=[-1,1],inc=0.1,edes=0.01):
"""This function runs bi(), but first shows you a plot and lets you choose the roots you want.
'fn' is the name of an equat... |
SkyLapse/DMS | src/Server/model/basemodel.py | from bson import DBRef
from pymongo.database import Database
__author__ = 'SkyLapse'
from abc import ABCMeta, abstractmethod
class BaseModel():
__metaclass__ = ABCMeta
def __init__(self, base, config, client, db):
self.base = base
self.config = config
self.client = client
se... |
greglinch/sourcelist | django-magic-link/django_magic_login/settings.py | """
Django settings for django_magic_login project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""... |
bunbun/ruffus | ruffus/cmdline.py | ################################################################################
#
#
# cmd_line_helper.py
#
# Copyright (c) 10/9/2009 Leo Goodstadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... |
stepank/pyws | tests/python/suds/testcases/test_add_integers.py | import unittest2 as unittest
from suds import null
from testcases.base import BaseTestCaseMixin
class AddIntegersTestCase(BaseTestCaseMixin, unittest.TestCase):
def test_null(self):
self.assertEqual(
self.service.add_integers(null(), null()), 0)
def test_empty(self):
self.asser... |
akayunov/amqpsfw | lib/amqpsfw/application.py | import logging
import select
import socket
from collections import deque
from amqpsfw import amqp_spec
from amqpsfw.exceptions import SfwException
from amqpsfw.configuration import Configuration
amqpsfw_logger = logging.getLogger('amqpsfw')
log_handler = logging.StreamHandler()
formatter = logging.Formatter('%(ascti... |
sukeesh/Jarvis | jarviscli/plugins/calories.py | from colorama import Fore
from plugin import plugin
@plugin("calories")
class calories:
"""
calculates recommended daily calorie
intake,calories for weight add and loss.
The calculating method is based on gender, age, height and weight.
since it uses the Miffin-St Jeor Equation as it is considered... |
mikaperlin/scripts-configs-etc | templates/py_figs.py | # dependency
import matplotlib as mp
# set fonts and use latex packages
params = { "font.family" : "serif",
"font.serif" : "Computer Modern",
"text.usetex" : True,
"text.latex.preamble" : r"\usepackage{amsmath}",
"font.size" : font_size }
rcParams.update(params)
# default ... |
yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/storage/tests/hybrid_2020_09_01/test_storage_account_scenarios.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
steinnymir/RegAscope2017 | test_scripts/GUI_test/PyQt5 Examples/inputDialogs.py | import sys
from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit
from PyQt5.QtGui import QIcon
class App(QWidget):
def __init__(self):
super().__init__()
self.title = 'PyQt5 input dialogs - pythonspot.com'
self.left = 10
self.top = 10
self.wi... |
okuta/chainer | tests/chainer_tests/functions_tests/rnn_tests/test_function_lstm.py | import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.functions.rnn import lstm
from chainer.testing import backend
def _sigmoid(x):
half = x.dtype.type(0.5)
return numpy.tanh(x ... |
reclosedev/lathermail | lathermail/smtp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import email
import smtpd
import asyncore
import logging
import socket
import base64
from lathermail.compat import bytes
log = logging.getLogger(__name__)
class SMTPChannelWithAuth(smtpd.SMTPChannel, object):
def __init__(self, server, conn, addr, on_close=lambda s... |
Sefrwahed/alfred-news | alfred_news/models.py | from alfred.modules.api.a_base_model import ABaseModel
class Article(ABaseModel):
def __init__(self, title, summary, date, url, image):
super().__init__()
self.title = title
self.summary = summary
self.date = date
self.url = url
self.image = image
class Source(ABa... |
UNH-CORE/RVAT-Re-dep | pyrvatrd/processing.py | # -*- coding: utf-8 -*-
"""This module contains classes and functions for processing data."""
from __future__ import division, print_function
import numpy as np
from pxl import timeseries as ts
from pxl.timeseries import calc_uncertainty, calc_exp_uncertainty
import matplotlib.pyplot as plt
from scipy.io import loadma... |
BOKteam/common | closure/google-closure-builder/builder/source.py | # Copyright 2009 The Closure Library 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 a... |
knuu/competitive-programming | atcoder/abc/abc154_f.py | mod = 10 ** 9+7
def inv(x):
return pow(x, mod - 2, mod)
r1, c1, r2, c2 = map(int, input().split())
fact, inv_fact = [1, 1], [1, 1]
for i in range(2, r2+c2+3):
fact.append(fact[-1] * i % mod)
inv_fact.append(inv(fact[-1]))
def nCr(n, r):
return fact[n] * inv_fact[r] * inv_fact[n-r] % mod
def path... |
benedictpaten/pecan | bp/pecan/SparsePecan.py | #!/usr/bin/env python
#Copyright (C) 2006-2011 by Benedict Paten (benedictpaten@gmail.com)
#
#Released under the MIT license, see LICENSE.txt
#!/usr/bin/env python
import sys
import os
import re
import math
import SparseAlign
def getStartStates(stateMachine):
def fn(i):
if i == MATCH:
re... |
zhirsch/destinykioskstatus | tools/update_manifest.py | #!/usr/bin/python
import json
import os
import sys
import tempfile
import urllib2
import zipfile
# Get the manifest urls.
req = urllib2.Request(
"https://www.bungie.net//platform/Destiny/Manifest/",
headers={'X-API-Key': sys.argv[1]},
)
resp = json.loads(urllib2.urlopen(req).read())
if resp['ErrorCode'] != 1:... |
boreq/recaptcha-client-python3 | captcha.py | import urllib
API_SSL_SERVER="https://www.google.com/recaptcha/api"
API_SERVER="http://www.google.com/recaptcha/api"
VERIFY_SERVER="www.google.com"
class RecaptchaResponse(object):
def __init__(self, is_valid, error_code=None):
self.is_valid = is_valid
self.error_code = error_code
def display_htm... |
Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_active_learning.py | # 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 ... |
igoroya/igor-oya-solutions-cracking-coding-interview | crackingcointsolutions/chapter2/exerciseeight.py | '''
Created on 23 Aug 2017
Loop detection: Given a circular linked list, implement an algorithm
that returns the beginning of the loop
DEFINITION
Circular linked list: A (corrupt) linked list in which a node's next pointer points
to another as to make a loop in the linked list.
EXAMPLE:
Input A -> B -> C -> D -> E -... |
docusign/docusign-python-client | docusign_esign/models/notary_journal_list.py | # coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... |
danforthcenter/plantcv | plantcv/plantcv/median_blur.py | # Median blur device
import os
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import params
from plantcv.plantcv import fatal_error
from scipy.ndimage.filters import median_filter
def median_blur(gray_img, ksize):
"""
Applies a median blur filter (applies median value to central pixel within ... |
caiopo/riemann-bot | src/calculus.py | import sympy
from math import e, sin, cos, tan
def make_func(f):
f = f.replace('-x', '(-x)')
f = f.replace('x', '(x)')
f = f.replace('^', '**')
return lambda x: eval(f)
def solve(msg):
_, fstr = msg.split(' ')
f = make_func(fstr)
x = sympy.Symbol('x')
return sympy.solvers.solve(f(x))
def limit(msg):
_, ... |
kimlaborg/NGSKit | ngskit/utils/codons_info.py |
# Codon Usage probability for each scpecie'
USAGE_FREQ = {'E.coli':{'GGG': 0.15,'GGA': 0.11,'GGT': 0.34,'GGC': 0.4,\
'GAG': 0.31,'GAA': 0.69,'GAT': 0.63,'GAC': 0.37,\
'GTG': 0.37,'GTA': 0.15,'GTT': 0.26,'GTC': 0.22,\
'GCG': 0.36,... |
Azure/azure-sdk-for-python | sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py | # 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 ... |
xiawei0000/Kinectforactiondetect | ChalearnLAPSample.py | # coding=gbk
#-------------------------------------------------------------------------------
# Name: Chalearn LAP sample
# Purpose: Provide easy access to Chalearn LAP challenge data samples
#
# Author: Xavier Baro
#
# Created: 21/01/2014
# Copyright: (c) Xavier Baro 2014
# Licence: <your lic... |
Daniel2357/tetris | tetris.py | #!/usr/bin/python3
from PyQt4 import QtGui
import sys
import TetrisMainWindow
import GameWidget
import TetrisGame
app = QtGui.QApplication(sys.argv)
gameWidget = GameWidget.GameWidget()
mainWindow = TetrisMainWindow.TetrisMainWindow(gameWidget)
game = TetrisGame.TetrisGame(mainWindow, gameWidget)
mainWindow.show(... |
matrix65537/xgo | src/python/tcpip/arp.py | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import os
import stat
import argparse
from scapy.all import(
Ether,
ARP,
sendp,
hexdump,
)
def process_cmd(ns):
eth = Ether()
arp = ARP(
op = "is-at",
hwsrc="12:34:56:78:9A:BC",
psrc="192.168.12.34",
)
p... |
rafallo/p2c | settings.py | # -*- coding: utf-8 -*-
import os, tempfile
PROJECT_ROOT = os.path.dirname(__file__)
TMP_DIR = tempfile.mkdtemp()
DOWNLOAD_DIR = os.path.join(TMP_DIR, "download")
LOG_DIR = os.path.join(TMP_DIR, "logs")
try:
os.makedirs(DOWNLOAD_DIR)
except OSError:
pass
try:
os.makedirs(LOG_DIR)
except OSError:
p... |
Sokrates80/air-py | aplink/messages/ap_imu.py | """
airPy is a flight controller based on pyboard and written in micropython.
The MIT License (MIT)
Copyright (c) 2016 Fabrizio Scimia, fabrizio.scimia@gmail.com
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... |
ajkerr0/kappa | kappa/plot.py | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 22 14:18:45 2016
@author: Alex Kerr
Define functions that draw molecule objects.
"""
import copy
from itertools import cycle
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from .molecule import ... |
amiraliakbari/static-inspector | inspector/saql/interpreter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', '..', '..', 'static-inspector'))
from inspector.saql.sams import SAMS
if __name__ == '__main__':
sams = SAMS()
try:
ind = sys.argv.index('-d')... |
SpringboardEdu/drip-py | drip/drip.py | import json
import requests
import logging
from mixins import DripQueryPathMixin
logger = logging.getLogger(__name__)
class DripPy(DripQueryPathMixin):
"""
The main class that interacts with Drip
https://www.getdrip.com/docs/rest-api#subscribers
"""
def __init__(self, token, account_id, endpoint... |
susemeee/Chunsabot-framework | chunsabot/pi.py | from decimal import *
class PI:
#Sets decimal to 25 digits of precision
getcontext().prec = 1000
@staticmethod
def factorial(n):
# if n<1:
# return 1
# else:
# return n * PI.factorial(n-1)
result = 1
for i in xrange(2, n+1):
result *=... |
J-Adrian-Zimmer/GraphIsomorphism | TestGraphs.py | from Graph import Graph
def mkTestGraph4():
return Graph(
['a','b','c','d'],
[ ('a','b'),
('b','c'),
('c','a'),
('a','d')
]
)
def mkTestGraph4b(): ## isomorphic with 4
return Graph(
['a','c','b','d'],
... |
dgm816/simple-index | nntp/nntp.py | import re
import socket
import ssl
class MyNntp:
def __init__(self, server, port, use_ssl):
"""Constructor
Pass in the server, port, and ssl usage value for connect.
"""
# just store the values for now
self.server = server
self.port = port
self.ssl = use_s... |
opentok/Opentok-Python-SDK | sample/HelloWorld/helloworld.py | from flask import Flask, render_template
from opentok import Client
import os
try:
api_key = os.environ["API_KEY"]
api_secret = os.environ["API_SECRET"]
except Exception:
raise Exception("You must define API_KEY and API_SECRET environment variables")
app = Flask(__name__)
opentok = Client(api_key, api_sec... |
fegonda/icon_demo | code/model/unet/ff.py | import os
import sys
import skimage.transform
import skimage.exposure
import time
import glob
import numpy as np
import mahotas
import random
import matplotlib
import matplotlib.pyplot as plt
import scipy
import scipy.ndimage
import json
from scipy.ndimage.filters import maximum_filter
base_path = os.path.dirname(__fi... |
MAPSuio/spring-challenge16 | frengers/generate.py | from random import choice, shuffle
names_fd = open('names.txt', 'ro')
names = map(lambda name: name.strip(), names_fd.readlines())
events = []
for i in xrange(7):
events.append("meet")
for i in xrange(3):
events.append("friends")
names_fd.close()
entries = set()
while len(entries) < 8000:
event = ... |
WarmongeR1/feedly-filter | apps/filters/management/commands/load_data.py | # -*- encoding: utf-8 -*-
import csv
from allauth.socialaccount.models import SocialToken
from django.core.management.base import BaseCommand
from apps.filters.filter import get_api
import os
from django.conf import settings
from yaml import load
from apps.filters.models import Collection, Entry, Category
class Co... |
vlaw/ApiTestEngine | tests/test_response.py | import requests
from ate import response, exception
from tests.base import ApiServerUnittest
class TestResponse(ApiServerUnittest):
def test_parse_response_object_json(self):
url = "http://127.0.0.1:5000/api/users"
resp = requests.get(url)
resp_obj = response.ResponseObject(resp)
p... |
WarwickAnimeSoc/aniMango | polls/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2018-08-08 19:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Option... |
Sirs0ri/PersonalAssistant | samantha/plugins/plugin.py | """Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ]
#
###############################################################################
# standard library imports
from collections import Iterable
from functools import wraps
import loggin... |
twisted/axiom | axiom/test/historic/stub_textlist.py | # -*- test-case-name: axiom.test.historic.test_textlist -*-
from axiom.item import Item
from axiom.attributes import textlist
from axiom.test.historic.stubloader import saveStub
class Dummy(Item):
typeName = 'axiom_textlist_dummy'
schemaVersion = 1
attribute = textlist(doc="a textlist")
def createDat... |
fbouliane/ddns-updater-aws | setup.py | from distutils.core import setup
from setuptools import find_packages
setup(name='ddns_updater_aws',
version='0.1',
author='Felix Bouliane',
license='MIT',
py_modules=[],
packages=find_packages(exclude=['contrib', 'docs', 'test']),
url='https://github.com/fbouliane/ddns-updater-aws',... |
bertmcmeyer/opti_ssr | opti_ssr_demo_headtracker.py | """
A python module for demonstrating head orientation tracking for
binaural synthesis.
Usage: python opti_ssr_demo.py [SSR_IP] [SSR_port] [optitrack ip] [multicast address] [optitrack port] [end_message]
"""
import sys
from time import sleep
import opti_ssr
def demo(ssr_ip='localhost', ssr_port=4711, opti_unicast_... |
StoDevX/cs251-toolkit | cs251tk/specs/load.py | import sys
from logging import warning
from glob import iglob
import json
import os
import shutil
from ..common import chdir, run
from .cache import cache_specs
from .dirs import get_specs_dir
def load_all_specs(*, basedir=get_specs_dir(), skip_update_check=True):
os.makedirs(basedir, exist_ok=True)
if not ... |
pari685/AStream | dist/client/dash_client.py | #!/usr/local/bin/python
"""
Author: Parikshit Juluri
Contact: pjuluri@umkc.edu
Testing:
import dash_client
mpd_file = <MPD_FILE>
dash_client.playback_duration(mpd_file, 'http://198.248.242.16:8005/')
From commandline:
python dash_client.py -m "http://198.248.242.16:8006/media/m... |
Xcelled/cap-n-snap | host.py | import loggingstyleadapter
log = loggingstyleadapter.getLogger(__name__)
from PyQt5.QtGui import QKeySequence
import hotkeys, plat
class Host:
def __init__(self):
pass
#enddef
def registerDestination(self, destination):
print("Don't forget to implement me (registerDestination)")
#enddef
def registerCommand... |
synth3tk/the-blue-alliance | helpers/event_insights_helper.py | import logging
from collections import defaultdict
class EventInsightsHelper(object):
@classmethod
def calculate_event_insights(cls, matches, year):
INSIGHTS_MAP = {
2016: cls.calculate_event_insights_2016
}
if year in INSIGHTS_MAP:
return INSIGHTS_MAP[year](ma... |
backtrace-labs/backtrace-python | tests/__init__.py | import simplejson as json
import os
import subprocess
import sys
import unittest
if sys.version_info.major >= 3:
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler
else:
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
tests_dir = o... |
BurtBiel/azure-cli | src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/tests/test_validators.py | #---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... |
SebastianoF/LabelsManager | nilabels/definitions.py | import os
__version__ = 'v0.0.7' # update also in setup.py
root_dir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
info = {
"name": "NiLabels",
"version": __version__,
"description": "",
"repository": {
"type": "git",
"url":... |
hanleilei/note | python/vir_manager/utils/libvirt_utils.py | import hashlib
import libvirt
from django.forms.models import model_to_dict
from utils.common import gen_passwd
from utils.common import gen_user_passwd
from backstage.models import LibvirtPass
from utils.salt_utils import SaltApiHandler
def get_host_passwd(host):
"""
* desc 获取机器的用户名和密码
* input 主机ip
... |
wright-group/WrightData | 2011-11 Yurs/workup.py | '''
First Created 2016/05/05 by Blaise Thompson
Last Edited 2016/08/08 by Blaise Thompson
Contributors: Blaise Thompson
'''
### import ####################################################################
import os
import sys
import importlib
import collections
import WrightTools as wt
### define ##############... |
NiceCircuits/pcbLibraryManager | src/pcbLibraryManager/symbols/symbolsIC.py | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 2 19:02:52 2015
@author: piotr at nicecircuits.com
"""
from libraryManager.symbol import symbol
from libraryManager.symbolPrimitive import *
from libraryManager.defaults import defaults
from libraryManager.common import *
class symbolIC(symbol):
"""
IC symbol g... |
abelboldu/nagpy-pushover | nagpy/util/pushover.py | #!/usr/bin/env python
import urllib
import urllib2
import urlparse
import json
import os
PUSHOVER_API = "https://api.pushover.net/1/"
class PushoverError(Exception): pass
def pushover(**kwargs):
assert 'message' in kwargs
if not 'token' in kwargs:
kwargs['token'] = os.environ['PUSHOVER_TOKEN']
... |
verityrise/Canine_Analysis | integrate_genome.py | #!/usr/bin/python
'''
This programs is to integrate dog reference genome from chr to a single one.
Author: Hongzhi Luo
'''
import gzip
import glob
import shutil
path='/vlsci/LSC0007/shared/canine_alport_syndrome/ref_files/'
#path=''
prefix='cfa_ref_CanFam3.1'
def integrate_genome():
'''
@param: num: chr1...ch... |
syncboard/syncboard | src/session.py | """
Cross-platform clipboard syncing tool
Copyright (C) 2013 Syncboard
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 opt... |
libvirt/autotest | frontend/tko/csv_encoder.py | import csv
import django.http
try:
import autotest.common as common
except ImportError:
import common
from autotest_lib.frontend.afe import rpc_utils
class CsvEncoder(object):
def __init__(self, request, response):
self._request = request
self._response = response
self._output_rows ... |
aglitke/vdsm | vdsm/storage/storage_exception.py | #
# Copyright 2009-2011 Red Hat, Inc.
#
# 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 program is distributed ... |
donhoffman/pi-keypad-controller | src/door_latch.py | import datetime
import logging
import sqlite3
import time
from os import environ
import relays
class Latch:
DIGIT_TIMEOUT = 60
LOCKOUT_TIMEOUT = 300
LOCKOUT_THRESHOLD = 5
VALID_CH = set('0123456789#*')
def __init__(self, latch_id, latch_index):
self._logger = logging.getLogger(__name__)... |
gwsu2008/automation | python/git-branch-diff.py | #!/usr/bin/env python3
import urllib3
import sys
import os
import json
from datetime import datetime
import urllib.parse
import requests
import time
import argparse
urllib3.disable_warnings()
debug = os.getenv('DEBUG', 0)
batch_size = 100
workspace = os.getenv('WORKSPACE', os.getcwd())
user_name = 'jenkins-testerdh'
u... |
wangtaoking1/found_website | 项目代码/classification.py | # -*- coding: utf-8 -*-
#search函数,参数为输入文件,输出文件,关键词。关键词与输入文件的每六行进行匹配(六行为一条微博),如果出现该关键词,则把该微博输出到输出文件中
def search(input_file,output_file,key):
line = input_file.readline()
if line == "\n":
line = input_file.readline()
while line: #如果文件没有结束,继续读取
lines = ""
lines += line
... |
psigcat/padrohabitants | plugin/ui/padrohabitants_dialog.py | # -*- coding: utf-8 -*-
from PyQt4 import QtGui, uic
import os
#from qgis.utils import iface
FORM_CLASS, _ = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'padrohabitants_dialog.ui'))
class PadroHabitantsDialog(QtGui.QDialog, FORM_CLASS):
def __init__(self, parent=None):
"""Constructor."""
... |
leojohnthomas/ahkab | mosq.py | # -*- coding: iso-8859-1 -*-
# mosq.py
# Implementation of the square-law MOS transistor model
# Copyright 2012 Giuseppe Venturini
#
# This file is part of the ahkab simulator.
#
# Ahkab is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... |
yochow/autotest | client/bin/harness.py | """The harness interface
The interface between the client and the server when hosted.
"""
__author__ = """Copyright Andy Whitcroft 2006"""
import os, sys
import common
class harness(object):
"""The NULL server harness
Properties:
job
The job object for this job
"""
... |
agati/chimera | src/chimera/instruments/sk/tests/skdrv_OK_25062015.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2006-2015 chimera - observatory automation system
# 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 Li... |
AIESECGermany/gis-hubspot-sync | gis_token_generator.py | import urllib
import urllib2
import cookielib
import logging
class GISTokenGenerator:
def __init__(self, email, password):
self.cj = cookielib.CookieJar()
self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
self.email = email
self.login_data = urllib.urlencode(... |
xybydy/kirilim | utils.py | import sys
from time import sleep
from colored import stylize, fg, attr
def flush(msg, err=None, fast=None, wait=0, code='reg'):
codes = dict(
error=fg('red') + attr('bold'),
reg=fg(28) + attr('bold'),
blue=fg('blue')
)
if err:
if fast:
print(stylize('\n[-] {0... |
asmacdo/shelf-reader | shelf_reader/ui.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from .compat import user_input
def correct(call_a, call_b):
"""
Informs the user that the order is correct.
:param call_a: first call number - not used at this time but could be
important in later versions.
:param call... |
ranji2612/leetCode | combinationSum.py | # Combination Sum
# https://leetcode.com/problems/combination-sum/
class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
if len(candidates)==0 or target<=0:
retu... |
kshahar/pylaunchy | plugins/PyDiry/pydiry.py | # Copyright (c) 2008 Shahar Kosti
#
# 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 program is distribu... |
szecsi/Gears | GearsPy/Project/Components/Temporal/CellLti7.py | import Gears as gears
from .. import *
from .Filter import *
class CellLti7(Filter) :
def applyWithArgs(
self,
stimulus,
) :
sequence = stimulus.getSequence().getPythonObject()
stimulus.setLtiMatrix(
[
0, 0.47494, -0.0966925, 0.150786, -... |
rafaelmartins/blohg | blohg/tests/vcs_backends/hg/filectx.py | # -*- coding: utf-8 -*-
"""
blohg.tests.vcs_backends.hg.filectx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module with tests for blohg integration with mercurial (file context).
:copyright: (c) 2010-2013 by Rafael Goncalves Martins
:license: GPL-2, see LICENSE for more details.
"""
import codecs
import ... |
shumik/skencil-c | Sketch/UI/command.py | # Sketch - A Python-based interactive drawing program
# Copyright (C) 1997, 1998, 2001 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the Lice... |
cea-hpc/shine | lib/Shine/Configuration/ModelFile.py | # Copyright (C) 2010-2014 CEA
#
# This file is part of shine
#
# 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 ... |
rbarlow/pulp_packaging | ci/promote-brach.py | #!/usr/bin/env python2
import os
import subprocess
import argparse
from lib import builder
from lib import promote
current_directory = os.path.realpath(os.path.dirname(__file__))
parser = argparse.ArgumentParser()
description = "Used to promote from one branch to another. For example, from 2.6-dev to " \
... |
repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/en/glodls.py | # -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... |
adrienbrunet/EulerProject | problem_030.py | # coding: utf-8
'''
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 1 ** 4 + 6 ** 4 + 3 ** 4 + 4 ** 4
8208 = 8 ** 4 + 2 ** 4 + 0 ** 4 + 8 ** 4
9474 = 9 ** 4 + 4 ** 4 + 7 ** 4 + 4 ** 4
As 1 = 1 ** 4 is not a sum it is not included.
The sum of these nu... |
K-3D/k3d | share/k3d/scripts/RenderManScript/tribble.py | #python
# Load this script into a RenderManScript node to create
# what is either a Tribble or a really bad-hair-day ...
import k3d
k3d.check_node_environment(context, "RenderManScript")
import sys
import ri
from ri import *
from random import *
from cgtypes import vec3
from noise import vsnoise
from sl import mix
... |
akshayka/bft2f | start_client.py | import sys, glob
sys.path.append('gen-py')
from auth_service import Auth_Service
from auth_service.ttypes import *
from bft2f_pb2 import *
from argparse import ArgumentParser
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from time import sleep, time
from Crypto.PublicKey... |
BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/Encodings/IUPACEncoding.py | """Properties once used for transcription and translation (DEPRECATED).
This module is deprecated, and is expected to be removed in the next release.
If you use this module, please contact the Biopython developers via the
mailing lists.
"""
#NOTE - Adding a deprecation warning would affect Bio.Alphabet.IUPAC
# Set up... |
commonsense/conceptdb | conceptdb/test/test_sentence.py | from conceptdb.metadata import Dataset
import conceptdb
from conceptdb.assertion import Sentence
conceptdb.connect_to_mongodb('test')
def test_sentence():
dataset = Dataset.create(language='en', name='/data/test')
#create test sentence with dataset
sentence1 = Sentence.make('/data/test', "This is a ... |
popazerty/dvbapp2-gui | lib/python/Plugins/Extensions/EGAMIPermanentClock/plugin.py | ##
## Permanent Clock
## by AliAbdul
##
from Components.ActionMap import ActionMap
from Components.config import config, ConfigInteger, ConfigSubsection, ConfigYesNo
from Components.MenuList import MenuList
from enigma import ePoint, eTimer, getDesktop
from os import environ
from Plugins.Plugin import PluginDescriptor
... |
claudep/translate | translate/tools/porestructure.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2005, 2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 ... |
ebilionis/variational-reformulation-of-inverse-problems | vuq/_first_order_entropy_approximation.py | """
A first order approximation to the entropy.
Author:
Ilias Bilionis
Date:
6/3/2014
"""
__all__ = ['FirstOrderEntropyApproximation']
import numpy as np
from . import MixtureOfMultivariateNormals
from . import EntropyApproximation
class FirstOrderEntropyApproximation(EntropyApproximation):
"""
... |
debugger06/MiroX | lib/test/widgetstateconstantstest.py | from miro.test.framework import MiroTestCase
from miro.frontends.widgets.widgetstatestore import WidgetStateStore
from miro.frontends.widgets.itemlist import SORT_KEY_MAP
class WidgetStateConstants(MiroTestCase):
def setUp(self):
MiroTestCase.setUp(self)
self.display_types = set(WidgetStateStore.ge... |
EdDev/vdsm | tests/storage_volume_metadata_test.py | # Copyright 2016 Red Hat, Inc.
#
# 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 program is distributed in the ... |
MDAnalysis/mdanalysis | testsuite/MDAnalysisTests/lib/test_nsgrid.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2018 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... |
flyapen/UgFlu | flumotion/worker/__init__.py | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... |
ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QApplication.py | # encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QApplication(__PyQt4_QtCore.QCoreApplication):
"""
QApplication(list-of-str)
QApplication(list-of-st... |
Meuh-Factory/womoobox | settings.py | # Configuration
# Generate key with specific length and chars
import string
KEY_LENGTH = 50
KEY_REF_SETS = string.ascii_letters + string.digits
# When getting last Moos to init map
MAX_NUMBER_OF_INITIAL_MOO = 25
# When getting last Moos from last call
MAX_NUMBER_OF_MOO = 25
# Do not accept more than 1 (same animal)... |
CodethinkLabs/firehose | debian/foo/debfile.py | # DebFile: a Python representation of Debian .deb binary packages.
# Copyright (C) 2007-2008 Stefano Zacchiroli <zack@debian.org>
# Copyright (C) 2007 Filippo Giunchedi <filippo@debian.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publi... |
GamesCrafters/GamesmanClassic | src/py/games/tt2.py | import game
import server
class tt2(game.Game):
class TT2Process(server.GameProcess):
def memory_percent_usage(self):
return 0.0
def __init__(self, server, name):
game.Game.__init__(self, server, name)
self.process_class = self.TT2Process
def get_option(self, query)... |
wallarelvo/mod | scripts/find_stations.py |
import sklearn.neighbors as nn
import numpy as np
import pandas as pd
import argparse
def find_clusters(geos, tol):
hav_tol = tol / 6371.0
used = [False] * len(geos)
ball_tree = nn.BallTree(np.radians(geos), metric="haversine")
centers = list()
for i in xrange(len(geos)):
if not used[i]:
... |
pybursa/homeworks | a_berezovsky/hw1/task05.py | # -*- coding: utf-8 -*-
"""
Задание 5: определение типа.
УСЛОВИЕ:
функция, которая принимает объект и выводит строку с наименованием типа этого объекта.
Пример:
typer(666) == "int"
typer("666") == "str"
typer(typer) == "function"
"""
def typer(variable):
return type(variable).__name__
if __name__ == '__main__... |
Germanika/plover | plover/system/english_stenotype.py |
KEYS = (
'#',
'S-', 'T-', 'K-', 'P-', 'W-', 'H-', 'R-',
'A-', 'O-',
'*',
'-E', '-U',
'-F', '-R', '-P', '-B', '-L', '-G', '-T', '-S', '-D', '-Z',
)
IMPLICIT_HYPHEN_KEYS = ('A-', 'O-', '5-', '0-', '-E', '-U', '*')
SUFFIX_KEYS = ('-S', '-G', '-Z', '-D')
NUMBER_KEY = '#'
NUMBERS = {
'S-': '... |
gliheng/Mojo | mojo/scripts/dump_blog_data.py | import os
import sys
import transaction
from pyramid.paster import bootstrap
import transaction
from mojo.models import root_factory
from mojo.blog.models import get_blogroot
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri>\n'
'(example: "%s development.ini")' % (cmd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.