repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
bjarneo/Pytify | pytify/song_list.py | from __future__ import absolute_import, unicode_literals
import curses
import sys
import os
from curses import panel
from pytify.strategy import get_pytify_class_by_platform
class SongList():
def __init__(self, items):
self.pytify = get_pytify_class_by_platform()()
self.items = items
self... |
bigdig/vnpy | vnpy/app/algo_trading/engine.py |
from vnpy.event import EventEngine, Event
from vnpy.trader.engine import BaseEngine, MainEngine
from vnpy.trader.event import (
EVENT_TICK, EVENT_TIMER, EVENT_ORDER, EVENT_TRADE)
from vnpy.trader.constant import (Direction, Offset, OrderType)
from vnpy.trader.object import (SubscribeRequest, OrderRequest, LogData)... |
nadavbh12/baselines-pytorch | baselines/a2c/policies.py | import gym
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from functools import reduce
from operator import mul
class CnnToMlp(nn.Module):
def __init__(self, input_dim, num_actions, convs, hiddens, *args, **kwargs):
super(CnnToMlp, self).__init__()
if n... |
vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/__init__.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 ... |
emijrp/pywikibot-core | scripts/solve_disambiguation.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
u"""
Script to help a human solve disambiguations by presenting a set of options.
Specify the disambiguation page on the command line.
The program will pick up the page, and look for all alternative links,
and show them with a number adjacent to them. It will then automatica... |
JoelBender/bacpypes | tests/test_vlan/test_ipnetwork.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test IPNetwork
------------
This module tests the basic functionality of a crudely simulated IPv4 network,
source and destination addresses are tuples like those used for sockets and
the UDPDirector.
"""
import unittest
from bacpypes.debugging import bacpypes_debugg... |
indicolite/flask-blog | flaskblog/extensions.py | #!/usr/bin/env python
# coding=utf-8
from flask_bcrypt import Bcrypt
from flask_oauth import OAuth
from flask_openid import OpenID
from flask_login import LoginManager
# Create the Flask-Bcrypt's instance
bcrypt = Bcrypt()
oauth = OAuth()
openid = OpenID()
# Create the auth object for Facebook
facebook = oauth.remo... |
Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_07_01/operations/_azure_firewall_fqdn_tags_operations.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 ... |
jpvantuyl/python_koans | python2/koans/about_iteration.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1, 6))
fib = 0
for num in it:
fib += num
self.assertEqual(15, fib)
def test_iterating_with_next(self):
... |
DonaldTrumpHasTinyHands/tiny_hands_pac | events/models.py | from django.db import models
from datetime import date
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailimages.edit_handlers import... |
CospanDesign/python | image_processor/opencv_harris_test.py | #! /usr/bin/env python
import cv2
import numpy as np
import matplotlib.pyplot as plt
from image_processor import *
print (TCOLORS.PURPLE + "OpenCV Harris Corner Detector" + TCOLORS.NORMAL)
try:
filename = FILENAME
except NameError:
#filename = 'chessboard.png'
#filename = 'chessboard.jpg'
filename ... |
CSGreater-Developers/HMC-Grader | app/helpers/autograder.py | # coding=utf-8
from app import app, celery, db
from app.structures.models.user import User
from app.structures.models.course import *
from app.structures.models.gradebook import GBGrade
import os,shutil, json, re, stat
from decimal import *
from subprocess import Popen, PIPE
from datetime import datetime
from app.pl... |
Trigition/MTG-DataScraper | mtg_dataminer/icon_config.py | import BeautifulSoup as bs
import urlparse
# '$' is replaced with cost specifier, like 'g' for 'green' mana cost
# https://github.com/andrewgioia/Mana
ICON_TAG = 'i'
ICON_CLASSES = "ms ms-$ ms_cost ms_shadow"
#ICON_TEMPLATE = '<i class="ms ms-$ ms-cost ms-shadow"></i>'
def get_delimited_cost(icon_path):
soup = b... |
HaydenFaulkner/phd | processing/feature/feature_combine.py | '''
Used to combine individual frame features (.npy) to a single (.npy) feature file for a particular sequence from an
annotation file
ie. build points features takes the 1 x len(feat) to numOfFrames x len(feat)
Used before feats_npy2txt.py which is used before framefc7_stream_text_to_hdf5_data.py before training a s... |
sparcs-kaist/araplus | apps/board/views.py | # -*- coding: utf-8
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from apps.board.models import *
from apps.board.backend import _get_post_list, _get_board_list
from apps.board.backend import _get_querystring, _get_content
fr... |
xiaohan2012/capitalization-restoration-train | process_and_save_capitalized_headlines.py | from pathlib import Path
from puls_util import extract_and_capitalize_headlines_from_corpus
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def process_and_save(corpus_dir, target_dir, docids, refresh=False):
target_dir = Path(target_dir)
headlines = extract_and_capitalize... |
noirbizarre/flask-fs | flask_fs/backends/s3.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import io
import logging
from contextlib import contextmanager
import boto3
from botocore.exceptions import ClientError
from . import BaseBackend
log = logging.getLogger(__name__)
class S3Backend(BaseBackend):
'''
An Amazon S3... |
w0w/miniPFC | tasks/actuate.py | import sys
import os.path
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from modules.fan import setFanOff, setFanOn
from modules.light import setLightOff, setLightOn
from modules.pump import setPumpOn, setPumpOff
from modules.sensor import getTempC, getHumidity
import... |
abhyudaynj/LSTM-CRF-models | bionlp/preprocess/dataset_preprocess.py | from __future__ import print_function
import logging
logging.basicConfig(level=logging.INFO)
logger=logging.getLogger(__name__)
from tqdm import tqdm
from bionlp.data.token import Token as Token
from bionlp.data.sentence import Sentence as Sentence
from bionlp.data.document import Document as Document
from bionlp.dat... |
davidharvey1986/pyRRG | src/plot_shears.py | from matplotlib import pyplot as plt
from astropy.io import fits
import numpy as np
from matplotlib import gridspec as gridspec
import ipdb as pdb
import matplotlib.colors as colors
def plot_shears( moments_catalogue, nbins=None,
min_gals_per_bins=100., catalogue=None ):
'''
Plot a quiver plo... |
Teknologforeningen/teknologr.io | teknologr/api/utils.py | # -*- coding: utf-8 -*-
from django.db.models import Q
from members.models import Member
from registration.models import Applicant
from datetime import date
def findMembers(query, count=50):
args = []
for word in query.split():
args.append(Q(given_names__icontains=word) | Q(surname__icontains=word)... |
tangrams/LIDar-tools | getPointsForID.py | import psycopg2
import sys
DATABASE = 'test2'
BUFFER_POLY = 5 # 0 == disable BUFFER (extend the radius of the search)
FILLING_DIST = 0 # 0 == disable filling
CENTERED = False
GROUND = 0
def extractPolygon(osm_id,outfile):
connection = psycopg2.connect(database = DATABASE)
cursor = connection.cursor();
# Default ... |
srkiyengar/NewGripper | src/reflex.py | __author__ = 'srkiyengar'
import dynamixel
import logging
import time
from datetime import datetime
MOVE_TICKS = 130
MOVE_TICKS_SERVO4 = 70
POS_ERROR = 20
ndi_measurement = False # meaning we are not running polaris when False
log_data_to_file = False # To collect servo data without ndi measureme... |
aretas2/catalytic-triad-detection | find_triad.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on June 15 22:40:41 2017
@author: Aretas
"""
###Accepts serine protease PDB file as an input
import sys
import math
class PDBatom:
def __init__(self, string):
self.atom_number = string[4:11].strip()
self.name = string[12:17].strip()
... |
zymtech/Scrapiders | jd_chinahr/jd_chinahr/pipelines.py | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
from scrapy.conf import settings
class JdChinahrPipeline(object):
def __init__(self):
host = settin... |
hideki-saito/Data-Service-for-Instagram | instagram_private_api/endpoints/users.py | import warnings
from ..compatpatch import ClientCompatPatch
class UsersEndpointsMixin(object):
"""For endpoints in ``/users/``."""
def user_info(self, user_id):
"""
Get user info for a specified user id
:param user_id:
:return:
"""
res = self._call_api('users... |
Q42/partyled | generators/ghost-rainbow.py | import math
rgb = 0
sC = 0
fadeSpeed = 0.02
runSpeed = 10
# NOTE time-based, but cheating with fading, which is inherently frame-based
def generator(dT, fr):
global rgb
fadeSpeed = 0.02 # higher = faster
runSpeed = 20 # higher = faster
for i in range(0, sC):
if(int(dT*runSpeed) % sC) == i... |
Keeper-Security/Commander | keepercommander/api.py | # _ __
# | |/ /___ ___ _ __ ___ _ _ ®
# | ' </ -_) -_) '_ \/ -_) '_|
# |_|\_\___\___| .__/\___|_|
# |_|
#
# Keeper Commander
# Copyright 2021 Keeper Security Inc.
# Contact: ops@keepersecurity.com
#
import itertools
import json
import base64
import collections
import re
import getpass
im... |
abualy/cloud-deployer | cloud_deployer/aws_handlers/dhcp.py | #!/usr/bin/env python
#import modules
import csv
#Create Dhcp Option Sets
def dhcp_create(awsc, my_csv, archi, tags=None):
#open csv file and read each row as dictionary
dhcp_file = open(my_csv, 'rb')
dhcp_reader = csv.DictReader(dhcp_file)
print "########################## Starting dhcp opti... |
opesci/devito | benchmarks/user/benchmark.py | from collections import OrderedDict
import sys
import numpy as np
import click
import os
from devito import (clear_cache, configuration, info, warning, set_log_level,
switchconfig, norm)
from devito.arch.compiler import IntelCompiler
from devito.mpi import MPI
from devito.operator.profiling import ... |
jgosmann/goppy | goppy/test/test_kernel.py | """Unit tests for kernel module."""
from hamcrest import assert_that, is_, equal_to
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal
from ..kernel import ExponentialKernel, Matern32Kernel, Matern52Kernel, \
SquaredExponentialKernel
class KernelTest(object):
def create_kernel(se... |
rgreinho/saliere | saliere/templatizer.py | import os
import shutil
import jinja2
from saliere.core import UsageError
class Templatizer:
"""Template manager.
Handles all the template related operations.
"""
def __init__(self, template_path_list=None, template_type=None):
"""Initializer.
:param template_path_list: the list o... |
1065865483/0python_script | vhall_zhike/zhike_unittest/case/tests_02_createSubjects.py | import unittest
from tests_01_login import *
@unittest.skip("skip Tests_02_CreateSubjects")
class Tests_02_CreateSubjects(StartEnd):
# 此界面元素无其他属性,暂用xpath定位元素
def tests_02_createSubjects(self):
'''创建课程'''
for i in range(0,3):
driver.find_element_by_xpath("/html/body/div[2]/div[5]/u... |
ccxt/ccxt | examples/py/async-fetch-order-book-from-many-exchanges.py | # -*- coding: utf-8 -*-
import asyncio
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt.async_support as ccxt # noqa: E402
exchange_ids = [ 'binance', 'kucoin', 'huobipro' ]
symbol = 'ET... |
RDCEP/EDE | ede/api/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from werkzeug.routing import BaseConverter
class ListConverter(BaseConverter):
def to_python(self, value):
return value.split(',')
def to_url(self, values):
return ','.join([BaseConverter.to_url(value) for value in values])
class IntListConvert... |
durandj/hord | hord/core/command/base.py | # -*- coding: utf-8 -*-
"""
Command implementation
"""
import asyncio
import inspect
import shlex
import attr
import hord.core.errors
from . import argument
# pylint: disable=unused-argument
def validate_is_coroutine(instance, attribute, func):
"""
Validates that the function is a coroutine
"""
if... |
Sopwai/dotfiles | .config/polybar/weather.py | #!/bin/python
# -*- coding: utf-8 -*-
# this is using python 3.6
import urllib.request, json
#input your info
city = "" #put your city here
api_key = "" #get an api key from openweathermap
units = "" #Metric or Imperial unit... |
okfn/datapackage-py | tests/test_resource.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import json
import pytest
import httpretty
from copy import deepcopy
from mock import Mock, ANY
from functools import partial
from tabl... |
a-musing-moose/cel | tests/test_utils.py | import os
import pytest
from cel import utils
def test_get_root_dir():
assert utils.get_root_dir() == os.path.realpath(
os.path.join(
os.path.dirname(__file__),
'..',
'cel'
)
)
def test_list_templates():
assert utils.list_templates() == ['default']
... |
Bl41r/quick_pyramid | src/test_main_funcs.py | """Test module for various functions.
These functions are prototypes for the main project.
"""
import os
import shutil
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
TEST_GENERICS_TEXT = """
@view_config(route_name="[ROUTE_NAME]", renderer="[TEMPLATE]",
permission="[PERMISSION]")
def [ROUTE_... |
nanvel/mdpages | setup.py | # -*- encoding: utf-8 -*-
"""
Python setup file for the nicedit app.
In order to register your app at pypi.python.org, create an account at
pypi.python.org and login, then register your new app like so:
python setup.py register
If your name is still free, you can now make your first release but first you
should ... |
mrcrgl/django_distributed_task | setup.py | from setuptools import setup, find_packages
EXCLUDE_FROM_PACKAGES = []
setup(
name='django_distributed_task',
version='1.0.0',
author='Marc Riegel',
author_email='mail@marclab.de',
packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
url='http://pypi.python.org/pypi/django-distributed-task/'... |
thebeansgroup/smush.py | smush/optimiser/formats/png.py | import os.path
from optimiser.optimiser import Optimiser
class OptimisePNG(Optimiser):
"""
Optimises pngs. Uses pngnq (http://pngnq.sourceforge.net/) to quantise them, then uses pngcrush
(http://pmt.sourceforge.net/pngcrush/) to crush them.
"""
def __init__(self, **kwargs):
super(Optimise... |
Aleksei-Badyaev/msbackup | msbackup/archive.py | # -*- coding: utf-8 -*-
"""Archivers module."""
import os
import shutil
import stat
import subprocess
class Tar(object):
"""Tar archiver class."""
SECTION = 'Archive-Tar'
ARCHIVE_PERMISSIONS = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP
def __init__(self, config, encryptor=None):
"""
... |
chipchilders/migrate2cs | ui_server_hyperv.py | #!/usr/bin/env python
## Copyright (c) 2014 Citrix Systems, Inc. All Rights Reserved.
## You may only reproduce, distribute, perform, display, or prepare derivative works of this file pursuant to a valid license from Citrix.
## ----------------------
## INSTALL DEPENDANCIES
## ----------------------
## $ pip... |
theotherzachm/conf_time | tests.py | import unittest
from ncclient.xml_ import NCElement
from ncclient import manager
from conf_time.device import Junos
class TestData(object):
def _test_data(self, path):
with open(path, 'r') as f:
reply = f.read()
return NCElement(
reply,
manager.make_device_handl... |
camilortte/RecomendadorUD | apps/externals/recommends/tests/tests.py | import timeit
from django.test import TestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client
from recommends.providers import recommendation_registry
from recommends.tasks import recommends_precompute
from .models import RecProduct, RecVote
from ... |
pombredanne/swidGenerator | swid_generator/argparser_helper.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import re
import os
from functools import partial
from argparse import ArgumentTypeError, Action
from .generators.swid_generator import software_id_matcher, package_name_matcher
from swid_generator.exceptions im... |
WST/thetool | portal/templatetags/blog_tags.py | # -*- coding: utf-8 -*-
from django import template
import re
register = template.Library()
paragraph_r = re.compile(r'^<(p[^>]*)>(.*)</p>$')
def preprocess_paragraph(text):
match = paragraph_r.match(text.strip())
if match is not None:
return match.groups()[1]
else:
return text
@register.filter(name = 'form... |
NickF40/VkSpyProject | autoresponder.py | import json
import logging
import like-a-s
import time
import urllib.parse as parse
import urllib.request as urllib
import postgresql as pg
import vk
db = pg.open(name='postgres', host='localhost', user='postgres', password='', port='') # your data here
def add_activity(mon, day):
mon_day = ''.join([str(mon), ... |
kelvict/Online-GoBang-Center | Client/LoginService.py | #-*- encoding:UTF-8 -*-
__author__ = 'gzs2478'
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Service import Service
class LoginService(Service):
serviceID = 1001
def __init__(self,parent):
Service.__init__(self,self.serviceID,parent)
self.initData()
def initData(self):
s... |
ccwang002/biocloud-server-kai | src/analyses/access.py | from pathlib import Path
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.shortcuts import redirect
from .models import Report
@login_required
def canonical_access_report(request, report_pk):
... |
CompPhysics/MachineLearning | doc/src/DimRed/Programs/covariance.py | # Importing various packages
import numpy as np
n = 100
# define two vectors
x = np.random.random(size=n)
y = 4+3*x+np.random.normal(size=n)
#scaling the x and y vectors
x = x - np.mean(x)
y = y - np.mean(y)
variance_x = np.sum(x@x)/n
variance_y = np.sum(y@y)/n
print(variance_x)
print(variance_y)
cov_xy = np.sum(x@y)/n... |
rhyswhitley/savanna_iav | src/data_preproc/aggit/aggrg_landsurf_outputs.py | #!/usr/bin/env python
import os
import cPickle as pickle
from scipy import integrate
from collections import OrderedDict
from natsort import natsorted
def main():
# load pickle object
flux_dict = pickle.load(open(PKLPATH + "hourly/fluxes_dict.pkl", 'rb'))
# lambda function for integrated sum
dayint ... |
indaco/saphcpiot-greenhouse | apps/remotecontroller/raspberrypi/cleanup_remotecontroller.py | #!/usr/bin/env python3
# coding: utf8
import RPi.GPIO as GPIO
import configs
if __name__ == "__main__":
LAMP_PIN = configs.lamp_pin
SERVO_PIN = configs.servo_pin
GPIO.setmode(GPIO.BCM)
# GPIO.cleanup()
GPIO.setwarnings(False)
GPIO.setup(LAMP_PIN, GPIO.OUT) # lamp
GPIO.setup(SERVO_PIN, GP... |
races1986/SafeLanguage | CEM/welcome.py | # -*- coding: utf-8 -*-
"""
Script to welcome new users. This script works out of the box for Wikis that
have been defined in the script. It is currently used on the Dutch, Norwegian,
Albanian, Italian Wikipedia, Wikimedia Commons and English Wikiquote.
Note: You can download the latest version available
from here: h... |
OpenBMP/openbmp-python-api-message | examples/log_consumer.py | #!/usr/bin/env python
import yaml
import datetime
import time
import kafka
from openbmp.api.parsed.message.Message import Message
from openbmp.api.parsed.message.BmpStat import BmpStat
from openbmp.api.parsed.message.Collector import Collector
from openbmp.api.parsed.message.LsLink import LsLink
from openbmp.api.pars... |
maximshcherbakov/hyresim | datagen/weatherdata.py | __author__ = 'maxim.shcherbakov'
import numpy as np
import pandas as pd
class BasicDataGenerator:
dataframe = None
def generate(self):
dataframe = 5
class WeatherDataGenerator(BasicDataGenerator):
def generate(self):
super().generate()
cols_ = 20
rows_ = 100
dat... |
denys-duchier/Scolar | ZopeProducts/exUserFolder/PropertyEditor/PropertyEditor.py | #
# Extensible User Folder
#
# (C) Copyright 2000,2001 The Internet (Aust) Pty Ltd
# ACN: 082 081 472 ABN: 83 082 081 472
# All Rights Reserved
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERC... |
TinyOS-Camp/DDEA-DEV | [Python]Collection/toolset.py | import types
import time
from datetime import datetime
import socket
import numpy as np
import pickle
import cPickle
import random
import resource
import mmap
import os
import dill
##################################################
# UDP TOOL
##################################################
def udpRx(ip, port):
... |
XtremeTeam/Talisman-xmpp-bot | plugins/dict_plugin.py | #===istalismanplugin===
# -*- coding: utf-8 -*-
# Talisman plugin
# dict_plugin.py
# Initial Copyright © 2007 Als <Als@exploit.in>
# 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... |
masterfeizz/EDuke3D | build/src/util/md3_export.py | #!BPY
"""
Name: 'Quake3 (.md3)...'
Blender: 242
Group: 'Export'
Tooltip: 'Export to Quake3 file format. (.md3)'
"""
__author__ = "PhaethonH, Bob Holcomb, Damien McGinnes, Robert (Tr3B) Beckebans"
__url__ = ("http://xreal.sourceforge.net")
__version__ = "0.7 2006-11-12"
__bpydoc__ = """\
This script exports a Quake3 f... |
bladealslayer/nettraf-scripts | flow2ports.py | #!/usr/bin/python
############################################################################
# flow2ports.py #
# v0.1 #
# ... |
truongduy134/DNA-Word-Design | src/m_poly.py | # Author: Nguyen Truong Duy
# Contact: truongduy134@gmail.com
##########################################################################
# This module implements a light-weight class of polynomial, called
# MyPoly
class MyPoly:
# Constructor:
def __init__(self, coeffarr = None):
coeffarr = coeffarr or... |
nkasenburg/SPT_priors | code/python/odf_reconstruction.py | #!/usr/bin/env python
#DiPy IO
from dipy.io import read_bvals_bvecs
from dipy.core.gradients import gradient_table
from dipy.io.pickles import save_pickle, load_pickle
from dipy.data import Sphere
#DiPy reconstruction models
from dipy.reconst.csdeconv import auto_response, ConstrainedSphericalDeconvModel
from dipy.reco... |
vincentbetro/NACA-SIM | scripts/scripts-1-2/adaptationruns2.py | #!/usr/bin/env python
#import sys and global var libraries, as well as option parser to make command line args
import os,sys
import glob
from optparse import OptionParser
#first, define system call with default retval for debugging
def mysystem(s,defaultretval=0):
#allows us to set effective debug flag
global... |
dvklopfenstein/PrincetonAlgorithms | py/AlgsSedgewickWayne/DirectedEdge.py | """Immutable weighted directed edge."""
class DirectedEdge(object):
"""a directed edge from vertex v to vertex w with the given weight"""
def __init__(self, v, w, weight):
if v < 0: raise Exception("Vertex names must be nonnegative integers")
if w < 0: raise Exception("Vertex names must be nonnegative in... |
gerwout/mslogparser | classes/Gui.py | import tempfile
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from os.path import expanduser
from classes.FormWidget import FormWidget
from classes.LogParser import LogParser
from classes.SqliteStorage import SqliteStorage
import csv
import io
import os
class Gui(QMainWindow):
... |
OpenDMM/bitbake | lib/bb/fetch2/gitsm.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' git submodules implementation
"""
# Copyright (C) 2013 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as... |
TurboTurtle/sos | setup.py | #!/usr/bin/env python
from distutils.core import setup
from distutils.command.build import build
from distutils.command.install_data import install_data
from distutils.dep_util import newer
from distutils.log import error
import glob
import os
import re
import subprocess
import sys
from sos import __version__ as VER... |
jrichte43/beacon | beacon/tests/test_person_locator.py | import unittest
from beacon.objects.person import Person
from beacon.objects.person_locator import PersonLocator
class TestPersonLocator(unittest.TestCase):
def setUp(self):
self.locator = PersonLocator(Person('James', 'Bond', 'Herbert'))
def test_enumerate_full_name_combinations_first_last(self):
... |
azumimuo/family-xbmc-addon | plugin.video.exodus/resources/lib/sources/torba_mv.py | # -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 lambda
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 3 of the License, or
(at your option) any l... |
Schrolli91/BOSWatch | plugins/Pushover/Pushover.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Pushover-Plugin to send FMS-, ZVEI- and POCSAG - messages to Pushover Clients
@author: Ricardo Krippner
@requires: Pushover-Configuration has to be set in the config.ini
"""
import logging # Global logger
import httplib # for the HTTP request
import urllib
from includ... |
uccgit/the-game | src/World/area.py | # Defines all the areas in the game
# I would like access of them to be based on level
area_names = {
'Elysium': 'Ruled by Cronus and home to the most deserving dead',
'Tartarus': 'The dungeon of torment and sufferings',
'Asphodel Fields': 'The meadow of asphodel where abide the souls and phantoms of those... |
FrodeSolheim/fs-uae-launcher | amitools/vamos/machine/mockmachine.py | from .mockcpu import MockCPU
from .mockmem import MockMemory
from .mocktraps import MockTraps
from amitools.vamos.label import LabelManager
class MockMachine(object):
def __init__(self, size_kib=16, fill=0, use_labels=True):
self.cpu = MockCPU()
self.mem = MockMemory(size_kib, fill)
self.traps = MockTrap... |
wasade/qiime | scripts/make_bootstrapped_tree.py | #!/usr/bin/env python
# File created on 09 Feb 2010
from __future__ import division
__author__ = "Justin Kuczynski"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = [
"Justin Kuczynski",
"Jesse Stombaugh",
"Jose Antonio Navas Molina"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintai... |
jungla/ICOM-fluidity-toolbox | Detectors/offline_advection/advect_particles_2D_big.py | import os, sys
import myfun
import numpy as np
import lagrangian_stats
import scipy.interpolate as interpolate
import csv
import matplotlib.pyplot as plt
import advect_functions
import fio
from intergrid import Intergrid
## READ archive (too many points... somehow)
# args: name, dayi, dayf, days
label = 'm_25_2_512'
... |
PinguinoIDE/pinguino-ide | pinguino/qtgui/gide/bloques/linear/linear.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yeison/Documentos/Desarrollo/Pinguino/GitHub/pinguino-ide/pinguino/qtgui/gide/bloques/linear/linear.ui'
#
# Created: Wed Mar 16 13:19:35 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this fi... |
icaoberg/scholarcloud | examples/example005/little_women.py | from os import path
import os
from scipy.misc import imread
import matplotlib.pyplot as plt
import random
import urllib
from wordcloud import WordCloud, STOPWORDS
#change this to your taste
dpi = 1000
#i used wc to count the number of words in little_women.txt
number_of_words = 188986
def grey_color_func(word, fon... |
dannysellers/django_orders | tracker/api/views/contact_view.py | from django.core.mail import send_mail
from django.conf import settings
from rest_framework.response import Response
from rest_framework.decorators import api_view, permission_classes
from rest_framework import status, permissions
import smtplib
@api_view(['POST'])
@permission_classes([permissions.AllowAny])
def co... |
ulif/pulp | streamer/test/unit/streamer/test_server.py | from httplib import NOT_FOUND, INTERNAL_SERVER_ERROR
from mock import Mock, patch, call
from mongoengine import DoesNotExist, NotUniqueError
from nectar.report import DownloadReport
from pulp.common.compat import unittest
from pulp.devel.unit.util import SideEffect
from pulp.plugins.loader.exceptions import PluginNot... |
Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/netdisco/ssdp.py | """Module that implements SSDP protocol."""
import re
import select
import socket
import logging
from datetime import datetime, timedelta
import xml.etree.ElementTree as ElementTree
import requests
from netdisco.util import etree_to_dict, interface_addresses
DISCOVER_TIMEOUT = 2
# MX is a suggested random wait time ... |
PisiLinuxNew/package-manager | src/rowanimator.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010, TUBITAK/UEKAE
#
# 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 ... |
sam-m888/gramps | gramps/gui/views/bookmarks.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
#
# 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; eith... |
Castronova/EMIT | tests/utilities/test_load_model.py | __author__ = 'tonycastronova'
import os
import unittest
from utilities import gui
class testExchangeItem(unittest.TestCase):
def test_load_model(self):
config = os.path.realpath('./configuration.ini')
params = gui.parse_config(config)
m = gui.load_model(params)
#todo: make su... |
amir73il/unionmount-testsuite | unmount_union.py | from tool_box import *
def unmount_union(ctx):
cfg = ctx.config()
system("umount " + cfg.union_mntroot())
check_not_tainted()
if cfg.should_mount_lower():
system("umount " + cfg.lower_mntroot())
check_not_tainted()
if cfg.testing_overlayfs():
# unmount individual layers wi... |
dwwkelly/dotfiles | ipython/profile_solarized/ipython_notebook_config.py | # Configuration file for ipython-notebook.
c = get_config()
#------------------------------------------------------------------------------
# NotebookApp configuration
#------------------------------------------------------------------------------
# NotebookApp will inherit config from: BaseIPythonApplication, Appli... |
drewcsillag/skunkweb | pylibs/prompt.py | #
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
"""
A prompt module, useful for asking interactive questions.
It's fairly simple, a... |
mail-apps/translate | translate/storage/properties.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2014 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 2... |
fastflo/emma | emmalib/providers/mysql/widgets/__init__.py | """
Emma MySql provider widgets
"""
# -*- coding: utf-8 -*-
# emma
#
# Copyright (C) 2006 Florian Schmidt (flo@fastflo.de)
# 2014 Nickolay Karnaukhov (mr.electronick@gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... |
BlackHole/enigma2-obh10 | lib/python/Screens/AudioSelection.py | from Screen import Screen
from Screens.Setup import getConfigMenuItem, Setup
from Screens.InputBox import PinInput
from Screens.MessageBox import MessageBox
from Components.ServiceEventTracker import ServiceEventTracker
from Components.ActionMap import NumberActionMap
from Components.ConfigList import ConfigListScreen
... |
wichmann/bbss | bbss/pdf.py |
"""
bbss - BBS Student Management
Exports student data as PDF file to be distributed.
Created on Mon Apr 15 10:51:47 2019
@author: Christian Wichmann
"""
import logging
import datetime
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.pagesizes import A4
from reportlab.lib.st... |
topic2k/EventGhost | eg/WinApi/Utils.py | # -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost 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... |
ComputerNetworks-UFRGS/Aurora | cloud/views/deployment_programs.py | import logging
import string
from django import forms
from django.contrib.auth.decorators import login_required
from django.core.files.base import ContentFile
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response, redirect
from django.template import Context, loader
from django.t... |
ranji2612/leetCode | substrWithConcat.py | # Substring with Concatenation of all words
# https://leetcode.com/problems/substring-with-concatenation-of-all-words/
class Solution(object):
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
def buildHash():
... |
hpcugent/easybuild-easyblocks | easybuild/easyblocks/n/numexpr.py | ##
# Copyright 2019-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... |
hdzierz/Kaka | mongodbforms/widgets.py | import copy
from django.forms.widgets import Widget, Media, TextInput
from django.utils.safestring import mark_safe
from django.core.validators import EMPTY_VALUES
from django.forms.utils import flatatt
class ListWidget(Widget):
def __init__(self, contained_widget, attrs=None):
self.contained_widget = con... |
chiamingyen/pygroup | wsgi/webster.py | #coding: utf-8
import os
import sys
import cherrypy
# 導入 pybean 模組與所要使用的 Store 及 SQLiteWriter 方法
from pybean import Store, SQLiteWriter
# 利用 Store 建立資料庫檔案對應物件, 並且設定 frozen=False 表示要開放動態資料表的建立
# 確定程式檔案所在目錄, 在 Windows 有最後的反斜線
_curdir = os.path.join(os.getcwd(), os.path.dirname(__file__))
if 'OPENSHIFT_REPO_DIR' in ... |
EdDev/vdsm | tests/storage_lvm_test.py | #
# Copyright 2012 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 th... |
geobricks/geobricks_proj4_to_epsg | geobricks_proj4_to_epsg/utils/epsg_json_file.py | import requests
import json
from geobricks_proj4_to_epsg.core.proj4_to_epsg import get_proj4_json_from_string
# TODO: @Deprecated
# dirty methods to get epsg/proj4 codes
epsg_json = []
cached_epsg_codes = []
def create_epsg_json_file():
with open("../data/epsg.json", "r") as f:
projection_list = json.loa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.