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
""" Copyright (c) 2018 Doyub Kim I am making my contributions/submissions to this project solely in my personal capacity and am not conveying any rights to any intellectual property of any third parties. """ import numpy as np import pyjet from pytest import approx from pytest_utils import * cnt = 0 def test_grid...
doyubkim/fluid-engine-dev
src/tests/python_tests/test_cell_centered_scalar_grid.py
Python
mit
12,197
import asyncio from aioriak import RiakClient from aioriak.tests import HOST, PORT import unittest import random class IntegrationTest: @classmethod def randname(cls, length=12): out = '' for i in range(length): out += chr(random.randint(ord('a'), ord('z'))) return out ...
rambler-digital-solutions/aioriak
aioriak/tests/base.py
Python
mit
1,399
# # 快乐学API # import json import logging import random import hashlib import requests import urllib from django.conf import settings from app.models import Student from app.utils import random_chars from app.utils.algorithm import verify_sha1_sig, sign_sha1 __all__ = [ "KLX_WEB_SITE", "KLX_STUDY_URL_FMT", ...
malaonline/Server
server/app/utils/klx_api.py
Python
mit
9,011
""" setup.py @author: franblas @url: https://github.com/franblas/pyAPI """ from setuptools import setup, find_packages setup( name='pyAPI', version='0.0.1', description='Data from multiple APIs with python', url='https://github.com/franblas/pyAPI', author='Francois Blas', author_email='francoi...
franblas/pyAPI
src/setup.py
Python
mit
784
from __future__ import division import os import sys from copy import deepcopy from collections import Counter from nltk.tag import CRFTagger THIS_DIR = os.path.dirname(os.path.realpath(__file__)) sys.path.append(THIS_DIR + "/../..") from deep_disfluency.feature_extraction.feature_utils import\ load_data_from_dis...
dsg-bielefeld/deep_disfluency
deep_disfluency/feature_extraction/POS_tagging.py
Python
mit
9,003
import numpy as np from scipy.stats import sem import scipy.constants as const from uncertainties import ufloat import uncertainties.unumpy as unp from uncertainties.unumpy import (nominal_values as noms, std_devs as stds) import matplotlib.pyplot as plt from scipy.optimize import curve_fit from PIL import Image import...
smjhnits/Praktikum_TU_D_16-17
Fortgeschrittenenpraktikum/Protokolle/V27_Zeeman-Effekt/Python/blau_s.py
Python
mit
2,866
# coding: latin-1 import sys import os default_path = r"C:\Program Files\gp423win32\gnuplot\bin\pgnuplot.exe" default_temp_dir = "tempgnuplot" imagenumber = 0 def execute_script_gnuplot (scr) : global default_temp_dir global imagenumber global default_path if not os.path.exists (default_tem...
sdpython/teachpyx
_todo/programme/graphplot.py
Python
mit
2,480
''' Created on Mar 21, 2013 @author: fniksic ''' from data import CoverabilityInstance, Transition, Interval from mister.ast import Constraint from mister.data import ReachabilityInstance def build_problem_instance(program_node): ''' Process node of the form Program(variables, rules, initial, target, invaria...
fniksic/mister
src/mister/builder.py
Python
mit
5,072
#!/usr/bin/env python #coding:utf8 class Solution(object): def permuteUnique(self, nums): length = len(nums) if length == 0: return [[]] rlists = [[nums[0]]] for i in range(1, length): tlists = [] for L in rlists: v = nums[i] ...
matrix65537/lab
leetcode/permutations/permutation2.py
Python
mit
785
import numpy import theano from fuel.datasets import IterableDataset from theano import tensor from blocks.algorithms import GradientDescent, Scale from blocks.extensions import FinishAfter, ProgressBar, Printing from blocks.main_loop import MainLoop from blocks.utils import shared_floatx def setup_mainloop(extensio...
rizar/attention-lvcsr
libs/blocks/tests/extensions/test_progressbar.py
Python
mit
1,721
#!/usr/bin/env python3 '''Conway's Game of Life in a Curses Terminal Window ''' import curses import time from GameOfLife import NumpyWorld from GameOfLife import Patterns from curses import ( COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_MAGENTA, COLOR_RED, COLOR...
JnyJny/GameOfLife
contrib/NCGameOfLife.py
Python
mit
5,897
""" Django CAS 2.0 authentication middleware """ from django.conf import settings from django.contrib import auth from django.contrib.auth.views import login, logout from django.core.exceptions import PermissionDenied from django.http import HttpResponseRedirect from django_cas.exceptions import CasTicketException fro...
childe/esproxy
django_cas/middleware.py
Python
mit
2,415
import ranking ranking.show_ranking()
prevwong/PSP0201
modules/ui.py
Python
mit
38
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-23 16:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('news', '0004_auto_20180213_1839'), ] operations = [ migrations.AlterField(...
hackerspace-ntnu/website
news/migrations/0005_auto_20180723_1631.py
Python
mit
730
# -*- coding: utf-8 -*- from io import open from setuptools import setup, find_packages setup( name='wuffi', version='0.0.0', description='TBD', long_description=open('README.md', encoding='utf-8').read(), author='Nikita Grishko', author_email='grin.minsk+github@gmail.com', url='https://g...
Gr1N/wuffi
setup.py
Python
mit
1,554
# 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/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_locations_operations.py
Python
mit
5,027
import socket from user_agents import parse import multiprocessing import ssl import sys from datetime import * class HTTP_Server(object): """This is the http page spoofing Server""" def __init__(self, bind_address, payloads_folder): global http_responce, s, html super(HTTP_Server, self).__init__() bind_port =...
Dylan-halls/Theseus
src/server/server.py
Python
mit
2,762
from ceph_deploy.lib import remoto from ceph_deploy.hosts.centos.install import repo_install, mirror_install # noqa from ceph_deploy.hosts.util import install_yum_priorities def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Fedora, # `kw['components...
alfredodeza/ceph-deploy
ceph_deploy/hosts/fedora/install.py
Python
mit
3,044
import webapp2 from google.appengine.ext import db from google.appengine.ext import ndb from db_class import DerivedClass as OldDerivedClass from ndb_class import BaseClass as NewBaseClass from ndb_class import DerivedClass as NewDerivedClass class Repro(webapp2.RequestHandler): def get(self): self.response...
lantius/ndb-key
repro.py
Python
mit
1,545
#!/usr/bin/env python ''' Pickle fasta file into a dictionary {id => sequence}. ''' import argparse, cPickle as pickle from Bio import SeqIO def fasta_file_to_dict(fh): '''fasta file to {id => sequence}''' return {record.id: str(record.seq) for record in SeqIO.parse(fh, 'fasta')} if __name__ == '__main__'...
almlab/SmileTrain
tools/setup_tools/pickle_id2seq_fasta.py
Python
mit
749
import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand VERSION = '0.4.1' class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] def initialize_options(self): TestCommand.initialize_options(self) ...
caioariede/pyintercept
setup.py
Python
mit
1,498
#!/usr/bin/env python from __future__ import division, print_function def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('distutils', parent_package, top_path) config.add_subpackage('command') config.add_subpackage('fcompiler...
DailyActie/Surrogate-Model
01-codes/numpy-master/numpy/distutils/setup.py
Python
mit
610
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>""" import numpy import sklearn.svm import sklearn.pipeline import sklearn.linear_model import sklearn.decomposition import sklearn.kernel_approximation import borg logger = borg.get_logger(__name__, default_level = "INFO") class MultiClassifier(object): def __in...
borg-project/borg
borg/regression.py
Python
mit
4,929
""" ICH flash descriptor """ import struct from raw import RAW from fd import FD _SIG = '5AA5F00F'.decode('hex') _SIG_OFFSET = 0x10 _SIG_SIZE = 0x4 _S_HEADER = struct.Struct('< 16s 4s BBBB BBBB BBBB') _S_REGION = struct.Struct('< H H') _REGIONS = [('ich', RAW), ('bios', FD), ('me', RAW), ('gbe', RAW), ('plat', RA...
fesh0r/romdump
ichdesc.py
Python
mit
3,000
import sys, tty, termios class _Getch: def __call__(self, a): return self._get_key(a) def _get_key(self, a): fd = sys.stdin.fileno() old = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(a) finally: termi...
gotankgo/practice
python/inputkeyboard/Inputkey.py
Python
mit
937
#!/usr/bin/env python # coding=utf-8 """ / 提供基础页面 """ import json import time import subprocess import tornado.concurrent import tornado.gen import tornado.httpclient import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web import tornado.template import pymongo from tornado.options im...
tao12345666333/Talk-Is-Cheap
conf-sys/web_app.py
Python
mit
1,765
# -*- coding: utf-8 -*- import pytest from boussole.exceptions import FinderException def test_001(finder): results = finder.get_relative_from_paths("/home/foo/plop", [ "/home/foo", "/home/bar", "/etc", ]) assert results == "plop" def test_002(finder): results = finder.get_...
sveetch/boussole
tests/002_finder/005_relativefrompaths.py
Python
mit
2,097
# Copyright (C) 2007 - 2009 Khronos Group # Copyright (c) 2012 The Khronos Group Inc. # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the...
KhronosGroup/COLLADA-CTS
StandardDataSets/collada/library_geometries/geometry/mesh/polygons/one_geometry_one_polygons/one_geometry_one_polygons.py
Python
mit
5,053
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Is this a triangle? #Problem level: 7 kyu def is_triangle(a, b, c): return (a+b>c) and (b+c>a) and (c+a>b)
Kunalpod/codewars
is_this_a_triangle.py
Python
mit
163
# -*- coding: utf-8 -*- ''' Nose wrapper that runs the test files using robot and then compare the screenshots using perceptualdiff. ''' import glob import os import subprocess import string import sys import unittest from robot.running.builder import TestSuiteBuilder class TestRobotS2LScreenshot(unittest.TestCase)...
canaryhealth/RobotS2LScreenshot
test/test_robots2lscreenshot.py
Python
mit
1,787
#!/usr/bin/env python3 """ Created on 15 Aug 2016 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) Note: this script uses the Pt1000 temp sensor for temperature compensation. """ import time from scs_core.data.json import JSONify from scs_core.gas.afe_baseline import AFEBaseline from scs_core.gas.afe_ca...
south-coast-science/scs_dfe_eng
tests/gas/afe/afe_test.py
Python
mit
2,350
#!/usr/bin/env python # # Jetduino Example for using the Grove Electricity Sensor (http://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor) # # The Jetduino connects the Jetson and Grove sensors. You can learn more about the Jetduino here: http://www.NeuroRoboticTech.com/Projects/Jetduino # # Have a question about...
NeuroRoboticTech/Jetduino
Software/Python/grove_electricity_sensor.py
Python
mit
2,751
#!/usr/bin/env python # -*- coding: utf-8 -*- __VERSION__ = "" # EOF
samjy/acmeclient
acmeclient/__init__.py
Python
mit
73
num_list1 = [1, 3, 21, 9, 88, 77, 0, 20] num_list2 = [10, 3, 21, 9, 88, 77, 0, 1000] # Defining/creating the function: def romeos_version_of_max( nlst ): print nlst largest = nlst[0] # Find the largest, and update the variable for number in nlst: if number >= largest: largest = ...
romeokpolo/SVMPython
src/01-Week2/find_largest.py
Python
mit
456
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: pogoprotos/networking/responses/award_free_raid_ticket_response.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _...
bellowsj/aiopogo
aiopogo/pogoprotos/networking/responses/award_free_raid_ticket_response_pb2.py
Python
mit
3,978
""" Read bam files""" from __future__ import print_function # from memory_profiler import profile import os.path as op import os import pysam from collections import defaultdict import pybedtools from mirtop.libs import do from mirtop.libs.utils import file_exists import mirtop.libs.logger as mylog from mirtop.mirna...
miRTop/mirtop
mirtop/bam/bam.py
Python
mit
15,466
#!/usr/bin/python import sys #what is the command command = sys.argv[1]; source = sys.argv[2]; print "Command: ", command; print "Source: ", source;
LucidWorks/fusion-seed-app
pipelines.py
Python
mit
151
#!/usr/bin/env python # Jonas Schnelli, 2013 # make sure the Pxlcoin-Qt.app contains the right plist (including the right version) # fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267) from string import Template from datetime import date bitcoinDir = "./"; inF...
tripmode/pxlcoin
share/qt/clean_mac_info_plist.py
Python
mit
894
# Django settings for controller project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Tim Spriggs', 'tims@arizona.edu'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '/home/apw...
imoverclocked/ServoBot
apwm_home/controller/controller/settings.py
Python
mit
5,602
from collections import MutableMapping def flatten(d, parent_key='', sep='/'): result = [] for k, v in d.iteritems(): new_key = parent_key + sep + k if parent_key else k if isinstance(v, MutableMapping): result.extend(flatten(v, new_key, sep=sep).iteritems()) else: ...
the-zebulan/CodeWars
katas/beta/lets_flat_them_out.py
Python
mit
396
# Reference and ideas from http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html from __future__ import print_function import torch.nn as nn import torchvision.models as models import warnings warnings.filterwarnings("ignore") ################################################################## ## ...
ivanlai/Kaggle-Planet-Amazon
PyTorch_models.py
Python
mit
5,862
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from unittest.mock import Mock, call from tinyrpc.server import RPCServer from tinyrpc.transports import ServerTransport from tinyrpc.protocols import RPCProtocol, RPCResponse from tinyrpc.dispatch import RPCDispatcher CONTEXT='sapperdeflap' RECMSG='out of...
mbr/tinyrpc
tests/test_server.py
Python
mit
1,748
# Generated by Django 3.0.5 on 2020-04-07 10:39 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("spectator_events", "0041_event_ticket"), ] operations = [ migrations.AlterField( model_name="venue...
philgyford/django-spectator
spectator/events/migrations/0042_auto_20200407_1039.py
Python
mit
1,302
from django.conf.urls import patterns, url from . import views urlpatterns = patterns('', url(r'^$', views.IndexView.as_view(), name="index"), url(r'^contacts/$', views.ContactsView.as_view(), name="contacts"), url(r'^login/$', views.LoginView.as_view(), name="login"), url(r'^logout/$', views.LogoutView.as_view...
pjlong/cambNet
cambnet/home/urls.py
Python
mit
342
from django.contrib import admin from .models import Station, Quest admin.site.register(Quest) admin.site.register(Station)
olimp-web/quest_manager
quest_map/admin.py
Python
mit
124
#!/usr/bin/python import Proxy_Hours, proxyhours_gather_all_data try: from PyQt4 import QtCore, QtGui qtplatform = "PyQt4" except: from PySide import QtCore, QtGui qtplatform = "PySide" import os def which(pgm): path=os.getenv('PATH') for p in path.split(os.path.pathsep): p=os.path.jo...
timlev/Proxy-Hours
main.py
Python
mit
1,572
# -*- coding: utf-8 -*- from __future__ import print_function from sys import hexversion import copy import bisect import random from .context import sortedcontainers from sortedcontainers import SortedListWithKey from nose.tools import raises from functools import wraps class SortedList(SortedListWithKey): pass...
lrq3000/pyFileFixity
pyFileFixity/lib/sortedcontainers/tests/test_stress_sortedlistwithkey.py
Python
mit
8,149
from __future__ import annotations from .. import ImmutableSequence class Condition(ImmutableSequence): def subsumes(self, other) -> bool: for ci, oi in zip(self, other): if ci != self.WILDCARD and oi != self.WILDCARD and ci != oi: return False return True @prope...
ParrotPrediction/pyalcs
lcs/agents/xcs/Condition.py
Python
mit
616
""" File: tonal_permutation.py Purpose: Class defining a function on one tonality based on a permatuation specification. """ from transformation.functions.tonalfunctions.tonal_permutation import TonalPermutation class TonalityPermutation(TonalPermutation): """ Class implementation of a permutation on a set...
dpazel/music_rep
transformation/functions/tonalfunctions/tonality_permutation.py
Python
mit
830
from flask import Blueprint, request, render_template, redirect, url_for from app import db from app.surveys.models import Surveys, Questions from app.surveys.forms import SurveyForm, QuestionForm mod = Blueprint('surveys', __name__, url_prefix='/surveys') @mod.route('/') def surveys(): surveys = Surveys.query....
jasonamyers/h4cn-index
app/surveys/views.py
Python
mit
1,285
from hk2.types import interface @interface class ITracer(object): def codec_write(self, conn, msg): pass def codec_read(self, conn): pass def connectionFactory_get(self, url): pass def connectionFactory_release(self, conn): pass def router_getRoutes(self, req): ...
mikhtonyuk/pynnacle
pynnacle/tracing/tracer.py
Python
mit
1,547
import monitors import servers
ewanbarr/reynard
reynard/__init__.py
Python
mit
31
# -*- coding: utf-8 -*- import json from concurrent.futures import ThreadPoolExecutor from datetime import date, timedelta import requests import common # ------------------------------------------------------------------------ def grab(url): requests.packages.urllib3.disable_warnings() # 请求头 headers ...
Cuile/Grab-the-National-Train-Timetable
grab.py
Python
mit
7,660
""" [2017-10-26] Challenge #337 [Intermediate] Scrambled images https://www.reddit.com/r/dailyprogrammer/comments/78twyd/20171026_challenge_337_intermediate_scrambled/ #Description For this challenge you will get a couple of images containing a secret word, you will have to unscramble the images to be able to read th...
DayGitH/Python-Challenges
DailyProgrammer/DP20171026B.py
Python
mit
1,315
# import datetime import json import os import re import time import redis import requests from flask import Flask, render_template APP_URL = os.environ.get('URL') ASSET_URLS = re.compile(r'(src|href)="(.*)"') CSS_ASSETS = re.compile(r'(url\([\'|"]?(.*)[\'|"]?\))') app = Flask(__name__) if os.environ.get('ENV') is...
tofumatt/fat-mirror
app.py
Python
mit
3,143
import unittest from nose.tools import assert_true, assert_equal from mock import patch, Mock, call from tests import tmp_repo_path class TestAdd(unittest.TestCase): def test_file_names_no_dot(self): from dvm import add link, filename = add.file_names('bashrc') assert_equal(link, '.b...
boldfield/dvm
tests/test_add.py
Python
mit
591
from south.db import db from django.db import models from csc.corpus.models import * class Migration: def forwards(self, orm): # Adding model 'TaggedSentence' db.create_table('tagged_sentences', ( ('text', orm['corpus.TaggedSentence:text']), ('language', orm['...
pbarton666/buzz_bot
djangoproj/djangoapp/csc/corpus/migrations/0001_initial.py
Python
mit
8,362
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'MiracleWong' from urllib import request with request.urlopen('http://news-at.zhihu.com/api/4/news/latest') as f: data = f.read() print('Status:', f.status, f.reason) for k, v in f.getheaders(): print('%s: %s' % (k, v)) print('Data:', d...
MiracleWong/PythonBasic
LiaoXueFeng/buildin/use_urllib.py
Python
mit
340
#!/opt/miniconda/envs/thesis/bin/python #!/usr/bin/env python2 """ Run code, analyis or build documents related to this repository Usage: run.py paper [--rerun=RR] [--view] [--viewer=PDF] run.py thesis [--rerun=RR] [--view] [--viewer=PDF] run.py notebook [--port=P] Options: --view Compile and then op...
Cadair/Thesis
run.py
Python
mit
2,086
import os import platform import subprocess import cat_service from apps.general import headers def main(): headers.print_header('LOLCAT FACTORY') # look for a directory if not there create it dir_path = get_or_create_output_folder() n_cats = get_number_cats() # contact the lol cat api, get binar...
egancatriona1/python-jumpstart
apps/06_lolcat_factory/you_try/program.py
Python
mit
1,553
from dal import autocomplete from django.conf.urls import url from .models import TModel urlpatterns = [ url( 'test-autocomplete/$', autocomplete.Select2QuerySetView.as_view(model=TModel), name='select2_djhacker_formfield', ), ] import djhacker from django import forms djhacker.for...
yourlabs/django-autocomplete-light
test_project/select2_djhacker_formfield/urls.py
Python
mit
446
from django.shortcuts import render from .models import Temas, Biblioteca from django.shortcuts import get_object_or_404 from django.db.models import Q # Create your views here. def index(request,template='biblioteca/index.html',slug=None): temas = Temas.objects.all() ultimas_guias = Biblioteca.objects.filter(tipo_d...
shiminasai/plataforma_fadcanic
biblioteca/views.py
Python
mit
1,157
# coding=utf-8 # 1. generate velocity and force nodes of sphere using MATLAB, # 2. for each force node, get b, solve surrounding velocity boundary condition (pipe and cover, named boundary velocity) using formula from Liron's paper, save .mat file # 3. read .mat file, for each boundary velocity, solve associated bounda...
pcmagic/stokes_flow
ecoli_in_pipe/tail_U.py
Python
mit
9,601
from django import forms from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy as _ from froide.account.forms import user_extra_registry from froide.foirequest.auth import can_read_foirequest from froide.helper.spam import SpamProtectionMixin from .models import FoiRequestFo...
stefanw/froide
froide/foirequestfollower/forms.py
Python
mit
1,957
__version__ = '0.5.0' default_app_config = 'janitor.apps.JanitorConfig'
bradmontgomery/django-janitor
janitor/__init__.py
Python
mit
72
#!/bin/python import requests,string url = "http://natas16.natas.labs.overthewire.org" auth_username = "natas16" auth_password = "WaIHEacj63wnNIBROHeqi3p9t0m5nhmh" characters = ''.join([string.ascii_letters,string.digits]) password = [] for i in range(1,34): for char in characters: uri = "{0}?needle=$(g...
nathanhicks/Writeups_overthewire.org
natas/natas16/blind_shell_injection.py
Python
mit
640
# Python - 3.6.0 test.assert_equals( disemvowel('This website is for losers LOL!'), 'Ths wbst s fr lsrs LL!' )
RevansChen/online-judge
Codewars/7kyu/disemvowel-trolls/Python/test.py
Python
mit
131
from django import template # from django.contrib.admin.util import lookup_field # from django.core.exceptions import ObjectDoesNotExist # from django.core.urlresolvers import NoReverseMatch, reverse # from django.db.models import ForeignKey # from django.template.defaulttags import NowNode # from django.utils.safestri...
skylifewww/pangolin_new
content/templatetags/content_tags.py
Python
mit
4,762
from handlers.base import BaseHandler import logging logger = logging.getLogger('boilerplate.' + __name__) class FundHandler(BaseHandler): def get(self): self.render("fund.html")
H0w13/WebGrabber
website/handlers/fund.py
Python
mit
193
# Copyright (c) 2014 - 2016 townhallpinball.org # # 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, p...
town-hall-pinball/project-omega
pin/lib/score.py
Python
mit
4,429
from test.UdsTest import UdsTest from test.stub import StubbedIsoTPSocket from udsoncan.exceptions import * import socket class TestStubbedIsoTPSocket(UdsTest): def test_open(self): tpsock = StubbedIsoTPSocket() self.assertFalse(tpsock.bound) tpsock.bind(interface='vcan0', rxid=0x100, txid=...
pylessard/python-udsoncan
test/test_stubbed_isotpsock.py
Python
mit
2,233
import io import csv import requests import datetime import time from bs4 import BeautifulSoup TRAIN_FILE = "train.csv" DEFAULT_INTERVAL = 1800 TRAIN_FILE_HEAD = ["Insult", "Date", "Comment"] def writeCsv(fname, text, delimiter = ","): prev_data = list() try: fil...
crystal150/CS350
collector.py
Python
mit
17,514
from __future__ import print_function import boto3 import sys import time import botocore.exceptions class Runner(object): def __init__(self, template, stack_name, params=[], iam_capability=False, session=None): self.stack_name = stack_name self.iam_capability = iam_capability self.params =...
enriclluelles/troposphere_sugar
troposphere_sugar/runner.py
Python
mit
2,590
def _type(name, package='org.apache.cassandra.db.marshal'): return '{0}.{1}'.format(package, name) native_types = { 'ASCII': _type('AsciiType'), 'BIGINT': _type('LongType'), 'BLOB': _type('BytesType'), 'BOOLEAN': _type('BooleanType'), 'COUNTER': _type('CounterColumnType'), 'DECIMAL': _type...
dreid/cql3parser
cql3parser/types.py
Python
mit
682
import base64 import json import requests import textwrap FRINK_URL = 'https://frinkiac.com' FRINK_API_URL = '{0}/api/search'.format(FRINK_URL) FRINK_CAPTION_URL = '{0}/api/caption'.format(FRINK_URL) FRINK_RANDOM_URL = '{0}/api/random'.format(FRINK_URL) MORB_URL = 'https://morbotron.com' MORB_API_URL = '{0}/api/searc...
GordonsBeard/frinkiac.py
Frinkiac/frinkiac.py
Python
mit
4,152
# -*- coding: utf-8 -*- from eventlet import httpc from zenqueue.client.http.common import HTTPQueueClient class QueueClient(HTTPQueueClient): def send(self, url, data=''): # Catch non-successful HTTP requests and treat them as if they were. try: result = httpc.post(url, data=da...
zacharyvoase/zenqueue
zenqueue/client/http/async.py
Python
mit
507
# -*- coding: utf-8 -*- from pytdx.hq import TdxHq_API from fooltrader.api import technical from fooltrader.contract.data_contract import KDATA_COLUMN_SINA from fooltrader.utils.utils import get_exchange def get_tdx_kdata(security_item, start, end): api = TdxHq_API() with api.connect(): # open close...
foolcage/fooltrader
fooltrader/datasource/tdx.py
Python
mit
854
import socket import time import threading def tcplink(sock, addr): print('Accept new connection from %s:%s...' % addr) sock.send(b'Welcome!') while True: data = sock.recv(1024) time.sleep(1) if not data or data.decode('utf-8') == 'exit': break sock.send(('Hello...
zhujianjunscut/python_learning
netprogram/server.py
Python
mit
737
REFRESH_TIMER = 1000 class Ticker(object): def __init__(self, _vim): self._vim = _vim self.has_timers = bool(int(self._vim.eval("has('timers')"))) if self.has_timers: self._timer = None self._start_refresh_timer() def tick(self, client): filename = cl...
ensime/ensime-vim
ensime_shared/ticker.py
Python
mit
956
import logging from pymongo.errors import DocumentTooLarge from . import Util class PathFinder: def __init__(self, config, pg_conn, mongo_client): self._config = config self._pg_conn = pg_conn self._mongo_client = mongo_client self._logger = logging.getLogger(self.__class__.__nam...
DBWangGroupUNSW/revs
revs/path.py
Python
mit
5,412
# epydoc.py: manpage-style text output # Edward Loper # # Created [01/30/01 05:18 PM] # $Id: man.py,v 1.6 2003/07/18 15:46:19 edloper Exp $ # """ Documentation formatter that produces man-style documentation. @note: This module is under development. It generates incomplete documentation pages, and is not yet incorpe...
dabodev/dabodoc
api/epydoc/man.py
Python
mit
8,842
import re from markdown2 import Markdown from ..conf import get_settings class MDPageMarkdown(Markdown): def __init__(self, settings): super(MDPageMarkdown, self).__init__(extras=[ 'wiki-tables', 'tables', 'footnotes', 'fenced-code-blocks', 'header-ids', 'task_list' ]) self....
dakrauth/django-markdown-page
mdpage/utils/markdown.py
Python
mit
1,896
# -*- encoding: utf-8 -*- ''' Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? ''' class Solution(object): def singleNumber(self, nums): """ ...
weixsong/algorithm
leetcode/137.py
Python
mit
614
from direct.distributed.MsgTypes import * OTP_DO_ID_SERVER_ROOT = 4007 OTP_DO_ID_FRIEND_MANAGER = 4501 OTP_DO_ID_LEADERBOARD_MANAGER = 4502 OTP_DO_ID_SERVER = 4600 OTP_DO_ID_UBER_DOG = 4601 OTP_CHANNEL_AI_AND_UD_BROADCAST = 4602 OTP_CHANNEL_UD_BROADCAST = 4603 OTP_CHANNEL_AI_BROADCAST = 4604 OTP_NET_MSGR_CHANNEL_ID_ALL...
Spiderlover/Toontown
otp/distributed/OtpDoGlobals.py
Python
mit
3,475
import time import collections from overviewbot import OverviewBot, Window def format_time(timestamp): return time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(timestamp)) class CustomWindow(Window): def __init__(self, input_key, *args, **keys): Window.__init__(self, *args, **keys) self.inpu...
softcert/vsroom
vsroom/common/customoverview.py
Python
mit
1,942
# This is the list of language codes with the 'modern' level of support in CLDR # (compared to 'full', which contains many more languages). We use this as the # list of languages that we store specific name-to-code mappings for. CLDR_LANGUAGES = { 'af', 'am', 'ar', 'az', 'be', 'bg', 'bn', ...
LuminosoInsight/langcodes
langcodes/language_lists.py
Python
mit
8,650
# Copyright 2012 John Kleint # This is free software, licensed under the MIT License; see LICENSE.txt. """ BlameThrower stats. - per-author, unattributed, and overall: - files - lines - bugs - total - high - med - low - bugs_per_line """ from __future__ import division from collections impor...
jkleint/blamethrower
blamethrower/stats.py
Python
mit
2,350
from solvertools.wordlist import WORDS from solvertools.normalize import slugify, sanitize from solvertools.util import data_path, corpus_path from whoosh.fields import Schema, ID, TEXT, KEYWORD, NUMERIC from whoosh.analysis import StandardAnalyzer from whoosh.index import create_in import nltk import os from tqdm impo...
rspeer/solvertools
scripts/build_search_index.py
Python
mit
3,318
import ast import docker import etcd import logging from requests.exceptions import ConnectionError from docrane.exceptions import ImageNotFoundError LOG = logging.getLogger("docrane") def _get_docker_client(): # Assume docker is local return docker.Client() def _get_etcd_client(): # Assume docker is...
CloudBrewery/docrane
docrane/util.py
Python
mit
7,395
#!/usr/bin/env/python """ Setup script for PuLP added by Stuart Mitchell 2007 Copyright 2007 Stuart Mitchell """ from ez_setup import use_setuptools use_setuptools() from setuptools import setup Description = open('README').read() License = open('LICENSE').read() Version = open('VERSION').read().strip() setup(name=...
ruxkor/pulp-or
setup.py
Python
mit
1,930
# -*- coding: utf-8 -*- import logging from twitter_watcher.actions import Callback log = logging.getLogger(__name__) class ObserverTwitter(Callback): def __init__(self, **kwargs): self.url = kwargs['url_callback'] self.usernames = kwargs['usernames'] self.hashtags = kwargs['hashtags']...
aoqfonseca/twitter_watcher
twitter_watcher/observers.py
Python
mit
1,472
from MBase.MFinalValueReachedException import MFinalValueReachedException class MValueAnimator: """ A class to animate single integer or float values. It would also help in applying various mathematical functions to the progress of the animation. """ def __init__(self, initial_value, final_val...
GelaniNijraj/PyMaterial
MBase/MValueAnimator.py
Python
mit
2,211
# coding=utf-8 """ - """ from __future__ import division, unicode_literals, absolute_import from __future__ import print_function from future import standard_library standard_library.install_aliases() import argparse from puf import cli_lib def main(params=None): """ :param params: :return: """ p...
erikdejonge/puffin
puf/cli.py
Python
mit
3,395
# Write a program that prompts the user for a measurement in meters and then con­ # verts it to miles, feet, and inches. measurementMeters = float(input("Enter the measurement in meters: ")) measurementMiles = measurementMeters * 0.000621371192 measurementFeet = measurementMeters * 3.2808399 measurementInches = measu...
futurepr0n/Books-solutions
Python-For-Everyone-Horstmann/Chapter2-Programming-with-Numbers-and-Strings/P2.6.py
Python
mit
510
#! /usr/bin/env python # Written by Vasaant S/O Krishnan. Friday, 18 March 2016. import re from pylab import * import sys from mpldatacursor import datacursor usrFile = sys.argv[1:] if len(usrFile) == 0: print "" print "# pts-test.py takes input from a single .PTS file to study the" print "# component a...
ekadhanda/bin
python/pts-test.py
Python
mit
11,854
# iterables.py print(""" An iterable is any object that returns an iterator when iter() function is invoked on it. """) print("""Writing an iterable that repeatedly returns an integer without stopping {code} class InfiniteIterator: def __init__(self): self.__int = 0 def __next__(self): self._...
nitin-cherian/LifeLongLearning
Python/Experiments/ITERATORS/Polyglot.Ninja/iterables.py
Python
mit
1,634
# coding=utf-8 """Accesses data in Sacred's MongoDB.""" import pymongo from sacredboard.app.data.datastorage import Cursor, DataStorage from sacredboard.app.data.pymongo import GenericDAO, MongoMetricsDAO, MongoFilesDAO from sacredboard.app.data.pymongo.rundao import MongoRunDAO class MongoDbCursor(Cursor): """I...
chovanecm/sacredboard
sacredboard/app/data/pymongo/mongodb.py
Python
mit
3,502
import numpy as np def donut(shape, radius, width, distribution='gaussian'): '''Generate a 2D Gaussian window of the given shape. width specifies the size of the Gaussian. radius specifies the distance to origo such that the window becomes a ring.''' if not distribution in ['gaussian', 'lognormal']: ...
andersbll/ipcv
ipcv/misc/donuts.py
Python
mit
1,393
#!/usr/bin/env python3 # Copyright (c) 2014-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. # # Test replace by fee code # from test_framework.test_framework import ElectrumTestFramework from test...
sinraf96/electrum
qa/rpc-tests/replace-by-fee.py
Python
mit
21,883
# -*- coding:utf8 -*- FILE_NAME='data.xlsx' SHEET_INDEX = 0 ROW_START = 1 ROW_END = 30 COLUMN_START = 1 COLUMN_END = 4
gaufung/LMDI
Figures/config.py
Python
mit
119